Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AArch64] Simplify legalizer info for G_JUMP_TABLE and G_BRJT. #71962

Merged
merged 1 commit into from
Nov 18, 2023

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Nov 10, 2023

Remove s64 as a valid type for G_JUMP_TABLE since I think it is always a pointer?

Replace custom predicate for G_BRJT with a legalFor that checks 2 types.

Remove s64 as a valid type for G_JUMP_TABLE since I think it is
always a pointer?

Replace custom predicate for G_BRJT with a legalFor that checks 2 types.
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 10, 2023

@llvm/pr-subscribers-llvm-globalisel

@llvm/pr-subscribers-backend-aarch64

Author: Craig Topper (topperc)

Changes

Remove s64 as a valid type for G_JUMP_TABLE since I think it is always a pointer?

Replace custom predicate for G_BRJT with a legalFor that checks 2 types.


Full diff: https://github.com/llvm/llvm-project/pull/71962.diff

2 Files Affected:

  • (modified) llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp (+2-4)
  • (modified) llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir (+2-2)
diff --git a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
index b197b416228bd21..000fd648595222b 100644
--- a/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
+++ b/llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp
@@ -930,11 +930,9 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST)
   getActionDefinitionsBuilder(G_CONCAT_VECTORS)
       .legalFor({{v4s32, v2s32}, {v8s16, v4s16}, {v16s8, v8s8}});
 
-  getActionDefinitionsBuilder(G_JUMP_TABLE).legalFor({{p0}, {s64}});
+  getActionDefinitionsBuilder(G_JUMP_TABLE).legalFor({p0});
 
-  getActionDefinitionsBuilder(G_BRJT).legalIf([=](const LegalityQuery &Query) {
-    return Query.Types[0] == p0 && Query.Types[1] == s64;
-  });
+  getActionDefinitionsBuilder(G_BRJT).legalFor({{p0, s64}});
 
   getActionDefinitionsBuilder({G_DYN_STACKALLOC,
                                G_STACKSAVE,
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir b/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
index 2ea8cff5961b9b2..4fa6cd087988128 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/legalizer-info-validation.mir
@@ -597,8 +597,8 @@
 # DEBUG-NEXT: .. type index coverage check SKIPPED: no rules defined
 # DEBUG-NEXT: .. imm index coverage check SKIPPED: no rules defined
 # DEBUG-NEXT: G_BRJT (opcode {{[0-9]+}}): 2 type indices
-# DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
-# DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected
+# DEBUG-NEXT: .. the first uncovered type index: 2, OK
+# DEBUG-NEXT: .. the first uncovered imm index: 0, OK
 # DEBUG-NEXT: G_INSERT_VECTOR_ELT (opcode {{[0-9]+}}): 3 type indices, 0 imm indices
 # DEBUG-NEXT: .. type index coverage check SKIPPED: user-defined predicate detected
 # DEBUG-NEXT: .. imm index coverage check SKIPPED: user-defined predicate detected

Copy link
Contributor

@aemerson aemerson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@topperc topperc merged commit d5ab48e into llvm:main Nov 18, 2023
5 checks passed
@topperc topperc deleted the pr/aarch64-jump-table branch November 18, 2023 19:00
sr-tream pushed a commit to sr-tream/llvm-project that referenced this pull request Nov 20, 2023
…71962)

Remove s64 as a valid type for G_JUMP_TABLE since I think it is always a
pointer?

Replace custom predicate for G_BRJT with a legalFor that checks 2 types.
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
…71962)

Remove s64 as a valid type for G_JUMP_TABLE since I think it is always a
pointer?

Replace custom predicate for G_BRJT with a legalFor that checks 2 types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants