[llvm] [X86] Eliminate redundant zero-extension instructions (PR #161401)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 24 00:27:31 PDT 2025


00001H wrote:

I'm not familiar with how LLVM's code works, but reading through your commit I have some questions:
1. What does "upper bits" in `hasZeroUpperBits` mean? `tryEliminateRedundantZeroExtend` eliminates an extension from 8 bits if `hasZeroUpperBits` returns true, so "upper bits" should clearly refer to bits 8-63 here. However, if I'm reading the switch in `hasZeroUpperBits` correctly, `true` is returned even for instructions like `MOVZX32rm16` (may leave bits 8-15 nonzero) and `ADD32rr` (may leave bits 8-31 nonzero).
2. What do  `TII`, `TRI` and `ToErase` (in `EliminateRedundantZeroExtend::runOnMachineFunction`) do? They are never referenced.

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


More information about the llvm-commits mailing list