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] |
I was working on a patch that tries to make use of df_simulate_one_insn_forwards, and I noticed that things weren't working quite as I was hoping. Some debugging showed that after calling df_simulate_one_insn_forwards on a CALL insn, all the call clobbered registers were incorrectly marked as live. The function calls df_simulate_find_defs to mark all set registers as live, then clears anything for which it can find a REG_DEAD/REG_UNUSED note. df_simulate_find_defs is broken for this purpose: it should ignore clobbers, but it ignores partial and conditional sets. Confusion about how to handle the latter two is a common problem with the df code; in this case at least it's clearly wrong to ignore them. While working on this, I discovered by accident that a function in ifcvt.c which uses this infrastructure is more conservative than it needs to be. Consider case 2 from one of the comments: (2) if (test) goto E; // x not live [TEST] x = big(); goto L; E: x = b; [ MERGE_BB ] goto M; becomes x = b; if (test) goto M; x = big(); goto L; Currently, it fails if (MERGE_SET & TEST_SET) != 0, but it really only needs to make sure that real sets (i.e. not clobbers) in MERGE_BB aren't overwritten in TEST. I've added a new function df_simulate_find_noclobber_defs, which is now used for this, and for df_simulate_one_insn_forwards. Bootstrapped and regression tested on i686-linux. Tests on arm aren't complete but look good. Ok (maybe also 4.5)? Bernd
Attachment:
df-problems.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |