[llvm] [X86][GlobalISel] Remove dependency on legal ruleset (PR #197374)
via llvm-commits
llvm-commits at lists.llvm.org
Tue May 12 23:48:51 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: David Green (davemgreen)
<details>
<summary>Changes</summary>
This fills in always legal rules, to remove the dependency on the legacy ruleset. I'm not sure about the truncate rule but all tests pass. This is not guaranteed to be all the rules, just the ones that appear in tests.
---
Full diff: https://github.com/llvm/llvm-project/pull/197374.diff
1 Files Affected:
- (modified) llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp (+7)
``````````diff
diff --git a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
index ce922538cfdc9..e2023c086a2a0 100644
--- a/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
+++ b/llvm/lib/Target/X86/GISel/X86LegalizerInfo.cpp
@@ -314,6 +314,7 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
.clampScalar(1, s16, sMaxScalar)
.scalarSameSizeAs(0, 1);
+ getActionDefinitionsBuilder(G_BR).alwaysLegal();
getActionDefinitionsBuilder(G_BRCOND).legalFor({s1});
// pointer handling
@@ -425,6 +426,8 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
.clampScalar(1, s8, sMaxScalar)
.scalarize(0);
+ getActionDefinitionsBuilder(G_TRUNC).alwaysLegal();
+
getActionDefinitionsBuilder(G_SEXT_INREG).lower();
// fp constants
@@ -615,6 +618,10 @@ X86LegalizerInfo::X86LegalizerInfo(const X86Subtarget &STI,
.minScalar(0, LLT::scalar(32))
.libcall();
+ getActionDefinitionsBuilder({G_INTRINSIC, G_INTRINSIC_W_SIDE_EFFECTS})
+ .alwaysLegal();
+ getActionDefinitionsBuilder({G_TRAP, G_DEBUGTRAP, G_UBSANTRAP}).alwaysLegal();
+
getLegacyLegalizerInfo().computeTables();
verify(*STI.getInstrInfo());
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/197374
More information about the llvm-commits
mailing list