]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ifcvt: disallow call instructions in noce_convert_multiple_sets [PR116358]
authorManolis Tsamis <manolis.tsamis@vrull.eu>
Thu, 22 Aug 2024 09:59:11 +0000 (02:59 -0700)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Fri, 23 Aug 2024 18:09:34 +0000 (20:09 +0200)
Similar to not allowing jump instructions in the generated code, we
also shouldn't allow call instructions in noce_convert_multiple_sets.
In the case of PR116358 a libcall was generated from force_operand.

PR middle-end/116358

gcc/ChangeLog:

* ifcvt.cc (noce_convert_multiple_sets): Disallow call insns.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/pr116358.c: New test.

gcc/ifcvt.cc
gcc/testsuite/gcc.target/aarch64/pr116358.c [new file with mode: 0644]

index da59c90789191862649765ddbe32750dc55026b7..b136d7dbbba3cf15a976a2d3c454150e10cebca5 100644 (file)
@@ -3550,7 +3550,7 @@ noce_convert_multiple_sets (struct noce_if_info *if_info)
     return false;
 
   for (insn = seq; insn; insn = NEXT_INSN (insn))
-    if (JUMP_P (insn)
+    if (JUMP_P (insn) || CALL_P (insn)
        || recog_memoized (insn) == -1)
       return false;
 
diff --git a/gcc/testsuite/gcc.target/aarch64/pr116358.c b/gcc/testsuite/gcc.target/aarch64/pr116358.c
new file mode 100644 (file)
index 0000000..0a5fd9e
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR middle-end/116358 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+long long f(int b, int c, long long d)
+{
+  if (c) {
+    long long bb = b;
+    long long t2 = (bb < 16 ? bb : 16);
+    d =  t2 - 16;
+  }
+  return d;
+}
+
+/* { dg-final { scan-assembler-not "bl" } } */