[llvm] 6193f2a - [AArch64] Assert `expandMOVImm` prioritizes optimal single MOVZ/N (#169341)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 25 00:48:27 PST 2025
Author: Tomer Shafir
Date: 2025-11-25T10:48:23+02:00
New Revision: 6193f2aeda1d5ca30cf990e28956824eefdc97f1
URL: https://github.com/llvm/llvm-project/commit/6193f2aeda1d5ca30cf990e28956824eefdc97f1
DIFF: https://github.com/llvm/llvm-project/commit/6193f2aeda1d5ca30cf990e28956824eefdc97f1.diff
LOG: [AArch64] Assert `expandMOVImm` prioritizes optimal single MOVZ/N (#169341)
The expansion of move immediate in `expandMOVImm` follows the priority
of the `MOV` alias. In addition, the selection there properly prefers
expansion based on perf optimality order. This change adds a simple
assert that `expandMOVImmSimple` expands a single optimal MOVZ/MOVK.
Added:
Modified:
llvm/lib/Target/AArch64/AArch64ExpandImm.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AArch64/AArch64ExpandImm.cpp b/llvm/lib/Target/AArch64/AArch64ExpandImm.cpp
index e9660ac140301..ae5818419cba5 100644
--- a/llvm/lib/Target/AArch64/AArch64ExpandImm.cpp
+++ b/llvm/lib/Target/AArch64/AArch64ExpandImm.cpp
@@ -549,6 +549,8 @@ void AArch64_IMM::expandMOVImm(uint64_t Imm, unsigned BitSize,
// Prefer MOVZ/MOVN over ORR because of the rules for the "mov" alias.
if ((BitSize / 16) - OneChunks <= 1 || (BitSize / 16) - ZeroChunks <= 1) {
expandMOVImmSimple(Imm, BitSize, OneChunks, ZeroChunks, Insn);
+ assert(Insn.size() == 1 &&
+ "Move of immediate should have expanded to a single MOVZ/MOVN");
return;
}
More information about the llvm-commits
mailing list