[PATCH] D21189: Create subranges for new intervals resulting from live interval splitting

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 19 16:52:49 PDT 2016


kparzysz marked 21 inline comments as done.

================
Comment at: include/llvm/CodeGen/LiveInterval.h:458
@@ -453,1 +457,3 @@
 
+    VNInfo *extendInBlock(SlotIndex StartIdx, SlotIndex Kill);
+
----------------
MatzeB wrote:
> This needs documentation. Probably most of the following function. (You can probably shorten the docu of the following function to something like "variant of extendInBlock() ... put undefs explanation here..."
I documented the "complicated" version first, and then the simpler one after that.

================
Comment at: lib/CodeGen/LiveIntervalAnalysis.cpp:581
@@ -579,2 +580,3 @@
   LRCalc->reset(MF, getSlotIndexes(), DomTree, &getVNInfoAllocator());
+  SmallVector<SlotIndex, 0> Undefs;
   for (unsigned i = 0, e = Indices.size(); i != e; ++i)
----------------
MatzeB wrote:
> `ArrayRef<SlotIndex> NoUndefs;` should be slightly more efficient and a better name.
`/*Undefs=*/{}` looks even prettier. :)

================
Comment at: lib/CodeGen/LiveIntervalAnalysis.cpp:979-986
@@ -975,2 +978,10 @@
       updateRegMaskSlots();
+
+    for (MachineOperand &MO : MI->operands()) {
+      if (!MO.isReg() || !MO.isDef())
+        continue;
+      unsigned Reg = MO.getReg();
+      if (!TargetRegisterInfo::isVirtualRegister(Reg))
+        continue;
+    }
   }
----------------
MatzeB wrote:
> empty loop?
Leftover from something.

================
Comment at: lib/Target/Hexagon/HexagonExpandCondsets.cpp:466-480
@@ +465,17 @@
+  unsigned VM = MRI->getMaxLaneMaskForVReg(Reg);
+  assert((VM & LM) != 0);
+  for (const MachineOperand &MO : MRI->def_operands(Reg)) {
+    if (!MO.isUndef())
+      continue;
+    unsigned SubReg = MO.getSubReg();
+    assert(SubReg != 0 && "Undef should only be set on subreg defs");
+    LaneBitmask M = TRI->getSubRegIndexLaneMask(SubReg);
+    LaneBitmask UM = VM & ~M;
+    if ((UM & LM) != 0) {
+      const MachineInstr &MI = *MO.getParent();
+      bool EarlyClobber = MO.isEarlyClobber();
+      SlotIndex Pos = Indexes.getInstructionIndex(MI).getRegSlot(EarlyClobber);
+      Undefs.push_back(Pos);
+    }
+  }
+
----------------
MatzeB wrote:
> This block appears to be the same as LiveRangeCalc::computeSubRangeUndefs(). We should find a way to share this code. Like adding a static variant of the function to LiveRangeCalc so you can call it independently of constructing a LiveRangeCalc instance.
LiveRangeCalc is only available inside CodeGen.  Maybe we can move the "computeSubRangeUndefs" to LiveInterval?


Repository:
  rL LLVM

https://reviews.llvm.org/D21189





More information about the llvm-commits mailing list