[llvm] 0995001 - [Attributor][NFC] Predetermine the module before verification

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 23 08:46:38 PDT 2020


Author: Johannes Doerfert
Date: 2020-03-23T10:45:23-05:00
New Revision: 0995001ce5732b6338b2679924e419b4ed8e30f2

URL: https://github.com/llvm/llvm-project/commit/0995001ce5732b6338b2679924e419b4ed8e30f2
DIFF: https://github.com/llvm/llvm-project/commit/0995001ce5732b6338b2679924e419b4ed8e30f2.diff

LOG: [Attributor][NFC] Predetermine the module before verification

It could happen that we delete the first function in the SCC in the
future so we should be careful accessing `Functions` after the manifest
stage.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/Attributor.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 89db1b3aea64..231b42d2bf6c 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -8672,9 +8672,9 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
     A.identifyDefaultAbstractAttributes(*F);
   }
 
+  Module &M = *Functions.front()->getParent();
   ChangeStatus Changed = A.run();
-  assert(!verifyModule(*Functions.front()->getParent(), &errs()) &&
-         "Module verification failed!");
+  assert(!verifyModule(M, &errs()) && "Module verification failed!");
   LLVM_DEBUG(dbgs() << "[Attributor] Done with " << Functions.size()
                     << " functions, result: " << Changed << ".\n");
   return Changed == ChangeStatus::CHANGED;


        


More information about the llvm-commits mailing list