This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, rtl-optimization]: Fix PR 45223, RTL PRE GCSE pass hoists trapping insn out of loop


Hello!

Attached patch fixes wrong hoisting of trapping insns out from the
loop.  As commented in the original PR [1], the problem is in PRE GCSE
pass that does not look if the moved instruction can trap.  The
original problem reliably triggers on targets, where modulo is a
single HW insn (as in case of moxie-elf target), but the problem can
also be shown on x86_64-pc-linux-gnu with slightly modified testcase
[2].

2010-08-07  Uros Bizjak  <ubizjak@gmail.com>

	PR rtl-optimization/45223
	* gcse.c (compute_hash_table_work): Skip insns that may trap when
	building hash table.

The patch was bootstrapped and regression tested on
x86_64-pc-linux-gnu {,-m32} on gcc-4_5 branch. I have also checked
that patched gcc produces correct asm for moxie and for modified FP
case. In the modified FP case, --ffast-math still hoists FP division
out of the loop (allowed by may_trap_p predicate).

H.J. will check the performance effect of the patch on the SPEC, but
--ffast-math compilation seems to be unaffected.

OK for mainline and release branches?

[1] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38819#c16
[2] http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45223#c2

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]