[llvm] r289566 - GlobalISel: fix GOT accesses on AArch64.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 10:25:39 PST 2016
Author: tnorthover
Date: Tue Dec 13 12:25:38 2016
New Revision: 289566
URL: http://llvm.org/viewvc/llvm-project?rev=289566&view=rev
Log:
GlobalISel: fix GOT accesses on AArch64.
We were using the correct pseudo-instruction, but because the operand's flags
weren't set correctly we still ended up emitting incorrect relocations during
MC lowering.
Modified:
llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir
Modified: llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp?rev=289566&r1=289565&r2=289566&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstructionSelector.cpp Tue Dec 13 12:25:38 2016
@@ -662,9 +662,10 @@ bool AArch64InstructionSelector::select(
return false;
}
unsigned char OpFlags = STI.ClassifyGlobalReference(GV, TM);
- if (OpFlags & AArch64II::MO_GOT)
+ if (OpFlags & AArch64II::MO_GOT) {
I.setDesc(TII.get(AArch64::LOADgot));
- else {
+ I.getOperand(1).setTargetFlags(OpFlags);
+ } else {
I.setDesc(TII.get(AArch64::MOVaddr));
I.getOperand(1).setTargetFlags(OpFlags | AArch64II::MO_PAGE);
MachineInstrBuilder MIB(MF, I);
Modified: llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir?rev=289566&r1=289565&r2=289566&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir (original)
+++ llvm/trunk/test/CodeGen/AArch64/GlobalISel/arm64-instructionselect.mir Tue Dec 13 12:25:38 2016
@@ -2408,7 +2408,7 @@ registers:
# CHECK: body:
# IOS: %0 = MOVaddr target-flags(aarch64-page) @var_local, target-flags(aarch64-pageoff, aarch64-nc) @var_local
# LINUX-DEFAULT: %0 = MOVaddr target-flags(aarch64-page) @var_local, target-flags(aarch64-pageoff, aarch64-nc) @var_local
-# LINUX-PIC: %0 = LOADgot @var_local
+# LINUX-PIC: %0 = LOADgot target-flags(aarch64-got) @var_local
body: |
bb.0:
%0(p0) = G_GLOBAL_VALUE @var_local
@@ -2423,9 +2423,9 @@ registers:
- { id: 0, class: gpr }
# CHECK: body:
-# IOS: %0 = LOADgot @var_got
+# IOS: %0 = LOADgot target-flags(aarch64-got) @var_got
# LINUX-DEFAULT: %0 = MOVaddr target-flags(aarch64-page) @var_got, target-flags(aarch64-pageoff, aarch64-nc) @var_got
-# LINUX-PIC: %0 = LOADgot @var_got
+# LINUX-PIC: %0 = LOADgot target-flags(aarch64-got) @var_got
body: |
bb.0:
%0(p0) = G_GLOBAL_VALUE @var_got
More information about the llvm-commits
mailing list