[llvm] 0b402e9 - [InstCombine] FoldShiftByConstant - remove unnecessary cast<>. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 05:21:02 PDT 2020


Author: Simon Pilgrim
Date: 2020-10-06T13:13:08+01:00
New Revision: 0b402e985e41e8c01768a0d026adbc25c2274744

URL: https://github.com/llvm/llvm-project/commit/0b402e985e41e8c01768a0d026adbc25c2274744
DIFF: https://github.com/llvm/llvm-project/commit/0b402e985e41e8c01768a0d026adbc25c2274744.diff

LOG: [InstCombine] FoldShiftByConstant - remove unnecessary cast<>. NFC.

Op1 is already a Constant*

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index b02e4eaa3cee..88357922fd18 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -693,8 +693,7 @@ Instruction *InstCombinerImpl::FoldShiftByConstant(Value *Op0, Constant *Op1,
     if (TrOp && I.isLogicalShift() && TrOp->isShift() &&
         isa<ConstantInt>(TrOp->getOperand(1))) {
       // Okay, we'll do this xform.  Make the shift of shift.
-      Constant *ShAmt =
-          ConstantExpr::getZExt(cast<Constant>(Op1), TrOp->getType());
+      Constant *ShAmt = ConstantExpr::getZExt(Op1, TrOp->getType());
       // (shift2 (shift1 & 0x00FF), c2)
       Value *NSh = Builder.CreateBinOp(I.getOpcode(), TrOp, ShAmt, I.getName());
 


        


More information about the llvm-commits mailing list