]> granicus.if.org Git - llvm/log
llvm
5 years agoUse VT::getHalfNumVectorElementsVT helpers in a few places. NFCI.
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

5 years ago[X86][BtVer2] Add a read-advance to every implicit register use of CMPXCHG8B/16B.
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

5 years ago[X86][BtVer2] Fix latency of ALU RMW instructions.
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

5 years ago[llvm-dlltool] Make sure to strip decorations from ExtName for renamed exports
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

5 years ago[DAGCombine] GetNegatedExpression - add FMA\FMAD support
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

5 years ago[AMDGPU] gfx10 atomic optimizer changes.
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

5 years ago[yaml2obj] - Allow setting the symbol st_other field to any integer.
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

5 years ago[X86] Add a further unrolled madd reduction test case that shows several deficiencies.
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

5 years ago[X86] Make combineLoopSADPattern use CONCAT_VECTORS instead of INSERT_SUBVECTORS...
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

5 years ago[X86] Improve lowering of v2i32 SAD handling in combineLoopSADPattern.
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

5 years ago[IndVars] Fix a bug noticed by inspection
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

5 years ago[AlignmentFromAssumptions] getNewAlignmentDiff(): use getURemExpr()
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

5 years agohwasan: Untag unwound stack frames by wrapping personality functions.
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

5 years ago[MC] Minor cleanup to MCFixup::Kind handling. NFC.
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

5 years ago[ARM] Automatically generate dsp-mlal.ll . NFC
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

5 years ago[utils] Update shebang to use the environment.
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

5 years ago[PowerPC] Automatically generate vec_buildvector_loadstore.ll . NFC
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

5 years ago[NFC][InstCombine] Fixup few new tests in unrecognized_three-way-comparison.ll
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

5 years ago[PowerPC] Automatically generate various tests. NFC
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

5 years agoIR. Change strip* family of functions to not look through aliases.
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

5 years ago[NFC][InstCombine] New tests: unrecognized_three-way-comparison.ll is ignorant about...
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

5 years agoFight a bit against global initializers. NFC.
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

5 years ago[llvm-objcopy][NFC] Refactor symbol/section matching
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

5 years ago[AArch64] autogenerate some tests. NFC
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

5 years agogn build: Merge r369680
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

5 years agogn build: Merge r369677
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

5 years agoRetire llvm::less_ptr. llvm::deref is much more flexible.
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

5 years agoRetire llvm::less/equal in favor of C++14 std::less<>/equal_to<>.
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

5 years agoGlobalISel: Don't create G_UADDE with constant false carry in
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

5 years ago[MachO][TLOF] Use hasLocalLinkage to determine if indirect symbol is local
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

5 years ago[NFC][InstCombine] New tests: unrecognized_three-way-comparison.ll is ignorant about...
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

5 years ago[X86] Remove MCInstLower code that drops operands from some CALL and TAILJMP instruct...
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

5 years ago[MBP] Disable aggressive loop rotate in plain mode
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

5 years ago[DAGCombiner] Remove explicit call to AddToWorklist in sqrt and reciprocal computations
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

5 years ago[X86][BtVer2] Fix latency/throughput of scalar integer MUL instructions.
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

5 years ago[PowerPC] Regenerate reciprocal tests, as discussed on D66548
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

5 years ago[PowerPC] Add combined ELF ABI and 32/64 bit queries to the subtarget. [NFC]
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

5 years ago[PowerPC][XCOFF][MC] Explicitly set containing csect on symbols. [NFC]
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

5 years ago[Attributor][NFC] Move DerefState to header and use StateWrapper
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

5 years ago[SlotIndexes] Add print-slotindexes to disable printing slotindexes
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

5 years ago[MCA] consistently use MCPhysReg instead of unsigned as register type. NFCI
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

5 years ago[yaml2obj] - Lookup relocation symbols in dynamic symbol when .dynsym referenced.
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

5 years agoFix some regressions caused by r369553 on old versions of Debian and Ubuntu
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

5 years ago[X86][BtVer2] Fix latency and throughput of XCHG and XADD.
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

5 years ago[MVT] Add MVT equivalent to EVT::getHalfNumVectorElementsVT() helper. NFCI.
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

