[Attributor][NFC] Predetermine the module
authorJohannes Doerfert <johannes@jdoerfert.de>
Tue, 17 Mar 2020 01:18:07 +0000 (20:18 -0500)
committerJohannes Doerfert <johannes@jdoerfert.de>
Thu, 2 Apr 2020 02:56:17 +0000 (21:56 -0500)
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.

llvm/lib/Transforms/IPO/Attributor.cpp

index 50071a2..0de59b3 100644 (file)
@@ -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;