[llvm] r297910 - Revert "[PGO] Minor cleanup for count instruction in SelectInstVisitor."

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 16:06:22 PDT 2017


Author: vitalybuka
Date: Wed Mar 15 18:06:22 2017
New Revision: 297910

URL: http://llvm.org/viewvc/llvm-project?rev=297910&view=rev
Log:
Revert "[PGO] Minor cleanup for count instruction in SelectInstVisitor."

Fails LLVMFuzzer.LLVMFuzzer.value-profile-strncmp.test

This reverts commit r297892.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp

Modified: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=297910&r1=297909&r2=297910&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Wed Mar 15 18:06:22 2017
@@ -205,7 +205,6 @@ struct SelectInstVisitor : public InstVi
   SelectInstVisitor(Function &Func) : F(Func) {}
 
   void countSelects(Function &Func) {
-    NSIs = 0;
     Mode = VM_counting;
     visit(Func);
   }
@@ -235,8 +234,6 @@ struct SelectInstVisitor : public InstVi
   void annotateOneSelectInst(SelectInst &SI);
   // Visit \p SI instruction and perform tasks according to visit mode.
   void visitSelectInst(SelectInst &SI);
-  // Return the number of select instructions. This needs be called after
-  // countSelects().
   unsigned getNumOfSelectInsts() const { return NSIs; }
 };
 
@@ -1107,9 +1104,9 @@ void SelectInstVisitor::visitSelectInst(
   if (SI.getCondition()->getType()->isVectorTy())
     return;
 
+  NSIs++;
   switch (Mode) {
   case VM_counting:
-    NSIs++;
     return;
   case VM_instrument:
     instrumentOneSelectInst(SI);




More information about the llvm-commits mailing list