5 years agoReapply: [ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32
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

5 years ago[Loop Peeling] Fix silly bug in metadata update.
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

5 years agoRevert r369626 "[ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32"
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

5 years ago[llvm-objdump] - Remove an outdated "FIXME". NFC.
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

5 years ago[llvm-readobj] - Remove `reportError(std::error_code EC, StringRef Input)` helper.
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

5 years ago[X86] Lower the cost of v2i32->v2f64 sint_to_fp under vector widening legalization.
Craig Topper [Thu, 22 Aug 2019 08:18:45 +0000 (08:18 +0000)]
[X86] Lower the cost of v2i32->v2f64 sint_to_fp under vector widening legalization.

I don't really understand the costs we're using for fp_to_sint,
but prior to widening legalization we used 20 as the cost for this
via the v2i64->v2f64 entry. That number seems better than the 40
we got with widening legalization. So now we need either a
v2i32->v2f64 entry or a v4i32->v2f64 entry depending on whether
AVX is enabled or not since we skip the first SSE2 table look up
under AVX.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369628 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Support] Improve readNativeFile(Slice) interface
Pavel Labath [Thu, 22 Aug 2019 08:13:30 +0000 (08:13 +0000)]
[Support] Improve readNativeFile(Slice) interface

Summary:
There was a subtle, but pretty important difference between the Slice
and regular versions of this function. The Slice function was
zero-initializing the rest of the buffer when the read syscall returned
less bytes than expected, while the regular function did not.

This patch removes the inconsistency by making both functions *not*
zero-initialize the buffer. The zeroing code is moved to the
MemoryBuffer class, which is currently the only user of this code. This
makes the API more consistent, and the code shorter.

While in there, I also refactor the functions to return the number of
bytes through the regular return value (via Expected<size_t>) instead of
a separate by-ref argument.

Reviewers: aganea, rnk

Subscribers: kristina, Bigcheese, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66471

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369627 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32
Sam Tebbs [Thu, 22 Aug 2019 08:12:06 +0000 (08:12 +0000)]
[ARM] Fix lsrl with a 128/256 bit shift amount or a shift of 32

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369626 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TargetLowering] Remove optional arguments passing to makeLibCall
Shiva Chen [Thu, 22 Aug 2019 04:59:43 +0000 (04:59 +0000)]
[TargetLowering] Remove optional arguments passing to makeLibCall

The patch introduces MakeLibCallOptions struct as suggested by @efriedma on D65497.
The struct contain argument flags which will pass to makeLibCall function.
The patch should not has any functionality changes.

Differential Revision: https://reviews.llvm.org/D65795

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369622 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[lit] Diagnose insufficient args to internal env
Joel E. Denny [Thu, 22 Aug 2019 03:42:01 +0000 (03:42 +0000)]
[lit] Diagnose insufficient args to internal env

Without this patch, failing to provide a subcommand to lit's internal
`env` results in either a python `IndexError` or an attempt to execute
the final `env` argument, such as `FOO=1`, as a command.  This patch
diagnoses those cases with a more helpful message.

Reviewed By: stella.stamenova

Differential Revision: https://reviews.llvm.org/D66482

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369620 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Making X86OptimizeLEAs pass public. NFC
Pengfei Wang [Thu, 22 Aug 2019 02:29:27 +0000 (02:29 +0000)]
[X86] Making X86OptimizeLEAs pass public. NFC

Reviewers: wxiao3, LuoYuanke, andrew.w.kaylor, craig.topper, annita.zhang, liutianle, pengfei, xiangzhangllvm, RKSimon, spatel, andreadb

Reviewed By: RKSimon

Subscribers: andreadb, hiraditya, llvm-commits

Tags: #llvm

Patch by Gen Pei (gpei)

Differential Revision: https://reviews.llvm.org/D65933

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369612 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[COFF] Fix section name for constants larger than 64 bits on Windows
Fangrui Song [Thu, 22 Aug 2019 01:48:34 +0000 (01:48 +0000)]
[COFF] Fix section name for constants larger than 64 bits on Windows

APIntToHexString returns wrong value ("0000000000000000ffffffffffffffff")
for integer larger than 64 bits, and thus
TargetLoweringObjectFileCOFF::getSectionForConstant returns same section name
for all numbers larger than 64 bits. This patch tries to fix it.

Differential Revision: https://reviews.llvm.org/D66458
Patch by Senran Zhang

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369610 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369605
Nico Weber [Thu, 22 Aug 2019 00:40:55 +0000 (00:40 +0000)]
gn build: Merge r369605

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369608 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369600
Nico Weber [Thu, 22 Aug 2019 00:01:59 +0000 (00:01 +0000)]
gn build: Merge r369600

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369603 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Object] FIX: update PlatformKind name in TapiFile
Cyndy Ishida [Wed, 21 Aug 2019 23:57:57 +0000 (23:57 +0000)]
[Object] FIX: update PlatformKind name in TapiFile

