Convert a sign bit testing into "a < 0". void bar (void); void foo (signed int a) { signed int b = a & (signed int) 0x80000000; if (b) bar (); } void baz (signed int a) { signed int b = a & 0x80000000; if (b) bar (); } void baa (signed int a) { signed int b = a & (1 << 31); if (b) bar (); } The last tree-ssa form looks like: ;; Function foo (foo) foo (a) { int b; <bb 0>: b_2 = a_1 & -2147483648; if (b_2 != 0) goto <L0>; else goto <L1>; <L0>:; bar () [tail call]; <L1>:; return; } ;; Function baz (baz) baz (a) { int b; int T.0; <bb 0>: T.0_1 = -080000000; b_3 = a_2 & T.0_1; if (b_3 != 0) goto <L0>; else goto <L1>; <L0>:; bar () [tail call]; <L1>:; return; } ;; Function baa (baa) baa (a) { int b; <bb 0>: b_2 = a_1 & -2147483648; if (b_2 != 0) goto <L0>; else goto <L1>; <L0>:; bar () [tail call]; <L1>:; return; }
Confirmed.
PR 15359 will fix foo and baa but not baz for some reason.
(In reply to comment #2) > PR 15359 will fix foo and baa but not baz for some reason. I mean 15459. Also this is done on the RTL level at least on PPC.
All three are now done by PR 15459.
It might be a while for me to rewrite the tree combiner so unassigning for now.
Fixed since 4.3.0.