inalloca: Don't remove dead arguments in the presence of inalloca args
[oota-llvm.git] / lib / Transforms / IPO / DeadArgumentElimination.cpp
index 81dbd329c4b6a1288ab7dc68ae5e2bcd52342f45..d372ba22d6e3b26689fba8336da06780fd5b9de1 100644 (file)
@@ -531,6 +531,13 @@ DAE::Liveness DAE::SurveyUses(const Value *V, UseVector &MaybeLiveUses) {
 // well as arguments to functions which have their "address taken".
 //
 void DAE::SurveyFunction(const Function &F) {
+  // Functions with inalloca parameters are expecting args in a particular
+  // register and memory layout.
+  if (F.getAttributes().hasAttrSomewhere(Attribute::InAlloca)) {
+    MarkLive(F);
+    return;
+  }
+
   unsigned RetCount = NumRetVals(&F);
   // Assume all return values are dead
   typedef SmallVector<Liveness, 5> RetVals;