diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -5157,9 +5157,11 @@ // still being dominated by the input positions. BasicBlock::iterator IP = HoistInsertPosition(LowestIP, Inputs); - // Don't insert instructions before PHI nodes. + // Don't insert instructions before PHI nodes and Allocas. while (isa(IP)) ++IP; + while (isa(IP)) ++IP; + // Ignore landingpad instructions. while (IP->isEHPad()) ++IP;