[llvm] [X86][GlobalISel] Narrow i64 G_PHI on 32-bit targets (PR #225264)
Demetrios Chiuratto Agourakis via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 22 09:49:54 PDT 2026
================
@@ -91,8 +91,10 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
// 32/64-bits needs support for s64/s128 to handle cases:
// s64 = EXTEND (G_IMPLICIT_DEF s32) -> s64 = G_IMPLICIT_DEF
// s128 = EXTEND (G_IMPLICIT_DEF s32/s64) -> s128 = G_IMPLICIT_DEF
- getActionDefinitionsBuilder(
- {G_IMPLICIT_DEF, G_PHI, G_FREEZE, G_CONSTANT_FOLD_BARRIER})
+ // Keep G_IMPLICIT_DEF/G_FREEZE able to materialize s64 even on i386, but do
+ // not treat multi-block G_PHI of s64 as legal there: the selector cannot
+ // EXTRACT/INSERT scalar subregs of an s64 GPR on 32-bit (#216648).
+ getActionDefinitionsBuilder({G_IMPLICIT_DEF, G_FREEZE, G_CONSTANT_FOLD_BARRIER})
.legalFor({p0, s1, s8, s16, s32, s64})
.legalFor(UseX87, {s80})
.legalFor(Is64Bit, {s128})
----------------
agourakis82 wrote:
The combined builder still needs `s64` legal on i386 for `G_IMPLICIT_DEF` / `G_FREEZE` (the extend-of-implicit-def cases in the comment above). If we only do `.legalFor(Is64Bit, {s64, s128})` on that shared group, those break too.
So I split just `G_PHI` out: same vector/scalar rules otherwise, but `s64` only when `Is64Bit`. Happy to tighten the wording if that helps.
https://github.com/llvm/llvm-project/pull/225264
More information about the llvm-commits
mailing list