[llvm] [BPF] Support Jump Table (PR #149715)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 22:20:32 PDT 2025


================
@@ -0,0 +1,64 @@
+; RUN: llc -march=bpf -mcpu=v4 < %s | FileCheck %s
+;
+; Source code:
+;    int bar(int a) {
+;       __label__ l1, l2;
+;       void * volatile tgt;
+;       int ret = 0;
+;       if (a)
+;         tgt = &&l1; // synthetic jump table generated here
+;       else
+;         tgt = &&l2; // another synthetic jump table
+;       goto *tgt;
+;   l1: ret += 1;
+;   l2: ret += 2;
+;       return ret;
+;     }
+;
+; Compilation Flags:
----------------
MaskRay wrote:

You may search `;--- gen` within llvm/test. Those files utilize https://llvm.org/docs/TestingGuide.html#extra-files to make update easier

https://github.com/llvm/llvm-project/pull/149715


More information about the llvm-commits mailing list