[llvm] 9825d3d - [X86] Use getConstantOperandVal helper in a few places. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri May 15 09:41:39 PDT 2020


Author: Simon Pilgrim
Date: 2020-05-15T17:31:27+01:00
New Revision: 9825d3daa80c19872326d8e137ada39a1727cfe8

URL: https://github.com/llvm/llvm-project/commit/9825d3daa80c19872326d8e137ada39a1727cfe8
DIFF: https://github.com/llvm/llvm-project/commit/9825d3daa80c19872326d8e137ada39a1727cfe8.diff

LOG: [X86] Use getConstantOperandVal helper in a few places. NFC.

Avoid raw cast<ConstantSDNode> calls.

Added: 
    

Modified: 
    llvm/lib/Target/X86/X86ISelLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index be147d39ee27..c1f237d0dbaa 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -9147,8 +9147,8 @@ static bool isHorizontalBinOpPart(const BuildVectorSDNode *N, unsigned Opcode,
     if (!CanFold)
       break;
 
-    unsigned I0 = cast<ConstantSDNode>(Op0.getOperand(1))->getZExtValue();
-    unsigned I1 = cast<ConstantSDNode>(Op1.getOperand(1))->getZExtValue();
+    unsigned I0 = Op0.getConstantOperandVal(1);
+    unsigned I1 = Op1.getConstantOperandVal(1);
 
     if (i * 2 < NumElts) {
       if (V0.isUndef()) {
@@ -9296,11 +9296,10 @@ static bool isAddSubOrSubAdd(const BuildVectorSDNode *BV,
     if (Op0.getOpcode() != ISD::EXTRACT_VECTOR_ELT ||
         Op1.getOpcode() != ISD::EXTRACT_VECTOR_ELT ||
         !isa<ConstantSDNode>(Op0.getOperand(1)) ||
-        !isa<ConstantSDNode>(Op1.getOperand(1)) ||
         Op0.getOperand(1) != Op1.getOperand(1))
       return false;
 
-    unsigned I0 = cast<ConstantSDNode>(Op0.getOperand(1))->getZExtValue();
+    unsigned I0 = Op0.getConstantOperandVal(1);
     if (I0 != i)
       return false;
 


        


More information about the llvm-commits mailing list