[llvm] [InstrRef][nfc] Remove usage of unique_ptrs of arrays (PR #74203)

Felipe de Azevedo Piovezan via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 10:15:54 PST 2023


================
@@ -3503,7 +3504,10 @@ bool InstrRefBasedLDV::depthFirstVLocAndEmit(
   // Helper lambda for ejecting a block -- if nothing is going to use the block,
   // we can translate the variable location information into DBG_VALUEs and then
   // free all of InstrRefBasedLDV's data structures.
+  SmallPtrSet<const MachineBasicBlock *, 8> EjectedBBs;
   auto EjectBlock = [&](MachineBasicBlock &MBB) -> void {
+    if (EjectedBBs.insert(&MBB).second == false)
+      return;
----------------
felipepiovezan wrote:

> I'm not confident enough to say the is-null test isn't double-ejection prevention so it should be kept

I think there may be some miscommunication going here: the check _is kept_, it just takes a different form.
I moved it _inside_ the lambda, and instead of checking for a nullptr (pointers don't exist anymore, so we can't check that), I am using an "has been ejected" check.

Does that make sense?

https://github.com/llvm/llvm-project/pull/74203


More information about the llvm-commits mailing list