llvm::Value *V = CreateTempAlloca(ConvertType(Ty), "coerce");
CreateCoercedStore(AI, V, *this);
// Match to what EmitParmDecl is expecting for this type.
- if (!CodeGenFunction::hasAggregateLLVMType(Ty))
+ if (!CodeGenFunction::hasAggregateLLVMType(Ty)) {
V = Builder.CreateLoad(V);
+ if (!getContext().typesAreCompatible(Ty, Arg->getType())) {
+ // This must be a promotion, for something like
+ // "void a(x) short x; {..."
+ V = EmitScalarConversion(V, Ty, Arg->getType());
+ }
+ }
EmitParmDecl(*Arg, V);
break;
}
-// RUN: clang -emit-llvm -o %t %s &&
-// RUN: clang -emit-llvm-bc -o %t %s &&
-// RUN: clang -g -emit-llvm-bc -o %t %s
+// RUN: clang -triple i386-unknown-unknown -emit-llvm -o %t %s &&
+// RUN: clang -triple i386-unknown-unknown -emit-llvm-bc -o %t %s &&
+// RUN: clang -triple i386-unknown-unknown -g -emit-llvm-bc -o %t %s &&
+// RUN: clang -triple x86_64-unknown-unknown -emit-llvm-bc -o %t %s &&
+// RUN: clang -triple x86_64-unknown-unknown -g -emit-llvm-bc -o %t %s
#include "c-language-features.inc"