diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp index 0c8d6fa47b9ae..3e11db7dd6e6b 100644 --- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp @@ -100,7 +100,7 @@ static void RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader, // Remove PHI node entries that are no longer live. BasicBlock::iterator I, E = OrigHeader->end(); for (I = OrigHeader->begin(); PHINode *PN = dyn_cast(I); ++I) - PN->removeIncomingValue(PN->getBasicBlockIndex(OrigPreheader)); + PN->removeIncomingValue(OrigPreheader); // Now fix up users of the instructions in OrigHeader, inserting PHI nodes // as necessary.