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

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 20 12:00:56 PDT 2025


================
@@ -181,6 +181,10 @@ bool BPFInstrInfo::analyzeBranch(MachineBasicBlock &MBB,
     if (!isUnpredicatedTerminator(*I))
       break;
 
+    // If a JX insn, we're done.
+    if (I->getOpcode() == BPF::JX)
----------------
eddyz87 wrote:

I think this should be replaced with:

```
    // From base method doc: ... returning true if it cannot be understood ...
    // Indirect branch has multiple destinations and no true/false concepts.
    if (I->isIndirectBranch())
      return true;
```

Otherwise there would be a dangling "goto" after "gotox" in some situations.

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


More information about the llvm-commits mailing list