Buildbots that use GCC failed to compile because overwritten
namespace with variable name

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369602 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Object] Add tapi files to object
Cyndy Ishida [Wed, 21 Aug 2019 23:30:53 +0000 (23:30 +0000)]
[Object] Add tapi files to object

Summary:
The intention for this is to allow reading and printing symbols out from
llvm-nm. Tapi file, and Tapi universal follow a similiar format to
their respective MachO Object format.

The tests are dependent on llvm-nm processing tbd files which is why its in D66160

Reviewers: ributzka, steven_wu, lhames

Reviewed By: ributzka, lhames

Subscribers: mgorny, hiraditya, dexonsmith, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66159

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369600 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Correct the scheduler classes for TAILJMP and TCRETURN CodeGenOnly instructions.
Craig Topper [Wed, 21 Aug 2019 23:17:52 +0000 (23:17 +0000)]
[X86] Correct the scheduler classes for TAILJMP and TCRETURN CodeGenOnly instructions.

We had an odd combination of WriteJump applied to some memory
instructions and WriteJumpLd applied to register and immediate
instructions.

Thsi should hopefully assign them all correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369599 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[X86] Replace a couple hardcoded '5's with X86::AddrNumOperands for readability. NFC
Craig Topper [Wed, 21 Aug 2019 22:40:07 +0000 (22:40 +0000)]
[X86] Replace a couple hardcoded '5's with X86::AddrNumOperands for readability. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369598 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369591
Nico Weber [Wed, 21 Aug 2019 22:26:02 +0000 (22:26 +0000)]
gn build: Merge r369591

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369594 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369587
Nico Weber [Wed, 21 Aug 2019 22:25:57 +0000 (22:25 +0000)]
gn build: Merge r369587

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369593 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] FIX: Try to make bots happy
Johannes Doerfert [Wed, 21 Aug 2019 22:21:13 +0000 (22:21 +0000)]
[Attributor] FIX: Try to make bots happy

Locally the tight iterations bounds work fine but the bots seem unhappy.
Try to get green bots and some time to determine the underlying problem.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369592 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Remove fix introduced by r369573, superseded by r369580
Luis Marques [Wed, 21 Aug 2019 22:02:56 +0000 (22:02 +0000)]
[RISCV] Remove fix introduced by r369573, superseded by r369580

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369590 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Fix: Gracefully handle non-instruction users
Johannes Doerfert [Wed, 21 Aug 2019 21:48:56 +0000 (21:48 +0000)]
[Attributor] Fix: Gracefully handle non-instruction users

Function can have users that are not instructions, e.g., bitcasts. For
now, we simply give up when we see them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369588 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd FileWriter to GSYM and encode/decode functions to AddressRange and AddressRanges
Greg Clayton [Wed, 21 Aug 2019 21:48:11 +0000 (21:48 +0000)]
Add FileWriter to GSYM and encode/decode functions to AddressRange and AddressRanges

The full GSYM patch started with: https://reviews.llvm.org/D53379

This patch add the ability to encode data using the new llvm::gsym::FileWriter class.

FileWriter is a simplified binary data writer class that doesn't require targets, target definitions, architectures, or require any other optional compile time libraries to be enabled via the build process. This class needs the ability to seek to different spots in the binary data that it produces to fix up offsets and sizes in GSYM data. It currently uses std::ostream over llvm::raw_ostream because llvm::raw_ostream doesn't support seeking which is required when encoding and decoding GSYM data.

AddressRange objects are encoded and decoded to be relative to a base address. This will be the FunctionInfo's start address if the AddressRange is directly contained in a FunctionInfo, or a base address of the containing parent AddressRange or AddressRanges. This allows address ranges to be efficiently encoded using ULEB128 encodings as we encode the offset and size of each range instead of full addresses. This also makes encoded addresses easy to relocate as we just need to relocate one base address.

Differential Revision: https://reviews.llvm.org/D63828

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369587 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor][NFCI] Introduce tight iteration bounds in the tests
Johannes Doerfert [Wed, 21 Aug 2019 21:42:46 +0000 (21:42 +0000)]
[Attributor][NFCI] Introduce tight iteration bounds in the tests

Summary:
To be able to track how many iterations we need to manifest all
information we check for we now make the maximum iteration count
explicit. The count is set tightly now and should be kept that way.

Reviewers: uenoku, sstefan1

Subscribers: bollu, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66554

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369586 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoUse C++14 heteregenous lookup for a couple of std::map<std::string, ...>
Benjamin Kramer [Wed, 21 Aug 2019 21:17:34 +0000 (21:17 +0000)]
Use C++14 heteregenous lookup for a couple of std::map<std::string, ...>

These call find with a StringRef, heterogenous lookup saves a temporary
std::string there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369581 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Fix use of side-effects in asserts in decoder functions
Luis Marques [Wed, 21 Aug 2019 21:11:37 +0000 (21:11 +0000)]
[RISCV] Fix use of side-effects in asserts in decoder functions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369580 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[BinaryFormat] Teach identify_magic about Tapi files.
Cyndy Ishida [Wed, 21 Aug 2019 21:00:16 +0000 (21:00 +0000)]
[BinaryFormat] Teach identify_magic about Tapi files.

Summary:
Tapi files are YAML files that start with the !tapi tag. The only execption are
TBD v1 files, which don't have a tag. In that case we have to scan a little
further and check if the first key "archs" exists.

This is the first patch in a series of patches to add libObject support for
text-based dynamic library (.tbd) files.

This patch is practically exactly the same as D37820, that was never pushed to master,
and is needed for future commits related to reading tbd files for llvm-nm

Reviewers: ributzka, steven_wu, bollu, espindola, jfb, shafik, jdoerfert

Reviewed By: steven_wu

Subscribers: dexonsmith, llvm-commits

Tags: #llvm, #clang, #sanitizers, #lldb, #libc, #openmp

Differential Revision: https://reviews.llvm.org/D66149

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369579 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor][NFC] Fix copy & paste error
Johannes Doerfert [Wed, 21 Aug 2019 20:57:20 +0000 (20:57 +0000)]
[Attributor][NFC] Fix copy & paste error

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369577 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor][NFC] Remove leftover semicolon
Johannes Doerfert [Wed, 21 Aug 2019 20:56:56 +0000 (20:56 +0000)]
[Attributor][NFC] Remove leftover semicolon

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369576 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Attributor] Use existing unreachable instead of introducing new ones
Johannes Doerfert [Wed, 21 Aug 2019 20:56:41 +0000 (20:56 +0000)]
[Attributor] Use existing unreachable instead of introducing new ones

So far we split the unreachable off and placed a new one, this is not
necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369575 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix -Werror=unused-variable error after r369528.
Richard Smith [Wed, 21 Aug 2019 20:42:37 +0000 (20:42 +0000)]
Fix -Werror=unused-variable error after r369528.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369573 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Merge r369568
Nico Weber [Wed, 21 Aug 2019 20:20:36 +0000 (20:20 +0000)]
gn build: Merge r369568

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369572 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogn build: Make sync script not exit 1 if it writes changes
Nico Weber [Wed, 21 Aug 2019 20:13:00 +0000 (20:13 +0000)]
gn build: Make sync script not exit 1 if it writes changes

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369571 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GVN] Do PHI translations across all edges between the load and the unavailable pred.
Florian Hahn [Wed, 21 Aug 2019 20:06:50 +0000 (20:06 +0000)]
[GVN] Do PHI translations across all edges between the load and the unavailable pred.

Currently we do not properly translate addresses with PHIs if LoadBB !=
LI->getParent(), because PHITranslateAddr expects a direct predecessor as argument,
because it considers all instructions outside of the current block to
not requiring translation.

The amount of cases that trigger this should be very low, as most single
predecessor blocks should be folded into their predecessor by GVN before
we actually start with value numbering. It is still not guaranteed to
happen, so we should do PHI translation along all edges between the
loads' block and the predecessor where we have to place a load.

There are a few test cases showing current limits of the PHI translation, which
could be improved later.

Reviewers: spatel, reames, efriedma, john.brawn

Reviewed By: efriedma

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65020

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369570 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r369549 as it broke the bots.
Aaron Ballman [Wed, 21 Aug 2019 20:00:41 +0000 (20:00 +0000)]
Revert r369549 as it broke the bots.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap/builds/13605/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369569 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoRevert r367389 (and follow-up r368404); it caused PR43073.
Nico Weber [Wed, 21 Aug 2019 19:53:42 +0000 (19:53 +0000)]
Revert r367389 (and follow-up r368404); it caused PR43073.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369567 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[WebAssembly] Handle aliases in WebAssemblyFixFunctionBitcasts
Sam Clegg [Wed, 21 Aug 2019 19:52:33 +0000 (19:52 +0000)]
[WebAssembly] Handle aliases in WebAssemblyFixFunctionBitcasts

Fixes: https://github.com/emscripten-core/emscripten/issues/8770
Differential Revision: https://reviews.llvm.org/D66508

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369566 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[MVT] Add v16f16 and v32f16 vectors.
Craig Topper [Wed, 21 Aug 2019 19:14:48 +0000 (19:14 +0000)]
[MVT] Add v16f16 and v32f16 vectors.

I might look at improving PR43065 which will require being
able to mark a 256 and 512 bit vector of f16 as Legal.

Differential Revision: https://reviews.llvm.org/D66515

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369565 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[TableGen] Include ValueTypes.td directly into the intrinsic-varargs.td test.
Craig Topper [Wed, 21 Aug 2019 19:14:38 +0000 (19:14 +0000)]
[TableGen] Include ValueTypes.td directly into the intrinsic-varargs.td test.

This prevents needing to keep the test in sync with ValueTypes.td

This is not the only test that includes ValueTypes.td.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369564 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips] Replace call `expandLoadAddress` by `loadAndAddSymbolAddress`. NFC
Simon Atanasyan [Wed, 21 Aug 2019 18:54:51 +0000 (18:54 +0000)]
[mips] Replace call `expandLoadAddress` by `loadAndAddSymbolAddress`. NFC

In case of expanding `lw/sw $reg, symbol($reg)` instruction for PIC it's
enough to call the `loadAndAddSymbolAddress` method. Additional work
performed by the `expandLoadAddress` is not required here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369563 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[mips] Remove duplicated case from the `StringSwitch`. NFC
Simon Atanasyan [Wed, 21 Aug 2019 18:54:41 +0000 (18:54 +0000)]
[mips] Remove duplicated case from the `StringSwitch`. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369562 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[DAGCombiner] Remove mostly redundant calls to AddToWorklist
Amaury Sechet [Wed, 21 Aug 2019 18:51:08 +0000 (18:51 +0000)]
[DAGCombiner] Remove mostly redundant calls to AddToWorklist

Summary:
These calls change the order in which some nodes are processed and so have an effect on codegen.

The change in fixup-bw-copy.ll is due to (and (load anyext)) gets transformed into (load zext) while previously the and was removed by SimplifyDemandedBits, so the (load anyext) remained.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66543

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369561 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[docs] Add GwpAsan to toctree.
Mitch Phillips [Wed, 21 Aug 2019 18:31:03 +0000 (18:31 +0000)]
[docs] Add GwpAsan to toctree.

Reverts rL369556 in the process, as it's no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369560 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[BitcodeReader] Check if we can create a null constant for type.
Florian Hahn [Wed, 21 Aug 2019 18:20:11 +0000 (18:20 +0000)]
[BitcodeReader] Check if we can create a null constant for type.

We cannot create null constants for certain types, e.g. VoidTy,
FunctionTy or LabelTy. getNullValue asserts if we pass in an
unsupported type. We should also check for opaque types, but I'm not
sure how.

This fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14795.

Reviewers: t.p.northover, jfb, vsk

Reviewed By: vsk

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D65897

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369557 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[docs] Fix GwpAsan.rst
Jordan Rupprecht [Wed, 21 Aug 2019 18:09:31 +0000 (18:09 +0000)]
[docs] Fix GwpAsan.rst

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369556 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd newline to GWP-ASan sphinx document.
Mitch Phillips [Wed, 21 Aug 2019 18:03:11 +0000 (18:03 +0000)]
Add newline to GWP-ASan sphinx document.
Should fix the document builder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369554 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[docs] Convert remaining command guide entries from md to rst.
Jordan Rupprecht [Wed, 21 Aug 2019 18:00:17 +0000 (18:00 +0000)]
[docs] Convert remaining command guide entries from md to rst.

Summary:
Linking between markdown and rst files is currently not supported very well, e.g. the current llvm-addr2line docs [1] link to "llvm-symbolizer" instead of "llvm-symbolizer.html". This is weirdly broken in different ways depending on which versions of sphinx and recommonmark are being used, so workaround the bug by using rst everywhere.

