aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-pre.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-01-18 15:51:12 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-01-18 15:51:12 +0000
commit890065bfe4a9d3367568a2f5a9a12b6289f377d0 (patch)
treec3c88c9e03ec958f75cbb15702d98af42d7408c2 /gcc/tree-ssa-pre.c
parenta729d731c8a6dcd45760f1bd7bc5d5379ae49d2c (diff)
downloadgcc-890065bfe4a9d3367568a2f5a9a12b6289f377d0.zip
gcc-890065bfe4a9d3367568a2f5a9a12b6289f377d0.tar.gz
gcc-890065bfe4a9d3367568a2f5a9a12b6289f377d0.tar.bz2
re PR tree-optimization/38819 (trapping expression wrongly hoisted out of loop)
2009-01-18 Richard Guenther <rguenther@suse.de> PR tree-optimization/38819 * tree-flow.h (operation_could_trap_helper_p): Declare. * tree-eh.c (operation_could_trap_helper_p): Export. * tree-ssa-sccvn.h (vn_nary_may_trap): Declare. * tree-ssa-sccvn.c (vn_nary_may_trap): New function. * tree-ssa-pre.c (insert_into_preds_of_block): Check if we are about to insert a possibly trapping instruction and fail in this case. * gcc.c-torture/execute/pr38819.c: New testcase. From-SVN: r143485
Diffstat (limited to 'gcc/tree-ssa-pre.c')
-rw-r--r--gcc/tree-ssa-pre.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 0a4fb6d..0717a36 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -3004,6 +3004,15 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
}
}
+ /* Make sure we are not inserting trapping expressions. */
+ FOR_EACH_EDGE (pred, ei, block->preds)
+ {
+ bprime = pred->src;
+ eprime = avail[bprime->index];
+ if (eprime->kind == NARY
+ && vn_nary_may_trap (PRE_EXPR_NARY (eprime)))
+ return false;
+ }
/* Make the necessary insertions. */
FOR_EACH_EDGE (pred, ei, block->preds)