• R/O
  • HTTP
  • SSH
  • HTTPS

提交

標籤
無標籤

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GCC with patches for Dreamcast


Commit MetaInfo

修訂1a121f0c20f490ff03f78e7f3f8a22ab9b2bbac9 (tree)
時間2021-05-05 19:12:34
作者Richard Biener <rguenther@suse...>
CommiterRichard Biener

Log Message

tree-optimization/98786 - fix issue with phiopt and abnormals

This fixes factor_out_conditional_conversion to avoid creating overlapping
lifetimes for abnormals.

2021-01-22 Richard Biener <rguenther@suse.de>

PR tree-optimization/98786
* tree-ssa-phiopt.c (factor_out_conditional_conversion): Avoid
adding new uses of abnormals.

* gcc.dg/torture/pr98786.c: New testcase.

(cherry picked from commit 329f730fd1daa7cdae4a637244d4e215f9bb9a8c)

Change Summary

差異

--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr98786.c
@@ -0,0 +1,23 @@
1+/* { dg-do compile } */
2+/* { dg-additional-options "-fno-tree-dce" } */
3+
4+void
5+func_30 (void);
6+
7+int __attribute__ ((pure, returns_twice))
8+func_38 (int g_15, int p_39)
9+{
10+ return !!g_15 ? p_39 : 0;
11+}
12+
13+void
14+func_26 (int func_26___trans_tmp_1)
15+{
16+ long int l_37 = 0;
17+ int __trans_tmp_1;
18+
19+ func_26___trans_tmp_1 = func_38 (func_26___trans_tmp_1, 1);
20+ __trans_tmp_1 = func_38 (func_26___trans_tmp_1, l_37);
21+ l_37 = 1;
22+ func_30 ();
23+}
--- a/gcc/tree-ssa-phiopt.c
+++ b/gcc/tree-ssa-phiopt.c
@@ -451,6 +451,9 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi,
451451 if (!is_gimple_reg_type (TREE_TYPE (new_arg0)))
452452 return NULL;
453453 }
454+ if (TREE_CODE (new_arg0) == SSA_NAME
455+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_arg0))
456+ return NULL;
454457
455458 if (TREE_CODE (arg1) == SSA_NAME)
456459 {
@@ -465,6 +468,9 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi,
465468 new_arg1 = gimple_assign_rhs1 (arg1_def_stmt);
466469 if (convert_code == VIEW_CONVERT_EXPR)
467470 new_arg1 = TREE_OPERAND (new_arg1, 0);
471+ if (TREE_CODE (new_arg1) == SSA_NAME
472+ && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_arg1))
473+ return NULL;
468474 }
469475 else
470476 {