[PATCH] D150210: [CodeGenPrepare] Fix for using outdated/corrupt LoopInfo

Momchil Velikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 09:48:27 PDT 2023


chill added inline comments.


================
Comment at: llvm/lib/CodeGen/CodeGenPrepare.cpp:602
     MadeChange = false;
-    DT.reset();
+    resetDT();
 
----------------
chill wrote:
> efriedma wrote:
> > chill wrote:
> > > efriedma wrote:
> > > > InitialLI is pointless if you're going to immediately throw it away.
> > > It's used in the construction of `BranchProbabilityInfo` and `BlockGFrequenceInfo`.
> > I guess, but you don't need to store it in the class for that.
> > 
> > Is the BPI also broken by CFG modifications?
> > I guess, but you don't need to store it in the class for that.
> Ah, indeed.
> 
> > Is the BPI also broken by CFG modifications?
> Looks like it, yes.
> 
BFI and BPI use CallbackVH for basic blocks, so they are perhaps fine, but they also keep a raw pointer to the LoopInfo.
Fortunately, LoopInfo is not hard to keep updated, so I opted for this approach in a new patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150210/new/

https://reviews.llvm.org/D150210



More information about the llvm-commits mailing list