[all-commits] [llvm/llvm-project] 85318b: [MachineLateInstrsCleanup] Handle multiple kills f...
Jonas Paulsson via All-commits
all-commits at lists.llvm.org
Thu Mar 13 07:51:17 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 85318bae285e9103acbc75ad3bdf78db1ce56f21
https://github.com/llvm/llvm-project/commit/85318bae285e9103acbc75ad3bdf78db1ce56f21
Author: Jonas Paulsson <paulson1 at linux.ibm.com>
Date: 2025-03-13 (Thu, 13 Mar 2025)
Changed paths:
M llvm/lib/CodeGen/MachineLateInstrsCleanup.cpp
A llvm/test/CodeGen/SystemZ/machine-latecleanup-kills.mir
Log Message:
-----------
[MachineLateInstrsCleanup] Handle multiple kills for a preceding definition. (#119132)
When removing a redundant definition in order to reuse an earlier
identical one it is necessary to remove any earlier kill flag as well.
Previously, the assumption has been that any register that kills the
defined Reg is enough to handle for this purpose, but this is actually
not quite enough. A kill of a super-register does not necessarily imply
that all of its subregs (including Reg) is defined at that point: a
partial definition of a register is legal. This means Reg may have been
killed earlier and is not live at that point.
This patch changes the tracking of kill flags to allow for multiple
flags to be removed: instead of remembering just the single / latest
kill flag, a vector is now used to track and remove them all.
TinyPtrVector seems ideal for this as there are only very rarely more
than one kill flag, and it doesn't seem to give much difference in
compile time.
The kill flags handling here is making this pass much more complicated
than it would have to be. This pass does not depend on kill flags for
its own use, so an interesting alternative to all this handling would be
to just remove them all. If there actually is a serious user, maybe that pass
could instead recompute them.
Also adding an assertion which is unrelated to kill flags, but it seems
to make sense (according to liberal assertion policy), to verify that
the preceding definition is in fact identical in clearKillsForDef().
Fixes #117783
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list