The following patch solves

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123092

The patch was successfully bootstrapped and tested on x86-64, aarch64, and ppc64le.

commit a045c88f2843ba5b5a14342ce27dc16396059a06
Author: Vladimir N. Makarov <[email protected]>
Date:   Fri Jan 16 10:09:52 2026 -0500

    [PR123092, LRA]: Reprocess insn after equivalence substitution
    
    LRA in the test case substituted equivalence in an insn but did not
    process the insn on satisfying constraints after that.  It resulted in
    error "insn does not satisfy its constraints"
    
    gcc/ChangeLog:
    
            PR target/123092
            * lra-constraints.cc (lra_constraints): Push insn on processing
            stack after equivalence substitution.
    
    gcc/testsuite/ChangeLog:
    
            PR target/123092
            * gcc.target/riscv/pr123092.c: New.

diff --git a/gcc/lra-constraints.cc b/gcc/lra-constraints.cc
index ba7342f3ed2..e3cee947243 100644
--- a/gcc/lra-constraints.cc
+++ b/gcc/lra-constraints.cc
@@ -5664,6 +5664,7 @@ lra_constraints (bool first_p)
 		   && loc_equivalence_change_p (&PATTERN (curr_insn)))
 	    {
 	      lra_update_insn_regno_info (curr_insn);
+	      lra_push_insn_by_uid (INSN_UID (curr_insn));
 	      changed_p = true;
 	    }
 	}
diff --git a/gcc/testsuite/gcc.target/riscv/pr123092.c b/gcc/testsuite/gcc.target/riscv/pr123092.c
new file mode 100644
index 00000000000..ebcf177a121
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/pr123092.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -march=rv64gc_zicbop -mabi=lp64d" } */
+struct a {
+  char *b;
+} d;
+int e;
+int c(struct a *);
+void f() {
+  __builtin_prefetch(d.b + 64);
+  if (e)
+    c(&d);
+}

Reply via email to