[PATCH] D32563: Add LiveRangeShrink pass to shrink live range within BB.

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 16:43:56 PDT 2017


wmi added a subscriber: atrick.
wmi added a comment.

+ Andy, for the history on pre-RA-sched and misched.



================
Comment at: lib/Transforms/Scalar/LiveRangeShrink.cpp:54-56
+    do {
+      Insert = Insert->getNextNode();
+    } while (isa<PHINode>(Insert));
----------------
Maybe use `BasicBlock::getFirstInsertionPt` instead. Set `Insert` to be `BasicBlock::getFirstInsertionPt` if `Insert` is before `BasicBlock::getFirstInsertionPt`.


================
Comment at: lib/Transforms/Scalar/LiveRangeShrink.cpp:58-60
+      InstOrderMap[I] = InstOrderMap[Insert];
+      for (Instruction *U = Insert; U != I; U = U->getNextNode())
+        InstOrderMap[U]++;
----------------
Can we remove the update loop of InstOrderMap? It leads to O(N^2) complexity. 

One way is just to let InstOrderMap[I] = InstOrderMap[Insert] and keep the rest the same.


================
Comment at: lib/Transforms/Scalar/LiveRangeShrink.cpp:66
+
+class LiveRangeShrinkLegacyPass : public BasicBlockPass {
+public:
----------------
Can we use a function pass? which will be easier for future extension.


https://reviews.llvm.org/D32563





More information about the llvm-commits mailing list