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]

Re: [PATCH][RTL ifcvt] PR 67786, 67787: Check that intermediate instructions in the basic block don't clobber a reg used in condition


This patch fixes the two wrong-code PRs.
The problem is related to the way the noce_emit_cmove helper function
emits conditional moves.
For some targets it re-emits the comparison from the condition block and
then the conditional move
after we have emitted the two basic blocks. Later passes always catch
the redundant comparison and eliminate
it anyway. However, this means that if any of the basic blocks clobber a
register
that is used in that comparison, the comparison will go wrong.

This happens in the testcase where one of the intermediate insns in the
basic block re-used a pseudo reg
that was used in the comparison to store an intermediate result. When
the comparison was re-emitted by
noce_emit_cmove later, it used the clobbered pseudo reg.


     PR rtl-optimization/67786
     PR rtl-optimization/67787
     * ifcvt.c (bb_valid_for_noce_process_p): Reject basic block if
     it modifies a reg used in the condition calculation.

To duoble-check its effect on code generation I ran this against my collection of .i files and it appears to have an effect only on the testcases, as expected. This is ok.


Bernd


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