Skip to content

Commit 088887d

Browse files
rguenthRichard Biener
authored andcommitted
rtl-optimization/119689 - compare-debug failure with LRA
The previous change to fix LRA rematerialization broke compare-debug for i586 bootstrap. Fixed by using prev_nonnote_nondebug_insn instead of prev_nonnote_insn. PR rtl-optimization/119689 PR rtl-optimization/115568 * lra-remat.cc (create_cands): Use prev_nonnote_nondebug_insn to check whether insn2 is directly before insn. * g++.target/i386/pr119689.C: New testcase.
1 parent 3e3b665 commit 088887d

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

gcc/lra-remat.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ create_cands (void)
460460
&& dst_regno >= FIRST_PSEUDO_REGISTER
461461
&& reg_renumber[dst_regno] < 0
462462
&& BLOCK_FOR_INSN (insn2) == BLOCK_FOR_INSN (insn)
463-
&& insn2 == prev_nonnote_insn (insn))
463+
&& insn2 == prev_nonnote_nondebug_insn (insn))
464464
{
465465
create_cand (insn2, regno_potential_cand[src_regno].nop,
466466
dst_regno, insn);
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// { dg-do compile }
2+
// { dg-options "-O2 -fcompare-debug" }
3+
// { dg-additional-options "-march=i586 -mtune=generic" { target ia32 } }
4+
// { dg-additional-options "-fPIC" { target { fpic } } }
5+
6+
enum gimple_code { GIMPLE_ASSIGN, GIMPLE_RETURN };
7+
bool is_gimple_call();
8+
int m_sig, m_exp, sreal_new_exp;
9+
struct sreal {
10+
sreal(long long sig) {
11+
long long __trans_tmp_6 = sig >= 0 ? sig : -(unsigned long long)sig;
12+
sig = __trans_tmp_6 <<= sreal_new_exp -= m_exp = __trans_tmp_6;
13+
m_sig = sig;
14+
}
15+
void operator/(sreal);
16+
};
17+
struct ipa_predicate {
18+
ipa_predicate(bool = true);
19+
void operator&=(ipa_predicate);
20+
void operator&(ipa_predicate);
21+
};
22+
void add_condition();
23+
gimple_code eliminated_by_inlining_prob_code;
24+
static int eliminated_by_inlining_prob() {
25+
switch (eliminated_by_inlining_prob_code) {
26+
case GIMPLE_RETURN:
27+
return 2;
28+
case GIMPLE_ASSIGN:
29+
return 1;
30+
}
31+
return 0;
32+
}
33+
void fp_expression_p() {
34+
ipa_predicate bb_predicate;
35+
for (;;) {
36+
int prob = eliminated_by_inlining_prob();
37+
ipa_predicate sra_predicate;
38+
sra_predicate &= add_condition;
39+
if (is_gimple_call())
40+
sreal(prob) / 2;
41+
if (prob != 2)
42+
bb_predicate & sra_predicate;
43+
}
44+
}

0 commit comments

Comments
 (0)