[PATCH] D29740: Fix PR31896.
Evgeniy Stepanov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 15:55:23 PST 2017
eugenis updated this revision to Diff 88982.
Repository:
rL LLVM
https://reviews.llvm.org/D29740
Files:
lib/Target/ARM/ARMISelLowering.cpp
test/CodeGen/ARM/alias_store.ll
Index: test/CodeGen/ARM/alias_store.ll
===================================================================
--- /dev/null
+++ test/CodeGen/ARM/alias_store.ll
@@ -0,0 +1,11 @@
+; RUN: llc < %s -mtriple=arm-linux-gnueabi | FileCheck %s
+
+ at X = constant {i8, i8 } { i8 0, i8 0 }
+ at 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
+}
+
Index: lib/Target/ARM/ARMISelLowering.cpp
===================================================================
--- lib/Target/ARM/ARMISelLowering.cpp
+++ lib/Target/ARM/ARMISelLowering.cpp
@@ -3077,17 +3077,20 @@
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())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29740.88982.patch
Type: text/x-patch
Size: 1705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170217/e2978158/attachment.bin>
More information about the llvm-commits
mailing list