https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61677
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Status|WAITING |NEW --- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Josh Triplett from comment #4) > Created attachment 33067 [details] > Reduced testcase > > Here's a reduced testcase. [CHECK] Found def edge 1 in jump_23 = PHI <jump_16(D)(13), jump_18(11)> [BEFORE SIMPLICATION -- [USE]: jump_23->offset = 42; is guarded by : i_19 != -1(OVF) (.AND.) _8 != 0 [BEFORE NORMALIZATION --[USE]: jump_23->offset = 42; is guarded by : i_19 != -1(OVF) (.AND.) _8 != 0 [AFTER NORMALIZATION -- [USE]: jump_23->offset = 42; is guarded by : menu_7(D) != 0B (.AND.) i_19 != -1(OVF) [BEFORE SIMPLICATION -- [DEF]: jump_23 = PHI <jump_16(D)(13), jump_18(11)> is guarded by : _8 != 0 (.AND.) (.NOT.) _12 != 0 [BEFORE NORMALIZATION --[DEF]: jump_23 = PHI <jump_16(D)(13), jump_18(11)> is guarded by : _8 != 0 (.AND.) (.NOT.) _12 != 0 [AFTER NORMALIZATION -- [DEF]: jump_23 = PHI <jump_16(D)(13), jump_18(11)> is guarded by : (.NOT.) _12 != 0 (.AND.) menu_7(D) != 0B [CHECK]: Found unguarded use: jump_23->offset = 42; There is something wrong in the computation of the guard-conditions. Perhaps the computation is not powerful enough to realize that "(.NOT.) _12 != 0" has to appear also in the use. It seems also that VRP is not powerful enough here: # RANGE [0, 2147483645] NONZERO 15 # i_3 = PHI <i_19(8), i_34(5)> # .MEM_6 = PHI <.MEM_13(8), .MEM_24(5)> [test.c : 14:11] # RANGE [-1, 2147483644] i_19 = i_3 + -1; [test.c : 14:11] if (i_19 != -1(OVF)) The range should be [0, 8].