diff mbox series

ifcvt: Disallow emitting call instructions in noce_convert_multiple_sets [PR116358]

Message ID 20240822110409.3798604-1-manolis.tsamis@vrull.eu
State New
Headers show
Series ifcvt: Disallow emitting call instructions in noce_convert_multiple_sets [PR116358] | expand

Commit Message

Manolis Tsamis Aug. 22, 2024, 11:04 a.m. UTC
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.

Signed-off-by: Manolis Tsamis <manolis.tsamis@vrull.eu>
---

 gcc/ifcvt.cc                                |  2 +-
 gcc/testsuite/gcc.target/aarch64/pr116358.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gcc.target/aarch64/pr116358.c

Comments

Jeff Law Aug. 22, 2024, 12:30 p.m. UTC | #1
On 8/22/24 5:04 AM, Manolis Tsamis wrote:
> 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.
OK
jeff
Philipp Tomsich Aug. 23, 2024, 6:19 p.m. UTC | #2
Applied to master, thanks!
--Philipp.


On Thu, 22 Aug 2024 at 20:30, Jeff Law <jeffreyalaw@gmail.com> wrote:
>
>
>
> On 8/22/24 5:04 AM, Manolis Tsamis wrote:
> > 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.
> OK
> jeff
>
diff mbox series

Patch

diff --git a/gcc/ifcvt.cc b/gcc/ifcvt.cc
index da59c907891..b136d7dbbba 100644
--- a/gcc/ifcvt.cc
+++ b/gcc/ifcvt.cc
@@ -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
index 00000000000..0a5fd9e02b9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr116358.c
@@ -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" } } */