aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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
commiteeba3f5695e39ca970a7aeb161558575216005b2 (patch)
tree2f42b2f1c59fe0888c4357c3a3b0f68db85a29fb /lib
parent1a8943a1f872a47b821fe7075f07b42403fa1a3f (diff)
downloadexternal_llvm-eeba3f5695e39ca970a7aeb161558575216005b2.zip
external_llvm-eeba3f5695e39ca970a7aeb161558575216005b2.tar.gz
external_llvm-eeba3f5695e39ca970a7aeb161558575216005b2.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123526 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index 72c8bf3..3496aa2 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/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;
}