Skip to content

Commit 21c83fe

Browse files
committed
[ARM] Simplify shouldAssumeDSOLocal for ELF. NFC
1 parent 69b8372 commit 21c83fe

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

llvm/lib/Target/ARM/ARMFastISel.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,8 +2953,7 @@ bool ARMFastISel::tryToFoldLoadIntoMI(MachineInstr *MI, unsigned OpNo,
29532953
}
29542954

29552955
unsigned ARMFastISel::ARMLowerPICELF(const GlobalValue *GV, MVT VT) {
2956-
bool UseGOT_PREL = !TM.shouldAssumeDSOLocal(*GV->getParent(), GV);
2957-
2956+
bool UseGOT_PREL = !GV->isDSOLocal();
29582957
LLVMContext *Context = &MF->getFunction().getContext();
29592958
unsigned ARMPCLabelIndex = AFI->createPICLabelUId();
29602959
unsigned PCAdj = Subtarget->isThumb() ? 4 : 8;

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3921,20 +3921,18 @@ SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
39213921
EVT PtrVT = getPointerTy(DAG.getDataLayout());
39223922
SDLoc dl(Op);
39233923
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
3924-
const TargetMachine &TM = getTargetMachine();
39253924
bool IsRO = isReadOnly(GV);
39263925

39273926
// promoteToConstantPool only if not generating XO text section
3928-
if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV) && !Subtarget->genExecuteOnly())
3927+
if (GV->isDSOLocal() && !Subtarget->genExecuteOnly())
39293928
if (SDValue V = promoteToConstantPool(this, GV, DAG, PtrVT, dl))
39303929
return V;
39313930

39323931
if (isPositionIndependent()) {
3933-
bool UseGOT_PREL = !TM.shouldAssumeDSOLocal(*GV->getParent(), GV);
3934-
SDValue G = DAG.getTargetGlobalAddress(GV, dl, PtrVT, 0,
3935-
UseGOT_PREL ? ARMII::MO_GOT : 0);
3932+
SDValue G = DAG.getTargetGlobalAddress(
3933+
GV, dl, PtrVT, 0, GV->isDSOLocal() ? 0 : ARMII::MO_GOT);
39363934
SDValue Result = DAG.getNode(ARMISD::WrapperPIC, dl, PtrVT, G);
3937-
if (UseGOT_PREL)
3935+
if (!GV->isDSOLocal())
39383936
Result =
39393937
DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), Result,
39403938
MachinePointerInfo::getGOT(DAG.getMachineFunction()));

llvm/lib/Target/ARM/ARMSubtarget.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,7 @@ bool ARMSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const {
366366
}
367367

368368
bool ARMSubtarget::isGVInGOT(const GlobalValue *GV) const {
369-
return isTargetELF() && TM.isPositionIndependent() &&
370-
!TM.shouldAssumeDSOLocal(*GV->getParent(), GV);
369+
return isTargetELF() && TM.isPositionIndependent() && !GV->isDSOLocal();
371370
}
372371

373372
unsigned ARMSubtarget::getMispredictionPenalty() const {

0 commit comments

Comments
 (0)