Print the number of uses of a function in the .ll since it can be informative
authorDuncan Sands <baldrick@free.fr>
Thu, 2 Sep 2010 08:52:23 +0000 (08:52 +0000)
committerDuncan Sands <baldrick@free.fr>
Thu, 2 Sep 2010 08:52:23 +0000 (08:52 +0000)
and there seems to be no reason not to.

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

lib/VMCore/AsmWriter.cpp
test/Transforms/IndVarSimplify/2003-12-10-IndVarDeadCode.ll

index ab9dd3e7f96b938a9e91e5e9b6fc1838524385ad..ce1b6f1e21ed32413e05cd9732e5c84cb8129e38 100644 (file)
@@ -1635,9 +1635,9 @@ void AssemblyWriter::printFunction(const Function *F) {
   if (F->hasGC())
     Out << " gc \"" << F->getGC() << '"';
   if (F->isDeclaration()) {
-    Out << "\n";
+    Out << " ; [#uses=" << F->getNumUses() << "]\n";  // Output # uses
   } else {
-    Out << " {";
+    Out << " { ; [#uses=" << F->getNumUses() << ']';  // Output # uses
 
     // Output all of its basic blocks... for the function
     for (Function::const_iterator I = F->begin(), E = F->end(); I != E; ++I)
index c8f97e39bef6eca71a8c4701be0ee5a502458dfd..74393e873017ba8e5858ab8ae435a730ae02075f 100644 (file)
@@ -1,8 +1,7 @@
 ; The induction variable canonicalization pass shouldn't leave dead
 ; instructions laying around!
 ;
-; RUN: opt < %s -indvars -S | \
-; RUN:   not grep {#uses=0}
+; RUN: opt < %s -indvars -S | grep {#uses=0} | count 1
 
 define i32 @mul(i32 %x, i32 %y) {
 entry: