Vendor import of llvm release_40 branch r296002:
https://llvm.org/svn/llvm-project/llvm/branches/release_40@296002
This commit is contained in:
parent
e49737eb04
commit
5a813558fc
@ -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())
|
||||
|
16
test/CodeGen/ARM/alias_store.ll
Normal file
16
test/CodeGen/ARM/alias_store.ll
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user