mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-05 23:52:45 +00:00
[InlineCost]Account for switch instructons when the switch condition could be simplified as a result of inlines.
Reviewed By: kazu Differential Revision: https://reviews.llvm.org/D152053
This commit is contained in:
parent
9ee65a7618
commit
2639fdc5dd
@ -855,6 +855,9 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
|
||||
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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user