[llvm] [SimplifyCFG] Add optimization for switches of powers of two (PR #70977)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 16 00:49:07 PST 2023


================
@@ -0,0 +1,258 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --tool ./bin/opt --version 3
+; RUN: opt %s -passes='simplifycfg<switch-to-lookup>' -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+
+; Check that the range of switch of powers of two is reduced and switch itself is lowered to jump-table
----------------
nikic wrote:

```suggestion
; Check that the range of switch of powers of two is reduced and switch itself is lowered to lookup table.
```

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


More information about the llvm-commits mailing list