Fix PR2267, by allowing indirect outputs to be intermixed
[oota-llvm.git] / lib / VMCore / InlineAsm.cpp
index d563e9557a6a234b3600293219dedc8d58afb358..5eefc8842bafb15daf15838d9dd5b944d280b091 100644 (file)
@@ -183,15 +183,18 @@ bool InlineAsm::Verify(const FunctionType *Ty, const std::string &ConstStr) {
   if (Constraints.empty() && !ConstStr.empty()) return false;
   
   unsigned NumOutputs = 0, NumInputs = 0, NumClobbers = 0;
+  unsigned NumIndirect = 0;
   
   for (unsigned i = 0, e = Constraints.size(); i != e; ++i) {
     switch (Constraints[i].Type) {
     case InlineAsm::isOutput:
+      if ((NumInputs-NumIndirect) != 0 || NumClobbers != 0)
+        return false;  // outputs before inputs and clobbers.
       if (!Constraints[i].isIndirect) {
-        if (NumInputs || NumClobbers) return false;  // outputs come first.
         ++NumOutputs;
         break;
       }
+      ++NumIndirect;
       // FALLTHROUGH for Indirect Outputs.
     case InlineAsm::isInput:
       if (NumClobbers) return false;               // inputs before clobbers.