@GOTPCREL is also rip-relative. Fix fast-isel to do the right thing.
authorChris Lattner <sabre@nondot.org>
Thu, 2 Jul 2009 04:22:01 +0000 (04:22 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 2 Jul 2009 04:22:01 +0000 (04:22 +0000)
This fixes an llvm-gcc bootstrap problem I introduced.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74691 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86FastISel.cpp
test/CodeGen/X86/fast-isel-gv.ll

index dcb8852a89bf7b7665116f5e782a88c23ed56e0d..b336d780c505da870ece3c25493b2dc72d4e7890 100644 (file)
@@ -478,8 +478,10 @@ bool X86FastISel::X86SelectAddress(Value *V, X86AddressMode &AM, bool isCall) {
         Opc = X86::MOV64rm;
         RC  = X86::GR64RegisterClass;
         
-        if (TM.getRelocationModel() != Reloc::Static)
+        if (TM.getRelocationModel() != Reloc::Static) {
           StubAM.GVOpFlags = X86II::MO_GOTPCREL;
+          StubAM.Base.Reg = X86::RIP;
+        }
       }
 
       unsigned ResultReg = createResultReg(RC);
index 7a4b94d1b9bb9376c1391d5090c49c71bcfb9404..b2f885095ecebe81fd0ef4a42292b93543b34b6c 100644 (file)
@@ -1,4 +1,4 @@
-; RUN: llvm-as < %s | llc -fast-isel | grep {_kill@GOTPCREL}
+; RUN: llvm-as < %s | llc -fast-isel | grep {_kill@GOTPCREL(%rip)}
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
 target triple = "x86_64-apple-darwin10.0"
 @f = global i8 (...)* @kill            ; <i8 (...)**> [#uses=1]