Index: llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp =================================================================== --- llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp +++ llvm/lib/Transforms/Scalar/InductiveRangeCheckElimination.cpp @@ -1877,7 +1877,6 @@ cast(SE.getMinusSCEV(SE.getSCEV(LS.IndVarBase), SE.getSCEV(LS.IndVarStep))); std::optional SafeIterRange; - Instruction *ExprInsertPt = Preheader->getTerminator(); SmallVector RangeChecksToEliminate; // Basing on the type of latch predicate, we interpret the IV iteration range @@ -1887,7 +1886,6 @@ auto IntersectRange = LS.IsSignedPredicate ? IntersectSignedRange : IntersectUnsignedRange; - IRBuilder<> B(ExprInsertPt); for (InductiveRangeCheck &IRC : RangeChecks) { auto Result = IRC.computeSafeIterationSpace(SE, IndVar, LS.IsSignedPredicate);