Deadly optimization bug (all gcc versions!)
Jeffrey A Law
law@cygnus.com
Fri Aug 27 01:26:00 GMT 1999
In message < Pine.LNX.4.10.9908241433380.16200-100000@biriani.cygnus.co.uk >you
write:
> insn 11 : set (reg 24) [some value]
> insn 13 [i1]: set (reg 25) [some value]
> insn 16 : set (reg 24) (plus (reg 24) (const_int 1))
> insn 18 [i2]: set (reg 27) (lshiftrt (reg 24) (const_int 1))
> insn 20 [i3]: set (reg 26) (plus (reg 27) (reg 25))
>
> We already substituted i2 into i3 and got a (valid) newpat that contains
> reg 24. Then, we try to substitute i1 into the newpat.
> subst_low_cuid gets set to INSN_CUID (i1). reg_last_set[24] is insn 16 at
> this point. The problem is that get_last_value returns the SET_SRC of
> insn 11, completely ignoring insn 16.
What may not be obvious here is the for loop in question starts at i3, then
walks backwards to the previous real insn before i1. It took a few minutes for
me to pick up on that important tidbit.
> The whole block of code looks very suspicious, though. I'm under the
> impression it can't ever find a valid set.
I don't see how either. But I'd like to look at it again when my eyes are
less tired.
> * combine.c (get_last_value): Don't look for earlier sets if the last
> known set is somewhere in between the insns being combined.
Please go ahead and install this change.
Thanks,
jeff
More information about the Gcc
mailing list