gcc/0300-Remove-erroneous-pattern-from-gimple-ifcvt.patch

56 lines
1.4 KiB
Diff
Raw Permalink Normal View History

2024-11-21 11:46:51 +08:00
From 91ef8899a80e493042fd2687ad89064c9f90cf17 Mon Sep 17 00:00:00 2001
From: Pronin Alexander <pronin.alexander@huawei.com>
Date: Thu, 31 Oct 2024 16:14:34 +0800
Subject: [PATCH 3/6] Remove erroneous pattern from gimple ifcvt
Signed-off-by: Pronin Alexander <pronin.alexander@huawei.com>
---
gcc/match.pd | 2 +-
gcc/testsuite/gcc.dg/ifcvt-gimple-1.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/ifcvt-gimple-1.c
diff --git a/gcc/match.pd b/gcc/match.pd
index 8f41c292f..2dd6581d1 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -4276,7 +4276,7 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
)
(if (flag_if_conversion_gimple)
- (for simple_op (plus minus bit_and bit_ior bit_xor)
+ (for simple_op (plus minus bit_ior bit_xor)
(simplify
(cond @0 (simple_op @1 INTEGER_CST@2) @1)
(switch
diff --git a/gcc/testsuite/gcc.dg/ifcvt-gimple-1.c b/gcc/testsuite/gcc.dg/ifcvt-gimple-1.c
new file mode 100644
index 000000000..381a4ad51
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ifcvt-gimple-1.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-options "-O2 -fno-inline -fif-conversion-gimple" } */
+
+#include <stdlib.h>
+
+void foo(int a, int *p) {
+ *p = a;
+}
+
+void verify (int a) {
+ if (a != 3)
+ abort ();
+}
+
+int main() {
+ int a = 0;
+ foo (3, &a);
+ int tmp = (a > 7) ? a & 1 : a;
+ verify (tmp);
+ return 0;
+}
--
2.33.0