Am 23.01.26 um 16:09 schrieb Stefan Schulze Frielinghaus:
Fixed by pulling the sledge hammer and skipping any potential
combination if a hard register constraint is involved. Ideally we would
skip based on the fact whether there is any usage of a hard register
referred by any hard register constraint between potentially combined
insns.
gcc/ChangeLog:
* combine.cc (cant_combine_insn_p): Do not try to combine insns
if hard register constraints are involved.
---
gcc/combine.cc | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/gcc/combine.cc b/gcc/combine.cc
index 816324f4735..a4e7aff971d 100644
--- a/gcc/combine.cc
+++ b/gcc/combine.cc
@@ -2229,6 +2229,27 @@ cant_combine_insn_p (rtx_insn *insn)
if (!NONDEBUG_INSN_P (insn))
return true;
+ /* Do not try to combine insns which make use of hard register constraints.
+ For example, assume that in the first insn operand r100 of exp_a is
+ constrained to hard register %5.
+
+ r101=exp_a(r100)
+ %5=...
+ r102=exp_b(r101)
+
+ Then combining the first insn into the last one creates a conflict for
+ pseudo r100 since hard register %5 is live for the last insn. Therefore,
+ skip for now. This is a sledge hammer approach. Ideally we would skip
+ based on the fact whether there is any definition of a hard register used
+ in a single register constraint between potentially combined insns. */
+
+ extract_insn (insn);
Hi Stefan,
as already noted, that extract_insn may run into "unrecognizable insn"
ICE. So before using extract_insn, it must be sure that the insn is
recognizable. I see this in a few tests in the avr testsuite.
extract_insn() is called for the argument of cant_combine_insn_p() and
if that would fail because of an unrecognizable insn this would mean we
call combine for unrecognizable insns. Your reported test failures as
e.g.
gcc.c-torture/execute/pr94412.c -O2 (test for excess errors)
compile fine for me if patch v2 or v3 is applied and fail with the
error message you posted if none of the patches is installed. This all
sounds to me as if you are still testing without v2 or v3 applied.
If you have something reproducible for me, I'm willing to have a look.
Maybe a non-matching split.
A test case I will provide next week.
Cheers,
Johann