代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/gcc 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From bc6537191e91c854cc6bee3319290d7a86768957 Mon Sep 17 00:00:00 2001
From: zhongyunde <zhongyunde@huawei.com>
Date: Wed, 10 May 2023 18:39:47 +0800
Subject: [PATCH 2/2] [phiopt2] Add option to control the simplify
The phiopt is brought in https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=c4574d23cb07340918793a5a98ae7bb2988b3791
But may be also has some bug fixed by later commit, so disable it default temporary.
This optimization is expected to enable after we update the gcc'base to gcc12's release version.
---
gcc/common.opt | 4 ++++
gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/bool-1.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/bool-2.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/pr18134.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/pr21829.c | 2 +-
gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c | 4 ++--
gcc/tree-ssa-phiopt.c | 3 +++
13 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/gcc/common.opt b/gcc/common.opt
index be7bfee60..5ad2def18 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2781,6 +2781,10 @@ ftree-store-ccp
Common Ignore
Does nothing. Preserved for backward compatibility.
+ftree-fold-phiopt
+Common Report Var(flag_fold_phiopt) Init(0) Optimization
+Attempt to simply the phi node with ssa form.
+
ftree-ch
Common Report Var(flag_tree_ch) Optimization
Enable loop header copying on trees.
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c
index 364ce6a69..b04316d55 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/20040514-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-phiopt2-details" } */
+/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-phiopt2-details" } */
int t( int i)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bool-1.c b/gcc/testsuite/gcc.dg/tree-ssa/bool-1.c
index 401357f2f..892654108 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/bool-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bool-1.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */
int f(_Bool x)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bool-2.c b/gcc/testsuite/gcc.dg/tree-ssa/bool-2.c
index add9cca1e..5ead90f06 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/bool-2.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/bool-2.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */
int f(_Bool x)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c
index 4c190e6af..7b678fafc 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-10.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */
int nem1_phi (unsigned long a) { return a ? -1 : 0; }
int eqm1_phi (unsigned long a) { return a ? 0 : -1; }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c
index fd3706666..23b679644 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-22.c
@@ -1,6 +1,6 @@
/* PR tree-optimization/97690 */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-phiopt2" } */
+/* { dg-options "-O2 -ftree-fold-phiopt -fdump-tree-phiopt2" } */
int foo (_Bool d) { return d ? 2 : 0; }
int bar (_Bool d) { return d ? 1 : 0; }
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c
index 3bdb85609..4efd9afc4 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-4.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */
_Bool t();
_Bool t1();
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
index 18ecbd52a..60dcc6733 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-7.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */
int g(int,int);
int f(int t, int c)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c
index 98c596b6a..aaa71a317 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-8.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-optimized -fdump-tree-phiopt2" } */
+/* { dg-options "-O -ftree-fold-phiopt -fdump-tree-optimized -fdump-tree-phiopt2" } */
int g(int,int);
int f(int t, int c)
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr18134.c b/gcc/testsuite/gcc.dg/tree-ssa/pr18134.c
index cd40ab2c1..efb1907cf 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr18134.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr18134.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O1 -ftree-fold-phiopt -fdump-tree-optimized" } */
int foo (int a)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c
index 8f5ae5127..8c8ada905 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21829.c
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -ftree-fold-phiopt -fdump-tree-optimized" } */
int test(int v)
{
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c
index a2770e5e8..88c13806a 100644
--- a/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr96928-1.c
@@ -1,9 +1,9 @@
/* PR tree-optimization/96928 */
/* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-phiopt2" } */
+/* { dg-options "-O2 -ftree-fold-phiopt -fdump-tree-phiopt2 -fdump-tree-optimized" } */
/* { dg-final { scan-tree-dump-times " = a_\[0-9]*\\\(D\\\) >> " 5 "phiopt2" } } */
/* { dg-final { scan-tree-dump-times " = ~c_\[0-9]*\\\(D\\\);" 1 "phiopt2" } } */
-/* { dg-final { scan-tree-dump-times " = ~" 1 "phiopt2" } } */
+/* { dg-final { scan-tree-dump-times " = ~" 1 "optimized" } } */
/* { dg-final { scan-tree-dump-times " = \[abc_0-9\\\(\\\)D]* \\\^ " 5 "phiopt2" } } */
/* { dg-final { scan-tree-dump-not "a < 0" "phiopt2" } } */
diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
index 51a2d3684..b7012932f 100644
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -839,6 +839,9 @@ match_simplify_replacement (basic_block cond_bb, basic_block middle_bb,
tree result;
gimple *stmt_to_move = NULL;
+ if (!flag_fold_phiopt)
+ return false;
+
/* Special case A ? B : B as this will always simplify to B. */
if (operand_equal_for_phi_arg_p (arg0, arg1))
return false;
--
2.33.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。