https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81184
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-06-23 CC| |jakub at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |marxin at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- Confirmed, I'm adding Jakub as author of original test-case. The affected function changed from: Optimizing range tests c_2(D) -[0, 31] and -[32, 32] into c_2(D) > 32 Removing basic block 3 ;; basic block 3, loop depth 0 ;; pred: ;; succ: 4 fix_loop_structure: fixing up loops for function f6 (unsigned char c) { int _1; _Bool _5; <bb 2> [100.00%] [count: INV]: if (c_2(D) == 34) goto <bb 5>; [18.79%] [count: INV] else goto <bb 3>; [81.21%] [count: INV] <bb 3> [65.95%] [count: INV]: _5 = c_2(D) <= 32; if (_5 != 0) goto <bb 5>; [31.00%] [count: INV] else goto <bb 4>; [69.00%] [count: INV] <bb 4> [45.51%] [count: INV]: <bb 5> [100.00%] [count: INV]: # _1 = PHI <2(2), 0(4), 2(3)> return _1; } to: Optimizing range tests c_2(D) -[32, 32] and -[34, 34] into (c_2(D) & 253) != 32 Width = 1 was chosen for reassociation Merging blocks 2 and 3 fix_loop_structure: fixing up loops for function f6 (unsigned char c) { int _1; _Bool _4; unsigned char _5; <bb 2> [100.00%] [count: INV]: _5 = c_2(D) & 253; _4 = _5 == 32; if (_4 != 0) goto <bb 5>; [10.65%] [count: INV] else goto <bb 3>; [89.35%] [count: INV] <bb 3> [79.83%] [count: INV]: if (c_2(D) <= 31) goto <bb 4>; [18.79%] [count: INV] else goto <bb 5>; [81.21%] [count: INV] <bb 4> [15.00%] [count: INV]: <bb 5> [100.00%] [count: INV]: # _1 = PHI <0(3), 2(2), 2(4)> return _1; } On x86_64 it's different because the function looks as follows: f6 (unsigned char c) { int _1; _Bool _4; _Bool _5; _Bool _7; _Bool _8; _Bool _9; <bb 2> [100.00%] [count: INV]: _5 = c_2(D) == 32; _4 = c_2(D) == 34; _9 = c_2(D) <= 32; _7 = c_2(D) <= 31; _8 = _9 | _4; if (_8 != 0) goto <bb 3>; [15.00%] [count: INV] else goto <bb 4>; [85.00%] [count: INV] <bb 3> [15.00%] [count: INV]: <bb 4> [100.00%] [count: INV]: # _1 = PHI <0(2), 2(3)> return _1; } Note that the PR exposes problem where we are able to do predictions for conditions, but here we transform: if (c_2(D) == 34) goto <bb 3>; [10.65%] [count: INV] else goto <bb 4>; [89.35%] [count: INV] into: _4 = c_2(D) == 34; and then we do _8 = _9 | _4; if (_8 != 0) It's related to PR79489.