[PATCH] D96015: [RegAllocFast] Handle case where operand of copy cannot be assigned.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 4 10:00:39 PST 2021


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


================
Comment at: llvm/lib/CodeGen/RegAllocFast.cpp:1083-1086
+  // Check for copies with a VReg use in a reg-class with all registers
+  // pre-assigned. In that case, hoist the instruction up to the definition of
+  // the VReg in the hope that some pre-assigned registers have been freed up.
+  if (MI.isCopy()) {
----------------
arsenm wrote:
> I don't see why copies specifically would be special for this problem
I don't think they are special, I just thought it might be worth initially limiting it to copies, as the most likely case is probably during moving values to physical registers for calls.

We can remove it, we just have to do a bit more scanning.


================
Comment at: llvm/lib/CodeGen/RegAllocFast.cpp:1103-1113
+        // If we find the definition of Reg, move MI just after it and exit
+        // the function.
+        for (auto &MI2 : reverse(make_range(
+                 MI.getParent()->begin()->getIterator(), MI.getIterator()))) {
+          bool DefinesReg = MI2.getOperand(0).isReg() &&
+                            MI2.getOperand(0).isDef() &&
+                            MI2.getOperand(0).getReg() == Reg;
----------------
arsenm wrote:
> What about partial defs?
I'll update this, if the direction is the right approach to pursue.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96015



More information about the llvm-commits mailing list