diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index 2fed10741ad7d..49b178359729a 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -612,14 +612,9 @@ static Value *getShiftedValue(Value *V, unsigned NumBits, bool isLeftShift, // We can always evaluate constants shifted. if (Constant *C = dyn_cast(V)) { if (isLeftShift) - V = IC.Builder.CreateShl(C, NumBits); + return IC.Builder.CreateShl(C, NumBits); else - V = IC.Builder.CreateLShr(C, NumBits); - // If we got a constantexpr back, try to simplify it with TD info. - // TODO: This is dubious, IRBuilder should already do this. - if (auto *C = dyn_cast(V)) - V = ConstantFoldConstant(C, DL, &IC.getTargetLibraryInfo()); - return V; + return IC.Builder.CreateLShr(C, NumBits); } Instruction *I = cast(V);