blob: 0eca175156e2190e6135a0e1fb80b979df4f8a7b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
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
|