[llvm] [AArch64] Share materialized constant between add x, k and sub x,k (PR #225430)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 27 03:02:12 PDT 2026
prajapati-git wrote:
> This is just blindly preferring positive constants, and hoping they'll fold? That works in simple cases, I guess, but I'm not sure how well it generalizes. Maybe worth considering a MachineIR pass that runs after isel, which could optimize based on all the constants used in the function.
Hi @efriedma-quic,
I reworked this as a MachineIR pass (folded into AArch64MIPeepholeOpt) that runs post-isel/post-MachineCSE with visibility into all constants materialized in a block, and only merges when it actually sees a matching one, rather than guessing signs locally at isel time.
https://github.com/llvm/llvm-project/pull/225430
More information about the llvm-commits
mailing list