aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp
index a2ca692147..fb4df73818 100644
--- a/lib/Transforms/IPO/SimplifyLibCalls.cpp
+++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp
@@ -1305,6 +1305,15 @@ public:
Function* fwrite_func = SLC.get_fwrite(FILEptr_type);
if (!fwrite_func)
return false;
+
+ // Make sure that the fprintf() and fwrite() functions both take the
+ // same type of char pointer.
+ if (ci->getOperand(2)->getType() !=
+ fwrite_func->getFunctionType()->getParamType(0))
+ {
+ return false;
+ }
+
std::vector<Value*> args;
args.push_back(ci->getOperand(2));
args.push_back(ConstantUInt::get(SLC.getIntPtrType(),len));