[llvm] [CodeGen] Keep physreg copies when successors use-before-def (PR #182732)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 2 12:55:20 PST 2026
================
@@ -563,6 +563,26 @@ void MachineCopyPropagation::readSuccessorLiveIns(
}
}
+// Conservatively detect a physical-register use in a successor block before
+// the register is redefined there. This guards against stale/incomplete
+// live-in information, which can otherwise make a required copy look
+// dead at block exit
----------------
Sightem wrote:
Indeed, you were right. upon a closer look this ended up being a backend issue.
root cause was in our out of tree eZ80 backend, several `PUSH16/24AF` preservation paths were marking the AF use as `undef`. That made a required A value copy look dead to MCP, so MCP deleted it.
Upon removing those AF `setIsUndef()`s and reverting the MCP workaround entirely the miscompile is gone and rendering is correct again. I will close this PR accordingly.
https://github.com/llvm/llvm-project/pull/182732
More information about the llvm-commits
mailing list