[llvm] [SystemZ] Eliminate call sequence instructions early. (PR #77812)

Jonas Paulsson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 12:49:37 PST 2024


================
@@ -88,13 +88,16 @@ entry:
   ret i64 %retval
 }
 
+; TODO: Unfortunately the lgdr is scheduled below the COPY from $r1d, causing
+; an overlap and thus an extra copy.
----------------
JonPsson1 wrote:

There seems to be a slight help over SPEC:
```
                         2017_A_main/                   2017
Spill|Reload   :               609379               609657     +278
Copies         :              1017860              1018237     +377
```
That's a bit unfortunate as there are supposed to be handling for physreg copies in the machinescheduler. 

I did some experiments per your suggestion by keeping them but setting the value to zero. As they have the side-effects flag, they do affect other optimizers. If I remove those pseudos in ExpandPostRAPseudos, they live past the PEI pass and then the CFG optimizations are hindred (less dublicated return blocks ets).

I think it would be nice to take these out of the equation by simply not using them as they do not make much sense on our target. In theory it should actually be better to not have them around as they model false side-effects. If MachineScheduler could be fixed to not make more COPYs and if the AdjustsStack flag was set early in SelectionDAGISel, I think it would be nice to just remove them. Unfortunately we can't keep them "anonymously" without being mapped as frame instructions, as they do not get removed in time (unless we would insert a new "process" hook in PEI to do that). 

So maybe for now we could just keep them as before and set them to 0. However, unfortunately that doesn't quite work either as PEI for some reason resets this value to 0 as it seems to want to recompute it even though it is set per isMaxCallFrameSizeComputed() ... :-/





https://github.com/llvm/llvm-project/pull/77812


More information about the llvm-commits mailing list