add IR names to coerced arguments.

llvm-svn: 107105
This commit is contained in:
Chris Lattner 2010-06-29 00:14:52 +00:00
parent 15ec361bd6
commit 9e748e9d6e
3 changed files with 12 additions and 9 deletions

View File

@ -910,6 +910,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
if (STy == cast<llvm::PointerType>(V->getType())->getElementType()) {
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
assert(AI != Fn->arg_end() && "Argument mismatch!");
AI->setName(Arg->getName() + ".coerce" + llvm::Twine(i));
llvm::Value *EltPtr = Builder.CreateConstGEP2_32(V, 0, i);
Builder.CreateStore(AI++, EltPtr);
}
@ -918,6 +919,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
llvm::Value *FormalArg = llvm::UndefValue::get(STy);
for (unsigned i = 0, e = STy->getNumElements(); i != e; ++i) {
assert(AI != Fn->arg_end() && "Argument mismatch!");
AI->setName(Arg->getName() + ".coerce" + llvm::Twine(i));
FormalArg = Builder.CreateInsertValue(FormalArg, AI++, i);
}
CreateCoercedStore(FormalArg, V, /*DestIsVolatile=*/false, *this);
@ -925,6 +927,7 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI,
} else {
// Simple case, just do a coerced store of the argument into the alloca.
assert(AI != Fn->arg_end() && "Argument mismatch!");
AI->setName(Arg->getName() + ".coerce");
CreateCoercedStore(AI++, V, /*DestIsVolatile=*/false, *this);
}

View File

@ -45,7 +45,7 @@ void f7(e7 a0) {
// Test merging/passing of upper eightbyte with X87 class.
//
// CHECK: define %0 @f8_1()
// CHECK: define void @f8_2(i64, double)
// CHECK: define void @f8_2(i64 %a0.coerce0, double %a0.coerce1)
union u8 {
long double a;
int b;
@ -56,7 +56,7 @@ void f8_2(union u8 a0) {}
// CHECK: define i64 @f9()
struct s9 { int a; int b; int : 0; } f9(void) { while (1) {} }
// CHECK: define void @f10(i64)
// CHECK: define void @f10(i64 %a0.coerce)
struct s10 { int a; int b; int : 0; };
void f10(struct s10 a0) {}
@ -64,7 +64,7 @@ void f10(struct s10 a0) {}
union { long double a; float b; } f11() { while (1) {} }
// CHECK: define i64 @f12_0()
// CHECK: define void @f12_1(i64)
// CHECK: define void @f12_1(i64 %a0.coerce)
struct s12 { int a __attribute__((aligned(16))); };
struct s12 f12_0(void) { while (1) {} }
void f12_1(struct s12 a0) {}
@ -95,7 +95,7 @@ void f17(float a, float b, float c, float d, float e, float f, float g, float h,
// Check for valid coercion. The struct should be passed/returned as i32, not
// as i64 for better code quality.
// rdar://8135035
// CHECK: define void @f18(i32 %a, i32)
// CHECK: define void @f18(i32 %a, i32 %f18_arg1.coerce)
struct f18_s0 { int f0; };
void f18(int a, struct f18_s0 f18_arg1) { while (1) {} }

View File

@ -6,19 +6,19 @@
// Basic base class test.
struct f0_s0 { unsigned a; };
struct f0_s1 : public f0_s0 { void *b; };
// CHECK: define void @_Z2f05f0_s1(i64, i64)
// CHECK: define void @_Z2f05f0_s1(i64 %a0.coerce0, i64 %a0.coerce1)
void f0(f0_s1 a0) { }
// Check with two eight-bytes in base class.
struct f1_s0 { unsigned a; unsigned b; float c; };
struct f1_s1 : public f1_s0 { float d;};
// CHECK: define void @_Z2f15f1_s1(i64, double)
// CHECK: define void @_Z2f15f1_s1(i64 %a0.coerce0, double %a0.coerce1)
void f1(f1_s1 a0) { }
// Check with two eight-bytes in base class and merge.
struct f2_s0 { unsigned a; unsigned b; float c; };
struct f2_s1 : public f2_s0 { char d;};
// CHECK: define void @_Z2f25f2_s1(i64, i64)
// CHECK: define void @_Z2f25f2_s1(i64 %a0.coerce0, i64 %a0.coerce1)
void f2(f2_s1 a0) { }
// PR5831
@ -26,8 +26,8 @@ struct s3_0 {};
struct s3_1 { struct s3_0 a; long b; };
void f3(struct s3_1 x) {}
// CHECK: define i64 @_Z4f4_0M2s4i(i64)
// CHECK: define [[i64_i64_ty]] @_Z4f4_1M2s4FivE(i64, i64)
// CHECK: define i64 @_Z4f4_0M2s4i(i64 %a.coerce)
// CHECK: define [[i64_i64_ty]] @_Z4f4_1M2s4FivE(i64 %a.coerce0, i64 %a.coerce1)
struct s4 {};
typedef int s4::* s4_mdp;
typedef int (s4::*s4_mfp)();