[PATCH] D146267: [llvm] Handle duplicate call bases when applying branch funneling

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 21 17:07:06 PDT 2023


leonardchan marked an inline comment as not done.
leonardchan added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp:1397
 
+      if (!CB.getParent()) {
+        // When finding devirtualizable calls, it's possible to find the same
----------------
aeubanks wrote:
> leonardchan wrote:
> > tejohnson wrote:
> > > I don't think this is safe since when we eraseFromParent the instruction is deleted. Can we track a different way?
> > Updated to just add erased pointers to a set and check on future iterations if they're in the set. This way we don't have to deref them.
> if the instruction is erased, can there be instructions created after that share the same pointer?
Hmm, I would think yes, but I think for this specific case it doesn't matter since none of the newly created instructions in this loop get added back to `CSInfo.CallSites` so each of the CBs should only refer to CBs that were added earlier.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146267



More information about the llvm-commits mailing list