[llvm] [UniformityAnalysis] Replace DenseMap with SmallVector indexed by block number. NFC (PR #210564)
Alexis Engelke via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 19 00:24:04 PDT 2026
================
@@ -104,30 +104,37 @@ template <typename ContextT> class ModifiedPostOrder {
void clear() { Order.clear(); }
void compute(const CycleInfoT &CI);
- unsigned count(BlockT *BB) const { return POIndex.count(BB); }
+ unsigned count(BlockT *BB) const {
+ unsigned Num = GraphTraits<BlockT *>::getNumber(BB);
+ return Num < POIndex.size() && POIndex[Num] != InvalidIndex;
+ }
const BlockT *operator[](size_t Idx) const { return Order[Idx]; }
void appendBlock(const BlockT &BB, bool IsReducibleCycleHeader = false) {
- POIndex[&BB] = Order.size();
+ unsigned Num = GraphTraits<const BlockT *>::getNumber(&BB);
+ POIndex[Num] = Order.size();
----------------
aengelke wrote:
Is this always safe without a bounds check?
https://github.com/llvm/llvm-project/pull/210564
More information about the llvm-commits
mailing list