diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-02-04 07:22:24 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-02-04 07:22:24 +0000 |
commit | 8b29a387788bbb7a7c3b64c37473bc46299d2132 (patch) | |
tree | e22452087d5ea06b52676fc72b6fabf62d965cd5 /lib/CodeGen/CGCall.cpp | |
parent | 137b6a6149c53dbbcb8fba98e524d9ad0f3c8736 (diff) |
Handle demotion of coerced arguments (as in void a(x) short x; { ... }).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63726 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r-- | lib/CodeGen/CGCall.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp index 8967ffbfc9..2ad8f917e1 100644 --- a/lib/CodeGen/CGCall.cpp +++ b/lib/CodeGen/CGCall.cpp @@ -1220,8 +1220,14 @@ void CodeGenFunction::EmitFunctionProlog(const CGFunctionInfo &FI, 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; } |