aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--lib/Target/ARM/ARMISelLowering.cpp13
-rw-r--r--test/CodeGen/ARM/alias_store.ll16
2 files changed, 24 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())
diff --git a/test/CodeGen/ARM/alias_store.ll b/test/CodeGen/ARM/alias_store.ll
new file mode 100644
index 000000000000..48f21fc03eca
--- /dev/null
+++ b/test/CodeGen/ARM/alias_store.ll
@@ -0,0 +1,16 @@
+; RUN: llc < %s -mtriple=arm-linux-gnueabi | FileCheck %s
+
+@X = constant {i8, i8 } { i8 0, i8 0 }
+@XA = alias i8, getelementptr inbounds ({ i8, i8 }, {i8, i8}* @X, i32 0, i32 1)
+
+define void @f(i8** %p) align 2 {
+entry:
+ store i8* @XA, i8 **%p, align 4
+ ret void
+}
+
+; CHECK: f:
+; CHECK: ldr r{{.*}}, [[L:.*]]
+; CHECK: [[L]]:
+; CHECK-NEXT: .long XA
+; CHECK: XA = X+1