mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
AArch64: don't drop GlobalAddress offset when handling extern_weak decls.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176258 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6303b661b3
commit
5366ab21f4
@ -1864,10 +1864,16 @@ AArch64TargetLowering::LowerGlobalAddressELF(SDValue Op,
|
||||
DAG.getTargetConstantPool(GV, PtrVT, 0, 0,
|
||||
AArch64II::MO_LO12),
|
||||
DAG.getConstant(8, MVT::i32));
|
||||
return DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), PoolAddr,
|
||||
MachinePointerInfo::getConstantPool(),
|
||||
/*isVolatile=*/ false, /*isNonTemporal=*/ true,
|
||||
/*isInvariant=*/ true, 8);
|
||||
SDValue GlobalAddr = DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), PoolAddr,
|
||||
MachinePointerInfo::getConstantPool(),
|
||||
/*isVolatile=*/ false,
|
||||
/*isNonTemporal=*/ true,
|
||||
/*isInvariant=*/ true, 8);
|
||||
if (GN->getOffset() != 0)
|
||||
return DAG.getNode(ISD::ADD, dl, PtrVT, GlobalAddr,
|
||||
DAG.getConstant(GN->getOffset(), PtrVT));
|
||||
|
||||
return GlobalAddr;
|
||||
}
|
||||
|
||||
if (Alignment == 0) {
|
||||
|
@ -12,3 +12,16 @@ define i32()* @foo() {
|
||||
; CHECK: ldr x0, [{{x[0-9]+}}, #:lo12:.LCPI0_0]
|
||||
|
||||
}
|
||||
|
||||
|
||||
@arr_var = extern_weak global [10 x i32]
|
||||
|
||||
define i32* @bar() {
|
||||
%addr = getelementptr [10 x i32]* @arr_var, i32 0, i32 5
|
||||
; CHECK: .LCPI1_0:
|
||||
; CHECK-NEXT: .xword arr_var
|
||||
|
||||
; CHECK: ldr [[BASE:x[0-9]+]], [{{x[0-9]+}}, #:lo12:.LCPI1_0]
|
||||
; CHECK: add x0, [[BASE]], #20
|
||||
ret i32* %addr
|
||||
}
|
Loading…
Reference in New Issue
Block a user