[Attributor] Emit fixed-point remark on function list
authorJoseph Huber <jhuber6@vols.utk.edu>
Tue, 8 Feb 2022 15:43:22 +0000 (10:43 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Tue, 8 Feb 2022 17:10:21 +0000 (12:10 -0500)
This patch replaces the function we emit the remark on when we run into
the fix-point limit. Previously we got a function to emit a remark on
from the worklist's associated function. However, the worklist may not
always have an associated function in the case of global variables.
Replace this with the function set, and if there are no functions don't
emit the remark.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D119248

llvm/lib/Transforms/IPO/Attributor.cpp

index d66140a..70db801 100644 (file)
@@ -1639,13 +1639,13 @@ void Attributor::runTillFixpoint() {
   } while (!Worklist.empty() && (IterationCounter++ < MaxFixedPointIterations ||
                                  VerifyMaxFixpointIterations));
 
-  if (IterationCounter > MaxFixedPointIterations && !Worklist.empty()) {
+  if (IterationCounter > MaxFixedPointIterations && !Functions.empty()) {
     auto Remark = [&](OptimizationRemarkMissed ORM) {
       return ORM << "Attributor did not reach a fixpoint after "
                  << ore::NV("Iterations", MaxFixedPointIterations)
                  << " iterations.";
     };
-    Function *F = Worklist.front()->getIRPosition().getAssociatedFunction();
+    Function *F = Functions.front();
     emitRemark<OptimizationRemarkMissed>(F, "FixedPoint", Remark);
   }