aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/ARM
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-02-23 19:13:48 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-02-23 19:13:48 +0000
commit5a813558fccf203e1f8733f4c8217a03fd87b430 (patch)
tree8a0d61091371dfc2cdca994dc23e46e0ee21bc89 /lib/Target/ARM
parente49737eb046479c0610f1254ef311a91036a5144 (diff)
downloadsrc-5a813558fccf203e1f8733f4c8217a03fd87b430.tar.gz
src-5a813558fccf203e1f8733f4c8217a03fd87b430.zip
Vendor import of llvm release_40 branch r296002:vendor/llvm/llvm-release_40-r296002
Notes
Notes: svn path=/vendor/llvm/dist/; revision=314168 svn path=/vendor/llvm/llvm-release_40-r296002/; revision=314169; tag=vendor/llvm/llvm-release_40-r296002
Diffstat (limited to 'lib/Target/ARM')
-rw-r--r--lib/Target/ARM/ARMISelLowering.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
index 97481d49ea34..0f84a2359160 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<GlobalAlias>(GV))
+ GV = GA->getBaseObject();
+ return (isa<GlobalVariable>(GV) && cast<GlobalVariable>(GV)->isConstant()) ||
+ isa<Function>(GV);
+}
+
SDValue ARMTargetLowering::LowerGlobalAddressELF(SDValue Op,
SelectionDAG &DAG) const {
EVT PtrVT = getPointerTy(DAG.getDataLayout());
SDLoc dl(Op);
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
const TargetMachine &TM = getTargetMachine();
- if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
- GV = GA->getBaseObject();
- bool IsRO =
- (isa<GlobalVariable>(GV) && cast<GlobalVariable>(GV)->isConstant()) ||
- isa<Function>(GV);
+ bool IsRO = isReadOnly(GV);
// promoteToConstantPool only if not generating XO text section
if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV) && !Subtarget->genExecuteOnly())