[pushed,PR112875,LRA] : Fix an assert in lra elimination code
Checks
Commit Message
The following patch fixes
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112875
The patch was successfully tested and bootstrapped on x86-64 and ppc64le.
commit 48cb51827c9eb991b92014a3f59d31eb237ce03f
Author: Vladimir N. Makarov <vmakarov@redhat.com>
Date: Fri Dec 8 15:37:42 2023 -0500
[PR112875][LRA]: Fix an assert in lra elimination code
PR112875 test ran into a wrong assert (gcc_unreachable) in elimination
in a debug insn. The insn seems ok. So I change the assertion.
To be more accurate I made it the same as analogous reload pass code.
gcc/ChangeLog:
PR rtl-optimization/112875
* lra-eliminations.cc (lra_eliminate_regs_1): Change an assert.
Add ASM_OPERANDS case.
gcc/testsuite/ChangeLog:
PR rtl-optimization/112875
* gcc.target/i386/pr112875.c: New test.
@@ -666,6 +666,10 @@ lra_eliminate_regs_1 (rtx_insn *insn, rtx x, machine_mode mem_mode,
return x;
case CLOBBER:
+ case ASM_OPERANDS:
+ gcc_assert (insn && DEBUG_INSN_P (insn));
+ break;
+
case SET:
gcc_unreachable ();
new file mode 100644
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Oz -frounding-math -fno-dce -fno-trapping-math -fno-tree-dce -fno-tree-dse -g" } */
+long a, f;
+int b, c, d, g, h, i, j;
+char e;
+void k(long, int l, char t) {
+ char m = b, n = g, o = 0;
+ int p, q, r = h;
+ long s = g;
+ if (f) {
+ q = t + (float)16777217;
+ o = ~0;
+ }
+ if (e) {
+ d = g + a;
+ if (d % (a % l)) {
+ p = d;
+ n = b;
+ }
+ if (l) {
+ i = b;
+ r = a;
+ p = h;
+ }
+ if (s)
+ s = q;
+ c = f;
+ e += t;
+ a = p;
+ }
+ j = r % n;
+ s += g / 0xc000000000000000 + !o;
+}