summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-02-02 02:26:54 +0000
committerChris Lattner <sabre@nondot.org>2010-02-02 02:26:54 +0000
commit302240d73eecdcd23841bfd69f8a6f547857732a (patch)
tree4728f5b4a4fc805cb038ffc4c3f205667cef359b /llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
parent29bb9272a62ddc8a13a82bee1e85136e912a371b (diff)
downloadbcm5719-llvm-302240d73eecdcd23841bfd69f8a6f547857732a.tar.gz
bcm5719-llvm-302240d73eecdcd23841bfd69f8a6f547857732a.zip
fix a crash in loop unswitch on a loop invariant vector condition.
llvm-svn: 95055
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/LoopUnswitch.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
index 527a7b51e11..e5fba28374b 100644
--- a/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopUnswitch.cpp
@@ -169,6 +169,10 @@ Pass *llvm::createLoopUnswitchPass(bool Os) {
/// invariant in the loop, or has an invariant piece, return the invariant.
/// Otherwise, return null.
static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) {
+ // We can never unswitch on vector conditions.
+ if (isa<VectorType>(Cond->getType()))
+ return 0;
+
// Constants should be folded, not unswitched on!
if (isa<Constant>(Cond)) return 0;
@@ -401,7 +405,7 @@ bool LoopUnswitch::IsTrivialUnswitchCondition(Value *Cond, Constant **Val,
/// UnswitchIfProfitable - We have found that we can unswitch currentLoop when
/// LoopCond == Val to simplify the loop. If we decide that this is profitable,
/// unswitch the loop, reprocess the pieces, then return true.
-bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val){
+bool LoopUnswitch::UnswitchIfProfitable(Value *LoopCond, Constant *Val) {
initLoopData();
OpenPOWER on IntegriCloud