GCC with patches for Dreamcast
修訂 | 1a121f0c20f490ff03f78e7f3f8a22ab9b2bbac9 (tree) |
---|---|
時間 | 2021-05-05 19:12:34 |
作者 | Richard Biener <rguenther@suse...> |
Commiter | Richard Biener |
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)
@@ -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 | +} |
@@ -451,6 +451,9 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi, | ||
451 | 451 | if (!is_gimple_reg_type (TREE_TYPE (new_arg0))) |
452 | 452 | return NULL; |
453 | 453 | } |
454 | + if (TREE_CODE (new_arg0) == SSA_NAME | |
455 | + && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_arg0)) | |
456 | + return NULL; | |
454 | 457 | |
455 | 458 | if (TREE_CODE (arg1) == SSA_NAME) |
456 | 459 | { |
@@ -465,6 +468,9 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi, | ||
465 | 468 | new_arg1 = gimple_assign_rhs1 (arg1_def_stmt); |
466 | 469 | if (convert_code == VIEW_CONVERT_EXPR) |
467 | 470 | 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; | |
468 | 474 | } |
469 | 475 | else |
470 | 476 | { |