Hi, enable-checking sometimes hides RTL checking bugs instead of detecting them.
The problem is that the `used' flag in the RTXs used in verify_rtl_sharing is not reset after doing the checks. But the flag is also used by other passes in order to fix RTX sharing (e.g. ifcvt). These passes then do unnecessary unsharing which in some cases also "fixes" some real bugs. With the patch all the `used' flags are reset after performing the checking in verify_rtl_sharing. Bootstrapped and tested with no regressions on x86_64, ppc64, and s390x. Ok for mainline? What about 4.8? Bye, -Andreas- 2013-04-11 Andreas Krebbel <andreas.kreb...@de.ibm.com> * emit-rtl.c (reset_all_used_flags): New function. (verify_rtl_sharing): Call reset_all_used_flags before and after performing the checks. --- gcc/emit-rtl.c | 24 +++++++++++++++--!!!!!!! 1 file changed, 15 insertions(+), 2 deletions(-), 7 modifications(!) Index: gcc/emit-rtl.c =================================================================== *** gcc/emit-rtl.c.orig --- gcc/emit-rtl.c *************** verify_rtx_sharing (rtx orig, rtx insn) *** 2660,2675 **** return; } ! /* Go through all the RTL insn bodies and check that there is no unexpected ! sharing in between the subexpressions. */ ! DEBUG_FUNCTION void ! verify_rtl_sharing (void) { rtx p; - timevar_push (TV_VERIFY_RTL_SHARING); - for (p = get_insns (); p; p = NEXT_INSN (p)) if (INSN_P (p)) { --- 2660,2672 ---- return; } ! /* Go through all the RTL insn bodies and remove the `used' flag. */ ! static void ! reset_all_used_flags (void) { rtx p; for (p = get_insns (); p; p = NEXT_INSN (p)) if (INSN_P (p)) { *************** verify_rtl_sharing (void) *** 2693,2698 **** --- 2690,2708 ---- } } } + } + + /* Go through all the RTL insn bodies and check that there is no unexpected + sharing in between the subexpressions. */ + + DEBUG_FUNCTION void + verify_rtl_sharing (void) + { + rtx p; + + timevar_push (TV_VERIFY_RTL_SHARING); + + reset_all_used_flags (); for (p = get_insns (); p; p = NEXT_INSN (p)) if (INSN_P (p)) *************** verify_rtl_sharing (void) *** 2703,2708 **** --- 2713,2720 ---- verify_rtx_sharing (CALL_INSN_FUNCTION_USAGE (p), p); } + reset_all_used_flags (); + timevar_pop (TV_VERIFY_RTL_SHARING); }