[PATCH] D119854: [SimplifyCFG][PhaseOrdering] Defer lowering switch into an integer range comparison and branch until after at least the IPSCCP
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 16 13:37:02 PST 2022
nikic added inline comments.
================
Comment at: llvm/include/llvm/Transforms/Utils/SimplifyCFGOptions.h:26
bool ForwardSwitchCondToPhi = false;
+ bool ConvertSwitchRangeToICmp = false;
bool ConvertSwitchToLookupTable = false;
----------------
As we want to disable this essentially only for the first SimplifyCFG run, may make the default true?
================
Comment at: llvm/lib/Transforms/Utils/SimplifyCFG.cpp:6566
+ // CVP. Therefore, only apply this transformation during late stages of the
+ // optimisation pipeline.
+ if (Options.ConvertSwitchRangeToICmp && TurnSwitchRangeIntoICmp(SI, Builder))
----------------
This copy&pasted description doesn't sound quite right for this case. What we're losing here is information on values that branch to unreachable.
```
// The conversion from switch to comparison may lose information on
// impossible switch values, so disable it early in the pipeline.
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D119854/new/
https://reviews.llvm.org/D119854
More information about the llvm-commits
mailing list