[llvm] r300302 - Fix test failure on windows: pass module to getInstrProfXXName calls

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 20:03:24 PDT 2017


Author: davidxl
Date: Thu Apr 13 22:03:24 2017
New Revision: 300302

URL: http://llvm.org/viewvc/llvm-project?rev=300302&view=rev
Log:
Fix test failure on windows: pass module to getInstrProfXXName calls

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

Modified: llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp?rev=300302&r1=300301&r2=300302&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp Thu Apr 13 22:03:24 2017
@@ -272,7 +272,7 @@ static bool isVtableAccess(Instruction *
 
 // Do not instrument known races/"benign races" that come from compiler
 // instrumentatin. The user has no way of suppressing them.
-static bool shouldInstrumentReadWriteFromAddress(Value *Addr) {
+static bool shouldInstrumentReadWriteFromAddress(const Module *M, Value *Addr) {
   // Peel off GEPs and BitCasts.
   Addr = Addr->stripInBoundsOffsets();
 
@@ -280,7 +280,7 @@ static bool shouldInstrumentReadWriteFro
     if (GV->hasSection()) {
       StringRef SectionName = GV->getSection();
       // Check if the global is in the PGO counters section.
-      if (SectionName.endswith(getInstrProfCountersSectionName()))
+      if (SectionName.endswith(getInstrProfCountersSectionName(M)))
         return false;
     }
 
@@ -342,13 +342,13 @@ void ThreadSanitizer::chooseInstructions
   for (Instruction *I : reverse(Local)) {
     if (StoreInst *Store = dyn_cast<StoreInst>(I)) {
       Value *Addr = Store->getPointerOperand();
-      if (!shouldInstrumentReadWriteFromAddress(Addr))
+      if (!shouldInstrumentReadWriteFromAddress(I->getModule(), Addr))
         continue;
       WriteTargets.insert(Addr);
     } else {
       LoadInst *Load = cast<LoadInst>(I);
       Value *Addr = Load->getPointerOperand();
-      if (!shouldInstrumentReadWriteFromAddress(Addr))
+      if (!shouldInstrumentReadWriteFromAddress(I->getModule(), Addr))
         continue;
       if (WriteTargets.count(Addr)) {
         // We will write to this temp, so no reason to analyze the read.




More information about the llvm-commits mailing list