From 5a813558fccf203e1f8733f4c8217a03fd87b430 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Thu, 23 Feb 2017 19:13:48 +0000 Subject: Vendor import of llvm release_40 branch r296002: https://llvm.org/svn/llvm-project/llvm/branches/release_40@296002 --- lib/Target/ARM/ARMISelLowering.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 97481d49ea344..0f84a2359160a 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -3027,17 +3027,20 @@ static SDValue promoteToConstantPool(const GlobalValue *GV, SelectionDAG &DAG, return DAG.getNode(ARMISD::Wrapper, dl, MVT::i32, CPAddr); } +static bool isReadOnly(const GlobalValue *GV) { + if (const GlobalAlias *GA = dyn_cast(GV)) + GV = GA->getBaseObject(); + return (isa(GV) && cast(GV)->isConstant()) || + isa(GV); +} + SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op, SelectionDAG &DAG) const { EVT PtrVT = getPointerTy(DAG.getDataLayout()); SDLoc dl(Op); const GlobalValue *GV = cast(Op)->getGlobal(); const TargetMachine &TM = getTargetMachine(); - if (const GlobalAlias *GA = dyn_cast(GV)) - GV = GA->getBaseObject(); - bool IsRO = - (isa(GV) && cast(GV)->isConstant()) || - isa(GV); + bool IsRO = isReadOnly(GV); // promoteToConstantPool only if not generating XO text section if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV) && !Subtarget->genExecuteOnly()) -- cgit v1.2.3