Message ID | 20120204121042.GL18768@tyan-ft48-01.lab.bos.redhat.com |
---|---|
State | New |
Headers | show |
Jakub Jelinek <jakub@redhat.com> writes: > The lower subreg pass apparently relies on recog_memoized being performed > on all insns in the first pass (analysis), then it replaces some > of the regs with concat and then again on each insn performs recog_memoized > + extract_insn. This works, because recog_memoized then does nothing, just > returns the memoized number, and extract insn extracts the operands > (which may be now CONCATNs) and then adjusts the insns. Interesting. For 4.8, it might be worth trying to remove the calls to recog_memoized in the second pass -- or at least replace them with an assert -- just to emphasise what the assumption is. I'll probably never get round to it though. > 2012-02-04 Jakub Jelinek <jakub@redhat.com> > > PR rtl-optimization/52113 > * lower-subreg.c (decompose_multiword_subregs): Call recog_memoized > even for decomposable shift/zext insns. > > * gcc.target/avr/pr52113.c: New test. OK, thanks. Richard
--- gcc/lower-subreg.c.jj 2011-12-21 08:43:48.000000000 +0100 +++ gcc/lower-subreg.c 2012-02-04 01:01:06.903472679 +0100 @@ -1135,10 +1135,11 @@ decompose_multiword_subregs (void) || GET_CODE (PATTERN (insn)) == USE) continue; + recog_memoized (insn); + if (find_decomposable_shift_zext (insn)) continue; - recog_memoized (insn); extract_insn (insn); set = simple_move (insn); --- gcc/testsuite/gcc.c-torture/compile/pr52113.c.jj 2012-02-04 01:05:39.100980253 +0100 +++ gcc/testsuite/gcc.c-torture/compile/pr52113.c 2012-02-04 01:05:15.000000000 +0100 @@ -0,0 +1,11 @@ +/* PR rtl-optimization/52113 */ + +unsigned long v1; +unsigned char v2; + +void +foo (void) +{ + if (v1 > (v2 * 1000L)) + v1 = 0; +}