Don't constant propagate byval pointers, since they are not really pointers, but
[oota-llvm.git] / lib / Transforms / IPO / IPConstantPropagation.cpp
index bb2448610f2855dcb86275394c9c9429adb0ff0f..95c3f4e35485b89dde874ff046ff585974f69513 100644 (file)
@@ -130,7 +130,8 @@ bool IPCP::PropagateConstantsIntoArguments(Function &F) {
   Function::arg_iterator AI = F.arg_begin();
   for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) {
     // Do we have a constant argument?
-    if (ArgumentConstants[i].second || AI->use_empty())
+    if (ArgumentConstants[i].second || AI->use_empty() || 
+        (AI->hasByValAttr() && isa<PointerType>(AI->getType())))
       continue;
   
     Value *V = ArgumentConstants[i].first;