Skip to content

Commit 23b82bf

Browse files
committed
[X86] Add getTargetConstantPoolFromBasePtr helper. NFC.
Split out of getTargetConstantFromBasePtr
1 parent d4d88b8 commit 23b82bf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4556,15 +4556,17 @@ static SDValue getShuffleVectorZeroOrUndef(SDValue V2, int Idx,
45564556
return DAG.getVectorShuffle(VT, SDLoc(V2), V1, V2, MaskVec);
45574557
}
45584558

4559-
static const Constant *getTargetConstantFromBasePtr(SDValue Ptr) {
4559+
static const ConstantPoolSDNode *getTargetConstantPoolFromBasePtr(SDValue Ptr) {
45604560
if (Ptr.getOpcode() == X86ISD::Wrapper ||
45614561
Ptr.getOpcode() == X86ISD::WrapperRIP)
45624562
Ptr = Ptr.getOperand(0);
4563+
return dyn_cast<ConstantPoolSDNode>(Ptr);
4564+
}
45634565

4564-
auto *CNode = dyn_cast<ConstantPoolSDNode>(Ptr);
4566+
static const Constant *getTargetConstantFromBasePtr(SDValue Ptr) {
4567+
const ConstantPoolSDNode *CNode = getTargetConstantPoolFromBasePtr(Ptr);
45654568
if (!CNode || CNode->isMachineConstantPoolEntry() || CNode->getOffset() != 0)
45664569
return nullptr;
4567-
45684570
return CNode->getConstVal();
45694571
}
45704572

0 commit comments

Comments
 (0)