[PATCH] D128897: [SimplifyCFG] Improve SwitchToLookupTable optimization

Alexander Shaposhnikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 7 09:28:22 PDT 2022


alexander-shaposhnikov planned changes to this revision.
alexander-shaposhnikov added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6373
 
+  uint64_t ZeroOffsetTableSize = MaxCaseVal->getLimitedValue() + 1;
+
----------------
hans wrote:
> Could this overflow?
yes, it could, however ShouldBuildLookupTable checks for table size (second argument) overflow
https://github.com/llvm/llvm-project/blob/main/llvm/lib/Transforms/Utils/SimplifyCFG.cpp#L6089,
perhaps, it'd be better not to rely on this





Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128897/new/

https://reviews.llvm.org/D128897



More information about the llvm-commits mailing list