[PATCH] D93694: [MachineLICM][MachineSink] Move SinkIntoLoop from MachineLICM to MachineSink

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 17 20:23:10 PST 2021


shchenz added a comment.

Is it possible to add this new logic to the original MachineSink infra? If so, we can not limit to sink the instruction in loop preheader? I guess we prevent this kind of sinking in machinesink pass is because we treat it as nonprofitable in `MachineSinking::isProfitableToSinkTo`?
And we already have some simple register estimation model in `MachineSinking::isProfitableToSinkTo`, should we do this kind of sinking based on register pressure, for example, only sinking to loop if the register pressure of the loop is high?



================
Comment at: llvm/lib/CodeGen/MachineSink.cpp:1178
+    // For now assumes that copies are cheap and thus almost always worth it.
+    if (!MI.isCopy()) {
+      CanSink = false;
----------------
Is this necessary? Assuming MI is a loop user, how does a loop COPY user impact the cost of sinking instruction `I` to the loop? `I` could still be any instruction like a load instruction.


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

https://reviews.llvm.org/D93694



More information about the llvm-commits mailing list