From 8b47e0d0ea7909fa2ffd9132d37b0c7b8885c97d Mon Sep 17 00:00:00 2001 From: Adam Nemet Date: Tue, 22 Mar 2016 18:38:15 +0000 Subject: [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 --- llvm/lib/Transforms/Utils/LoopVersioning.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/Utils/LoopVersioning.cpp') 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(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) { -- cgit v1.1