[arm-fast-isel] After promoting a function parameter be sure to update the

argument value type.  Otherwise, the sign/zero-extend has no effect on arguments
passed via the stack (i.e., undefined high-order bits).
rdar://10515467

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145701 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chad Rosier 2011-12-02 20:25:18 +00:00
parent 427876757f
commit b74c865841
2 changed files with 50 additions and 2 deletions

View File

@ -1765,21 +1765,23 @@ bool ARMFastISel::ProcessCallArgs(SmallVectorImpl<Value*> &Args,
switch (VA.getLocInfo()) {
case CCValAssign::Full: break;
case CCValAssign::SExt: {
EVT DestVT = VA.getLocVT();
MVT DestVT = VA.getLocVT();
unsigned ResultReg = ARMEmitIntExt(ArgVT, Arg, DestVT,
/*isZExt*/false);
assert (ResultReg != 0 && "Failed to emit a sext");
Arg = ResultReg;
ArgVT = DestVT;
break;
}
case CCValAssign::AExt:
// Intentional fall-through. Handle AExt and ZExt.
case CCValAssign::ZExt: {
EVT DestVT = VA.getLocVT();
MVT DestVT = VA.getLocVT();
unsigned ResultReg = ARMEmitIntExt(ArgVT, Arg, DestVT,
/*isZExt*/true);
assert (ResultReg != 0 && "Failed to emit a sext");
Arg = ResultReg;
ArgVT = DestVT;
break;
}
case CCValAssign::BCvt: {

View File

@ -80,3 +80,49 @@ declare zeroext i16 @t6();
declare signext i8 @t7();
declare zeroext i8 @t8();
declare zeroext i1 @t9();
define i32 @t10(i32 %argc, i8** nocapture %argv) {
entry:
; ARM: @t10
; ARM: movw r0, #0
; ARM: movw r1, #248
; ARM: movw r2, #187
; ARM: movw r3, #28
; ARM: movw r9, #40
; ARM: movw r12, #186
; ARM: uxtb r0, r0
; ARM: uxtb r1, r1
; ARM: uxtb r2, r2
; ARM: uxtb r3, r3
; ARM: uxtb r9, r9
; ARM: str r9, [sp]
; ARM: uxtb r9, r12
; ARM: str r9, [sp, #4]
; ARM: bl _bar
; THUMB: @t10
; THUMB: movs r0, #0
; THUMB: movt r0, #0
; THUMB: movs r1, #248
; THUMB: movt r1, #0
; THUMB: movs r2, #187
; THUMB: movt r2, #0
; THUMB: movs r3, #28
; THUMB: movt r3, #0
; THUMB: movw r9, #40
; THUMB: movt r9, #0
; THUMB: movw r12, #186
; THUMB: movt r12, #0
; THUMB: uxtb r0, r0
; THUMB: uxtb r1, r1
; THUMB: uxtb r2, r2
; THUMB: uxtb r3, r3
; THUMB: uxtb.w r9, r9
; THUMB: str.w r9, [sp]
; THUMB: uxtb.w r9, r12
; THUMB: str.w r9, [sp, #4]
; THUMB: bl _bar
%call = call i32 @bar(i8 zeroext 0, i8 zeroext -8, i8 zeroext -69, i8 zeroext 28, i8 zeroext 40, i8 zeroext -70)
ret i32 0
}
declare i32 @bar(i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext, i8 zeroext)