From 9825d3daa80c19872326d8e137ada39a1727cfe8 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 15 May 2020 17:30:55 +0100 Subject: [PATCH] [X86] Use getConstantOperandVal helper in a few places. NFC. Avoid raw cast calls. --- llvm/lib/Target/X86/X86ISelLowering.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index be147d3..c1f237d 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(Op0.getOperand(1))->getZExtValue(); - unsigned I1 = cast(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(Op0.getOperand(1)) || - !isa(Op1.getOperand(1)) || Op0.getOperand(1) != Op1.getOperand(1)) return false; - unsigned I0 = cast(Op0.getOperand(1))->getZExtValue(); + unsigned I0 = Op0.getConstantOperandVal(1); if (I0 != i) return false; -- 2.7.4