diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 9e318b04c2c99..e3ef9d8680b53 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -3785,7 +3785,7 @@ LSRInstance::CollectLoopInvariantFixupsAndFormulae() { // Ignore icmp instructions which are already being analyzed. if (const ICmpInst *ICI = dyn_cast(UserInst)) { unsigned OtherIdx = !U.getOperandNo(); - Value *OtherOp = const_cast(ICI->getOperand(OtherIdx)); + Value *OtherOp = ICI->getOperand(OtherIdx); if (SE.hasComputableLoopEvolution(SE.getSCEV(OtherOp), L)) continue; }