[llvm] [CodeLayout][NFC] Using MergedVector to avoid extra vector allocations (PR #68724)
    Rahman Lavaee via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Oct 10 10:52:21 PDT 2023
    
    
  
================
@@ -798,17 +811,15 @@ class ExtTSPImpl {
   /// element being the corresponding merging type.
   MergeGainT getBestMergeGain(ChainT *ChainPred, ChainT *ChainSucc,
                               ChainEdge *Edge) const {
-    if (Edge->hasCachedMergeGain(ChainPred, ChainSucc)) {
+    if (Edge->hasCachedMergeGain(ChainPred, ChainSucc))
       return Edge->getCachedMergeGain(ChainPred, ChainSucc);
-    }
 
     // Precompute jumps between ChainPred and ChainSucc.
-    auto Jumps = Edge->jumps();
-    ChainEdge *EdgePP = ChainPred->getEdge(ChainPred);
-    if (EdgePP != nullptr) {
-      Jumps.insert(Jumps.end(), EdgePP->jumps().begin(), EdgePP->jumps().end());
-    }
+    MergedVector<JumpT> Jumps(Edge->jumps().begin(), Edge->jumps().end());
     assert(!Jumps.empty() && "trying to merge chains w/o jumps");
----------------
rlavaee wrote:
Change or remove this assertion (the semantics of the Jumps object has changed)?
https://github.com/llvm/llvm-project/pull/68724
    
    
More information about the llvm-commits
mailing list