[llvm] [RISCV][GISel] Legalizer and register bank selection for G_JUMP_TABLE and G_BRJT (PR #71970)
Michael Maitland via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 10 11:47:05 PST 2023
================
@@ -0,0 +1,121 @@
+# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
+# RUN: llc -mtriple=riscv32 -mattr=+m -run-pass=legalizer %s -o - \
+# RUN: | FileCheck %s
+
+--- |
+ define i32 @jt_test(i32 %x) {
+ entry:
+ switch i32 %x, label %return [
+ i32 75, label %sw.bb
+ i32 34, label %sw.bb
+ i32 56, label %sw.bb
+ i32 35, label %sw.bb
+ i32 40, label %sw.bb
+ i32 4, label %sw.bb1
+ i32 5, label %sw.bb1
+ i32 6, label %sw.bb1
+ ]
+
+ sw.bb: ; preds = %entry, %entry, %entry, %entry, %entry
+ %add = add nsw i32 %x, 42
----------------
michaelmaitland wrote:
Do we need the `add` and `mul` here? Can we just return? Legalizer and regbank selection will never do any any optimizing of the jump table to the default label if jump targets only contain a branch to the default label.
https://github.com/llvm/llvm-project/pull/71970
More information about the llvm-commits
mailing list