Fangrui Song [Sat, 24 Aug 2019 02:50:42 +0000 (02:50 +0000)]
[LoopFusion] Fix -Wunused-function in -DLLVM_ENABLE_ASSERTIONS=off build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369836
91177308-0d34-0410-b5e6-
96231b3b80d8
Amara Emerson [Sat, 24 Aug 2019 02:39:51 +0000 (02:39 +0000)]
Remove unnecessary REQUIRES from a test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369835
91177308-0d34-0410-b5e6-
96231b3b80d8
Amara Emerson [Sat, 24 Aug 2019 02:25:56 +0000 (02:25 +0000)]
[GlobalISel] Introduce a G_DYN_STACKALLOC opcode to represent dynamic allocas.
This just adds the opcode and verifier, it will be used to replace existing
dynamic alloca handling in a subsequent patch.
Differential Revision: https://reviews.llvm.org/D66677
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369833
91177308-0d34-0410-b5e6-
96231b3b80d8
Vitaly Buka [Sat, 24 Aug 2019 01:44:39 +0000 (01:44 +0000)]
NFC: Rename lifetime-asan.ll -> lifetime-sanitizer.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369831
91177308-0d34-0410-b5e6-
96231b3b80d8
Guillaume Chatelet [Fri, 23 Aug 2019 23:19:25 +0000 (23:19 +0000)]
[LLVM][NFC] Removing unused functions
Summary: Removes a not so useful function from DataLayout and cleans up Support/MathExtras.h
Reviewers: courbet
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66691
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369824
91177308-0d34-0410-b5e6-
96231b3b80d8
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:22:49 +0000 (22:22 +0000)]
[AMDGPU] Check for immediate SrcC in mfma in AsmParser
Differential Revision: https://reviews.llvm.org/D66674
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369819
91177308-0d34-0410-b5e6-
96231b3b80d8
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:22:29 +0000 (22:22 +0000)]
[AMDGPU] w/a for gfx908 mfma SrcC literal HW bug
gfx908 ignores an mfma if SrcC is a literal.
Differential Revision: https://reviews.llvm.org/D66670
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369818
91177308-0d34-0410-b5e6-
96231b3b80d8
Stanislav Mekhanoshin [Fri, 23 Aug 2019 22:09:58 +0000 (22:09 +0000)]
[AMDGPU] w/a for gfx908 mfma SrcC literal HW bug
gfx908 ignores an mfma if SrcC is a literal.
Differential Revision: https://reviews.llvm.org/D66670
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369816
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Fri, 23 Aug 2019 21:37:20 +0000 (21:37 +0000)]
hwasan: Fix use of uninitialized memory.
Reported by e.g.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/23071/steps/build%20with%20ninja/logs/stdio
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369815
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Fri, 23 Aug 2019 21:15:27 +0000 (21:15 +0000)]
[x86] add tests for bt/test; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369812
91177308-0d34-0410-b5e6-
96231b3b80d8
Guillaume Chatelet [Fri, 23 Aug 2019 20:49:06 +0000 (20:49 +0000)]
[LLVM][NFC] remove unused fields
Summary:
Here is the commit introducing the fields
https://github.com/llvm/llvm-project/commit/
cf6749e4c091
It dates back from 2006 and was used by AArch64 backend.
There is no more reference to these fields in the whole codebase so I think it's fine.
Reviewers: courbet
Subscribers: javed.absar, kristof.beyls, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66683
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369810
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Fri, 23 Aug 2019 20:37:32 +0000 (20:37 +0000)]
[ORC] Remove query dependencies when symbols are resolved.
If the dependencies are not removed then a late failure (one symbol covered by
the query failing after others have already been resolved) can result in an
attempt to detach the query from already finalized symbol, resulting in an
assert/crash. This patch fixes the issue by removing query dependencies in
JITDylib::resolve for symbols that meet the required state.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369809
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Fri, 23 Aug 2019 20:37:31 +0000 (20:37 +0000)]
[ORC] Fix a FIXME: Propagate errors to dependencies.
When symbols are failed (via MaterializationResponsibility::failMaterialization)
any symbols depending on them will now be moved to an error state. Attempting
to resolve or emit a symbol in the error state (via the notifyResolved or
notifyEmitted methods on MaterializationResponsibility) will result in an error.
If notifyResolved or notifyEmitted return an error due to failure of a
dependence then the caller should log or discard the error and call
failMaterialization to propagate the failure to any queries waiting on the
symbols being resolved/emitted (plus their dependencies).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369808
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Fri, 23 Aug 2019 20:37:26 +0000 (20:37 +0000)]
[ORC] Fix an incorrect comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369807
91177308-0d34-0410-b5e6-
96231b3b80d8
Jessica Paquette [Fri, 23 Aug 2019 20:31:34 +0000 (20:31 +0000)]
[AArch64][GlobalISel] Import XRO load/store patterns instead of custom selection
Instead of using custom C++ in `earlySelect` for loads and stores, just import
the patterns.
Remove `earlySelectLoad`, since we can just import the work it's doing.
Some minor changes to how `ComplexRendererFns` are returned for the XRO
addressing modes. If you add immediates in two steps, sometimes they are not
imported properly and you only end up with one immediate. I'm not sure if this
is intentional.
- Update load-addressing-modes.mir to include the instructions we can now
import.
- Add a similar test, store-addressing-modes.mir to show which store opcodes we
currently import, and show that we can pull in shifts etc.
- Update arm64-fastisel-gep-promote-before-add.ll to use FastISel instead of
GISel. This test failed with GISel because GISel folds the gep into the load.
The test checks that FastISel doesn't fold non-pointer-width adds into loads.
GISel on the other hand, produces a G_CONSTANT of -128 for the add, and then
a G_GEP, which must be pointer-width.
Note that we don't get STRBRoX right now. It seems like the importer can't
handle `FPR8Op:{ *:[Untyped] }:$Rt` source operands. So, those are not currently
supported.
Differential Revision: https://reviews.llvm.org/D66679
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369806
91177308-0d34-0410-b5e6-
96231b3b80d8
Volkan Keles [Fri, 23 Aug 2019 20:30:35 +0000 (20:30 +0000)]
[GlobalISel] Legalizer: Retry combining illegal artifacts as long as there new artifacts
Summary:
Currently, Legalizer aborts if it’s unable to legalize artifacts. However, it’s
possible to combine them after processing the rest of the instruction because
the legalization is likely to generate more artifacts that allow ArtifactCombiner
to combine away them.
Instead, move illegal artifacts to another list called RetryList and wait until all of the
instruction in InstList are legalized. After that, check if there is any new artifacts and
try to combine them again if that’s the case. If not, abort. The idea is similar to D59339,
but the approach is a bit different.
This patch fixes the issue described above, but the legalizer still may be unable to handle
some cases depending on when to legalize artifacts. So, in the long run, we probably need
a different legalization strategy that handles this dependency in a better way.
Reviewers: dsanders, aditya_nandakumar, qcolombet, arsenm, aemerson, paquette
Reviewed By: dsanders
Subscribers: jvesely, wdng, nhaehnle, rovka, javed.absar, hiraditya, Petar.Avramovic, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65894
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369805
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 20:20:10 +0000 (20:20 +0000)]
[Attributor] Manifest alignment in load and store instructions
Summary:
We can now manifest alignment information in load/store instructions if
the pointer is known to have a better alignment.
Reviewers: uenoku, sstefan1, lebedev.ri
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66567
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369804
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 23 Aug 2019 19:59:23 +0000 (19:59 +0000)]
Do a sweep of symbol internalization. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369803
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 23 Aug 2019 19:52:24 +0000 (19:52 +0000)]
[X86] Move a transform out of combineConcatVectorOps so we don't prematurely turn CONCAT_VECTORS into INSERT_SUBVECTORS.
CONCAT_VECTORS and INSERT_SUBVECTORS can both call combineConcatVectorOps,
but we shouldn't produce INSERT_SUBVECTORS from there. We should
keep CONCAT_VECTORS until vector legalization.
Noticed while looking at the madd_quad_reduction test from madd.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369802
91177308-0d34-0410-b5e6-
96231b3b80d8
Wei Mi [Fri, 23 Aug 2019 19:39:12 +0000 (19:39 +0000)]
Fix some warnings introduced by r369798.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369799
91177308-0d34-0410-b5e6-
96231b3b80d8
Wei Mi [Fri, 23 Aug 2019 19:05:30 +0000 (19:05 +0000)]
[SampleFDO] Add ExtBinary format to support extension of binary profile.
This is a patch split from https://reviews.llvm.org/D66374. It tries to add
a new format of profile called ExtBinary. The format adds a section header
table to the profile and organize the profile in sections, so the future
extension like adding a new section or extending an existing section will be
easier while keeping backward compatiblity feasible.
Differential Revision: https://reviews.llvm.org/D66513
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369798
91177308-0d34-0410-b5e6-
96231b3b80d8
Roland Froese [Fri, 23 Aug 2019 19:04:47 +0000 (19:04 +0000)]
[PowerPC] Expand v1i128 smin
The smin opcode and friends for v1i128 are incorrectly marked as legal for PPC.
Change them to expand.
Differential Revision: https://reviews.llvm.org/D64960
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369797
91177308-0d34-0410-b5e6-
96231b3b80d8
Philip Reames [Fri, 23 Aug 2019 18:27:57 +0000 (18:27 +0000)]
Fix a bug in just submitted rL369789
Started implementing the vector case and realized the scalar case hadn't handled the GEP producing a different type than the base correctly. It's entertaining seeing what slips through review when we're focused on the 'hard' parts. :(
Also adding an extra vector test as it happened to be in workspace and wasn't worth separating.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369795
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 23 Aug 2019 18:25:34 +0000 (18:25 +0000)]
RegScavenger: Use Register
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369794
91177308-0d34-0410-b5e6-
96231b3b80d8
Amaury Sechet [Fri, 23 Aug 2019 18:12:33 +0000 (18:12 +0000)]
[X86] Automatically generate load-local-v3i1.ll . NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369793
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 23 Aug 2019 18:05:37 +0000 (18:05 +0000)]
[X86] Mark VPDPWSSD and VPDPWSSDS as commutable. Add stack folding tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369792
91177308-0d34-0410-b5e6-
96231b3b80d8
Manoj Gupta [Fri, 23 Aug 2019 18:01:13 +0000 (18:01 +0000)]
Revert r369233.
This breaks building of some projects like libfuse and alsa-lib
that now fail when linking.
Error details in PR43092.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369790
91177308-0d34-0410-b5e6-
96231b3b80d8
Philip Reames [Fri, 23 Aug 2019 17:58:58 +0000 (17:58 +0000)]
[InstCombine] icmp eq/ne (gep inbounds P, Idx..), null -> icmp eq/ne P, null
This generalizes the isGEPKnownNonNull rule from ValueTracking to apply when we do not know if the base is non-null, and thus need to replace one condition with another.
The core notion is that since an inbounds GEP can only form null if the base pointer is null and the offset is zero. However, if the offset is non-zero, the the "inbounds" marker makes the result poison. Thus, we're free to ignore the case where the offset is non-zero. Similarly, there's no case under which a non-null base can result in a null result without generating poison.
Differential Revision: https://reviews.llvm.org/D66608
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369789
91177308-0d34-0410-b5e6-
96231b3b80d8
Amaury Sechet [Fri, 23 Aug 2019 17:58:49 +0000 (17:58 +0000)]
[AMDGPU] Automatically generate various tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369787
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 17:56:10 +0000 (17:56 +0000)]
[BasicAA] Use dereferenceability to reason about aliasing
Summary:
We already use the fact that an object with known size X does not alias
another objection of size Y > X before. With this commit, we use
dereferenceability information to determine a lower bound for Y and not
only rely on the user provided query size.
The result for @global_and_deref_arg_2() and @local_and_deref_ret_2()
in test/Analysis/BasicAA/dereferenceable.ll improved with this patch.
Reviewers: asbirlea, chandlerc, hfinkel, sanjoy
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66157
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369786
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 17:41:37 +0000 (17:41 +0000)]
[Attributor] Manifest constant return values
Summary:
If the unique return value is a constant we now replace call uses with
that constant.
Reviewers: sstefan1, uenoku
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66551
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369785
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 17:29:23 +0000 (17:29 +0000)]
[Attributor] Deal with shrinking dereferenceability in a loop
Summary:
If we have a loop in which the dereferenceability of a pointer decreases
we did slowly decrease it iteration by iteration, leading to a timeout.
With this patch we detect such circular reasoning and indicate a
fixpoint early.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66558
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369784
91177308-0d34-0410-b5e6-
96231b3b80d8
Nathan Huckleberry [Fri, 23 Aug 2019 17:25:21 +0000 (17:25 +0000)]
Allow Compiler.h to be included in C files and fix fallthrough warnings
Summary:
Since clang does not support comment style fallthrough annotations
these should be switched to macros defined in Compiler.h. This
requires some fixing to Compiler.h.
Original patch: https://reviews.llvm.org/D66487
Reviewers: nickdesaulniers, aaron.ballman, xbolva00, rsmith
Reviewed By: nickdesaulniers, aaron.ballman, rsmith
Subscribers: rsmith, sfertile, ormris, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66609
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369782
91177308-0d34-0410-b5e6-
96231b3b80d8
Shafik Yaghmour [Fri, 23 Aug 2019 17:19:21 +0000 (17:19 +0000)]
Debug Info: Support for DW_AT_export_symbols for anonymous structs
This implements the DWARF 5 feature described in:
http://dwarfstd.org/ShowIssue.php?issue=141212.1
To support recognizing anonymous structs:
struct A {
struct { // Anonymous struct
int y;
};
} a;
This patch adds a new (DI)flag to LLVM metadata:
ExportSymbols
Differential Revision: https://reviews.llvm.org/D66352
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369781
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 23 Aug 2019 17:14:58 +0000 (17:14 +0000)]
[SelectionDAG][X86] Enable iX SimplifyDemandedBits to vXi1 SimplifyDemandedVectorElts simplification. Add a hack to X86 to avoid a regression
Patch showing the effect of enabling bool vector oversimplification.
Non-VLX builds can simplify a kshift shuffle, but VLX builds simplify:
insert_subvector v8i zeroinitializer, v2i --> insert_subvector v8i undef, v2i
Preventing the removal of the AND to clear the upper bits of result
Differential Revision: https://reviews.llvm.org/D53022
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369780
91177308-0d34-0410-b5e6-
96231b3b80d8
Jeremy Morse [Fri, 23 Aug 2019 16:33:42 +0000 (16:33 +0000)]
[DebugInfo] Remove invalidated locations during LiveDebugValues
LiveDebugValues gives variable locations to blocks, but it should also take
away. There are various circumstances where a variable location is known
until a loop backedge with a different location is detected. In those
circumstances, where there's no agreement on the variable location, it
should be undef / removed, otherwise we end up picking a location that's
valid on some loop iterations but not others.
However, LiveDebugValues doesn't currently do this, see the new testcase
attached. Without this patch, the location of !3 is assumed to be %bar
through the loop. Once it's added to the In-Locations list, it's never
removed, even though the later dbg.value(0... of !3 makes the location
un-knowable.
This patch checks during block-location-joining to see whether any
previously-present locations have been removed in a predecessor. If they
have, the live-ins have changed, and the block needs reprocessing.
Similarly, in transferTerminator, assign rather than |= the Out-Locations
after processing a block, as we may have deleted some previously valid
locations. This will mean that LiveDebugValues performs more propagation
-- but that's necessary for it being correct.
Differential Revision: https://reviews.llvm.org/D66599
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369778
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Fri, 23 Aug 2019 16:22:32 +0000 (16:22 +0000)]
[SLP] use range-for loops, fix formatting; NFC
These are part of D57059, but that patch doesn't apply cleanly to trunk
at this point, so we might as well remove some of the noise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369776
91177308-0d34-0410-b5e6-
96231b3b80d8
Teresa Johnson [Fri, 23 Aug 2019 16:02:25 +0000 (16:02 +0000)]
Fix target for new X86 test
Test added in r369766 had the wrong target arch for the X86 directory,
leading to some bot failures. Fix it to have the appropriate target.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369774
91177308-0d34-0410-b5e6-
96231b3b80d8
Cameron McInally [Fri, 23 Aug 2019 15:49:38 +0000 (15:49 +0000)]
[Reassoc] Small fix to support unary FNeg in NegateValue(...)
Differential Revision: https://reviews.llvm.org/D66612
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369772
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 15:45:46 +0000 (15:45 +0000)]
[Attributor][Fix] Deal with "growing" dereferenceability
Summary:
If we have a negative inbounds offset dereferenceabily "grows". However,
until we do not handle the overflow that can occur in the
dereferenceable bytes and the problem with loops, we simply do not grow
the state.
Reviewers: sstefan1, uenoku
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66557
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369771
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 15:42:19 +0000 (15:42 +0000)]
[Attributor][NFCI] Avoid lookups when resolving returned values
If the number of potentially returned values not change since the last
traversal we do not need to visit the returned values again. This works
as we only add values to the returned values set now.
Differential Revision: https://reviews.llvm.org/D66484
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369770
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Fri, 23 Aug 2019 15:26:12 +0000 (15:26 +0000)]
[SLP] fix formatting; NFC
These are part of D57059, but that patch doesn't apply cleanly to trunk
at this point, so we might as well remove some of the noise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369769
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 15:24:57 +0000 (15:24 +0000)]
[Attributor] FIX: Treat new attributes as changed ones
Summary:
When we have new attributes and we end the fixpoint iteration because
the iteration limit is reached, we need to treat the new ones as if they
changed in the last iteration, as they might have.
This adds a test for which we should not derive anything regardless of
the iteration limit, e.g., if we abort there should not be any
attributes manifested in the IR.
Reviewers: uenoku, sstefan1
Subscribers: hiraditya, bollu, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66549
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369768
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 15:23:49 +0000 (15:23 +0000)]
[Attributor][NFCI] Try to avoid potential non-deterministic behavior
This commit replaces sets with set vectors in an effort to make the
behavior of the Attributor deterministic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369767
91177308-0d34-0410-b5e6-
96231b3b80d8
Teresa Johnson [Fri, 23 Aug 2019 15:18:58 +0000 (15:18 +0000)]
[ThinLTO] Fix handling of weak interposable symbols
Summary:
Keep aliasees alive if their alias is live, otherwise we end up with an
alias to a declaration, which is invalid. This can happen when the
aliasee is weak and non-prevailing.
This fix exposed the fact that we were then attempting to internalize
the weak symbol, which was not exported as it was not prevailing. We
should not internalize interposable symbols in general, unless this is
the prevailing copy, since it can lead to incorrect inlining and other
optimizations. Most of the changes in this patch are due to the
restructuring required to pass down the prevailing callback.
Finally, while implementing the test cases, I found that in the case of
a weak aliasee that is still marked not live because its alias isn't
live, after dropping the definition we incorrectly marked the
declaration with weak linkage when resolving prevailing symbols in the
module. This was due to some special case handling for symbols marked
WeakLinkage in the summary located before instead of after a subsequent
check for the symbol being a declaration. It turns out that we don't
actually need this special case handling any more (looking back at the
history, when that was added the code was structured quite differently)
- we will correctly mark with weak linkage further below when the
definition hasn't been dropped.
Fixes PR42542.
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, dang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66264
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369766
91177308-0d34-0410-b5e6-
96231b3b80d8
Johannes Doerfert [Fri, 23 Aug 2019 15:17:27 +0000 (15:17 +0000)]
[MustExec] Add a generic "must-be-executed-context" explorer
Given an instruction I, the MustBeExecutedContextExplorer allows to
easily traverse instructions that are guaranteed to be executed whenever
I is. For now, these instruction have to be statically "after" I, in
the same or different basic blocks.
This patch also adds a pass which prints the must-be-executed-context
for each instruction in a module. It is used to test the
MustBeExecutedContextExplorer, for now on the examples given in the
class comment of the MustBeExecutedIterator.
Differential Revision: https://reviews.llvm.org/D65186
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369765
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rupprecht [Fri, 23 Aug 2019 14:28:58 +0000 (14:28 +0000)]
[llvm-objcopy] Strip debug sections when running with --strip-unneeded.
Summary:
GNU --strip-unneeded strips debugging sections as well. Do that for llvm-objcopy as well.
Additionally, add a test that verifies we keep the .gnu_debuglink section. This apparently was not always the case, and I'm not sure which commit fixed it, but there doesn't appear to be any test coverage to make sure we continue to do so.
This fixes PR41043.
Reviewers: jhenderson, jakehehrlich, espindola, alexshap
Subscribers: emaste, arichardson, MaskRay, abrachet, seiya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66623
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369761
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Atanasyan [Fri, 23 Aug 2019 13:36:24 +0000 (13:36 +0000)]
[mips] Reduce number of instructions used for loading a global symbol's value
Now `lw/sw $reg, sym+offset` pseudo instructions for global symbol `sym`
are lowering into the following three instructions.
```
lw $reg, %got(symbol)($gp)
addiu $reg, $reg, offset
lw/sw $reg, 0($reg)
```
It's possible to reduce the number of instructions by taking the offset
in account in the final `lw/sw` command. This patch implements that
optimization.
```
lw $reg, %got(symbol)($gp)
lw/sw $reg, offset($reg)
```
Differential Revision: https://reviews.llvm.org/D66553
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369756
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Atanasyan [Fri, 23 Aug 2019 13:36:14 +0000 (13:36 +0000)]
[mips] Do not include offset into `%got` expression for global symbols
Now pseudo instruction `la $6, symbol+8($6)` is expanding into the following
chain of commands:
```
lw $1, %got(symbol+8)($gp)
addiu $1, $1, 8
addu $6, $1, $6
```
This is incorrect. When a linker handles the `R_MIPS_GOT16` relocation,
it does not expect to get any addend and breaks on assertion. Otherwise
it has to create new GOT entry for each unique "sym + offset" pair.
Offset for a global symbol should be added to result of loading GOT
entry by a separate `add` command.
The patch fixes the problem by stripping off an offset from the expression
passed to the `%got`. That's interesting that even current code inserts
a separate `add` command.
Differential Revision: https://reviews.llvm.org/D66552
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369755
91177308-0d34-0410-b5e6-
96231b3b80d8
Amaury Sechet [Fri, 23 Aug 2019 13:30:45 +0000 (13:30 +0000)]
[PowerPC] Automatically generate various tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369754
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Fri, 23 Aug 2019 12:37:09 +0000 (12:37 +0000)]
Use VT::getHalfNumVectorElementsVT helpers in a few places. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369751
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrea Di Biagio [Fri, 23 Aug 2019 12:19:45 +0000 (12:19 +0000)]
[X86][BtVer2] Add a read-advance to every implicit register use of CMPXCHG8B/16B.
This is a follow up of r369642.
This patch assigns a ReadAfterLd to every implicit register use of instruction
CMPXCHG8B and instruction CMPXCHG16B. Perf micro-benchmarks show that implicit
registers are read after 3cy from the start of execution.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369750
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrea Di Biagio [Fri, 23 Aug 2019 11:34:10 +0000 (11:34 +0000)]
[X86][BtVer2] Fix latency of ALU RMW instructions.
Excluding ADC/SBB and the bit-test instructions (BTR/BTS/BTC), the observed
latency of all other RMW integer arithmetic/logic instructions is 6cy and not
5cy.
Example (ADD):
```
addb $0, (%rsp) # Latency: 6cy
addb $7, (%rsp) # Latency: 6cy
addb %sil, (%rsp) # Latency: 6cy
addw $0, (%rsp) # Latency: 6cy
addw $511, (%rsp) # Latency: 6cy
addw %si, (%rsp) # Latency: 6cy
addl $0, (%rsp) # Latency: 6cy
addl $511, (%rsp) # Latency: 6cy
addl %esi, (%rsp) # Latency: 6cy
addq $0, (%rsp) # Latency: 6cy
addq $511, (%rsp) # Latency: 6cy
addq %rsi, (%rsp) # Latency: 6cy
```
The same latency profile applies to SUB/AND/OR/XOR/INC/DEC.
The observed latency of ADC/SBB is 7-8cy. So we need a different write to model
those. Latency of BTS/BTR/BTC is not fixed by this patch (they are much slower
than what the model for btver2 currently reports).
Differential Revision: https://reviews.llvm.org/D66636
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369748
91177308-0d34-0410-b5e6-
96231b3b80d8
Martin Storsjo [Fri, 23 Aug 2019 11:18:11 +0000 (11:18 +0000)]
[llvm-dlltool] Make sure to strip decorations from ExtName for renamed exports
ExtName should not be decorated, just like Name.
This avoids double decoration on symbols in import libraries
that use = for renaming functions. (Weak aliases, which use ==,
worked fine with respect to decoration.)
Differential Revision: https://reviews.llvm.org/D66617
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369747
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Fri, 23 Aug 2019 10:49:46 +0000 (10:49 +0000)]
[DAGCombine] GetNegatedExpression - add FMA\FMAD support
If the accumulator and either of the multiply operands are negatable then we can we negate the entire expression.
Differential Revision: https://reviews.llvm.org/D63141
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369746
91177308-0d34-0410-b5e6-
96231b3b80d8
Jay Foad [Fri, 23 Aug 2019 10:07:43 +0000 (10:07 +0000)]
[AMDGPU] gfx10 atomic optimizer changes.
Summary:
Add support for gfx10, where all DPP operations are confined to work
within a single row of 16 lanes, and wave32.
Reviewers: arsenm, sheredom, critson, rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, jfb, dstuttard, tpr, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65644
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369745
91177308-0d34-0410-b5e6-
96231b3b80d8
George Rimar [Fri, 23 Aug 2019 09:31:07 +0000 (09:31 +0000)]
[yaml2obj] - Allow setting the symbol st_other field to any integer.
st_other field of a symbol usually contains its visibility.
Other bits are usually 0, though some targets, like
MIPS can set them using the named bit field values.
Problem is that there is no way to set an arbitrary value now,
though that might be useful for our test cases.
In this patch I introduced a way to set st_other to any numeric
value using the new StOther field.
I added a test and simplified the existent one to show the effect/benefit
Differential revision: https://reviews.llvm.org/D66583
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369742
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 23 Aug 2019 07:38:25 +0000 (07:38 +0000)]
[X86] Add a further unrolled madd reduction test case that shows several deficiencies.
The AVX2 check lines show two issues. An ADD that became an OR
because we knew the input was disjoint, but really it was zero
so we should have just removed the ADD/OR all together.
Relatedly we use 128-bit VPMADDWD instructions followed by
256-bit VPADDD operations. We should be able to narrow these
VPADDDs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369736
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 23 Aug 2019 06:08:33 +0000 (06:08 +0000)]
[X86] Make combineLoopSADPattern use CONCAT_VECTORS instead of INSERT_SUBVECTORS for widening with zeros.
CONCAT_VECTORS is more canonical for the early DAG combine runs
until we start getting into the op legalization phases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369734
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 23 Aug 2019 05:33:27 +0000 (05:33 +0000)]
[X86] Improve lowering of v2i32 SAD handling in combineLoopSADPattern.
For v2i32 we only feed 2 i8 elements into the psadbw instructions
with 0s in the other 14 bytes. The resulting psadbw instruction
will produce zeros in bits [127:16] of the output. We need to take
the result and feed it to a v2i32 add where the first element
includes bits [15:0] of the sad result. The other element should
be zero.
Prior to this patch we were using a truncate to take 0 from
bits 95:64 of the psadbw. This results in a pshufd to move those
bits to 63:32. But since we also have zeroes in bits 63:32 of
the psadbw output, we should just take those bits.
The previous code probably worked better with promoting legalization,
but now we use widening legalization. I've preserved the old
behavior if -x86-experimental-vector-widening-legalization=false
until we get that option removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369733
91177308-0d34-0410-b5e6-
96231b3b80d8
Philip Reames [Fri, 23 Aug 2019 04:03:23 +0000 (04:03 +0000)]
[IndVars] Fix a bug noticed by inspection
We were computing the loop exit value, but not ensuring the addrec belonged to the loop whose exit value we were computing. I couldn't actually trip this; the test case shows the basic setup which *might* trip this, but none of the variations I've tried actually do.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369730
91177308-0d34-0410-b5e6-
96231b3b80d8
Fangrui Song [Fri, 23 Aug 2019 02:17:04 +0000 (02:17 +0000)]
[AlignmentFromAssumptions] getNewAlignmentDiff(): use getURemExpr()
The alignment is calculated incorrectly, thus sometimes it doesn't generate aligned mov instructions, as shown by the example below:
```
// b.cc
typedef long long index;
extern "C" index g_tid;
extern "C" index g_num;
void add3(float* __restrict__ a, float* __restrict__ b, float* __restrict__ c) {
index n = 64*1024;
index m = 16*1024;
index k = 4*1024;
index tid = g_tid;
index num = g_num;
__builtin_assume_aligned(a, 32);
__builtin_assume_aligned(b, 32);
__builtin_assume_aligned(c, 32);
for (index i0=tid*k; i0<m; i0+=num*k)
for (index i1=0; i1<n*m; i1+=m)
for (index i2=0; i2<k; i2++)
c[i1+i0+i2] = b[i0+i2] + a[i1+i0+i2];
}
```
Compile with `clang b.cc -Ofast -march=skylake -mavx2 -S`
```
vmovaps -224(%rdi,%rbx,4), %ymm0
vmovups -192(%rdi,%rbx,4), %ymm1 # should be movaps
vmovups -160(%rdi,%rbx,4), %ymm2 # should be movaps
vmovups -128(%rdi,%rbx,4), %ymm3 # should be movaps
vaddps -224(%rsi,%rbx,4), %ymm0, %ymm0
vaddps -192(%rsi,%rbx,4), %ymm1, %ymm1
vaddps -160(%rsi,%rbx,4), %ymm2, %ymm2
vaddps -128(%rsi,%rbx,4), %ymm3, %ymm3
vmovaps %ymm0, -224(%rdx,%rbx,4)
vmovups %ymm1, -192(%rdx,%rbx,4) # should be movaps
vmovups %ymm2, -160(%rdx,%rbx,4) # should be movaps
vmovups %ymm3, -128(%rdx,%rbx,4) # should be movaps
```
Differential Revision: https://reviews.llvm.org/D66575
Patch by Dun Liang
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369723
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Fri, 23 Aug 2019 01:28:44 +0000 (01:28 +0000)]
hwasan: Untag unwound stack frames by wrapping personality functions.
One problem with untagging memory in landing pads is that it only works
correctly if the function that catches the exception is instrumented.
If the function is uninstrumented, we have no opportunity to untag the
memory.
To address this, replace landing pad instrumentation with personality function
wrapping. Each function with an instrumented stack has its personality function
replaced with a wrapper provided by the runtime. Functions that did not have
a personality function to begin with also get wrappers if they may be unwound
past. As the unwinder calls personality functions during stack unwinding,
the original personality function is called and the function's stack frame is
untagged by the wrapper if the personality function instructs the unwinder
to keep unwinding. If unwinding stops at a landing pad, the function is
still responsible for untagging its stack frame if it resumes unwinding.
The old landing pad mechanism is preserved for compatibility with old runtimes.
Differential Revision: https://reviews.llvm.org/D66377
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369721
91177308-0d34-0410-b5e6-
96231b3b80d8
Sam Clegg [Fri, 23 Aug 2019 01:00:55 +0000 (01:00 +0000)]
[MC] Minor cleanup to MCFixup::Kind handling. NFC.
Prefer `MCFixupKind` where possible and add getTargetKind() to
convert to `unsigned` when needed rather than scattering cast
operators around the place.
Differential Revision: https://reviews.llvm.org/D59890
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369720
91177308-0d34-0410-b5e6-
96231b3b80d8
Amaury Sechet [Thu, 22 Aug 2019 23:43:48 +0000 (23:43 +0000)]
[ARM] Automatically generate dsp-mlal.ll . NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369718
91177308-0d34-0410-b5e6-
96231b3b80d8
Jonas Devlieghere [Thu, 22 Aug 2019 23:42:31 +0000 (23:42 +0000)]
[utils] Update shebang to use the environment.
This changes the shebang to launch bash through /usr/bin/env.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369717
91177308-0d34-0410-b5e6-
96231b3b80d8
Amaury Sechet [Thu, 22 Aug 2019 20:42:50 +0000 (20:42 +0000)]
[PowerPC] Automatically generate vec_buildvector_loadstore.ll . NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369703
91177308-0d34-0410-b5e6-
96231b3b80d8
Roman Lebedev [Thu, 22 Aug 2019 20:34:56 +0000 (20:34 +0000)]
[NFC][InstCombine] Fixup few new tests in unrecognized_three-way-comparison.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369701
91177308-0d34-0410-b5e6-
96231b3b80d8
Amaury Sechet [Thu, 22 Aug 2019 20:26:56 +0000 (20:26 +0000)]
[PowerPC] Automatically generate various tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369700
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Collingbourne [Thu, 22 Aug 2019 19:56:14 +0000 (19:56 +0000)]
IR. Change strip* family of functions to not look through aliases.
I noticed another instance of the issue where references to aliases were
being replaced with aliasees, this time in InstCombine. In the instance that
I saw it turned out to be only a QoI issue (a symbol ended up being missing
from the symbol table due to the last reference to the alias being removed,
preventing HWASAN from symbolizing a global reference), but it could easily
have manifested as incorrect behaviour.
Since this is the third such issue encountered (previously: D65118, D65314)
it seems to be time to address this common error/QoI issue once and for all
and make the strip* family of functions not look through aliases.
Includes a test for the specific issue that I saw, but no doubt there are
other similar bugs fixed here.
As with D65118 this has been tested to make sure that the optimization isn't
load bearing. I built Clang, Chromium for Linux, Android and Windows as well
as the test-suite and there were no size regressions.
Differential Revision: https://reviews.llvm.org/D66606
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369697
91177308-0d34-0410-b5e6-
96231b3b80d8
Roman Lebedev [Thu, 22 Aug 2019 19:53:23 +0000 (19:53 +0000)]
[NFC][InstCombine] New tests: unrecognized_three-way-comparison.ll is ignorant about commutative variants part 2
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369696
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Thu, 22 Aug 2019 19:43:27 +0000 (19:43 +0000)]
Fight a bit against global initializers. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369695
91177308-0d34-0410-b5e6-
96231b3b80d8
Jordan Rupprecht [Thu, 22 Aug 2019 19:17:50 +0000 (19:17 +0000)]
[llvm-objcopy][NFC] Refactor symbol/section matching
Summary:
The matchers for section/symbol related flags (e.g. `--keep-symbol=Name` or `--regex --keep-symbol=foo.*`) are currently just vectors that are matched linearlly. However, adding wildcard support would require negative matching too, e.g. a symbol should be removed if it matches a wildcard *but* doesn't match some other wildcard.
To make the next patch simpler, consolidate matching logic to a class defined in CopyConfig that takes care of matching.
Reviewers: jhenderson, seiya, MaskRay, espindola, alexshap
Reviewed By: jhenderson, MaskRay
Subscribers: emaste, arichardson, jakehehrlich, abrachet, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66432
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369689
91177308-0d34-0410-b5e6-
96231b3b80d8
Amaury Sechet [Thu, 22 Aug 2019 18:53:41 +0000 (18:53 +0000)]
[AArch64] autogenerate some tests. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369685
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Thu, 22 Aug 2019 18:22:05 +0000 (18:22 +0000)]
gn build: Merge r369680
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369682
91177308-0d34-0410-b5e6-
96231b3b80d8
Nico Weber [Thu, 22 Aug 2019 17:53:18 +0000 (17:53 +0000)]
gn build: Merge r369677
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369678
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Thu, 22 Aug 2019 17:32:16 +0000 (17:32 +0000)]
Retire llvm::less_ptr. llvm::deref is much more flexible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369675
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Thu, 22 Aug 2019 17:31:59 +0000 (17:31 +0000)]
Retire llvm::less/equal in favor of C++14 std::less<>/equal_to<>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369674
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Thu, 22 Aug 2019 17:29:17 +0000 (17:29 +0000)]
GlobalISel: Don't create G_UADDE with constant false carry in
The x86 tests are now broken (in paticular add-scalar.ll now hits the
DAG fallback) due to not handling G_UADDO. The DAG x86 backend has a
custom lowering for this, so that will need to be implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369673
91177308-0d34-0410-b5e6-
96231b3b80d8
Francis Visoiu Mistrih [Thu, 22 Aug 2019 16:59:00 +0000 (16:59 +0000)]
[MachO][TLOF] Use hasLocalLinkage to determine if indirect symbol is local
Local symbols in the indirect symbol table contain the value
`INDIRECT_SYMBOL_LOCAL` and the corresponding __pointers entry must
contain the address of the target.
In r349060, I added support for local symbols in the indirect symbol
table, which was checking if the symbol `isDefined` && `!isExternal` to
determine if the symbol is local or not.
It turns out that `isDefined` will return false if the user of the
symbol comes before its definition, and we'll again generate .long 0
which will be the symbol at the adress 0x0.
Instead of doing that, use GlobalValue::hasLocalLinkage() to check if
the symbol is local.
Differential Revision: https://reviews.llvm.org/D66563
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369671
91177308-0d34-0410-b5e6-
96231b3b80d8
Roman Lebedev [Thu, 22 Aug 2019 16:46:16 +0000 (16:46 +0000)]
[NFC][InstCombine] New tests: unrecognized_three-way-comparison.ll is ignorant about commutative variants
D66232 "exposes" the problem.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369667
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Thu, 22 Aug 2019 16:23:35 +0000 (16:23 +0000)]
[X86] Remove MCInstLower code that drops operands from some CALL and TAILJMP instructions. Add asserts to verify operand count
It appears the FIXME here was handled at some point. r159728 from 2012 seems to be at least aportion of fixing it.
Differential Revision: https://reviews.llvm.org/D66570
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369665
91177308-0d34-0410-b5e6-
96231b3b80d8
Guozhi Wei [Thu, 22 Aug 2019 16:21:32 +0000 (16:21 +0000)]
[MBP] Disable aggressive loop rotate in plain mode
Patch https://reviews.llvm.org/D43256 introduced more aggressive loop layout optimization which depends on profile information. If profile information is not available, the statically estimated profile information(generated by BranchProbabilityInfo.cpp) is used. If user program doesn't behave as BranchProbabilityInfo.cpp expected, the layout may be worse.
To be conservative this patch restores the original layout algorithm in plain mode. But user can still try the aggressive layout optimization with -force-precise-rotation-cost=true.
Differential Revision: https://reviews.llvm.org/D65673
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369664
91177308-0d34-0410-b5e6-
96231b3b80d8
Amaury Sechet [Thu, 22 Aug 2019 15:35:45 +0000 (15:35 +0000)]
[DAGCombiner] Remove explicit call to AddToWorklist in sqrt and reciprocal computations
Summary: These nodes end up being processed regardless due to DAGCombiner ensuring arguments are processed. This changes the order in which nodes are processed, which fixes an issue on PowerPC.
Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri, mcberg2017, stefanp, hfinkel
Subscribers: nemanjai, MaskRay, jsji, steven.zhang, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66548
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369662
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrea Di Biagio [Thu, 22 Aug 2019 15:20:16 +0000 (15:20 +0000)]
[X86][BtVer2] Fix latency/throughput of scalar integer MUL instructions.
Single operand MUL instructions that implicitly set EAX have the following
latency/throughput profile (see below):
imul %cl # latency: 3cy - uOPs: 1 - 1 JMul
imul %cx # latency: 3cy - uOPs: 3 - 3 JMul
imul %ecx # latency: 3cy - uOPs: 2 - 2 JMul
imul %rcx # latency: 6cy - uOPs: 2 - 4 JMul
mul %cl # latency: 3cy - uOPs: 1 - 1 JMul
mul %cx # latency: 3cy - uOPs: 3 - 3 JMul
mul %ecx # latency: 3cy - uOPs: 2 - 2 JMul
mul %rcx # latency: 6cy - uOPs: 2 - 4 JMul
Excluding the 64bit variant, which has a latency of 6cy, every other instruction
has a latency of 3cy. However, the number of decoded macro-opcodes (as well as
the resource cyles) depend on the MUL size.
The two operand MULs have a more predictable profile (see below):
imul %dx, %dx # latency: 3cy - uOPs: 1 - 1 JMul
imul %edx, %edx # latency: 3cy - uOPs: 1 - 1 JMul
imul %rdx, %rdx # latency: 6cy - uOPs: 1 - 4 JMul
imul $3, %dx, %dx # latency: 4cy - uOPs: 2 - 2 JMul
imul $3, %ecx, %ecx # latency: 3cy - uOPs: 1 - 1 JMul
imul $3, %rdx, %rdx # latency: 6cy - uOPs: 1 - 4 JMul
This patch updates the values in the Jaguar scheduling model and regenerates
llvm-mca tests.
Differential Revision: https://reviews.llvm.org/D66547
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369661
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Thu, 22 Aug 2019 15:14:52 +0000 (15:14 +0000)]
[PowerPC] Regenerate reciprocal tests, as discussed on D66548
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369659
91177308-0d34-0410-b5e6-
96231b3b80d8
Sean Fertile [Thu, 22 Aug 2019 15:11:28 +0000 (15:11 +0000)]
[PowerPC] Add combined ELF ABI and 32/64 bit queries to the subtarget. [NFC]
A lot of places in the code combine checks for both ABI (SVR4/Darwin/AIX) and
addressing mode (64-bit vs 32-bit). In an attempt to make some of the code more
readable I've added a couple functions that combine checking for the ELF abi and
64-bit/32-bit code at once. As we add more AIX support I intend to add similar
functions for the AIX ABI.
Differential Revision: https://reviews.llvm.org/D65814
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369658
91177308-0d34-0410-b5e6-
96231b3b80d8
Sean Fertile [Thu, 22 Aug 2019 15:11:23 +0000 (15:11 +0000)]
[PowerPC][XCOFF][MC] Explicitly set containing csect on symbols. [NFC]
Previously we would get the csect a symbol was contained in through its
fragment. This works only if we are writing an object file, and only for
defined symbols. To fix this we set the contating csect explicitly on the
MCSymbolXCOFF object.
Differential Revision: https://reviews.llvm.org/D66032
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369657
91177308-0d34-0410-b5e6-
96231b3b80d8
Hideto Ueno [Thu, 22 Aug 2019 14:18:29 +0000 (14:18 +0000)]
[Attributor][NFC] Move DerefState to header and use StateWrapper
Summary: In D65402, I want to get DerefState from AADereferenceable but it was not allowed. This patch moves DerefState definition into Attributor.h and makes AADerefenceable inherit StateWrapper.
Reviewers: jdoerfert, sstefan1
Reviewed By: jdoerfert
Subscribers: hiraditya, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66585
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369653
91177308-0d34-0410-b5e6-
96231b3b80d8
Jinsong Ji [Thu, 22 Aug 2019 13:44:47 +0000 (13:44 +0000)]
[SlotIndexes] Add print-slotindexes to disable printing slotindexes
Summary:
When we print the IR with --print-after/before-*,
SlotIndexes will be printed whenever available (We haven't freed it).
This introduces some noises when we try to compare the IR
among different optimizations.
eg:
-print-before=machine-cp will print SlotIndexes for 1st machine-cp
pass, but NOT for 2nd machine-cp;
-print-after=machine-cp will NOT print SlotIndexes for both
machine-cp passes.
So SlotIndexes in 1st pass introduce noises when differing these IRs.
This patch introduces an option to hide indexes.
Reviewers: stoklund, thegameg, qcolombet
Reviewed By: thegameg
Subscribers: hiraditya, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66500
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369650
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrea Di Biagio [Thu, 22 Aug 2019 13:32:17 +0000 (13:32 +0000)]
[MCA] consistently use MCPhysReg instead of unsigned as register type. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369648
91177308-0d34-0410-b5e6-
96231b3b80d8
George Rimar [Thu, 22 Aug 2019 12:39:56 +0000 (12:39 +0000)]
[yaml2obj] - Lookup relocation symbols in dynamic symbol when .dynsym referenced.
This fixes https://bugs.llvm.org/show_bug.cgi?id=40337.
Previously, it was always assumed that relocations referenced symbols in the static symbol table.
Now, if the Link field references a section called ".dynsym" it will look up these symbols
in the dynamic symbol table.
This patch is heavily based on D59097 by James Henderson
Differential revision: https://reviews.llvm.org/D66532
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369645
91177308-0d34-0410-b5e6-
96231b3b80d8
Sylvestre Ledru [Thu, 22 Aug 2019 12:16:08 +0000 (12:16 +0000)]
Fix some regressions caused by r369553 on old versions of Debian and Ubuntu
It was causing some errors like:
Encoding error:
'ascii' codec can't decode byte 0xe2 in position 341: ordinal not in range(128)
The full traceback has been saved in /tmp/sphinx-err-y2fq4dtb.log, if you want to report the issue to the developers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369644
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrea Di Biagio [Thu, 22 Aug 2019 11:32:47 +0000 (11:32 +0000)]
[X86][BtVer2] Fix latency and throughput of XCHG and XADD.
On Jaguar, XCHG has a latency of 1cy and decodes to 2 macro-opcodes. Maximum
throughput for XCHG is 1 IPC. The byte exchange has worse latency and decodes to
1 extra uOP; maximum observed throughput is 0.5 IPC.
```
xchgb %cl, %dl # Latency: 2cy - uOPs: 3 - 2 ALU
xchgw %cx, %dx # Latency: 1cy - uOPs: 2 - 2 ALU
xchgl %ecx, %edx # Latency: 1cy - uOPs: 2 - 2 ALU
xchgq %rcx, %rdx # Latency: 1cy - uOPs: 2 - 2 ALU
```
The reg-mem forms of XCHG are atomic operations with an observed latency of
16cy. The resource usage is similar to the XCHGrr variants. The biggest
difference is obviously the bus-locking, which prevents the LS to issue other
memory uOPs in parallel until the unlocking store uOP is executed.
```
xchgb %cl, (%rsp) # Latency: 16cy - uOPs: 3 - ECX latency: 11cy
xchgw %cx, (%rsp) # Latency: 16cy - uOPs: 3 - ECX latency: 11cy
xchgl %ecx, (%rsp) # Latency: 16cy - uOPs: 3 - ECX latency: 11cy
xchgq %rcx, (%rsp) # Latency: 16cy - uOPs: 3 - ECX latency: 11cy
```
The exchanged in/out register operand becomes available after 11cy from the
start of execution. Added test xchg.s to verify that we correctly see that
register write committed in 11cy (and not 16cy).
Reg-reg XADD instructions have the same latency/throughput than the byte
exchange (register-register variant).
```
xaddb %cl, %dl # latency: 2cy - uOPs: 3 - 3 ALU
xaddw %cx, %dx # latency: 2cy - uOPs: 3 - 3 ALU
xaddl %ecx, %edx # latency: 2cy - uOPs: 3 - 3 ALU
xaddq %rcx, %rdx # latency: 2cy - uOPs: 3 - 3 ALU
```
The non-atomic RM variants have a latency of 11cy, and decode to 4
macro-opcodes. They still consume 2 ALU pipes, and the exchange in/out register
operand becomes available in 3cy (it matches the 'load-to-use latency').
```
xaddb %cl, (%rsp) # latency: 11cy - uOPs: 4 - 3 ALU
xaddw %cx, (%rsp) # latency: 11cy - uOPs: 4 - 3 ALU
xaddl %ecx, (%rsp) # latency: 11cy - uOPs: 4 - 3 ALU
xaddq %rcx, (%rsp) # latency: 11cy - uOPs: 4 - 3 ALU
```
The atomic XADD variants execute in 16cy. The in/out register operand is
available after 11cy from the start of execution.
```
lock xaddb %cl, (%rsp) # latency: 16cy - uOPs: 4 - 3 ALU -- ECX latency: 11cy
lock xaddw %cx, (%rsp) # latency: 16cy - uOPs: 4 - 3 ALU -- ECX latency: 11cy
lock xaddl %ecx, (%rsp) # latency: 16cy - uOPs: 4 - 3 ALU -- ECX latency: 11cy
lock xaddq %rcx, (%rsp) # latency: 16cy - uOPs: 4 - 3 ALU -- ECX latency: 11cy
```
Added test xadd.s to verify those latencies as well as read-advance values.
Differential Revision: https://reviews.llvm.org/D66535
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369642
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Thu, 22 Aug 2019 11:14:30 +0000 (11:14 +0000)]
[MVT] Add MVT equivalent to EVT::getHalfNumVectorElementsVT() helper. NFCI.
Allows for some cleanup in a lot of SSE/AVX vector splitting code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369640
91177308-0d34-0410-b5e6-
96231b3b80d8
Sam Tebbs [Thu, 22 Aug 2019 10:29:20 +0000 (10:29 +0000)]
Reapply: [ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32
The CodeGen/Thumb2/mve-vaddv.ll test needed to be amended to reflect the
changes from the above patch.
This reverts commit
cd53ff6, reapplying
7c6b229.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369638
91177308-0d34-0410-b5e6-
96231b3b80d8
Serguei Katkov [Thu, 22 Aug 2019 10:06:46 +0000 (10:06 +0000)]
[Loop Peeling] Fix silly bug in metadata update.
We must update loop metedata before we moved to parent loop if
it is present.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369637
91177308-0d34-0410-b5e6-
96231b3b80d8
Hans Wennborg [Thu, 22 Aug 2019 09:16:53 +0000 (09:16 +0000)]
Revert r369626 "[ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32"
It broke the bots, see e.g. http://lab.llvm.org:8011/builders/clang-cuda-build/builds/36275/
> This patch fixes shifts by a 128/256 bit shift amount. It also fixes
> codegen for shifts of 32 by delegating to LLVM's default optimisation
> instead of emitting a long shift.
>
> Tests that used to generate long shifts of 32 are updated to check for the
> more optimised codegen.
>
> Differential revision: https://reviews.llvm.org/D66519
>
> llvm-svn: 369626
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369636
91177308-0d34-0410-b5e6-
96231b3b80d8
George Rimar [Thu, 22 Aug 2019 09:10:17 +0000 (09:10 +0000)]
[llvm-objdump] - Remove an outdated "FIXME". NFC.
The bug mentioned in this test case was fixed in D63779 (r364955),
which also provides a test case.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369634
91177308-0d34-0410-b5e6-
96231b3b80d8
George Rimar [Thu, 22 Aug 2019 08:56:24 +0000 (08:56 +0000)]
[llvm-readobj] - Remove `reportError(std::error_code EC, StringRef Input)` helper.
We do not need it, std::error_code is used mostly for COFF and
this patch rewrites the calls to use a different overload.
Having reportError(std::error_code EC, ... is excessive by itself,
because API that use error codes actually needs refactoring to
use Error/Expected<> instead.
DIfferential revision: https://reviews.llvm.org/D66521
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369630
91177308-0d34-0410-b5e6-
96231b3b80d8