[llvm] [SPIRV] Prevent creation of jump tables from switch (PR #82287)

Vyacheslav Levytskyy via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 00:54:28 PST 2024


================
@@ -31,6 +31,10 @@ class SPIRVTargetLowering : public TargetLowering {
     return true;
   }
 
+  // Set the lower limit for number of blocks in a jump table in such a way to
+  // prevent creation of jump tables from switch
+  unsigned getMinimumJumpTableEntries() const override { return 0xffffffff; }
----------------
VyacheslavLevytskyy wrote:

It's a good question indeed, thank you. Description of the command line options doesn't help to decide, it's just "Use jump tables for lowering switches" that we can interpret in different ways. Probably, the main argument would be that jump tables provide means of optimization (better code) and at maximum this deserves a warning, not an error. As for warnings, I'm not sure if we produce any at the moment, but all that helps a developer to better understand the job done would help of course. I should remember this idea in general and think how we can use it.

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


More information about the llvm-commits mailing list