aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGCall.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-07-12 04:53:39 +0000
committerChris Lattner <sabre@nondot.org>2011-07-12 04:53:39 +0000
commit21ca1fdb25c2bb98721e569aacd10e8b684dd51a (patch)
tree44fa4cdfc063bbfc041acbabb9dd9afc7dacc614 /lib/CodeGen/CGCall.cpp
parent9f3480bab8fcb6547978f8ad9e2b8f468e3658ee (diff)
fix PR10335 by watching out for IR type compatibility in call argument lists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134966 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCall.cpp')
-rw-r--r--lib/CodeGen/CGCall.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/CodeGen/CGCall.cpp b/lib/CodeGen/CGCall.cpp
index ab1ea69157..c42571323b 100644
--- a/lib/CodeGen/CGCall.cpp
+++ b/lib/CodeGen/CGCall.cpp
@@ -1568,9 +1568,13 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
else
V = Builder.CreateLoad(RV.getAggregateAddr());
+ // If the argument doesn't match, perform a bitcast to coerce it. This
+ // can happen due to trivial type mismatches.
+ if (IRArgNo < IRFuncTy->getNumParams() &&
+ V->getType() != IRFuncTy->getParamType(IRArgNo))
+ V = Builder.CreateBitCast(V, IRFuncTy->getParamType(IRArgNo));
Args.push_back(V);
- // Validate argument match.
checkArgMatches(V, IRArgNo, IRFuncTy);
break;
}