================ @@ -62,6 +62,107 @@ static RegisterRegAlloc fastRegAlloc("fast", "fast register allocator", namespace { +/// Assign ascending index for instructions in machine basic block. The index +/// can be used to determine dominance between instructions in same MBB. +class InstrPosIndexes { +public: + void init(const MachineBasicBlock &MBB) { + CurMBB = &MBB; + Instr2PosIndex.clear(); + uint64_t LastIndex = 0; + for (const MachineInstr &MI : MBB) { + LastIndex += InstrDist; + Instr2PosIndex[&MI] = LastIndex; + } ---------------- nikic wrote:
Can we do this lazily, on first query? It looks like dominates() is actually only used in very rare situations (where a block branches back to itself), so populating this map is unnecessary for most blocks. https://github.com/llvm/llvm-project/pull/72250 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits