diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -1081,8 +1081,7 @@ // a truncate within in. bool Extended = false; const SCEV *IV = SE->getSCEV(CmpIndVar); - const SCEV *TruncatedIV = SE->getTruncateExpr(SE->getSCEV(CmpIndVar), - ExitCnt->getType()); + const SCEV *TruncatedIV = SE->getTruncateExpr(IV, ExitCnt->getType()); const SCEV *ZExtTrunc = SE->getZeroExtendExpr(TruncatedIV, CmpIndVar->getType());