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] Fix ifcvt ICE


Hi,
this patch fixes an ICE (seen on ARM) in the ifcvt pass. The tail merging code in cond_exec_process_if_block(), under certain conditions, runs out into the previous basic block, causing an assertion fail later.


This is due to the use of next/prev_active_insn(), which does not check BB boundaries, and also skips use/clobber insns during post-reload. In the particular testcase I have, observed on ARM, prev_active_insn() is called on an insn which is preceded in that BB only by note and clobber insns, and ended up returning the jump insn in the preceding block...

So this patch is quite simple: implement two replacement functions find_active_insn_before/after() that correct the above mentioned behavior, and use them in ifcvt.

I'll also note that the included testcase triggers the same assert fail on ia64 too, and is also fixed by this patch, though I have not further tested it on that target.

Tested without new regressions on ARM-Linux using QEMU.
Ok for trunk?

Thanks,
Chung-Lin

2010-10-11 Chung-Lin Tang <cltang@codesourcery.com>

        * ifcvt.c (find_active_insn_before): New function.
        (find_active_insn_after): New function.
        (cond_exec_process_if_block): Use new functions to replace
        prev_active_insn() and next_active_insn().


testsuite/ * gcc.dg/20101010-1.c: New testcase.

Attachment: ifcvt.diff
Description: Text document


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