summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-15 07:36:13 +0000
committerChris Lattner <sabre@nondot.org>2011-01-15 07:36:13 +0000
commit8df83c4a240293463700b0b97ca9e5425878c0ef (patch)
tree55369f41522b8b2ef02baf063cc7dfbed39b767d /llvm/lib/Transforms
parentee588defc6957cbd9624e0061f7e6f20e5189f4a (diff)
downloadbcm5719-llvm-8df83c4a240293463700b0b97ca9e5425878c0ef.tar.gz
bcm5719-llvm-8df83c4a240293463700b0b97ca9e5425878c0ef.zip
fix rdar://8785296 - -fcatch-undefined-behavior generates inefficient code
The basic issue is that isel (very reasonably!) expects conditional branches to be folded, so CGP leaving around a bunch dead computation feeding conditional branches isn't such a good idea. Just fold branches on constants into unconditional branches. llvm-svn: 123526
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 72c8bf30477..3496aa20abb 100644
--- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp
@@ -1071,6 +1071,9 @@ bool CodeGenPrepare::OptimizeInst(Instruction *I) {
if (CallInst *CI = dyn_cast<CallInst>(I))
return OptimizeCallInst(CI);
+ if (isa<TerminatorInst>(I))
+ return ConstantFoldTerminator(I->getParent());
+
return false;
}
OpenPOWER on IntegriCloud