- Jun 06, 2021
-
-
Liqiang Tao authored
-
Liqiang Tao authored
This patch abstract Calls in Inliner:run() to InlineOrder. With this patch, it's possible to customize the inlining order, i.e. use queue or priority queue. Reviewed By: kazu Differential Revision: https://reviews.llvm.org/D103315
-
- May 22, 2021
-
-
Arthur Eubanks authored
This reverts commit d14d84af. Causes unacceptable memory regressions.
-
- May 08, 2021
-
-
Arthur Eubanks authored
Printing pass manager invocations is fairly verbose and not super useful. This allows us to remove DebugLogging from pass managers and PassBuilder since all logging (aside from analysis managers) goes through instrumentation now. This has the downside of never being able to print the top level pass manager via instrumentation, but that seems like a minor downside. Reviewed By: ychen Differential Revision: https://reviews.llvm.org/D101797
-
- May 04, 2021
-
-
Arthur Eubanks authored
Previously, any change in any function in an SCC would cause all analyses for all functions in the SCC to be invalidated. With this change, we now manually invalidate analyses for functions we modify, then let the pass manager know that all function analyses should be preserved. So far this only touches the inliner, argpromotion, funcattrs, and updateCGAndAnalysisManager(), since they are the most used. Slight compile time improvements: http://llvm-compile-time-tracker.com/compare.php?from=326da4adcb8def2abdd530299d87ce951c0edec9&to=8942c7669f330082ef159f3c6c57c3c28484f4be&stat=instructions Reviewed By: mtrofin Differential Revision: https://reviews.llvm.org/D100917
-
- Apr 27, 2021
-
-
Arthur Eubanks authored
The ModulePassManager should already have taken care of all analysis invalidation. Without this change, upcoming changes will cause more invalidation than necessary. Reviewed By: mtrofin Differential Revision: https://reviews.llvm.org/D101320
-
- Mar 15, 2021
-
-
Hongtao Yu authored
Reviewed By: wenlei Differential Revision: https://reviews.llvm.org/D98439
-
- Jan 26, 2021
-
-
modimo authored
This change leverages the work done in D83743 to replay in the SampleProfile inliner to also be used in the CGSCC inliner. NOTE: currently restricted to non-ML advisors only. The added switch `-cgscc-inline-replay=<remarks file>` will replay the inlining decisions in that file where the remarks file is generated via `-Rpass=inline`. The aim here is to make it easier to analyze changes that would modify inlining heuristics to be separated from this behavior. Doing so allows easier examination of assembly and runtime behavior compared to the baseline rather than trying to dig through the large churn caused by inlining. In LTO compilation, since inlining is done twice you can separately specify replay by passing the flag to the FE (`-cgscc-inline-replay=`) and to the linker (`-Wl,cgscc-inline-replay=`) with the remarks generated from their respective places. Testing on mysqld by comparing the inline decisions between base (generates remarks.txt) and diff (replay using identical input/tools with remarks.txt) and examining the inlining sites with `diff` shows 14,000 mismatches out of 247,341 for a ~94% replay accuracy. I believe this gap can be narrowed further though for the general case we may never achieve full accuracy. For my personal use, this is close enough to be representative: I set the baseline as the one generated by the replay on identical input/toolset and compare that to my modified input/toolset using the same replay. Testing: ninja check-llvm newly added test correctly replays CGSCC inlining decisions Reviewed By: mtrofin, wenlei Differential Revision: https://reviews.llvm.org/D94334
-
- Jan 22, 2021
-
-
Xun Li authored
The same check is done in InlineCost: https://github.com/llvm/llvm-project/blob/8b0bd54d0ec968df28ccc58bbb537a7b7c074ef2/llvm/lib/Analysis/InlineCost.cpp#L2537-L2552 Also, doing a check on the callee here is confusing, because anything that deals with callee should be done in the inner loop where we proecss all calls from the same caller. Differential Revision: https://reviews.llvm.org/D95186
-
- Jan 20, 2021
-
-
Mircea Trofin authored
This reverts commit d97f776b. The original problem was due to build failures in shared lib builds. D95079 moved ImportedFunctionsInliningStatistics under Analysis, unblocking this.
-
Mircea Trofin authored
This is related to D94982. We want to call these APIs from the Analysis component, so we can't leave them under Transforms. Differential Revision: https://reviews.llvm.org/D95079
-
Mircea Trofin authored
This reverts commit e8aec763.
-
Mircea Trofin authored
When using 2 InlinePass instances in the same CGSCC - one for other mandatory inlinings, the other for the heuristic-driven ones - the order in which the ImportedFunctionStats would be output-ed would depend on the destruction order of the inline passes, which is not deterministic. This patch moves the ImportedFunctionStats responsibility to the InlineAdvisor to address this problem. Differential Revision: https://reviews.llvm.org/D94982
-
- Jan 16, 2021
-
-
Mircea Trofin authored
Expanding from D94808 - we ensure the same InlineAdvisor is used by both InlinerPass instances. The notion of mandatory inlining is moved into the core InlineAdvisor: advisors anyway have to handle that case, so this change also factors out that a bit better. Differential Revision: https://reviews.llvm.org/D94825
-
- Dec 17, 2020
-
-
dfukalov authored
Continuing work started in https://reviews.llvm.org/D92489: Removed a bunch of includes from "AliasAnalysis.h" and "LoopPassManager.h". Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D92852
-
- Dec 12, 2020
-
-
Kazu Hirata authored
-
- Dec 03, 2020
-
-
modimo authored
-
- Nov 30, 2020
-
-
Mircea Trofin authored
Enable performing mandatory inlinings upfront, by reusing the same logic as the full inliner, instead of the AlwaysInliner. This has the following benefits: - reduce code duplication - one inliner codebase - open the opportunity to help the full inliner by performing additional function passes after the mandatory inlinings, but before th full inliner. Performing the mandatory inlinings first simplifies the problem the full inliner needs to solve: less call sites, more contextualization, and, depending on the additional function optimization passes run between the 2 inliners, higher accuracy of cost models / decision policies. Note that this patch does not yet enable much in terms of post-always inline function optimization. Differential Revision: https://reviews.llvm.org/D91567
-
- Nov 13, 2020
-
-
Arthur Eubanks authored
Obsolete as of https://reviews.llvm.org/D91046.
-
- Nov 11, 2020
-
-
Arthur Eubanks authored
Previously the inliner did a bit of a hack by adding ref edges for all new edges introduced by performing an inline before calling updateCGAndAnalysisManagerForPass(). This was because updateCGAndAnalysisManagerForPass() didn't handle new non-trivial call edges. This adds handling of non-trivial call edges to updateCGAndAnalysisManagerForPass(). The inliner called updateCGAndAnalysisManagerForFunctionPass() since it was handling adding newly introduced edges (so updateCGAndAnalysisManagerForPass() would only have to handle promotion), but now it needs to call updateCGAndAnalysisManagerForCGSCCPass() since updateCGAndAnalysisManagerForPass() is now handling the new call edges and function passes cannot add new edges. We follow the previous path of adding trivial ref edges then letting promotion handle changing the ref edges to call edges and the CGSCC updates. So this still does not allow adding call edges that result in an addition of a non-trivial ref edge. This is in preparation for better detecting devirtualization. Previously since the inliner itself would add ref edges, updateCGAndAnalysisManagerForPass() would think that promotion and thus devirtualization had happened after any sort of inlining. Reviewed By: asbirlea Differential Revision: https://reviews.llvm.org/D91046
-
- Oct 24, 2020
-
-
Arthur Eubanks authored
Fixes noalias-calls.ll under NPM. Differential Revision: https://reviews.llvm.org/D89592
-
- Oct 23, 2020
-
-
Arthur Eubanks authored
An alwaysinline function may not get inlined in inliner-wrapper due to the inlining order. Previously for the following, the inliner would first inline @a() into @b(), ``` define void @a() { entry: call void @b() ret void } define void @b() alwaysinline { entry: br label %for.cond for.cond: call void @a() br label %for.cond } ``` making @b() recursive and unable to be inlined into @a(), ending at ``` define void @a() { entry: call void @b() ret void } define void @b() alwaysinline { entry: br label %for.cond for.cond: call void @b() br label %for.cond } ``` Running always-inliner first makes sure that we respect alwaysinline in more cases. Fixes https://bugs.llvm.org/show_bug.cgi?id=46945. Reviewed By: davidxl, rnk Differential Revision: https://reviews.llvm.org/D86988
-
- Jul 07, 2020
-
-
Arthur Eubanks authored
Previously the NPM inliner would skip all potential inlines in an optnone function, but alwaysinline callees should be inlined regardless of optnone. Fixes inline-optnone.ll under NPM. Reviewed By: kazu Differential Revision: https://reviews.llvm.org/D83021
-
- Jul 02, 2020
-
-
Guillaume Chatelet authored
This patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Differential Revision: https://reviews.llvm.org/D82977
-
- Jun 01, 2020
-
-
Mircea Trofin authored
Summary: This simplifies the interface by storing the function analysis manager with the InlineAdvisor, and, thus, not requiring it be passed each time we inquire for an advice. Reviewers: davidxl, asbirlea Subscribers: eraman, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80405
-
- May 18, 2020
-
-
Mircea Trofin authored
Changed OnPass{Entry|Exit} -> onPass{Entry|Exit} Also fixed a small typo in a comment.
-
- May 16, 2020
-
-
Eli Friedman authored
Along the lines of D77454 and D79968. Unlike loads and stores, the default alignment is getPrefTypeAlign, to match the existing handling in various places, including SelectionDAG and InstCombine. Differential Revision: https://reviews.llvm.org/D80044
-
- May 15, 2020
-
-
Mircea Trofin authored
This reverts commit 454de99a. The problem was that one of the ctor arguments of CallAnalyzer was left to be const std::function<>&. A function_ref was passed for it, and then the ctor stored the value in a function_ref field. So a std::function<> would be created as a temporary, and not survive past the ctor invocation, while the field would. Tested locally by following https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild Original Differential Revision: https://reviews.llvm.org/D79917
-
Mircea Trofin authored
This reverts commit 767db5be.
-
Mircea Trofin authored
Summary: Replacing uses of std::function pointers or refs, or Optional, to function_ref, since the usage pattern allows that. If the function is optional, using a default parameter value (nullptr). This led to a few parameter reshufles, to push all optionals to the end of the parameter list. Reviewers: davidxl, dblaikie Subscribers: arsenm, jvesely, nhaehnle, eraman, hiraditya, haicheng, kerbowa, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79917
-
- May 13, 2020
-
-
Eric Christopher authored
-
Mircea Trofin authored
Summary: This change introduces InliningAdvisor (and related APIs), the interface that abstracts decision making away from the inlining pass. We will use this interface to delegate decision making to a trained ML model, subsequently (see referenced RFC). RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140763.html Reviewers: davidxl, eraman, dblaikie Subscribers: mgorny, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79042
-
Alina Sbirlea authored
Summary: Analyses that are statefull should not be retrieved through a proxy from an outer IR unit, as these analyses are only invalidated at the end of the inner IR unit manager. This patch disallows getting the outer manager and provides an API to get a cached analysis through the proxy. If the analysis is not stateless, the call to getCachedResult will assert. Reviewers: chandlerc Subscribers: mehdi_amini, eraman, hiraditya, zzheng, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D72893
-
- May 11, 2020
-
-
Mircea Trofin authored
Summary: Factoring out in preparation to https://reviews.llvm.org/D79042 Reviewers: dblaikie, davidxl Subscribers: mgorny, eraman, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79613
-
- May 05, 2020
-
-
Kazu Hirata authored
Summary: This patch teaches shouldBeDeferred to take into account the total cost of inlining. Suppose we have a call hierarchy {A1,A2,A3,...}->B->C. (Each of A1, A2, A3, ... calls B, which in turn calls C.) Without this patch, shouldBeDeferred essentially returns true if TotalSecondaryCost < IC.getCost() where TotalSecondaryCost is the total cost of inlining B into As. This means that if B is a small wraper function, for example, it would get inlined into all of As. In turn, C gets inlined into all of As. In other words, shouldBeDeferred ignores the cost of inlining C into each of As. This patch adds an option, inline-deferral-scale, to replace the expression above with: TotalCost < Allowance where - TotalCost is TotalSecondaryCost + IC.getCost() * # of As, and - Allowance is IC.getCost() * Scale For now, the new option defaults to -1, disabling the new scheme. Reviewers: davidxl Subscribers: eraman, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79138
-
- May 03, 2020
-
-
Mircea Trofin authored
Summary: This factors cost and reporting out of the inlining workflow, thus making it easier to reuse when driving inlining from the upcoming InliningAdvisor. Depends on: D79215 Reviewers: davidxl, echristo Subscribers: eraman, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79275
-
Mircea Trofin authored
Discussion is in https://reviews.llvm.org/D79215
-
- May 02, 2020
-
-
https://reviews.llvm.org/D79215Mircea Trofin authored
Operator error - performed the rename and didn't save.
-
Mircea Trofin authored
Summary: shouldInline makes a decision based on the InlineCost of a call site, as well as an evaluation on whether the site should be deferred. This means it's possible for the decision to be not to inline, even for an InlineCost that would otherwise allow it. Both uses of shouldInline performed the exact same logic after calling it. In addition, the decision on whether to inline or not was communicated through two values of the Option<InlineCost> return value: None, or an InlineCost evaluating to false. Simplified by: - encapsulating the decision in the return object. The bool it evaluates to communicates unambiguously the decision. The InlineCost is also available. - encapsulated the common post-shouldInline code into shouldInline. Reviewers: davidxl, echristo, eraman Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79215
-
- Apr 30, 2020
-
-
Mircea Trofin authored
Summary: Renamed 'CS' to 'CB', and, in one case, to a more specific name to avoid naming collision with outer scope (a maintainability/readability reason, not correctness) Also updated comments. Reviewers: davidxl, dblaikie, jdoerfert Subscribers: eraman, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D79101
-