If Cost < Threshold, we will try to inline the callee. So, we can early exit when Cost >= Threshold which is earlier than Cost > Threshold.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/Analysis/InlineCost.cpp | ||
---|---|---|
1209 ↗ | (On Diff #112481) | I don't think this is NFC. In visitSwitchInst I see the cost is calculating based on a result of TTI.getEstimatedNumberOfCaseClusters. If threshold is big (-O1 and above) this might not be a problem but if it is low (-Os, -Oz) this might be a problem. |
lib/Analysis/InlineCost.cpp | ||
---|---|---|
1209 ↗ | (On Diff #112481) | Specifically for this part, we cannot say that this is NFC in case when "CostLowerBound == Threshold" and the switch ends up with a bit test. See above "FIXME". However, I cannot see any big problem using ">=" here. |
lib/Analysis/InlineCost.cpp | ||
---|---|---|
1209 ↗ | (On Diff #112481) | I agree it does not look like a big problem but to be sure some benchmarking, especially code size, needs to be done. |