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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 28 11:56:37 PDT 2021


foad added inline comments.


================
Comment at: llvm/lib/CodeGen/LiveVariables.cpp:722
+  // Add new kill flags. For each block in which Reg is used but is not
+  // live-through, find the last instruction that uses Reg.
+  for (unsigned UseBBNum : UseBlocks) {
----------------
Does this work for phi uses? I'm not sure.


================
Comment at: llvm/lib/CodeGen/LiveVariables.cpp:731-732
+      if (MI.readsRegister(Reg)) {
+        if (!MI.killsRegister(Reg)) {
+          MI.addRegisterKilled(Reg, nullptr);
+          VI.Kills.push_back(&MI);
----------------
arsenm wrote:
> Won't this do the right thing if you unconditionally call addRegisterKilled?
It could give you duplicate entries in the Kills vector which seems undesirable.


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