[llvm] 54d6a60 - [Attributor][NFC] Predetermine the module

Johannes Doerfert via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 20:01:04 PDT 2020


Author: Johannes Doerfert
Date: 2020-04-01T21:56:17-05:00
New Revision: 54d6a608bf81952fa042b101c31f58e8bfa9b1fd

URL: https://github.com/llvm/llvm-project/commit/54d6a608bf81952fa042b101c31f58e8bfa9b1fd
DIFF: https://github.com/llvm/llvm-project/commit/54d6a608bf81952fa042b101c31f58e8bfa9b1fd.diff

LOG: [Attributor][NFC] Predetermine the module

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 50071a234ef5..0de59b388ef2 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -8794,9 +8794,10 @@ static bool runAttributorOnFunctions(InformationCache &InfoCache,
     A.identifyDefaultAbstractAttributes(*F);
   }
 
+  Module &M = *Functions.front()->getParent();
+  (void)M;
   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