[PATCH] D152053: [InlineCost]Account for switch instructons when the switch condition could be simplified as a result of inlines.
Mingming Liu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 20 14:49:16 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2639fdc5dd0e: [InlineCost]Account for switch instructons when the switch condition could be… (authored by mingmingl).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152053/new/
https://reviews.llvm.org/D152053
Files:
llvm/lib/Analysis/InlineCost.cpp
Index: llvm/lib/Analysis/InlineCost.cpp
===================================================================
--- llvm/lib/Analysis/InlineCost.cpp
+++ llvm/lib/Analysis/InlineCost.cpp
@@ -855,6 +855,9 @@
SimplifiedValues.lookup(BI->getCondition()))) {
CurrentSavings += InstrCost;
}
+ } else if (SwitchInst *SI = dyn_cast<SwitchInst>(&I)) {
+ if (isa_and_present<ConstantInt>(SimplifiedValues.lookup(SI->getCondition())))
+ CurrentSavings += InstrCost;
} else if (Value *V = dyn_cast<Value>(&I)) {
// Count an instruction as savings if we can fold it.
if (SimplifiedValues.count(V)) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152053.557149.patch
Type: text/x-patch
Size: 684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230920/55740df2/attachment.bin>
More information about the llvm-commits
mailing list