[PATCH] D110623: [SLP] Avoid calculating expensive spill cost when it is not required

Dinar Temirbulatov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 6 04:56:46 PST 2021


dtemirbulatov marked an inline comment as done.
dtemirbulatov added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:2189-2190
   struct BlockScheduling {
-    BlockScheduling(BasicBlock *BB)
-        : BB(BB), ChunkSize(BB->size()), ChunkPos(ChunkSize) {}
+    BlockScheduling(BasicBlock *BB, BoUpSLP *R)
+        : BB(BB), R(R), ChunkSize(BB->size()), ChunkPos(ChunkSize) {}
 
----------------
ABataev wrote:
> ABataev wrote:
> > Not sure it is a good idea to add tree here. Maybe just add an internal flag and update `R->NoCallInst` after scheduling the region, reading the flag from BlockScheduling? or return as one of the results of `BS.tryScheduleBundle`.
> Also, maybe it is worth trying to change `BoUpSLP::getSpillCost` too? For example, we can try to calculate `NumCalls` in the scheduling function and avoid doing this in the function `BoUpSLP::getSpillCost`.
I think the implementation is too complex, here in getSpillCost we are calculating the number of calls between two given instructions and as we might change a tree entry the state to gather this might become even more complicated.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110623/new/

https://reviews.llvm.org/D110623



More information about the llvm-commits mailing list