- Apr 10, 2020
-
-
Mircea Trofin authored
Summary: *Almost* all uses are replaced. Left FIXMEs for the two sites that require refactoring outside of Inliner, to scope this patch. Subscribers: eraman, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D77817
-
- Apr 09, 2020
-
-
Johannes Doerfert authored
Attributor.cpp became quite big and we need to start provide structure. The Attributor code is now in Attributor.cpp and the classes derived from AbstractAttribute are in AttributorAttributes.cpp. Minor changes were required but no intended functional changes. We also minimized includes as part of this. Reviewed By: baziotis Differential Revision: https://reviews.llvm.org/D76873
-
- Apr 08, 2020
-
-
Fangrui Song authored
dso_local leads to direct access even if the definition is not within this compilation unit (it is still in the same linkage unit). On ELF, such a relocation (e.g. R_X86_64_PC32) referencing a STB_GLOBAL STV_DEFAULT object can cause a linker error in a -shared link. If the linkage is changed to available_externally, the dso_local flag should be dropped, so that no direct access will be generated. The current behavior is benign, because -fpic does not assume dso_local (clang/lib/CodeGen/CodeGenModule.cpp:shouldAssumeDSOLocal). If we do that for -fno-semantic-interposition (D73865), there will be an R_X86_64_PC32 linker error without this patch. Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D74751
-
- Apr 07, 2020
-
-
Eli Friedman authored
Use the current getAlign() APIs where it makes sense, and use Align instead of MaybeAlign when we know the value is non-zero.
-
Eli Friedman authored
Now that we have scalable vectors, there's a distinction that isn't getting captured in the original SequentialType: some vectors don't have a known element count, so counting the number of elements doesn't make sense. In some cases, there's a better way to express the commonality using other methods. If we're dealing with GEPs, there's GEP methods; if we're dealing with a ConstantDataSequential, we can query its element type directly. In the relatively few remaining cases, I just decided to write out the type checks. We're talking about relatively few places, and I think the abstraction doesn't really carry its weight. (See thread "[RFC] Refactor class hierarchy of VectorType in the IR" on llvmdev.) Differential Revision: https://reviews.llvm.org/D75661
-
- Apr 06, 2020
-
-
Tarindu Jayatilaka authored
The new and old pass managers (PassManagerBuilder.cpp and PassBuilder.cpp) are exposed to an `extern` declaration of `attributor-disable` option which will guard the addition of the attributor passes to the pass pipelines. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D76871
-
- Apr 05, 2020
-
-
Stefanos Baziotis authored
Query AAValueSimplify on pointers in memory accessing instructions to take advantage of the constant propagation (or any other value simplification) of such values.
-
- Apr 04, 2020
-
-
Luofan Chen authored
This patch is based on D63312 and D63319. For now we create shallow wrappers for all functions that are IPO amendable. See also [this github issue](https://github.com/llvm/llvm-project/issues/172). Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D76404
-
- Apr 03, 2020
-
-
Hongtao Yu authored
Summary: A recent change in the instruction simplifier enables a call to a function that just returns one of its parameter to be simplified as simply loading the parameter. This exposes a bug in the inliner where double inlining may be involved which in turn may cause compiler ICE when an already-inlined callsite is reused for further inlining. To put it simply, in the following-like C program, when the function call second(t) is inlined, its code t = third(t) will be reduced to just loading the return value of the callsite first(). This causes the inliner internal data structure to register the first() callsite for the call edge representing the third() call, therefore incurs a double inlining when both call edges are considered an inline candidate. I'm making a fix to break the inliner from reusing a callsite for new call edges. ``` void top() { int t = first(); second(t); } void second(int t) { t = third(t); fourth(t); } void third(int t) { return t; } ``` The actual failing case is much trickier than the example here and is only reproducible with the legacy inliner. The way the legacy inliner works is to process each SCC in a bottom-up order. That means in reality function first may be already inlined into top, or function third is either inlined to second or is folded into nothing. To repro the failure seen from building a large application, we need to figure out a way to confuse the inliner so that the bottom-up inlining is not fulfilled. I'm doing this by making the second call indirect so that the alias analyzer fails to figure out the right call graph edge from top to second and top can be processed before second during the bottom-up. We also need to tweak the test code so that when the inlining of top happens, the function body of second is not that optimized, by delaying the pass of function attribute deducer (i.e, which tells function third has no side effect and just returns its parameter). Since the CGSCC pass is iterative, additional calls are added to top to postpone the inlining of second to the second round right after the first function attribute deducing pass is done. I haven't been able to repro the failure with the new pass manager since the processing order of ininlined callsites is a bit different, but in theory the issue could happen there too. Note that this fix could introduce a side effect that blocks the simplification of inlined code, specifically for a call site that can be folded to another call site. I hope this can probably be complemented by subsequent inlining or folding, as shown in the attached unit test. The ideal fix should be to separate the use of VMap. However, in reality this failing pattern shouldn't happen often. And even if it happens, there should be a good chance that the non-folded call site will be refolded by iterative inlining or subsequent simplification. Reviewers: wenlei, davidxl, tejohnson Reviewed By: wenlei, davidxl Subscribers: eraman, nikic, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D76248
-
- Apr 02, 2020
-
-
Johannes Doerfert authored
There was a TODO in genericValueTraversal to provide the context instruction and due to the lack of it users that wanted one just used something available. Unfortunately, using a fixed instruction is wrong in the presence of PHIs so we need to update the context instruction properly. Reviewed By: uenoku Differential Revision: https://reviews.llvm.org/D76870
-
Johannes Doerfert authored
This cannot be triggered right now, as far as I know, but it doesn't make sense to deduce a constant range on arguments of declarations. Exposed during testing of AAValueSimplify extensions.
-
Johannes Doerfert authored
It could happen that we delete the first function in the SCC in the future so we should be careful accessing `Functions` after the manifest stage.
-
Johannes Doerfert authored
Use DL & ABI information for better alignment deduction, e.g., if a type is accessed and the ABI specifies an alignment requirement for such an access we can use it. This is based on a patch by @lebedev.ri and inspired by getBaseAlign in Loads.cpp. Depends on D76673. Reviewed By: lebedev.ri Differential Revision: https://reviews.llvm.org/D76674
-
Johannes Doerfert authored
If we have a must-tail call the callee and caller need to have matching ABIs. Part of that is alignment which we might modify when we deduce alignment of arguments of either. Since we would need to keep them in sync, which is not as simple, we simply avoid deducing alignment for arguments of the must-tail caller or callee. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D76673
-
Johannes Doerfert authored
We create a lot of AbstractAttributes and they live as long as the Attributor does. It seems reasonable to allocate them via a BumpPtrAllocator owned by the Attributor. Reviewed By: baziotis Differential Revision: https://reviews.llvm.org/D76589
-
- Apr 01, 2020
-
-
Uday Bondhugula authored
Make the attributor pass aware of aligned_alloc for converting heap allocations to stack ones. Depends on D76971. Differential Revision: https://reviews.llvm.org/D76974
-
- Mar 31, 2020
-
-
Wei Mi authored
Compbinary format uses MD5 to represent strings in name table. That gives smaller profile without the need of compression/decompression when writing/reading the profile. The patch adds the support in extbinary format. It is off by default but user can choose to enable it. Note the feature of using MD5 in name table can bring very small chance of name conflict leading to profile mismatch. Besides, profile using the feature won't have the profile remapping support. Differential Revision: https://reviews.llvm.org/D76255
-
- Mar 28, 2020
-
-
Uday Bondhugula authored
Minor update/fixes to comments for the Attributor pass, and dyn_cast -> cast. Signed-off-by:
Uday Bondhugula <uday@polymagelabs.com> Differential Revision: https://reviews.llvm.org/D76972
-
- Mar 24, 2020
-
-
Johannes Doerfert authored
This patch integrates operand bundle llvm.assumes [0] with the Attributor. Most IRAttributes will now look at uses of the associated value and if there are llvm.assume operand bundle uses with the right tag we will check if they are in the must-be-executed-context (around the context instruction). Droppable users, which is currently only llvm::assume, are handled special in some places now as well. [0] http://lists.llvm.org/pipermail/llvm-dev/2019-December/137632.html Reviewed By: uenoku Differential Revision: https://reviews.llvm.org/D74888
-
Vedant Kumar authored
PR35760 shows an example program which, when compiled with `clang -O0` or gcc at any optimization level, prints '0'. However, llvm transforms the program in a way that causes it to print '1'. Fix the issue by having `AllUsesOfValueWillTrapIfNull` return false when analyzing a load from a global which is used by an `icmp`. This special case was untested [0] so this is just deleting dead code. An alternative fix might be to change the GlobalStatus analysis for the global to report "Stored" instead of "StoredOnce". However, "StoredOnce" is appropriate when only one value other than the initializer is stored to the global. [0] http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/llvm/lib/Transforms/IPO/GlobalOpt.cpp.html#L662 Differential Revision: https://reviews.llvm.org/D76645
-
Johannes Doerfert authored
This should fix the issue reported here: https://reviews.llvm.org/D76058#1937554
-
- Mar 23, 2020
-
-
Stefanos Baziotis authored
Reviewed By: sstefan1, uenoku Differential Revision: https://reviews.llvm.org/D76175
-
Johannes Doerfert authored
Validation of the found runtime library functions declarations types (return and argument types) with the expected types. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D76058
-
Benjamin Kramer authored
Fixes unused variable warning in Release builds.
-
Johannes Doerfert authored
On IRC this was called a "code smell" so we get rid of it.
-
Johannes Doerfert authored
We did handle calls that were operands of certain instructions but not standalone calls we visit via indirection, e.g., selects.
-
Johannes Doerfert authored
We special cased must-tail calls all over the place because they cannot be modified as other calls can be. However, we already centralized the modification API so we can centralize the handling as well. This simplifies the code and allows to remove must-tail calls completely.
-
Johannes Doerfert authored
It could happen that we delete the first function in the SCC in the future so we should be careful accessing `Functions` after the manifest stage.
-
Johannes Doerfert authored
-
- Mar 22, 2020
-
-
Nikita Popov authored
D75801 removed the last and only user of this option, so we can drop it now. The original idea behind this was to only run expensive transforms under -O3, but apart from the one known bits transform, this has never really taken off. I believe nowadays the recommendation is to put expensive transforms in AggressiveInstCombine instead, though that isn't terribly popular either :) Differential Revision: https://reviews.llvm.org/D76540
-
- Mar 18, 2020
-
-
Eli Friedman authored
The existence of the class is more confusing than helpful, I think; the commonality is mostly just "GEP is legal", which can be queried using APIs on GetElementPtrInst. Differential Revision: https://reviews.llvm.org/D75660
-
- Mar 13, 2020
-
-
omarahmed1111 authored
This patch add mayContainUnboundedCycle helper function which checks whether a function has any cycle which we don't know if it is bounded or not. Loops with maximum trip count are considered bounded, any other cycle not. It also contains some fixed tests and some added tests contain bounded and unbounded loops and non-loop cycles. Reviewed By: jdoerfert, uenoku, baziotis Differential Revision: https://reviews.llvm.org/D74691
-
Pankaj Gode authored
Resolution for below fixme: (ii) Check whether the value is captured in the scope using AANoCapture. FIXME: This is conservative though, it is better to look at CFG and check only uses possibly executed before this callsite. Propagates caller argument's noalias attribute to callee. Reviewed by: jdoerfert, uenoku Reviewers: jdoerfert, sstefan1, uenoku Subscribers: uenoku, sstefan1, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D71617
-
Johannes Doerfert authored
Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D75590
-
rathod-sahaab authored
This patch aims to prevent warning-as-error failures in release build. As suggested in this comment https://reviews.llvm.org/D69930#1910922 Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D75970
-
- Mar 12, 2020
-
-
Hideto Ueno authored
-
- Mar 09, 2020
-
-
evgeny authored
Differential revision: https://reviews.llvm.org/D75617
-
Hideto Ueno authored
This patch introduces the propagation of known information based on path exploration. For example, ``` int u(int c, int *p){ if(c) { return *p; } else { return *p + 1; } } ``` An argument `p` is dereferenced whatever c's value is. For an instruction `CtxI`, we accumulate branch instructions in the must-be-executed-context of `CtxI` and then, we take the conjunction of the successors' known state. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D65593
-
- Mar 07, 2020
-
-
Stefanos Baziotis authored
It is possible that an instruction to be changed to unreachable is in the same block with a terminator that can be constant-folded. In this case, as of now, the instruction will be changed to unreachable before the terminator is folded. But, then the whole BB becomes invalidated and so when we go ahead to fold the terminator, we trap. Change the order of these two. Differential Revision: https://reviews.llvm.org/D75780
-
- Mar 06, 2020
-
-
Fangrui Song authored
If we infer the dso_local flag for -fpic, dso_local should be dropped when we convert a GlobalVariable a declaration. dso_local causes the generation of direct access (e.g. R_X86_64_PC32). Such relocations referencing STB_GLOBAL STV_DEFAULT objects are not allowed in a -shared link. Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D74749
-