[PATCH] D100296: [Live Intervals] Teach Greedy RA to recognize special case live-through

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 13 13:06:56 PDT 2021


reames accepted this revision.
reames added a comment.
This revision is now accepted and ready to land.

LGTM w/minor comments.



================
Comment at: llvm/lib/CodeGen/LiveIntervals.cpp:891
 //===----------------------------------------------------------------------===//
+/// Check whether use of reg in MI is live-through.
+static bool hasLiveThroughUse(const MachineInstr *MI, Register Reg) {
----------------
Add a definition of live-through to the comment.  A couple of words is fine, you don't need anything exhaustive.  


================
Comment at: llvm/lib/CodeGen/LiveIntervals.cpp:934
   bool Found = false;
-  while (true) {
-    assert(*SlotI >= LiveI->start);
-    // Loop over all slots overlapping this segment.
-    while (*SlotI < LiveI->end) {
-      // *SlotI overlaps LI. Collect mask bits.
+  // Utility to union regmasks.
+  auto CollectRegMask = [&](unsigned Idx) {
----------------
Rename this to unionBitMask, commit, and rebase please.  


================
Comment at: llvm/test/CodeGen/X86/statepoint-regs.ll:58
 ; CHECK:       ## %bb.0: ## %entry
-; CHECK-NEXT:    subq $24, %rsp
+; CHECK-NEXT:    pushq %rbp
+; CHECK-NEXT:    .cfi_def_cfa_offset 16
----------------
This test delta (and all the following analogous ones) is interesting.  It's correct, but it's a case where we'd have better off pushing the deopt operands onto the stack.  (Note: "push" here is key word.  General spilling and leaving other values in registers would be smaller code wise, but probably *not* faster due to stack engine.)

Probably a good case to look into for regalloc quality around deopt.  


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

https://reviews.llvm.org/D100296



More information about the llvm-commits mailing list