aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InlineCost.cpp
AgeCommit message (Collapse)AuthorFilesLines
2021-10-08[InlineCost] model calls to llvm.is.constant* more carefullyNick Desaulniers1-0/+24
llvm.is.constant* intrinsics are evaluated to 0 or 1 integral values. A common use case for llvm.is.constant comes from the higher level __builtin_constant_p. A common usage pattern of __builtin_constant_p in the Linux kernel is: void foo (int bar) { if (__builtin_constant_p(bar)) { // lots of code that will fold away to a constant. } else { // a little bit of code, usually a libcall. } } A minor issue in InlineCost calculations is when `bar` is _not_ Constant and still will not be after inlining, we don't discount the true branch and the inline cost of `foo` ends up being the cost of both branches together, rather than just the false branch. This leads to code like the above where inlining will not help prove bar Constant, but it still would be beneficial to inline foo, because the "true" branch is irrelevant from a cost perspective. For example, IPSCCP can sink a passed constant argument to foo: const int x = 42; void bar (void) { foo(x); } This improves our inlining decisions, and fixes a few head scratching cases were the disassembly shows a relatively small `foo` not inlined into a lone caller. We could further improve this modeling by tracking whether the argument to llvm.is.constant* is a parameter of the function, and if inlining would allow that parameter to become Constant. This idea is noted in a FIXME comment. Link: https://github.com/ClangBuiltLinux/linux/issues/1302 Reviewed By: kazu Differential Revision: https://reviews.llvm.org/D111272
2021-10-07[Inline] Introduce Constant::hasOneLiveUse, use it instead of hasOneUse in ↵Erik Desjardins1-3/+3
inline cost model (PR51667) Otherwise, inlining costs may be pessimized by dead constants. Fixes https://bugs.llvm.org/show_bug.cgi?id=51667. Reviewed By: mtrofin, aeubanks Differential Revision: https://reviews.llvm.org/D109294
2021-09-09[APInt] Normalize naming on keep constructors / predicate methods.Chris Lattner1-2/+2
This renames the primary methods for creating a zero value to `getZero` instead of `getNullValue` and renames predicates like `isAllOnesValue` to simply `isAllOnes`. This achieves two things: 1) This starts standardizing predicates across the LLVM codebase, following (in this case) ConstantInt. The word "Value" doesn't convey anything of merit, and is missing in some of the other things. 2) Calling an integer "null" doesn't make any sense. The original sin here is mine and I've regretted it for years. This moves us to calling it "zero" instead, which is correct! APInt is widely used and I don't think anyone is keen to take massive source breakage on anything so core, at least not all in one go. As such, this doesn't actually delete any entrypoints, it "soft deprecates" them with a comment. Included in this patch are changes to a bunch of the codebase, but there are more. We should normalize SelectionDAG and other APIs as well, which would make the API change more mechanical. Differential Revision: https://reviews.llvm.org/D109483
2021-09-02[CSSPGO] Allow inlining recursive call for preinlinerWenlei He1-4/+12
When preinliner is used for CSSPGO, we try to honor global preinliner decision as much as we can except for uninlinable callees. We rely on InlineCost::Never to prevent us from illegal inlining. However, it turns out that we use InlineCost::Never for both illeagle inlining and some of the "not-so-beneficial" inlining. The most common one is recursive inlining, while it can bloat size a lot during CGSCC bottom-up inlining, it's less of a problem when recursive inlining is guided by profile and done in top-down manner. Ideally it'd be better to have a clear separation between inline legality check vs cost-benefit check, but that requires a bigger change. This change enables InlineCost computation to allow inlining recursive calls, controlled by InlineParams. In SampleLoader, we now enable recursive inlining for CSSPGO when global preinliner decision is used. With this change, we saw a few perf improvements on SPEC2017 with CSSPGO and preinliner on: 2% for povray_r, 6% for xalancbmk_s, 3% omnetpp_s, while size is about the same (no noticeable perf change for all other benchmarks) Differential Revision: https://reviews.llvm.org/D109104
2021-09-02[InlineCost] Introduce attributes to override InlineCost for inliner testingDaniil Suchkov1-0/+56
This patch introduces four new string attributes: function-inline-cost, function-inline-threshold, call-inline-cost and call-threshold-bonus. These attributes allow you to selectively override some aspects of InlineCost analysis. That would allow us to test inliner separately from the InlineCost analysis. That could be useful when you're trying to write tests for inliner and you need to test some very specific situation, like "the inline cost has to be this high", or "the threshold has to be this low". Right now every time someone does that, they have get creative to come up with a way to make the InlineCost give them the number they need (like adding ~30 load/add pairs for a trivial test). This process can be somewhat tedious which can discourage some people from writing enough tests for their changes. Also, that results in tests that are fragile and can be easily broken without anyone noticing it because the test writer can't explicitly control what input the inliner will get from the inline cost analysis. These new attributes will alleviate those problems to an extent. Reviewed By: mtrofin Differential Revision: https://reviews.llvm.org/D109033
2021-07-26[Inliner] Make the CallPenalty configurablePhilipp Krones1-7/+10
Tests with multiple benchmarks, like Embench [1], showed that the CallPenalty magic number has the most influence on inlining decisions when optimizing for size. On the other hand, there was no good default value for this parameter. Some benchmarks profited strongly from a reduced call penalty. On example is the picojpeg benchmark compiled for RISC-V, which got 6% smaller with a CallPenalty of 10 instead of 12. Other benchmarks increased in size, like matmult. This commit makes the compromise of turning the magic number constant of CallPenalty into a configurable value. This introduces the flag `--inline-call-penalty`. With that flag users can fine tune the inliner to their needs. The CallPenalty constant was also used for loops. This commit replaces the CallPenalty constant with a new LoopPenalty constant that is now used instead. This is a slimmed down version of https://reviews.llvm.org/D30899 [1]: https://github.com/embench/embench-iot Differential Revision: https://reviews.llvm.org/D105976
2021-07-25[llvm][Inline] Add interface to return cost-benefit stuffLiqiang Tao1-2/+9
Return cost-benefit stuff which is computed by cost-benefit analysis. Reviewed By: mtrofin Differential Revision: https://reviews.llvm.org/D105349
2021-07-22[NFC] Code cleanups in InlineCost.cpp.Jacob Hegna1-8/+9
- annotate const functions with "const" - replace C-style casts with static_cast Differential Revision: https://reviews.llvm.org/D105362
2021-07-20Fix Threshold overwrite bug in the Oz inlining model features.Jacob Hegna1-2/+2
Differential Revision: https://reviews.llvm.org/D106336
2021-07-09[NewPM] Consistently use 'simplifycfg' rather than 'simplify-cfg'Bjorn Pettersson1-1/+1
There was an alias between 'simplifycfg' and 'simplify-cfg' in the PassRegistry. That was the original reason for this patch, which effectively removes the alias. This patch also replaces all occurrances of 'simplify-cfg' by 'simplifycfg'. Reason for choosing that form for the name is that it matches the DEBUG_TYPE for the pass, and the legacy PM name and also how it is spelled out in other passes such as 'loop-simplifycfg', and in other options such as 'simplifycfg-merge-cond-stores'. I for some reason the name should be changed to 'simplify-cfg' in the future, then I think such a renaming should be more widely done and not only impacting the PassRegistry. Reviewed By: aeubanks Differential Revision: https://reviews.llvm.org/D105627
2021-07-02Unpack the CostEstimate feature in ML inlining models.Jacob Hegna1-16/+238
This change yields an additional 2% size reduction on an internal search binary, and an additional 0.5% size reduction on fuchsia. Differential Revision: https://reviews.llvm.org/D104751
2021-06-29[NFC] clang-format on InlineCost.cpp and InlineAdvisor.h.Jacob Hegna1-23/+20
2021-05-01[NFC] Use getParamByValType instead of pointee typeArthur Eubanks1-1/+1
To reduce dependence on pointee types for opaque pointers. Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D101706
2021-04-30[InlineCost] CallAnalyzer: use TTI info for extractvalue - they are free ↵Roman Lebedev1-4/+4
(PR50099) It seems incorrect to use TTI data in some places, and override it in others. In this case, TTI says that `extractvalue` are free, yet we bill them. While this doesn't address https://bugs.llvm.org/show_bug.cgi?id=50099 yet, it reduces the cost from 55 to 50 while the threshold is 45. Differential Revision: https://reviews.llvm.org/D101228
2021-04-29[InlineCost] Remove visitUnaryInstruction()Arthur Eubanks1-23/+7
The simplifyInstruction() in visitUnaryInstruction() does not trigger for all of check-llvm. Looking at all delegates to UnaryInstruction in InstVisitor, the only instructions that either don't have a visitor in CallAnalyzer, or redirect to UnaryInstruction, are VAArgInst and Alloca. VAArgInst will never get simplified, and visitUnaryInstruction(Alloca) would always return false anyway. Reviewed By: mtrofin, lebedev.ri Differential Revision: https://reviews.llvm.org/D101577
2021-04-12[Inliner] Propagate SROA analysis through invariant group intrinsicsArthur Eubanks1-0/+5
SROA can handle invariant group intrinsics, let the inliner know that for better heuristics when the intrinsics are present. This fixes size issues in a couple files when turning on -fstrict-vtable-pointers in Chrome. Reviewed By: rnk, mtrofin Differential Revision: https://reviews.llvm.org/D100249
2021-03-31[InlineCost] Remove TODO comment that consider other forms of savings in the ↵Liqiang Tao1-3/+0
cost-benefit analysis Attempts to compute savings more accurately cannot impact the set of critically important call sites. Reviewed By: kazu Differential Revision: https://reviews.llvm.org/D98577
2021-03-31NFC: Change getUserCost to return InstructionCostSander de Smalen1-11/+11
This patch migrates the TTI cost interfaces to return an InstructionCost. See this patch for the introduction of the type: https://reviews.llvm.org/D91174 See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html Depends on D97382 Reviewed By: ctetreau, paulwalker-arm Differential Revision: https://reviews.llvm.org/D97466
2021-03-25Reapply [InlineCost] Enable the cost benefit analysis on FDOKazu Hirata1-3/+10
This patch enables the cost-benefit-analysis-based inliner by default if we have instrumentation profile. - SPEC CPU 2017 shows a 0.4% improvement. - An internal large benchmark shows a 0.9% reduction in the cycle count along with 14.6% reduction in the number of call instructions executed. Differential Revision: https://reviews.llvm.org/D98213
2021-03-25[InlineCost] Reject a zero entry countKazu Hirata1-2/+4
This patch teaches the cost-benefit-analysis-based inliner to reject a zero entry count so that we don't trigger a divide-by-zero.
2021-03-25Revert "[InlineCost] Enable the cost benefit analysis on FDO"Nico Weber1-10/+3
This reverts commit ef69aa961d12dee2141a79b05c9637d8cc9c0c74. Makes clang assert in PGO builds, see repro tgz in https://bugs.chromium.org/p/chromium/issues/detail?id=1192783#c6
2021-03-24[InlineCost] Make cost-benefit decision explicitWenlei He1-0/+15
With cost-benefit analysis for inlining, we bypass the cost-threshold by returning inline result from call analyzer early. However the cost and threshold are still available from call analyzer, and when cost is actually higher than threshold, we incorrect set the reason. The change makes the decision from cost-benefit analysis explicit. It's mostly NFC, except that it allows the priority-based sample loader inliner used by CSSPGO to use cost-benefit heuristic. Differential Revision: https://reviews.llvm.org/D99302
2021-03-24[InlineCost] Enable the cost benefit analysis on FDOKazu Hirata1-3/+10
This patch enables the cost-benefit-analysis-based inliner by default if we have instrumentation profile. - SPEC CPU 2017 shows a 0.4% improvement. - An internal large benchmark shows a 0.9% reduction in the cycle count along with 14.6% reduction in the number of call instructions executed. Differential Revision: https://reviews.llvm.org/D98213
2021-03-12[AMDGPU] Fix -amdgpu-inline-arg-alloca-costStanislav Mekhanoshin1-1/+2
Before D94153 this threshold was in a pre-scaled units. After D94153 inlining threshold multiplier is not applied to this portion of the threshold anymore. Restore the threshold by applying the multiplier. Differential Revision: https://reviews.llvm.org/D98362
2021-01-21[AMDGPU][Inliner] Remove amdgpu-inline and add a new TTI inline hookArthur Eubanks1-0/+1
Having a custom inliner doesn't really fit in with the new PM's pipeline. It's also extra technical debt. amdgpu-inline only does a couple of custom things compared to the normal inliner: 1) It disables inlining if the number of BBs in a function would exceed some limit 2) It increases the threshold if there are pointers to private arrays(?) These can all be handled as TTI inliner hooks. There already exists a hook for backends to multiply the inlining threshold. This way we can remove the custom amdgpu-inline pass. This caused inline-hint.ll to fail, and after some investigation, it looks like getInliningThresholdMultiplier() was previously getting applied twice in amdgpu-inline (https://reviews.llvm.org/D62707 fixed it not applying at all, so some later inliner change must have fixed something), so I had to change the threshold in the test. Reviewed By: rampitec Differential Revision: https://reviews.llvm.org/D94153
2021-01-05[Inliner] Compute the full cost for the cost benefit analsysisKazu Hirata1-1/+2
This patch teaches the inliner to compute the full cost for a call site where the newly introduced cost benefit analysis is enabled. Note that the cost benefit analysis requires the full cost to be computed. However, without this patch or the -inline-cost-full option, the early termination logic would kick in when the cost exceeds the threshold, so we don't get to perform the cost benefit analysis. For this reason, we would need to specify four clang options: -mllvm -inline-cost-full -mllvm -inline-enable-cost-benefit-analysis This patch eliminates the need to specify -inline-cost-full. Differential Revision: https://reviews.llvm.org/D93658
2020-12-18[InlineCost] Implement cost-benefit-based inlinerKazu Hirata1-0/+178
This patch adds an alternative cost metric for the inliner to take into account both the cost (i.e. size) and cycle count savings into account. Without this patch, we decide to inline a given call site if the size of inlining the call site is below the threshold that is computed according to the hotness of the call site. This patch adds a new cost metric, turned off by default, to take over the handling of hot call sites. Specifically, with the new cost metric, we decide to inline a given call site if the ratio of cycle savings to size exceeds a threshold. The cycle savings are computed from call site costs, parameter propagation, folded conditional branches, etc, all weighted by their respective profile counts. The size is primarily the callee size, but we subtract call site costs and the size of basic blocks that are never executed. The new cost metric implicitly takes advantage of the machine function splitter recently introduced by Snehasish Kumar, which dramatically reduces the cost of duplicating (e.g. inlining) cold basic blocks by placing cold basic blocks of hot functions in the .text.split section. We evaluated the new cost metric on clang bootstrap and SPECInt 2017. For clang bootstrap, we observe 0.69% runtime improvement. For SPECInt we report the change in IntRate the C/C++ benchmarks. All benchmarks apart from perlbench and omnetpp improve, on average by 0.21% with the max for mcf at 1.96%. Benchmark % Change 500.perlbench_r -0.45 502.gcc_r 0.13 505.mcf_r 1.96 520.omnetpp_r -0.28 523.xalancbmk_r 0.49 525.x264_r 0.00 531.deepsjeng_r 0.00 541.leela_r 0.35 557.xz_r 0.21 Differential Revision: https://reviews.llvm.org/D92780
2020-12-08[coroutine] should disable inline before calling coro splitXun Li1-0/+7
This is a rework of D85812, which didn't land. When callee coroutine function is inlined into caller coroutine function before coro-split pass, llvm will emits "coroutine should have exactly one defining @llvm.coro.begin". It seems that coro-early pass can not handle this quiet well. So we believe that unsplited coroutine function should not be inlined. This patch fix such issue by not inlining function if it has attribute "coroutine.presplit" (it means the function has not been splited) to fix this issue test plan: check-llvm, check-clang In D85812, there was suggestions on moving the macros to Attributes.td to avoid circular header dependency issue. I believe it's not worth doing just to be able to use one constant string in one place. Today, there are already 3 possible attribute values for "coroutine.presplit": https://github.com/llvm/llvm-project/blob/c6543cc6b8f107b58e7205d8fc64865a508bacba/llvm/lib/Transforms/Coroutines/CoroInternal.h#L40-L42 If we move them into Attributes.td, we would be adding 3 new attributes to EnumAttr, just to support this, which I think is an overkill. Instead, I think the best way to do this is to add an API in Function class that checks whether this function is a coroutine, by checking the attribute by name directly. Differential Revision: https://reviews.llvm.org/D92706
2020-12-02[Inline] prevent inlining on stack protector mismatchNick Desaulniers1-3/+13
It's common for code that manipulates the stack via inline assembly or that has to set up its own stack canary (such as the Linux kernel) would like to avoid stack protectors in certain functions. In this case, we've been bitten by numerous bugs where a callee with a stack protector is inlined into an attribute((no_stack_protector)) caller, which generally breaks the caller's assumptions about not having a stack protector. LTO exacerbates the issue. While developers can avoid this by putting all no_stack_protector functions in one translation unit together and compiling those with -fno-stack-protector, it's generally not very ergonomic or as ergonomic as a function attribute, and still doesn't work for LTO. See also: https://lore.kernel.org/linux-pm/20200915172658.1432732-1-rkir@google.com/ https://lore.kernel.org/lkml/20200918201436.2932360-30-samitolvanen@google.com/T/#u SSP attributes can be ordered by strength. Weakest to strongest, they are: ssp, sspstrong, sspreq. Callees with differing SSP attributes may be inlined into each other, and the strongest attribute will be applied to the caller. (No change) After this change: * A callee with no SSP attributes will no longer be inlined into a caller with SSP attributes. * The reverse is also true: a callee with an SSP attribute will not be inlined into a caller with no SSP attributes. * The alwaysinline attribute overrides these rules. Functions that get synthesized by the compiler may not get inlined as a result if they are not created with the same stack protector function attribute as their callers. Alternative approach to https://reviews.llvm.org/D87956. Fixes pr/47479. Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed By: rnk, MaskRay Differential Revision: https://reviews.llvm.org/D91816
2020-11-30[InlineCost] prefer range-for. NFCNick Desaulniers1-23/+23
Prefer range-for over iterators when such methods exist. Precommitted from https://reviews.llvm.org/D91816. Signed-off-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed By: dblaikie Differential Revision: https://reviews.llvm.org/D92350
2020-11-26[InlineCost] Fix indentation (NFC)Kazu Hirata1-1/+1
2020-11-23[Inline] Fix in handling of ptrtoint in InlineCostMikael Holmen1-1/+1
ConstantOffsetPtrs contains mappings from a Value to a base pointer and an offset. The offset is typed and has a size, and at least when dealing with ptrtoint, it could happen that we had a mapping from a ptrtoint with type i32 to an offset with type i16. This could later cause problems, showing up in PR 47969 and PR 38500. In PR 47969 we ended up in an assert complaining that trunc i16 to i16 is invalid and in Pr 38500 that a cmp on an i32 and i16 value isn't valid. Reviewed By: spatel Differential Revision: https://reviews.llvm.org/D90610
2020-11-20[CSSPGO] IR intrinsic for pseudo-probe block instrumentationHongtao Yu1-0/+4
This change introduces a new IR intrinsic named `llvm.pseudoprobe` for pseudo-probe block instrumentation. Please refer to https://reviews.llvm.org/D86193 for the whole story. A pseudo probe is used to collect the execution count of the block where the probe is instrumented. This requires a pseudo probe to be persisting. The LLVM PGO instrumentation also instruments in similar places by placing a counter in the form of atomic read/write operations or runtime helper calls. While these operations are very persisting or optimization-resilient, in theory we can borrow the atomic read/write implementation from PGO counters and cut it off at the end of compilation with all the atomics converted into binary data. This was our initial design and we’ve seen promising sample correlation quality with it. However, the atomics approach has a couple issues: 1. IR Optimizations are blocked unexpectedly. Those atomic instructions are not going to be physically present in the binary code, but since they are on the IR till very end of compilation, they can still prevent certain IR optimizations and result in lower code quality. 2. The counter atomics may not be fully cleaned up from the code stream eventually. 3. Extra work is needed for re-targeting. We choose to implement pseudo probes based on a special LLVM intrinsic, which is expected to have most of the semantics that comes with an atomic operation but does not block desired optimizations as much as possible. More specifically the semantics associated with the new intrinsic enforces a pseudo probe to be virtually executed exactly the same number of times before and after an IR optimization. The intrinsic also comes with certain flags that are carefully chosen so that the places they are probing are not going to be messed up by the optimizer while most of the IR optimizations still work. The core flags given to the special intrinsic is `IntrInaccessibleMemOnly`, which means the intrinsic accesses memory and does have a side effect so that it is not removable, but is does not access memory locations that are accessible by any original instructions. This way the intrinsic does not alias with any original instruction and thus it does not block optimizations as much as an atomic operation does. We also assign a function GUID and a block index to an intrinsic so that they are uniquely identified and not merged in order to achieve good correlation quality. Let's now look at an example. Given the following LLVM IR: ``` define internal void @foo2(i32 %x, void (i32)* %f) !dbg !4 { bb0: %cmp = icmp eq i32 %x, 0 br i1 %cmp, label %bb1, label %bb2 bb1: br label %bb3 bb2: br label %bb3 bb3: ret void } ``` The instrumented IR will look like below. Note that each `llvm.pseudoprobe` intrinsic call represents a pseudo probe at a block, of which the first parameter is the GUID of the probe’s owner function and the second parameter is the probe’s ID. ``` define internal void @foo2(i32 %x, void (i32)* %f) !dbg !4 { bb0: %cmp = icmp eq i32 %x, 0 call void @llvm.pseudoprobe(i64 837061429793323041, i64 1) br i1 %cmp, label %bb1, label %bb2 bb1: call void @llvm.pseudoprobe(i64 837061429793323041, i64 2) br label %bb3 bb2: call void @llvm.pseudoprobe(i64 837061429793323041, i64 3) br label %bb3 bb3: call void @llvm.pseudoprobe(i64 837061429793323041, i64 4) ret void } ``` Reviewed By: wmi Differential Revision: https://reviews.llvm.org/D86490
2020-08-17[InlineCost] Fix scalable vectors in visitAllocaCullen Rhodes1-2/+2
Discovered as part of the VLS type work (see D85128). Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D85848
2020-06-25[InlineCost] GetElementPtr with constant operandsKirill Naumov1-0/+14
If the GEP instruction contanins only constants as its arguments, then it should be recognized as a constant. For now, there was also added a flag to turn off this simplification if it causes any regressions ("disable-gep-const-evaluation") which is off by default. Once I gather needed data of the effectiveness of this simplification, the flag will be deleted. Reviewers: apilipenko, davidxl, mtrofin Reviewed By: mtrofin Differential Revision: https://reviews.llvm.org/D81026
2020-06-24Don't inline dynamic allocas that simplify to huge static allocas.Amara Emerson1-0/+12
Some sequences of optimizations can generate call sites which may never be executed during runtime, and through constant propagation result in dynamic allocas being converted to static allocas with very large allocation amounts. The inliner tries to move these to the caller's entry block, resulting in the stack limits being reached/bypassed. Avoid inlining functions if this would result. The threshold of 64k currently doesn't get triggered on the test suite with an -Os LTO build on arm64, care should be taken in changing this in future to avoid needlessly pessimising inlining behaviour. Differential Revision: https://reviews.llvm.org/D81765
2020-06-24[InlineCost] PrinterPass prints constants to which instructions are simplifiedKirill Naumov1-0/+11
This patch enables printing of constants to see which instructions were constant-folded. Needed for tests and better visiual analysis of inliner's work. Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev Reviewed By: mtrofin Differential Revision: https://reviews.llvm.org/D81024
2020-06-24[InlineCost] InlineCostAnnotationWriterPass introducedKirill Naumov1-0/+37
This class allows to see the inliner's decisions for better optimization verifications and tests. To use, use flag "-passes="print<inline-cost>"". This is the second attempt to integrate the patch. The problem from the first try has been discussed and fixed in D82205. Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev Reviewed By: mtrofin Differential revision: https://reviews.llvm.org/D81743
2020-06-24[InlineCost] Added InlineCostCallAnalyzer::print()Kirill Naumov1-3/+11
For the upcoming changes, we need to have an ability to dump InlineCostCallAnalyzer info in non-debug builds as well. Reviewed-By: mtrofin Differential Revision: https://reviews.llvm.org/D82205
2020-06-20[Analysis/Transforms/Sanitizers] As part of using inclusive languageEric Christopher1-1/+2
within the llvm project, migrate away from the use of blacklist and whitelist.
2020-06-17Revert "[InlineCost] InlineCostAnnotationWriterPass introduced"Kirill Naumov1-37/+0
This reverts commit 37e06e8f5c6ee39a1d7cbaf7d5f5a3ebfa1b4e15.
2020-06-17Revert "[InlineCost] PrinterPass prints constants to which instructions are ↵Kirill Naumov1-12/+1
simplified" This reverts commit 52b0db22f8cfb594c32389224570681d2d2c2f21.
2020-06-17Revert "[InlineCost] GetElementPtr with constant operands"Kirill Naumov1-14/+0
This reverts commit 34fba68d80051e3c53e7843157c036f6d511ae03.
2020-06-17[InlineCost] GetElementPtr with constant operandsKirill Naumov1-0/+14
If the GEP instruction contanins only constants as its arguments, then it should be recognized as a constant. For now, there was also added a flag to turn off this simplification if it causes any regressions ("disable-gep-const-evaluation") which is off by default. Once I gather needed data of the effectiveness of this simplification, the flag will be deleted. Reviewers: apilipenko, davidxl, mtrofin Reviewed By: mtrofin Differential Revision: https://reviews.llvm.org/D81026
2020-06-17[InlineCost] PrinterPass prints constants to which instructions are simplifiedKirill Naumov1-1/+12
This patch enables printing of constants to see which instructions were constant-folded. Needed for tests and better visiual analysis of inliner's work. Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev Reviewed By: mtrofin Differential Revision: https://reviews.llvm.org/D81024
2020-06-17[InlineCost] InlineCostAnnotationWriterPass introducedKirill Naumov1-0/+37
This class allows to see the inliner's decisions for better optimization verifications and tests. To use, use flag "-passes="print<inline-cost>"". Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev Reviewed By: mtrofin Differential revision: https://reviews.llvm.org/D81743
2020-06-11[InlineCost] Preparational patch for creation of Printer pass.Kirill Naumov1-31/+43
- Renaming the printer class, flag - Refactoring - Changing some tests This patch is a preparational stage for introducing a new printing pass and new functionality to the existing Annotation Writer. I plan to extend this functionality for this tool to be more useful when looking at the inline process.
2020-06-04[Inlining] Introduce -enable-npm-pgo-inline-deferralKazu Hirata1-1/+2
Summary: Experiments show that inline deferral past pre-inlining slightly pessimizes the performance. This patch introduces an option to control inline deferral during PGO. The option defaults to true for now (that is, NFC). Reviewers: davidxl Reviewed By: davidxl Subscribers: eraman, hiraditya, haicheng, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D80776
2020-05-15Revert "Revert "[llvm][NFC] Cleanup uses of std::function in ↵Mircea Trofin1-27/+37
Inlining-related APIs"" This reverts commit 454de99a6fec705e76ed7743bf538f7a77296f59. 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
2020-05-14Revert "[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs"Mircea Trofin1-29/+27
This reverts commit 767db5be67cab5aa04d81227725765cad9620611.