[llvm] [TableGen] Add list value test for switch(NFC) (PR #202327)

Tomer Shafir via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 05:22:46 PDT 2026


https://github.com/tomershafir created https://github.com/llvm/llvm-project/pull/202327

None

>From ea49b260e86269d8309ea0e7a96ad17d020bb953 Mon Sep 17 00:00:00 2001
From: tomershafir <tomer.shafir8 at gmail.com>
Date: Mon, 8 Jun 2026 15:22:07 +0300
Subject: [PATCH] [TableGen] Add list value test for switch(NFC)

---
 llvm/test/TableGen/switch.td | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/test/TableGen/switch.td b/llvm/test/TableGen/switch.td
index 5ad4a5f4ed831..1326cb8d9ec0c 100644
--- a/llvm/test/TableGen/switch.td
+++ b/llvm/test/TableGen/switch.td
@@ -58,6 +58,7 @@ def labeled_99 : Labeled<99>;
 // CHECK:   string_key = "v1";
 // CHECK:   bits_val = { 1, 1 };
 // CHECK:   single_bit = 1;
+// CHECK:   list_val = [7, 8, 9];
 def nonempty_caselist_default {
   string color = !switch(99, 1: "red", 2: "green", 3: "blue", "default");
   int age = !switch(99, 1: 20, 2: 30, 3: 40, 10);
@@ -65,6 +66,7 @@ def nonempty_caselist_default {
   string string_key = !switch("k99", "k1": "v2", "k2": "v3", "k3": "v4", "v1");
   bits<2> bits_val = !switch(99, 1: {0, 1}, 2: {1, 0}, {1, 1});
   bit single_bit = !switch(99, 1: !eq(0, 0), 2: !eq(0, 1), !eq(1, 1));
+  list<int> list_val = !switch(99, 1: [1, 2, 3], 2: [4, 5, 6], [7, 8, 9]);
 }
 
 // Non-empty case list, key matches a case key
@@ -75,6 +77,7 @@ def nonempty_caselist_default {
 // CHECK:   string_key = "v2";
 // CHECK:   bits_val = { 1, 0 };
 // CHECK:   single_bit = 0;
+// CHECK:   list_val = [4, 5, 6];
 def nonempty_caselist_match_case {
   string color = !switch(1,  1: "red", 2: "green", 3: "blue", "default");
   int age = !switch(2, 1: 20, 2: 30, 3: 40, 10);
@@ -82,6 +85,7 @@ def nonempty_caselist_match_case {
   string string_key = !switch("k1", "k1": "v2", "k2": "v3", "k3": "v4", "v1");
   bits<2> bits_val = !switch(2, 1: {0, 1}, 2: {1, 0}, {1, 1});
   bit single_bit = !switch(2, 1: !eq(0, 0), 2: !eq(0, 1), !eq(1, 1));
+  list<int> list_val = !switch(2, 1: [1, 2, 3], 2: [4, 5, 6], [7, 8, 9]);
 }
 
 // Partially unset values



More information about the llvm-commits mailing list