aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopVersioning.cpp
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-03-22 18:38:15 +0000
committerAdam Nemet <anemet@apple.com>2016-03-22 18:38:15 +0000
commit8b47e0d0ea7909fa2ffd9132d37b0c7b8885c97d (patch)
tree7c20a19b83bbe20fdb4b49c28951ed1d3bfc7dc8 /llvm/lib/Transforms/Utils/LoopVersioning.cpp
parente409e688a328d1c61229653a7d4e1ab108cf3a3c (diff)
downloadllvm-8b47e0d0ea7909fa2ffd9132d37b0c7b8885c97d.zip
llvm-8b47e0d0ea7909fa2ffd9132d37b0c7b8885c97d.tar.gz
llvm-8b47e0d0ea7909fa2ffd9132d37b0c7b8885c97d.tar.bz2
[LoopVersioning] Relax an assert for LCSSA PHIs
When you have multiple LCSSA (single-operand) PHIs that are converted into two-operand PHIs due to versioning, only assert that the PHI currently being converted has a single operand. I.e. we don't want to check PHIs that were converted earlier in the loop. Fixes PR27023. Thanks to Karl-Johan Karlsson for the minimized testcase! llvm-svn: 264081
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopVersioning.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopVersioning.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopVersioning.cpp b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
index 19c7fa7..e3f711f 100644
--- a/llvm/lib/Transforms/Utils/LoopVersioning.cpp
+++ b/llvm/lib/Transforms/Utils/LoopVersioning.cpp
@@ -133,10 +133,11 @@ void LoopVersioning::addPHINodes(
// First see if we have a single-operand PHI with the value defined by the
// original loop.
for (auto I = PHIBlock->begin(); (PN = dyn_cast<PHINode>(I)); ++I) {
- assert(PN->getNumOperands() == 1 &&
- "Exit block should only have on predecessor");
- if (PN->getIncomingValue(0) == Inst)
+ if (PN->getIncomingValue(0) == Inst) {
+ assert(PN->getNumOperands() == 1 &&
+ "Exit block should only have on predecessor");
break;
+ }
}
// If not create it.
if (!PN) {