summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-09-25 23:34:02 +0000
committerDan Gohman <gohman@apple.com>2008-09-25 23:34:02 +0000
commit789ce77c6a90747aab392e01f30601d55a95fe3a (patch)
tree49dbc7d2f6ede84de76378e0ef2e6fa4870459a0
parentc4f72dd6e759a170808ecfc6be784f8598367484 (diff)
downloadllvm-789ce77c6a90747aab392e01f30601d55a95fe3a.tar.gz
llvm-789ce77c6a90747aab392e01f30601d55a95fe3a.tar.bz2
llvm-789ce77c6a90747aab392e01f30601d55a95fe3a.tar.xz
Fix a bug in which address displacements were being added to the
load from the stub, instead of the result of the load from the stub. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56626 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/X86FastISel.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp
index 0554121e62..b7ff7494c0 100644
--- a/lib/Target/X86/X86FastISel.cpp
+++ b/lib/Target/X86/X86FastISel.cpp
@@ -427,10 +427,18 @@ bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM, bool isCall) {
Opc = X86::MOV64rm;
RC = X86::GR64RegisterClass;
}
+
+ X86AddressMode StubAM;
+ StubAM.Base.Reg = AM.Base.Reg;
+ StubAM.GV = AM.GV;
unsigned ResultReg = createResultReg(RC);
- addFullAddress(BuildMI(MBB, TII.get(Opc), ResultReg), AM);
+ addFullAddress(BuildMI(MBB, TII.get(Opc), ResultReg), StubAM);
+
+ // Now construct the final address. Note that the Disp, Scale,
+ // and Index values may already be set here.
AM.Base.Reg = ResultReg;
AM.GV = 0;
+
// Prevent loading GV stub multiple times in same MBB.
LocalValueMap[V] = AM.Base.Reg;
}