[PATCH] D34608: [AArch64] Increase CSR cost when defering use of CSR is preferred

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 16:50:52 PDT 2017


wmi added inline comments.


================
Comment at: lib/CodeGen/RegAllocGreedy.cpp:2384-2390
+  // Conservatively, we try to increase the CSR cost only when all blocks in
+  // the live range have no call.
+  ArrayRef<SplitAnalysis::BlockInfo> UseBlocks = SA->getUseBlocks();
+  for (int i = 0, e = UseBlocks.size(); i < e; ++i)
+    for (auto &MI : *UseBlocks[i].MBB)
+      if (MI.isCall())
+        return BestCost;
----------------
I don't see why the logic here is better than D32201. It will miss the motivational case we are targeting. For a long live range of a function argument, which crosses call in a cold bb, we want to increase the first time CSRCost so that regalloc can choose to split the long live range before and after the call in the cold bb and use non-CSR register in the places other than the cold bb. As a result shrinkwrapping will be unblocked because after the splitting there will be less or no CSR use inside of entry/exit.




https://reviews.llvm.org/D34608





More information about the llvm-commits mailing list