]> granicus.if.org Git - llvm/commitdiff
[DAGCombine] Reduce scope of ShAmtVal variable. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 20 Jun 2019 10:56:37 +0000 (10:56 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 20 Jun 2019 10:56:37 +0000 (10:56 +0000)
Fixes cppcheck warning.

Use the more capable getAPIntVal() instead of getZExtValue() as well since I'm here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@363921 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/DAGCombiner.cpp

index 33e339de3545b7d3d3caea5873dee6a7a80f7849..5eee749d33034b01922884e2a6d505ffa1d99756 100644 (file)
@@ -9840,14 +9840,13 @@ SDValue DAGCombiner::visitZERO_EXTEND(SDNode *N) {
       N0.getOperand(0).getOpcode() == ISD::ZERO_EXTEND &&
       N0.hasOneUse()) {
     SDValue ShAmt = N0.getOperand(1);
-    unsigned ShAmtVal = cast<ConstantSDNode>(ShAmt)->getZExtValue();
     if (N0.getOpcode() == ISD::SHL) {
       SDValue InnerZExt = N0.getOperand(0);
       // If the original shl may be shifting out bits, do not perform this
       // transformation.
       unsigned KnownZeroBits = InnerZExt.getValueSizeInBits() -
         InnerZExt.getOperand(0).getValueSizeInBits();
-      if (ShAmtVal > KnownZeroBits)
+      if (cast<ConstantSDNode>(ShAmt)->getAPIntValue().ugt(KnownZeroBits))
         return SDValue();
     }