[PATCH] D154922: The endless loop of --iterative-guess

yinchengwu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 10 23:21:43 PDT 2023


maipianworni created this revision.
Herald added a reviewer: rafauler.
Herald added a subscriber: ayermolo.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a project: All.
maipianworni requested review of this revision.
Herald added subscribers: llvm-commits, yota9.
Herald added a project: LLVM.

Solve the endless loop caused by iterative guess. The main function of this option is guessEdgeByIterativeApproach, where the do while loop involves guessPredEdgeCounts and guessSuccessEdgeCounts. In some scenarios, the do while loop will fall into an endless loop. The reason is that although the GuessedPredEdgeCounts function has guessed the pred-edges counts, GuessedArcs does not insert the corresponding BB block, resulting in the changed variable always being true.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154922

Files:
  bolt/lib/Passes/MCF.cpp


Index: bolt/lib/Passes/MCF.cpp
===================================================================
--- bolt/lib/Passes/MCF.cpp
+++ bolt/lib/Passes/MCF.cpp
@@ -262,6 +262,7 @@
       continue;
 
     Pred->getBranchInfo(*BB).Count = Guessed;
+    GuessedArcs.insert(std::make_pair(Pred, BB));
     return true;
   }
   llvm_unreachable("Expected unguessed arc");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154922.538923.patch
Type: text/x-patch
Size: 362 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230711/086db5ac/attachment.bin>


More information about the llvm-commits mailing list