mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 14:59:39 +02:00
[PR124572, LRA]: Deal with generation of reload insns during elimination
It was assumed that elimination in LRA does not generate new reload insns. In the testcase the elimination of SFP subreg generates reload insn of the subreg and this insn is added at end of RTL code. The insn is also skipped for necessary processing. This results in ICE. The patch checks creation of reloads insn during elimination, insert them in the right place, and add them for later processing. gcc/ChangeLog: PR rtl-optimization/124572 * lra-eliminations.cc (lra_eliminate): Push new reload insns for eliminations in insns. gcc/testsuite/ChangeLog: PR rtl-optimization/124572 * gcc.target/aarch64/pr124572.c: New.
This commit is contained in:
@@ -1544,8 +1544,19 @@ lra_eliminate (bool final_p, bool first_p)
|
||||
EXECUTE_IF_SET_IN_BITMAP (&insns_with_changed_offsets, 0, uid, bi)
|
||||
/* A dead insn can be deleted in process_insn_for_elimination. */
|
||||
if (lra_insn_recog_data[uid] != NULL)
|
||||
process_insn_for_elimination (lra_insn_recog_data[uid]->insn,
|
||||
final_p, first_p);
|
||||
{
|
||||
rtx_insn *insn = lra_insn_recog_data[uid]->insn;
|
||||
start_sequence ();
|
||||
process_insn_for_elimination (insn, final_p, first_p);
|
||||
rtx_insn *first = get_insns ();
|
||||
end_sequence ();
|
||||
if (first != NULL)
|
||||
{
|
||||
lra_assert (!final_p);
|
||||
lra_process_new_insns (insn, first, NULL,
|
||||
"Inserting elimination insn", true);
|
||||
}
|
||||
}
|
||||
bitmap_clear (&insns_with_changed_offsets);
|
||||
|
||||
lra_eliminate_done:
|
||||
|
||||
10
gcc/testsuite/gcc.target/aarch64/pr124572.c
Normal file
10
gcc/testsuite/gcc.target/aarch64/pr124572.c
Normal file
@@ -0,0 +1,10 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
int e() {
|
||||
char f;
|
||||
long tt = (long)&f;
|
||||
tt+=1;
|
||||
int g = tt;
|
||||
return g + 3;
|
||||
}
|
||||
Reference in New Issue
Block a user