[PATCH] D109565: Teach SimplifyCFG to fold switches into lookup tables in more cases.
    Nikita Popov via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Sep 15 13:08:10 PDT 2021
    
    
  
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:5072
+    Constant *StrippedC = cast<Constant>(CE->stripInBoundsConstantOffsets());
+    if (StrippedC != C && !ValidLookupTableConstant(StrippedC, TTI))
       return false;
----------------
Shouldn't this condition be `StrippedC == C ||`? What you're doing now is effectively allowing all constant expressions for which nothing can be stripped.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109565/new/
https://reviews.llvm.org/D109565
    
    
More information about the llvm-commits
mailing list