[PATCH] D58399: [Inliner] Don't initialize ComputeFullInlineCost to be always true because of ORE
Wei Mi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 19 11:26:29 PST 2019
wmi created this revision.
wmi added reviewers: eraman, chandlerc.
Herald added subscribers: jdoerfert, haicheng.
Herald added a project: LLVM.
Right now ComputeFullInlineCost is always true because it is set to be true if ORE is non-null. However ORE is never null for inliner. Whether we will emit optimization remark for inliner doesn't depend on it. This introduces the problem that during getInlineCost we cannot return early even if we already know the cost is definitely higher than the threshold. It is a general problem for compile time.
For now, we simply remove ORE check when we initialize ComputeFullInlineCost. That will solve the compile time problem. Although it will miss some extra information in the optimization remark report, currently we don't have a clean way to check whether optimization remark are enabled for either inline or inline-cost passes. If the missing information is a problem, explicitly adding -mllvm -inline-cost-full will solve that.
Repository:
rL LLVM
https://reviews.llvm.org/D58399
Files:
lib/Analysis/InlineCost.cpp
Index: lib/Analysis/InlineCost.cpp
===================================================================
--- lib/Analysis/InlineCost.cpp
+++ lib/Analysis/InlineCost.cpp
@@ -279,8 +279,12 @@
: TTI(TTI), GetAssumptionCache(GetAssumptionCache), GetBFI(GetBFI),
PSI(PSI), F(Callee), DL(F.getParent()->getDataLayout()), ORE(ORE),
CandidateCS(CSArg), Params(Params), Threshold(Params.DefaultThreshold),
+ // TODO: It is better to initialize ComputeFullInlineCost to true when
+ // Rpass=inline* is used to enable more precise report. However right
+ // now the check is inside of diagnose emission and we don't have a
+ // clean way to do the check here. It is something to be improved.
Cost(0), ComputeFullInlineCost(OptComputeFullInlineCost ||
- Params.ComputeFullInlineCost || ORE),
+ Params.ComputeFullInlineCost),
IsCallerRecursive(false), IsRecursiveCall(false),
ExposesReturnsTwice(false), HasDynamicAlloca(false),
ContainsNoDuplicateCall(false), HasReturn(false), HasIndirectBr(false),
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58399.187414.patch
Type: text/x-patch
Size: 1151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190219/158f44a6/attachment.bin>
More information about the llvm-commits
mailing list