http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56605
Steven Bosscher <steven at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|steven at gcc dot gnu.org | --- Comment #3 from Steven Bosscher <steven at gcc dot gnu.org> 2013-03-12 23:14:39 UTC --- GCC gets to implies_p with: Breakpoint 11, implies_p (a=0x3fffb5fd1410, b=0x3fffb5fd15c0) at ../../trunk/gcc/loop-iv.c:1499 1499 if (GET_CODE (a) == EQ) (gdb) p debug_rtx(a) (eq:SI (subreg:SI (reg:DI 153 [ bnd.10D.2035+-4 ]) 4) (const_int 0 [0])) $26 = void (gdb) p debug_rtx(b) (eq:SI (subreg:SI (reg:DI 153 [ bnd.10D.2035+-4 ]) 4) (const_int 0 [0])) $27 = void (gdb) But implies_p doesn't handle SUBREGs. If it would allow REGs and SUBREGs of REGs, it would fold the assumption away: 1504 if (REG_P (op0)) (gdb) p op0 $29 = (rtx) 0x3fffb5fd13e0 (gdb) p debug_rtx(op0) (subreg:SI (reg:DI 153 [ bnd.10D.2035+-4 ]) 4) $30 = void (gdb) p debug_rtx(op1) (const_int 0 [0]) $31 = void (gdb) p debug_rtx(simplify_replace_rtx (b, op0, op1)) (const_int 1 [0x1]) $32 = void Something like the following, perhaps? Index: loop-iv.c =================================================================== --- loop-iv.c (revision 196575) +++ loop-iv.c (working copy) @@ -1496,19 +1496,26 @@ implies_p (rtx a, rtx b) rtx op0, op1, opb0, opb1, r; enum machine_mode mode; + if (rtx_equal_p (a, b)) + return true; + if (GET_CODE (a) == EQ) { op0 = XEXP (a, 0); op1 = XEXP (a, 1); - if (REG_P (op0)) + if (REG_P (op0) + || (GET_CODE (op0) == SUBREG + && REG_P (SUBREG_REG (op0)))) { r = simplify_replace_rtx (b, op0, op1); if (r == const_true_rtx) return true; } - if (REG_P (op1)) + if (REG_P (op1) + || (GET_CODE (op1) == SUBREG + && REG_P (SUBREG_REG (op1)))) { r = simplify_replace_rtx (b, op1, op0); if (r == const_true_rtx)