[llvm] [MachineCopyPropagation] Recognise and delete no-op moves produced after forwarded uses (PR #129889)
Steven Michaud via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 6 10:16:53 PST 2025
steven-michaud wrote:
> @steven-michaud I wonder if adding `MI.getNumImplicitOperands() == 0` to the checks before deleting the instruction would fix the issue. Hopefully, if the upper bits are used there will be an implicit definition operand of the 64-bit register. There was similar fix in [e4b4a93](https://github.com/llvm/llvm-project/commit/e4b4a939f8852b2d5aab0d5b999890c7ef85be18).
I tried this, but it doesn't fix the crashes. In fact it doesn't seem to make any difference at all.
In the LLVM intermediate language code from my debug logging output, I often see lines containing "implicit-def", for example the following:
```
$w8 = ORRWrs $wzr, renamable $w13, 0, implicit-def $x8, debug-location !188573; third_party/sqlite3/src/sqlite3.c:167712:19
```
Is this a case of `MI.getNumImplicitOperands() > 0`? Even before your patch, instructions with this property are *never* among those removed by `MI.eraseFromParent();` [here](https://github.com/llvm/llvm-project/blob/release/21.x/llvm/lib/CodeGen/MachineCopyPropagation.cpp#L945).
https://github.com/llvm/llvm-project/pull/129889
More information about the llvm-commits
mailing list