mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-12 22:26:14 +00:00
[x32] Fast ISel should use LEA64_32r instead of LEA32r to adjust addresses in x32 mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226661 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
506c6ec22a
commit
0b4244ade1
@ -3224,7 +3224,10 @@ unsigned X86FastISel::X86MaterializeGV(const GlobalValue *GV, MVT VT) {
|
||||
ResultReg)
|
||||
.addGlobalAddress(GV);
|
||||
} else {
|
||||
unsigned Opc = TLI.getPointerTy() == MVT::i32 ? X86::LEA32r : X86::LEA64r;
|
||||
unsigned Opc = TLI.getPointerTy() == MVT::i32
|
||||
? (Subtarget->isTarget64BitILP32()
|
||||
? X86::LEA64_32r : X86::LEA32r)
|
||||
: X86::LEA64r;
|
||||
addFullAddress(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
||||
TII.get(Opc), ResultReg), AM);
|
||||
}
|
||||
@ -3266,7 +3269,10 @@ unsigned X86FastISel::fastMaterializeAlloca(const AllocaInst *C) {
|
||||
X86AddressMode AM;
|
||||
if (!X86SelectAddress(C, AM))
|
||||
return 0;
|
||||
unsigned Opc = TLI.getPointerTy() == MVT::i32 ? X86::LEA32r : X86::LEA64r;
|
||||
unsigned Opc = TLI.getPointerTy() == MVT::i32
|
||||
? (Subtarget->isTarget64BitILP32()
|
||||
? X86::LEA64_32r : X86::LEA32r)
|
||||
: X86::LEA64r;
|
||||
const TargetRegisterClass* RC = TLI.getRegClassFor(TLI.getPointerTy());
|
||||
unsigned ResultReg = createResultReg(RC);
|
||||
addFullAddress(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DbgLoc,
|
||||
|
10
test/CodeGen/X86/x32-lea-1.ll
Normal file
10
test/CodeGen/X86/x32-lea-1.ll
Normal file
@ -0,0 +1,10 @@
|
||||
; RUN: llc < %s -mtriple=x86_64-linux-gnux32 -O0 | FileCheck %s
|
||||
; CHECK: leal {{[-0-9]*}}(%r{{s|b}}p),
|
||||
; CHECK-NOT: leal {{[-0-9]*}}(%e{{s|b}}p),
|
||||
|
||||
define void @foo(i32** %p) {
|
||||
%a = alloca i32, i32 10
|
||||
%addr = getelementptr i32* %a, i32 4
|
||||
store i32* %addr, i32** %p
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue
Block a user