summaryrefslogtreecommitdiffstats
path: root/clang/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
commit3ce8668273c418a9f8c807e704d35f97e07a67a9 (patch)
tree5282fc7bfe3d443a283e89fd4b5ad353817a9e9d /clang/lib/CodeGen/CGCall.cpp
parent9b72b0c7d5818d4686f2390bfb0bb7fe6233c179 (diff)
downloadbcm5719-llvm-3ce8668273c418a9f8c807e704d35f97e07a67a9.tar.gz
bcm5719-llvm-3ce8668273c418a9f8c807e704d35f97e07a67a9.zip
fix PR10335 by watching out for IR type compatibility in call argument lists.
llvm-svn: 134966
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r--clang/lib/CodeGen/CGCall.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index ab1ea69157a..c42571323ba 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud