diff options
author | Chris Lattner <sabre@nondot.org> | 2006-02-22 23:55:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2006-02-22 23:55:00 +0000 |
commit | f8bf116f808ecc6a9ca09cb761fe2a169e006b57 (patch) | |
tree | 0cbd1f264adc35f691e3542960b0222a6606d38d /lib/Transforms/Scalar/LoopUnswitch.cpp | |
parent | 116ae7c067b774c2dbdd95775e826e943a16dec9 (diff) |
Fix Regression/Transforms/LoopUnswitch/2006-02-22-UnswitchCrash.ll, which
caused SPASS to fail building last night.
We can't trivially unswitch a loop if the exit block has phi nodes in it,
because we don't know which predecessor to use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@26320 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/LoopUnswitch.cpp')
-rw-r--r-- | lib/Transforms/Scalar/LoopUnswitch.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/LoopUnswitch.cpp b/lib/Transforms/Scalar/LoopUnswitch.cpp index 61a043596d..b0be443c11 100644 --- a/lib/Transforms/Scalar/LoopUnswitch.cpp +++ b/lib/Transforms/Scalar/LoopUnswitch.cpp @@ -325,7 +325,9 @@ static bool IsTrivialUnswitchCondition(Loop *L, Value *Cond, Constant **Val = 0, } } - if (!LoopExitBB) + // If we didn't find a single unique LoopExit block, or if the loop exit block + // contains phi nodes, this isn't trivial. + if (!LoopExitBB || isa<PHINode>(LoopExitBB->begin())) return false; // Can't handle this. if (LoopExit) *LoopExit = LoopExitBB; |