[PATCH] D152053: [InlineCost]Account for switch instructons when the switch condition could besimplified as a result of inlines.
Kazu Hirata via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 5 12:55:20 PDT 2023
kazu accepted this revision.
kazu added a comment.
This revision is now accepted and ready to land.
See the comment about `isa_and_present` above.
================
Comment at: llvm/lib/Analysis/InlineCost.cpp:857-858
+ } else if (SwitchInst *SI = dyn_cast<SwitchInst>(&I)) {
+ if (Value *V = SimplifiedValues.lookup(SI->getCondition()) &&
+ isa<ConstantInt>(V))
+ CurrentSavings += InstrCost;
----------------
May I suggest something like this?
```
if (isa_and_present<ConstantInt>(SimplifiedValues.lookup(SI->getCondition())))
```
This is for consistency with the `BranchInst` handling just a few lines above.
`isa_and_present` is a successor of `isa_and_nonnull`, which I *think* will be deprecated.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152053/new/
https://reviews.llvm.org/D152053
More information about the llvm-commits
mailing list