[llvm] [Codegen] Remove redundant instruction using machinelateCleanup (PR #139716)

Rohit Aggarwal via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 3 02:29:41 PDT 2025


rohitaggarwal007 wrote:

> See:
> 
> https://github.com/llvm/llvm-project/blob/10647685ca3cad0107a2f754b21a078405d30359/llvm/include/llvm/CodeGen/MachineOperand.h#L117
> 
> `undef %9510.sub_32bit:gr64_with_sub_8bit =` is a def of the low 32 bits of %9510, and acts like an undef read of the high 32 bits. I.e. before this instruction %9510 does not need a definition and after this instruction the high 32 bits are undef.
> 
> MOV32r0 does not clear the high 32 bits of `$rax`. It only modifies `$eax` aka the low 32 bits of `$rax`.

I went through some online material and found that 32 bit instruction are zext or signed extended to 64 bit instruction by the hardware and then it is executed.
I should automatically clear upper 32 bit of the $rax.

https://github.com/llvm/llvm-project/pull/139716


More information about the llvm-commits mailing list