Consider: int foo (unsigned long a) { int b = __builtin_clzl (a); int c = __builtin_clzl (a); if (b == c) return 1; return 0; }
Here is what I get after FRE. foo (a) { int c; int b; int D.1235; <bb 0>: b_3 = __builtin_clzl (a_2); c_4 = __builtin_clzl (a_2); if (b_3 == c_4) goto <L0>; else goto <L1>; <L0>:; D.1235_7 = 1; goto <bb 3> (<L2>); <L1>:; D.1235_6 = 0; # D.1235_1 = PHI <1(1), 0(2)>; <L2>:; return D.1235_1; } DOM catches this later. -- Summary: FRE does not eliminate a redundant builtin call. Product: gcc Version: unknown Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kazu at cs dot umass dot edu CC: dberlin at gcc dot gnu dot org,gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21576