redundant divmodsi4 not optimized away
Michael Matz
matz@suse.de
Wed Apr 28 13:11:00 GMT 2010
Hi,
On Tue, 27 Apr 2010, Greg McGary wrote:
> (define_insn "*udivmodsi4_libcall"
> [(set (reg:SI 4)
> (udiv:SI (reg:SI 1)
> (reg:SI 2)))
> (set (reg:SI 1)
> (umod:SI (reg:SI 1)
> (reg:SI 2)))
> (clobber (reg:SI 2))
> (clobber (reg:SI 3))
> (clobber (reg:CC CC_REGNUM))
> (clobber (reg:SI RETURN_POINTER_REGNUM))]
> ""
> "call\\t__udivmodsi4"
> [(set_attr "length" "4")])
So, this pattern uses r2 and clobbers r2+r3. Two calls in a row can't be
eliminated because the execution of one destroys one operand of the other
as far as GCC knows, and the necessary copies to reload the correct value
into r2 before the second call might confuse combine/CSE/DCE/whatever. At
least that would be my theory to start from :)
Ciao,
Michael.
More information about the Gcc
mailing list