The "ambiguous instructions" check only produces anything with -debug,
authorChris Lattner <sabre@nondot.org>
Mon, 6 Sep 2010 20:21:47 +0000 (20:21 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 6 Sep 2010 20:21:47 +0000 (20:21 +0000)
so only do the N^2 loop with debug mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113168 91177308-0d34-0410-b5e6-96231b3b80d8

utils/TableGen/AsmMatcherEmitter.cpp

index c0d95fbc1edfebac2e006a8bc00b8204af93a0fa..e7f4aa696ee8659f7785d0186cbee8ac085479af 100644 (file)
@@ -1513,29 +1513,30 @@ void AsmMatcherEmitter::run(raw_ostream &OS) {
     });
 
   // Check for ambiguous instructions.
-  unsigned NumAmbiguous = 0;
-  for (unsigned i = 0, e = Info.Instructions.size(); i != e; ++i) {
-    for (unsigned j = i + 1; j != e; ++j) {
-      InstructionInfo &A = *Info.Instructions[i];
-      InstructionInfo &B = *Info.Instructions[j];
-    
-      if (A.CouldMatchAmiguouslyWith(B)) {
-        DEBUG_WITH_TYPE("ambiguous_instrs", {
-            errs() << "warning: ambiguous instruction match:\n";
-            A.dump();
-            errs() << "\nis incomparable with:\n";
-            B.dump();
-            errs() << "\n\n";
-          });
-        ++NumAmbiguous;
+  DEBUG(unsigned NumAmbiguous = 0;
+    for (unsigned i = 0, e = Info.Instructions.size(); i != e; ++i) {
+      for (unsigned j = i + 1; j != e; ++j) {
+        InstructionInfo &A = *Info.Instructions[i];
+        InstructionInfo &B = *Info.Instructions[j];
+      
+        if (A.CouldMatchAmiguouslyWith(B)) {
+          DEBUG_WITH_TYPE("ambiguous_instrs", {
+              errs() << "warning: ambiguous instruction match:\n";
+              A.dump();
+              errs() << "\nis incomparable with:\n";
+              B.dump();
+              errs() << "\n\n";
+            });
+          ++NumAmbiguous;
+        }
       }
     }
-  }
-  if (NumAmbiguous)
-    DEBUG_WITH_TYPE("ambiguous_instrs", {
-        errs() << "warning: " << NumAmbiguous 
-               << " ambiguous instructions!\n";
-      });
+    if (NumAmbiguous)
+      DEBUG_WITH_TYPE("ambiguous_instrs", {
+          errs() << "warning: " << NumAmbiguous 
+                 << " ambiguous instructions!\n";
+        });
+  );
 
   // Write the output.