[PATCH] D112731: [AMDGPU] Really preserve LiveVariables in SILowerControlFlow

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 29 01:38:48 PDT 2021


foad marked 7 inline comments as done.
foad added inline comments.


================
Comment at: llvm/lib/CodeGen/LiveVariables.cpp:695-699
+    if (UseMI.isPHI()) {
+      // If Reg is used in a phi then it is live-out of the corresponding
+      // predecessor.
+      unsigned Idx = UseMI.getOperandNo(&UseMO);
+      LiveOutBlocks.push_back(UseMI.getOperand(Idx + 1).getMBB());
----------------
ruiling wrote:
> This is not quite accurate. if the user is a PHI. we need to handle differently if the user appears in the same block as the define block.
> 
> For the pattern drawn at line 148 (incoming block is the same as define block), we don't treat the Reg is alive through the incoming block, it is only alive from the definition to the end. If the incoming block is different from define block, we need to mark the Reg is alive through the incoming block.
I think my code is correct. I am only saying it is live-**out** of the corresponding predecessor, not live-through. The "Iterate ..." loop below handles the case where Reg is live-out of DefBB.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112731



More information about the llvm-commits mailing list