[PATCH] D149651: [UnreachableBlockElim] Don't remove LCSSA phi nodes

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 3 07:55:03 PDT 2023


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp:430-431
           .add(MI.getOperand(0));
+  if (LV)
+    LV->replaceKillInstruction(MI.getOperand(0).getReg(), MI, *AndN2);
 
----------------
Pierre-vh wrote:
> foad wrote:
> > I can submit this separately, but I guess I would have to come up with a MIR test case. I am not sure why the change to UnreachableBlockElim exposed this problem.
> No strong opinion on leaving this in this patch or splitting it up, but it would be nice to have a MIR testcase just for this fix IMO (with `-run-pass` or `-start-before`). 
> 
> Maybe you can quickly get one by using `-stop-before` + `llvm-reduce` & some manual cleanup on the test that was previously failing?
It was too hard. I can dump the MIR after UnreachableBlockElim to generate a test case, but to show the bug I would need to run something like `llc -run-pass=livevars,phi-node-elimination,si-lower-control-flow`. But the LiveVariables pass adds a run of UnreachableBlockElim as a prerequisite, which is enough to mess up the test case. I think I'll just commit this separately as an obvious fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149651



More information about the llvm-commits mailing list