aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-unswitch.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2015-10-09 12:18:24 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2015-10-09 12:18:24 +0000
commitf813d16ec532adc9760b0d6d4574b2028034b73a (patch)
tree204e33aa8889c3902a864e581b9a62cda9529d94 /gcc/tree-ssa-loop-unswitch.c
parent6be1d686e1e87fad27be534862c68279448fb87a (diff)
downloadgcc-f813d16ec532adc9760b0d6d4574b2028034b73a.zip
gcc-f813d16ec532adc9760b0d6d4574b2028034b73a.tar.gz
gcc-f813d16ec532adc9760b0d6d4574b2028034b73a.tar.bz2
[PR67828] don't unswitch on default defs of non-parms
for gcc/ChangeLog PR rtl-optimizatoin/67828 * tree-ssa-loop-unswitch.c: Include tree-ssa.h. (tree_may_unswitch_on): Don't unswitch on expressions involving undefined values. for gcc/testsuite/ChangeLog PR rtl-optimization/67828 * gcc.dg/torture/pr67828.c: New. From-SVN: r228650
Diffstat (limited to 'gcc/tree-ssa-loop-unswitch.c')
-rw-r--r--gcc/tree-ssa-loop-unswitch.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 4328d6a..d6faa37 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see
#include "internal-fn.h"
#include "gimplify.h"
#include "tree-cfg.h"
+#include "tree-ssa.h"
#include "tree-ssa-loop-niter.h"
#include "tree-ssa-loop.h"
#include "tree-into-ssa.h"
@@ -139,6 +140,10 @@ tree_may_unswitch_on (basic_block bb, struct loop *loop)
/* Condition must be invariant. */
FOR_EACH_SSA_TREE_OPERAND (use, stmt, iter, SSA_OP_USE)
{
+ /* Unswitching on undefined values would introduce undefined
+ behavior that the original program might never exercise. */
+ if (ssa_undefined_value_p (use, true))
+ return NULL_TREE;
def = SSA_NAME_DEF_STMT (use);
def_bb = gimple_bb (def);
if (def_bb