aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-reassoc.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-05-04 10:07:35 +0200
committerRichard Biener <rguenther@suse.de>2021-05-04 12:31:50 +0200
commita310bb73edc9548e08d1fa28e7a56246caf27757 (patch)
tree4494b14985d410f01d6ecb2f5616b3884aa0508f /gcc/tree-ssa-reassoc.c
parent2326627eb19d8c21251fd60479f1a190621c475b (diff)
downloadgcc-a310bb73edc9548e08d1fa28e7a56246caf27757.zip
gcc-a310bb73edc9548e08d1fa28e7a56246caf27757.tar.gz
gcc-a310bb73edc9548e08d1fa28e7a56246caf27757.tar.bz2
tree-optimization/100329 - avoid reassociating asm goto defs
This avoids reassociating asm goto defs because we have no idea on which outgoing edge to insert defs. 2021-05-04 Richard Biener <rguenther@suse.de> PR tree-optimization/100329 * tree-ssa-reassoc.c (can_reassociate_p): Do not reassociate asm goto defs. (insert_stmt_after): Assert we're not running into asm goto. * gcc.dg/torture/pr100329.c: New testcase.
Diffstat (limited to 'gcc/tree-ssa-reassoc.c')
-rw-r--r--gcc/tree-ssa-reassoc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c
index 8e2a489..359367c 100644
--- a/gcc/tree-ssa-reassoc.c
+++ b/gcc/tree-ssa-reassoc.c
@@ -1446,6 +1446,10 @@ insert_stmt_after (gimple *stmt, gimple *insert_point)
gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
return;
}
+ else if (gimple_code (insert_point) == GIMPLE_ASM)
+ /* We have no idea where to insert - it depends on where the
+ uses will be placed. */
+ gcc_unreachable ();
else
/* We assume INSERT_POINT is a SSA_NAME_DEF_STMT of some SSA_NAME,
thus if it must end a basic block, it should be a call that can
@@ -5893,6 +5897,12 @@ can_reassociate_p (tree op)
tree type = TREE_TYPE (op);
if (TREE_CODE (op) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (op))
return false;
+ /* Make sure asm goto outputs do not participate in reassociation since
+ we have no way to find an insertion place after asm goto. */
+ if (TREE_CODE (op) == SSA_NAME
+ && gimple_code (SSA_NAME_DEF_STMT (op)) == GIMPLE_ASM
+ && gimple_asm_nlabels (as_a <gasm *> (SSA_NAME_DEF_STMT (op))) != 0)
+ return false;
if ((ANY_INTEGRAL_TYPE_P (type) && TYPE_OVERFLOW_WRAPS (type))
|| NON_SAT_FIXED_POINT_TYPE_P (type)
|| (flag_associative_math && FLOAT_TYPE_P (type)))