[llvm] [AMDGPU] Optimize PreRARematStage candidate initialization (PR #220924)

Frederik Harwath via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 14 05:59:21 PDT 2026


================
@@ -1538,7 +1538,9 @@ bool PreRARematStage::initGCNSchedStage() {
   // Collect candidates. We have more restrictions on what we can track here
   // compared to the rematerializer.
   SmallVector<ScoredRemat, 8> Candidates;
-  SmallVector<unsigned> CandidateOrder;
+  DenseMap<Register, unsigned> DefRegToCandIdx;
----------------
frederik-h wrote:

> Use an `IndexedMap<unsigned, VirtReg2IndexFunctor>` the size of `DAG.MRI.getNumVirtRegs()` to avoid repeated map lookups.

I have changed it to use an `IndexedMap` now. However, I did not see any performance benefits for the example from issue  #219708.

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


More information about the llvm-commits mailing list