[Bug tree-optimization/96232] Failure to optimize bool pattern equivalent to minus 1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96232 Jakub Jelinek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #4 from Jakub Jelinek --- Fixed for GCC 11.
[Bug tree-optimization/96232] Failure to optimize bool pattern equivalent to minus 1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96232 --- Comment #3 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:8c23434fdadcf4caa1f0e966294c5f67ccf4bcf9 commit r11-5805-g8c23434fdadcf4caa1f0e966294c5f67ccf4bcf9 Author: Jakub Jelinek Date: Sun Dec 6 10:58:10 2020 +0100 [PATCH] phiopt: Handle bool in two_value_replacement [PR796232] The following patch improves code generation on the included testcase by enabling two_value_replacement on booleans. It does that only for arg0/arg1 values that conditional_replacement doesn't handle. Additionally it limits two_value_replacement optimization to the late phiopt like conditional_replacement. 2020-12-06 Jakub Jelinek PR tree-optimization/96232 * tree-ssa-phiopt.c (two_value_replacement): Optimize even boolean lhs cases as long as arg0 has wider precision and conditional_replacement doesn't handle that case. (tree_ssa_phiopt_worker): Don't call two_value_replacement during early phiopt. * gcc.dg/tree-ssa/pr96232-2.c: New test. * gcc.dg/tree-ssa/pr88676-2.c: Check phiopt2 dump rather than phiopt1.
[Bug tree-optimization/96232] Failure to optimize bool pattern equivalent to minus 1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96232 --- Comment #2 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:9e12b8b1819342ef7efac58cf7f4ba4294abe551 commit r11-5804-g9e12b8b1819342ef7efac58cf7f4ba4294abe551 Author: Jakub Jelinek Date: Sun Dec 6 10:55:12 2020 +0100 match.pd: Improve conditional_replacement for x ? 0 : -1 [PR796232] As mentioned in the PR, for boolean x we currently optimize in phiopt x ? 0 : -1 into -(int)!x but it can be optimized as (int) x - 1 which is one less operation both in GIMPLE and in x86 assembly. This patch optimizes it in match.pd, by optimizing -(type)!x when x has boolean range into (type)x - 1. 2020-12-06 Jakub Jelinek PR tree-optimization/96232 * match.pd (-(type)!A -> (type)A - 1): New optimization. * gcc.dg/tree-ssa/pr96232-1.c: New test.
[Bug tree-optimization/96232] Failure to optimize bool pattern equivalent to minus 1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96232 Jakub Jelinek changed: What|Removed |Added Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org Last reconfirmed||2020-12-04 Ever confirmed|0 |1 --- Comment #1 from Jakub Jelinek --- Created attachment 49684 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49684=edit gcc11-pr96232.patch Untested fix.