[llvm] [LoopVectorize] Compute BlockFrequencyInfo eagerly to fix assertion failure (PR #215237)
Karthika Devi C via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 13 04:41:31 PDT 2026
================
@@ -8478,9 +8478,13 @@ PreservedAnalyses LoopVectorizePass::run(Function &F,
auto &MAMProxy = AM.getResult<ModuleAnalysisManagerFunctionProxy>(F);
PSI = MAMProxy.getCachedResult<ProfileSummaryAnalysis>(*F.getParent());
- GetBFI = [&AM, &F]() -> BlockFrequencyInfo & {
- return AM.getResult<BlockFrequencyAnalysis>(F);
- };
+ // Compute BFI eagerly rather than lazily. LoopVectorize may modify the
+ // function (vectorizing earlier loops) before requesting BFI for later loops.
+ // If BFI is computed lazily after such modifications, its dependency
+ // CycleAnalysis may be stale (holding pointers to deleted blocks), causing
----------------
kartcq wrote:
I have tried this approach in latest patchset
Please let me know your thoughts on the patch
Pushed the same to my other perf branch for compile time tracking as well.
CC - @fhahn @aengelke
https://github.com/llvm/llvm-project/pull/215237
More information about the llvm-commits
mailing list