LRA did not generate insn satisfying insn constraints on the PR
test. The reason for this is that LRA assigned the same hard reg for
two conflicting reload pseudos. The two insn reload pseudos are
originated from the same pseudo and LRA tried to optimize as it
assigned the same value for the reload pseudos. It is an LRA
optimization to minimize reload insns. The two reload pseudos
conflict as one of them is an early clobber insn operands. The patch
solves this problem by assigning unique value if the operand is early
clobber one.
gcc/ChangeLog:
PR target/117105
* lra-constraints.cc (get_reload_reg): Create unique value reload
pseudos for early clobbered operands.
gcc/testsuite/ChangeLog:
PR target/117105
* gcc.target/i386/pr117105.c: New test.
{
int i, regno;
enum reg_class new_class;
- bool unique_p = false;
if (type == OP_OUT)
{
exclude_start_hard_regs, title);
return true;
}
+
+ bool unique_p = early_clobber_p;
/* Prevent reuse value of expression with side effects,
e.g. volatile memory. */
if (! side_effects_p (original))
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O3 -fno-code-hoisting -fno-tree-fre -fno-tree-dominator-opts -fno-tree-pre -fno-tree-sra" } */
+int a;
+struct b {
+ char c;
+ char d;
+};
+int main() {
+ struct b e;
+ int f;
+ while (a)
+ if (f == e.d)
+ f = e.c = e.d & 1 >> e.d;
+ return 0;
+}