[1] http://llvm.org/docs/CommandGuide/llvm-addr2line.html

Reviewers: jhenderson

Reviewed By: jhenderson

Subscribers: lebedev.ri, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66305

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369553 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[GWP-ASan] Add public-facing documentation [6].
Mitch Phillips [Wed, 21 Aug 2019 17:53:51 +0000 (17:53 +0000)]
[GWP-ASan] Add public-facing documentation [6].

Summary:
Note: Do not submit this documentation until Scudo support is reviewed and submitted (should be #[5]).

See D60593 for further information.

This patch introduces the public-facing documentation for GWP-ASan, as well as updating the definition of one of the options, which wasn't properly merged. The document describes the design and features of GWP-ASan, as well as how to use GWP-ASan from both a user's standpoint, and development documentation for supporting allocators.

Reviewers: jfb, morehouse, vlad.tsyrklevich

Reviewed By: morehouse, vlad.tsyrklevich

Subscribers: kcc, dexonsmith, kubamracek, cryptoad, jfb, #sanitizers, llvm-commits, vlad.tsyrklevich, morehouse

Tags: #sanitizers, #llvm

Differential Revision: https://reviews.llvm.org/D62875

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369552 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoFix -Wimplicit-fallthrough warnings in regcomp.c
Nathan Huckleberry [Wed, 21 Aug 2019 17:07:43 +0000 (17:07 +0000)]
Fix -Wimplicit-fallthrough warnings in regcomp.c

Summary:
Since clang does not support comment style fallthrough annotations
these should be switched.

Reviewers: aaron.ballman, nickdesaulniers, xbolva00

Reviewed By: aaron.ballman, nickdesaulniers, xbolva00

Subscribers: xbolva00, nickdesaulniers, hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66487

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369549 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it.
Alina Sbirlea [Wed, 21 Aug 2019 17:00:57 +0000 (17:00 +0000)]
[LoopPassManager + MemorySSA] Only enable use of MemorySSA for LPMs known to preserve it.

Summary:
Add a flag to the FunctionToLoopAdaptor that allows enabling MemorySSA only for the loop pass managers that are known to preserve it.

If an LPM is known to have only loop transforms that *all* preserve MemorySSA, then use MemorySSA if `EnableMSSALoopDependency` is set.
If an LPM has loop passes that do not preserve MemorySSA, then the flag passed is `false`, regardless of the value of `EnableMSSALoopDependency`.

When using a custom loop pass pipeline via `passes=...`, use keyword `loop` vs `loop-mssa` to use MemorySSA in that LPM. If a loop that does not preserve MemorySSA is added while using the `loop-mssa` keyword, that's an error.

Add the new `loop-mssa` keyword to a few tests where a difference occurs when enabling MemorySSA.

Reviewers: chandlerc

Subscribers: mehdi_amini, Prazek, george.burgess.iv, sanjoy.google, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D66376

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369548 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoGlobalISel: Implement moreElementsVector for G_UNMERGE_VALUES sources
Matt Arsenault [Wed, 21 Aug 2019 16:59:10 +0000 (16:59 +0000)]
GlobalISel: Implement moreElementsVector for G_UNMERGE_VALUES sources

This is necessary for handling <3 x s16> on AMDGPU, assuming this
should be handled as 2 separate legalization actions. The alternative
would be for fewerElementsVector to handle 3->2.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369547 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agoAdd a couple of extra test noticed in post-commit discussion of rL369541
Philip Reames [Wed, 21 Aug 2019 16:57:53 +0000 (16:57 +0000)]
Add a couple of extra test noticed in post-commit discussion of rL369541

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369546 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ARM] Formatting for ARMInstrMVE.td. NFC
David Green [Wed, 21 Aug 2019 16:20:35 +0000 (16:20 +0000)]
[ARM] Formatting for ARMInstrMVE.td. NFC

This is just some formatting cleanup, prior to the masked load and store patch
in D66534.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369545 91177308-0d34-0410-b5e6-96231b3b80d8

5 years agogit-llvm: Make push --force suppress error on nothing to commit as well
Nico Weber [Wed, 21 Aug 2019 16:03:34 +0000 (16:03 +0000)]
git-llvm: Make push --force suppress error on nothing to commit as well

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369544 91177308-0d34-0410-b5e6-96231b3b80d8