]> granicus.if.org Git - llvm/log
llvm
5 years ago[IPRA][ARM] Make use of the "returned" parameter attribute
Oliver Stannard [Mon, 22 Jul 2019 08:44:36 +0000 (08:44 +0000)]
[IPRA][ARM] Make use of the "returned" parameter attribute

ARM has code to recognise uses of the "returned" function parameter
attribute which guarantee that the value passed to the function in r0
will be returned in r0 unmodified. IPRA replaces the regmask on call
instructions, so needs to be told about this to avoid reverting the
optimisation.

Differential revision: https://reviews.llvm.org/D64986

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

5 years ago[llvm-readobj] - Stop using precompiled objects in file-headers.test
George Rimar [Mon, 22 Jul 2019 08:10:02 +0000 (08:10 +0000)]
[llvm-readobj] - Stop using precompiled objects in file-headers.test

This converts all sub-tests except one to YAML instead of precompiled inputs.

Differential revision: https://reviews.llvm.org/D64800

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

5 years ago[AMDGPU] Save some work when an atomic op has no uses
Jay Foad [Mon, 22 Jul 2019 07:19:44 +0000 (07:19 +0000)]
[AMDGPU] Save some work when an atomic op has no uses

Summary:
In the atomic optimizer, save doing a bunch of work and generating a
bunch of dead IR in the fairly common case where the result of an
atomic op (i.e. the value that was in memory before the atomic op was
performed) is not used. NFC.

Reviewers: arsenm, dstuttard, tpr

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, jfb, llvm-commits

Tags: #llvm

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

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

5 years ago[PowerPC][NFC] Precommit a test case where ppc-mi-peepholes miscompiles extswsli
Kai Luo [Mon, 22 Jul 2019 05:32:20 +0000 (05:32 +0000)]
[PowerPC][NFC] Precommit a test case where ppc-mi-peepholes miscompiles extswsli

Added a test case to show codegen differences.

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

5 years ago[Loop Peeling] Fix the handling of branch weights of peeled off branches.
Serguei Katkov [Mon, 22 Jul 2019 05:15:34 +0000 (05:15 +0000)]
[Loop Peeling] Fix the handling of branch weights of peeled off branches.

Current algorithm to update branch weights of latch block and its copies is
based on the assumption that number of peeling iterations is approximately equal
to trip count.

However it is not correct. According to profitability check in one case we can decide to peel
in case it helps to reduce the number of phi nodes. In this case the number of peeled iteration
can be less then estimated trip count.

This patch introduces another way to set the branch weights to peeled of branches.
Let F is a weight of the edge from latch to header.
Let E is a weight of the edge from latch to exit.
F/(F+E) is a probability to go to loop and E/(F+E) is a probability to go to exit.
Then, Estimated TripCount = F / E.
For I-th (counting from 0) peeled off iteration we set the the weights for
the peeled latch as (TC - I, 1). It gives us reasonable distribution,
The probability to go to exit 1/(TC-I) increases. At the same time
the estimated trip count of remaining loop reduces by I.

As a result after peeling off N iteration the weights will be
(F - N * E, E) and trip count of loop becomes
F / E - N or TC - N.

The idea is taken from the review of the patch D63918 proposed by Philip.

Reviewers: reames, mkuper, iajbar, fhahn
Reviewed By: reames
Subscribers: hiraditya, zzheng, llvm-commits
Differential Revision: https://reviews.llvm.org/D64235

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

5 years ago[utils] Clean up UpdateTestChecks/common.py
Fangrui Song [Mon, 22 Jul 2019 04:59:01 +0000 (04:59 +0000)]
[utils] Clean up UpdateTestChecks/common.py

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

5 years ago[InstCombine] Add foldAndOfICmps test cases inspired by PR42691.
Craig Topper [Mon, 22 Jul 2019 02:43:43 +0000 (02:43 +0000)]
[InstCombine] Add foldAndOfICmps test cases inspired by PR42691.

icmp ne %x, INT_MIN can be treated similarly to icmp sgt %x, INT_MIN.
icmp ne %x, INT_MAX can be treated similarly to icmp slt %x, INT_MAX.
icmp ne %x, UINT_MAX can be treated similarly to icmp ult %x, UINT_MAX.

We already treat icmp ne %x, 0 similarly to icmp ugt %x, 0

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

5 years ago[PowerPC][NFC] Precomit test case for upcoming patch
Nemanja Ivanovic [Sun, 21 Jul 2019 21:03:45 +0000 (21:03 +0000)]
[PowerPC][NFC] Precomit test case for upcoming patch

Just committing a test case for an upcoming patch so that the review can show
only the codegen differences.

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

5 years ago[X86] SimplifyDemandedVectorEltsForTargetNode - Move SUBV_BROADCAST narrowing handlin...
Simon Pilgrim [Sun, 21 Jul 2019 19:04:44 +0000 (19:04 +0000)]
[X86] SimplifyDemandedVectorEltsForTargetNode - Move SUBV_BROADCAST narrowing handling. NFCI.

Move the narrowing of SUBV_BROADCAST to where we handle all the other opcodes.

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

5 years ago[PowerPC][NFC] Regenerate test using script
Nemanja Ivanovic [Sun, 21 Jul 2019 18:42:29 +0000 (18:42 +0000)]
[PowerPC][NFC] Regenerate test using script

This test case ended up as a hybrid of generated checks and manually inserted
checks. Regenerate using script to make it consistent.

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

5 years ago[InstCombine] Update comment I missed in r366649. NFC
Craig Topper [Sun, 21 Jul 2019 16:15:03 +0000 (16:15 +0000)]
[InstCombine] Update comment I missed in r366649. NFC

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

5 years ago[SmallBitVector] Fix bug in find_next_unset for small types with indices >=32
Simon Pilgrim [Sun, 21 Jul 2019 16:06:26 +0000 (16:06 +0000)]
[SmallBitVector] Fix bug in find_next_unset for small types with indices >=32

We were creating a bitmask from a shift of unsigned instead of uintptr_t, meaning we couldn't create masks for indices above 31.

Noticed due to a MSVC analyzer warning.

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

5 years ago[GISel]: Attach missing range metadata while translating G_LOADs
Aditya Nandakumar [Sun, 21 Jul 2019 14:07:54 +0000 (14:07 +0000)]
[GISel]: Attach missing range metadata while translating G_LOADs

https://reviews.llvm.org/D65048

Attach range information to G_LOAD when only defining one register.

reviewed by: arsenm

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

5 years ago[ARM] Move MVE VPT block tests into the Thumb2 directory. NFC
David Green [Sun, 21 Jul 2019 13:09:19 +0000 (13:09 +0000)]
[ARM] Move MVE VPT block tests into the Thumb2 directory. NFC

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

5 years ago[NFC][InstCombine] Add a few extra srem-by-power-of-two tests - extra uses
Roman Lebedev [Sun, 21 Jul 2019 09:05:49 +0000 (09:05 +0000)]
[NFC][InstCombine] Add a few extra srem-by-power-of-two tests - extra uses

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

5 years ago[InstCombine] Remove insertRangeTest code that handles the equality case.
Craig Topper [Sun, 21 Jul 2019 06:43:38 +0000 (06:43 +0000)]
[InstCombine] Remove insertRangeTest code that handles the equality case.

For equality, the function called getTrue/getFalse with the VT
of the comparison input. But getTrue/getFalse need the boolean VT.
So if this code ever executed, it would assert.

I believe these cases are removed by InstSimplify so we don't get here.

So this patch just fixes up an assert to exclude the equality
possibility and removes the broken code.

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

5 years ago[InstCombine] Don't use AddOne/SubOne to see if two APInts are 1 apart. Use APInt...
Craig Topper [Sun, 21 Jul 2019 05:26:05 +0000 (05:26 +0000)]
[InstCombine] Don't use AddOne/SubOne to see if two APInts are 1 apart. Use APInt operations instead. NFCI

AddOne/SubOne create new Constant objects. That seems heavy for
comparing ConstantInts which wrap APInts. Just do the math on
on the APInts and compare them.

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

5 years agogn build: Merge r366622
Nico Weber [Sun, 21 Jul 2019 00:03:55 +0000 (00:03 +0000)]
gn build: Merge r366622

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

5 years ago[NFC][InstCombine] Autogenerate a few tests
Roman Lebedev [Sat, 20 Jul 2019 21:34:00 +0000 (21:34 +0000)]
[NFC][InstCombine] Autogenerate a few tests

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

5 years ago[NFC][InstCombine] Add srem-by-signbit tests - still can fold to bittest
Roman Lebedev [Sat, 20 Jul 2019 21:33:50 +0000 (21:33 +0000)]
[NFC][InstCombine] Add srem-by-signbit tests - still can fold to bittest

https://rise4fun.com/Alive/IIeS

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

5 years ago[NFC][Codegen][X86][AArch64] Add "(x s% C) == 0" tests
Roman Lebedev [Sat, 20 Jul 2019 19:25:44 +0000 (19:25 +0000)]
[NFC][Codegen][X86][AArch64] Add "(x s% C) == 0" tests

Much like with `urem`, the same optimization (albeit with slightly
different algorithm) applies for the signed case, too.

I'm simply copying the test coverage from `urem` case for now,
i believe it should be (close to?) sufficient.

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

5 years ago[Codegen][SelectionDAG] X u% C == 0 fold: non-splat vector improvements
Roman Lebedev [Sat, 20 Jul 2019 16:33:15 +0000 (16:33 +0000)]
[Codegen][SelectionDAG] X u% C == 0 fold: non-splat vector improvements

Summary:
Four things here:
1. Generalize the fold to handle non-splat divisors. Reasonably trivial.
2. Unban power-of-two divisors. I don't see any reason why they should
   be illegal.
   * There is no ban in Hacker's Delight
   * I think the ban came from the same bug that caused the miscompile
      in the base patch - in `floor((2^W - 1) / D)` we were dividing by
      `D0` instead of `D`, and we **were** ensuring that `D0` is not `1`,
      which made sense.
3. Unban `1` divisors. I no longer believe Hacker's Delight actually says
   that the fold is invalid for `D = 0`. Further considerations:
   * We know that
     * `(X u% 1) == 0`  can be constant-folded to `1`,
     * `(X u% 1) != 0`  can be constant-folded to `0`,
   *  Also, we know that
     * `X u<= -1` can be constant-folded to `1`,
     * `X u>  -1` can be constant-folded to `0`,
   * https://godbolt.org/z/7jnZJX https://rise4fun.com/Alive/oF6p
   * We know will end up with the following:
       `(setule/setugt (rotr (mul N, P), K), Q)`
   * Therefore, for given new DAG nodes and comparison predicates
     (`ule`/`ugt`), we will still produce the correct answer if:
     `Q` is a all-ones constant; and both `P` and `K` are *anything*
     other than `undef`.
   * The fold will indeed produce `Q = all-ones`.
4. Try to re-splat the `P` and `K` vectors - we don't care about
   their values for the lanes where divisor was `1`.

Reviewers: RKSimon, hermord, craig.topper, spatel, xbolva00

Reviewed By: RKSimon

Subscribers: hiraditya, javed.absar, dexonsmith, llvm-commits

Tags: #llvm

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

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

5 years ago[X86][SSE] Use PSADBW to improve vXi8 sum reduction (PR42674)
Simon Pilgrim [Sat, 20 Jul 2019 15:20:11 +0000 (15:20 +0000)]
[X86][SSE] Use PSADBW to improve vXi8 sum reduction (PR42674)

As detailed on PR42674, we can reduce a vXi8 down until we have the final <8 x i8>, and then use PSADBW with zero, to sum those values. We then extract the bottom i8, discarding any overflow from the upper bits of the i16 result.

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

5 years ago[Local] Zap blockaddress without users in ConstantFoldTerminator.
Florian Hahn [Sat, 20 Jul 2019 12:25:47 +0000 (12:25 +0000)]
[Local] Zap blockaddress without users in ConstantFoldTerminator.

If the blockaddress is not destoryed, the destination block will still
be marked as having its address taken, limiting further transformations.

I think there are other places where the dead blockaddress constants are kept
around, I'll look into that as follow up.

Reviewers: craig.topper, brzycki, davide

Reviewed By: brzycki, davide

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

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

5 years ago[GlobalISel][AArch64] Contract trivial same-size cross-bank copies into G_STOREs
Jessica Paquette [Sat, 20 Jul 2019 01:55:35 +0000 (01:55 +0000)]
[GlobalISel][AArch64] Contract trivial same-size cross-bank copies into G_STOREs

Sometimes, you can end up with cross-bank copies between same-sized GPRs and
FPRs, which feed into G_STOREs. When these copies feed only into stores, they
aren't necessary; we can just store using the original register bank.

This provides some minor code size savings for some floating point SPEC
benchmarks. (Around 0.2% for 453.povray and 450.soplex)

This issue doesn't seem to show up due to regbankselect or anything similar. So,
this patch introduces an early select function, `contractCrossBankCopyIntoStore`
which performs the contraction when possible. The selector then continues
normally and selects the correct store opcode, eliminating needless copies
along the way.

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

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

5 years ago[WebAssembly] Compute and export TLS block alignment
Guanzhong Chen [Fri, 19 Jul 2019 23:34:16 +0000 (23:34 +0000)]
[WebAssembly] Compute and export TLS block alignment

Summary:
Add immutable WASM global `__tls_align` which stores the alignment
requirements of the TLS segment.

Add `__builtin_wasm_tls_align()` intrinsic to get this alignment in Clang.

The expected usage has now changed to:

    __wasm_init_tls(memalign(__builtin_wasm_tls_align(),
                             __builtin_wasm_tls_size()));

Reviewers: tlively, aheejin, sbc100, sunfish, alexcrichton

Reviewed By: tlively

Subscribers: dschuff, jgravelle-google, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoRe-commit: r366610 and r366612: Expand pseudo-components before embedding in llvm...
Daniel Sanders [Fri, 19 Jul 2019 22:46:47 +0000 (22:46 +0000)]
Re-commit: r366610 and r366612: Expand pseudo-components before embedding in llvm-config

There were two main problems:
* The 'nativecodegen' pseudo-component was unconditionally adding
  ${native_tgt}CodeGen even though it conditionally added ${native_tgt}Info and
  ${native_tgt}Desc. This has been fixed by making ${native_tgt}CodeGen
  conditional too
* The 'all' pseudo-component was causing library names like LLVMLLVMDemangle as
  the expansion was to a library name and not a component. There doesn't seem to
  be a list of available components anywhere so this has been fixed by moving the
  expansion of 'all' back where it was before. This manifested in different ways
  on different builders but it was the same root cause

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

5 years agoAMDGPU/GlobalISel: Legalize GEP for other 32-bit address spaces
Matt Arsenault [Fri, 19 Jul 2019 22:28:44 +0000 (22:28 +0000)]
AMDGPU/GlobalISel: Legalize GEP for other 32-bit address spaces

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

5 years ago[AMDGPU] Autogenerate register sequences in tuples
Stanislav Mekhanoshin [Fri, 19 Jul 2019 21:43:42 +0000 (21:43 +0000)]
[AMDGPU] Autogenerate register sequences in tuples

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

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

5 years ago[AMDGPU] Fixed occupancy calculation for gfx10
Stanislav Mekhanoshin [Fri, 19 Jul 2019 21:29:51 +0000 (21:29 +0000)]
[AMDGPU] Fixed occupancy calculation for gfx10

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

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

5 years agoRevert r366610 and r366612: Expand pseudo-components before embedding in llvm-config
Daniel Sanders [Fri, 19 Jul 2019 21:11:05 +0000 (21:11 +0000)]
Revert r366610 and r366612: Expand pseudo-components before embedding in llvm-config

Some targets are missing LLVMDemangle, one is adding the LLVM prefix twice, and two
are hitting the very error this patch fixes for my target. Reverting while I work
through the reports.

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

5 years ago[InstCombine] Fix copy/paste mistake in the test cases I added for PR42691. NFC
Craig Topper [Fri, 19 Jul 2019 21:09:21 +0000 (21:09 +0000)]
[InstCombine] Fix copy/paste mistake in the test cases I added for PR42691. NFC

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

5 years agoAMDGPU: Avoid custom predicates for stores with glue
Matt Arsenault [Fri, 19 Jul 2019 21:01:30 +0000 (21:01 +0000)]
AMDGPU: Avoid custom predicates for stores with glue

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

5 years agoFix a latent bug discovered by r366610: nativecodegen includes X86CodeGen when X86...
Daniel Sanders [Fri, 19 Jul 2019 20:58:11 +0000 (20:58 +0000)]
Fix a latent bug discovered by r366610: nativecodegen includes X86CodeGen when X86 is not compiled

I believe this to have been a latent bug as the same expansion checks for the
existence of ${native_tgt}Info and ${native_tgt}Desc and only adds them if
they were compiled but unconditionally adds ${native_tgt}CodeGen.

This should fix llvm-clang-x86_64-win-fast which builds ARM only on an X86 host and similar builders.

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

5 years ago[InstCombine] Add test cases for PR42691. NFC
Craig Topper [Fri, 19 Jul 2019 20:48:52 +0000 (20:48 +0000)]
[InstCombine] Add test cases for PR42691. NFC

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

5 years agoExpand pseudo-components before embedding in llvm-config
Daniel Sanders [Fri, 19 Jul 2019 20:38:05 +0000 (20:38 +0000)]
Expand pseudo-components before embedding in llvm-config

Summary:
If you use pseudo-targets like AllTargetsCodeGens in LLVM_DYLIB_COMPONENTS
then a test will fail because `./bin/llvm-config --shared-mode` can't
handle these targets. We can fix this by expanding them before embedding
the string into llvm-config

Reviewers: bogner

Reviewed By: bogner

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years agoAMDGPU: Redefine setcc condition PatLeafs
Matt Arsenault [Fri, 19 Jul 2019 20:24:40 +0000 (20:24 +0000)]
AMDGPU: Redefine setcc condition PatLeafs

Avoid using custom code predicates.

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

5 years agoAMDGPU: Don't rely on m0 being -1 for GWS offsets
Matt Arsenault [Fri, 19 Jul 2019 20:01:24 +0000 (20:01 +0000)]
AMDGPU: Don't rely on m0 being -1 for GWS offsets

This only works if the high bits of m0 are also 0, so m0 would have to
be set to 0xffff.

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

5 years agoAMDGPU: Force s_waitcnt after GWS instructions
Matt Arsenault [Fri, 19 Jul 2019 19:47:30 +0000 (19:47 +0000)]
AMDGPU: Force s_waitcnt after GWS instructions

This is apparently required to be the immediately following
instruction, so force it into a bundle with a waitcnt.

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

5 years agoLiveIntervals: Fix handleMove asserting on BUNDLE
Matt Arsenault [Fri, 19 Jul 2019 19:32:00 +0000 (19:32 +0000)]
LiveIntervals: Fix handleMove asserting on BUNDLE

The top-level BUNDLE instruction should behave as an ordinary
instruction. It is supposed to have all relevant registers as implicit
operands. Moving it should work as any other instruction. I believe
the assert intended to avoid moving instructions inside bundles.

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

5 years agoRevert "[libc++] Integrate the PSTL into libc++"
Louis Dionne [Fri, 19 Jul 2019 18:52:46 +0000 (18:52 +0000)]
Revert "[libc++] Integrate the PSTL into libc++"

This reverts r366593, which caused unforeseen breakage on the build bots.
I'm reverting until the problems have been figured out and fixed.

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

5 years ago[AMDGPU] Add test case on crashing of `si-lower-sgpr-spills` pass
Michael Liao [Fri, 19 Jul 2019 18:50:53 +0000 (18:50 +0000)]
[AMDGPU] Add test case on crashing of `si-lower-sgpr-spills` pass

Reviewers: arsenm

Subscribers: qcolombet, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Tags: #llvm

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

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

5 years agoRevert "Use the MachineBasicBlock symbol for a callbr target"
Nick Desaulniers [Fri, 19 Jul 2019 18:18:02 +0000 (18:18 +0000)]
Revert "Use the MachineBasicBlock symbol for a callbr target"

This reverts commit r366523/ccbffefccaff42b0d094c9ef0f49fc3e8c8456ea.

Two regressions were immediately reported:
- https://github.com/ClangBuiltLinux/linux/issues/614
- https://github.com/ClangBuiltLinux/linux/issues/615

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

5 years ago[RISCV] Disable tests failing on buildbots.
Matt Morehouse [Fri, 19 Jul 2019 18:05:12 +0000 (18:05 +0000)]
[RISCV] Disable tests failing on buildbots.

r366399 enabled a couple tests that are failing on a few buildbots.

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

5 years ago[AMDGPU] Allow register tuples to set asm names
Stanislav Mekhanoshin [Fri, 19 Jul 2019 18:05:01 +0000 (18:05 +0000)]
[AMDGPU] Allow register tuples to set asm names

This change reverts most of the previous register name generation.
The real problem is that RegisterTuple does not generate asm names.
Added optional operand to RegisterTuple. This way we can simplify
register name access and dramatically reduce the size of static
tables for the backend.

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

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

5 years agoAMDGPU/GlobalISel: Fix MMO flags for kernel argument loads
Matt Arsenault [Fri, 19 Jul 2019 17:52:56 +0000 (17:52 +0000)]
AMDGPU/GlobalISel: Fix MMO flags for kernel argument loads

The DAG lowering sets dereferencable and invariant, not nontemporal.

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

5 years agoGlobalISel: Add GINodeEquiv for fcopysign
Matt Arsenault [Fri, 19 Jul 2019 17:32:19 +0000 (17:32 +0000)]
GlobalISel: Add GINodeEquiv for fcopysign

I don't need this at the moment, but it should be here.

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

5 years ago[llvm-lipo] Remove trailing whitespace. NFC
Shoaib Meenai [Fri, 19 Jul 2019 17:19:57 +0000 (17:19 +0000)]
[llvm-lipo] Remove trailing whitespace. NFC

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

5 years ago[libc++] Integrate the PSTL into libc++
Louis Dionne [Fri, 19 Jul 2019 17:02:42 +0000 (17:02 +0000)]
[libc++] Integrate the PSTL into libc++

Summary:
This commit allows specifying LIBCXX_ENABLE_PARALLEL_ALGORITHMS when
configuring libc++ in CMake. When that option is enabled, libc++ will
assume that the PSTL can be found somewhere on the CMake module path,
and it will provide the C++17 parallel algorithms based on the PSTL
(that is assumed to be available).

The commit also adds support for running the PSTL tests as part of
the libc++ test suite.

Reviewers: rodgert, EricWF

Subscribers: mgorny, christof, jkorous, dexonsmith, libcxx-commits, mclow.lists, EricWF

Tags: #libc

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

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

5 years agoAMDGPU: Add some function return test cases
Matt Arsenault [Fri, 19 Jul 2019 16:45:48 +0000 (16:45 +0000)]
AMDGPU: Add some function return test cases

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

5 years ago[AMDGPU] Regenerate test file for upcoming patch. NFCI.
Simon Pilgrim [Fri, 19 Jul 2019 15:43:56 +0000 (15:43 +0000)]
[AMDGPU] Regenerate test file for upcoming patch. NFCI.

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

5 years agoAMDGPU: Attempt to fix bot error
Matt Arsenault [Fri, 19 Jul 2019 14:56:24 +0000 (14:56 +0000)]
AMDGPU: Attempt to fix bot error

Manually remove file name from check line, since it somehow ends
up being different on an msvc bot.

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

5 years agoAMDGPU/GlobalISel: Selection for fminnum/fmaxnum
Matt Arsenault [Fri, 19 Jul 2019 14:42:40 +0000 (14:42 +0000)]
AMDGPU/GlobalISel: Selection for fminnum/fmaxnum

v2f16 case doesn't work yet because the VOP3P complex patterns haven't
been ported yet.

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

5 years agoAMDGPU/GlobalISel: Support arguments with multiple registers
Matt Arsenault [Fri, 19 Jul 2019 14:29:30 +0000 (14:29 +0000)]
AMDGPU/GlobalISel: Support arguments with multiple registers

Handles structs used directly in argument lists.

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

5 years agoAMDGPU/GlobalISel: Rewrite lowerFormalArguments
Matt Arsenault [Fri, 19 Jul 2019 14:15:18 +0000 (14:15 +0000)]
AMDGPU/GlobalISel: Rewrite lowerFormalArguments

This should now handle everything except structs passed as multiple
registers.

I think most of the packing logic should be handled by
handleAssignments, but I'm unclear on what the contract is for
multiple registers. This is copying how x86 handles this.

This does change the behavior of the test_sgpr_alignment0 amdgpu_vs
test. I don't think shader arguments should try to follow the
alignment, and registers need to be repacked. I also don't think it
matters, since I think the pointers are packed to the beginning of the
argument list anyway.

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

5 years agoAMDGPU: Decompose all values to 32-bit pieces for calling conventions
Matt Arsenault [Fri, 19 Jul 2019 13:57:44 +0000 (13:57 +0000)]
AMDGPU: Decompose all values to 32-bit pieces for calling conventions

This is the more natural lowering, and presents more opportunities to
reduce 64-bit ops to 32-bit.

This should also help avoid issues graphics shaders have had with
64-bit values, and simplify argument lowering in globalisel.

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

5 years agogn build: Set +x on symlink_or_copy.py
Nico Weber [Fri, 19 Jul 2019 13:40:54 +0000 (13:40 +0000)]
gn build: Set +x on symlink_or_copy.py

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

5 years agoDAG: Handle dbg_value for arguments split into multiple subregs
Matt Arsenault [Fri, 19 Jul 2019 13:36:46 +0000 (13:36 +0000)]
DAG: Handle dbg_value for arguments split into multiple subregs

This was handled previously for arguments split due to not fitting in
an MVT. This was dropping the register for argument registers split
due to TLI::getRegisterTypeForCallingConv.

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

5 years ago[NFC] include cstdint/string prior to using uint8_t/string
Than McIntosh [Fri, 19 Jul 2019 13:13:54 +0000 (13:13 +0000)]
[NFC] include cstdint/string prior to using uint8_t/string

Summary: include proper header prior to use of uint8_t typedef
and std::string.

Subscribers: llvm-commits

Reviewers: cherry

Tags: #llvm

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

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

5 years ago[AMDGPU][MC] Corrected parsing of branch offsets
Dmitry Preobrazhensky [Fri, 19 Jul 2019 13:12:47 +0000 (13:12 +0000)]
[AMDGPU][MC] Corrected parsing of branch offsets

See bug 40820: https://bugs.llvm.org/show_bug.cgi?id=40820

Reviewers: artem.tamazov, arsenm

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

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

5 years ago[MachineCSE][MachinePRE] Avoid hoisting code from code regions into hot BBs.
Kai Luo [Fri, 19 Jul 2019 12:58:16 +0000 (12:58 +0000)]
[MachineCSE][MachinePRE] Avoid hoisting code from code regions into hot BBs.

Summary:
Current PRE hoists common computations into
CMBB = DT->findNearestCommonDominator(MBB, MBB1).
However, if CMBB is in a hot loop body, we might get performance
degradation.

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

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

5 years ago[X86] for split stack, not save/restore nested arg if unused
Than McIntosh [Fri, 19 Jul 2019 12:54:44 +0000 (12:54 +0000)]
[X86] for split stack, not save/restore nested arg if unused

Summary:
For split-stack, if the nested argument (i.e. R10) is not used, no need to save/restore it in the prologue.

Reviewers: thanm

Reviewed By: thanm

Subscribers: mstorsjo, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC][InstCombine] Tests for 'rem' formation from sub-of-mul-by-'div' (PR42673)
Roman Lebedev [Fri, 19 Jul 2019 11:29:18 +0000 (11:29 +0000)]
[NFC][InstCombine] Tests for 'rem' formation from sub-of-mul-by-'div' (PR42673)

https://rise4fun.com/Alive/8Rp
https://bugs.llvm.org/show_bug.cgi?id=42673

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

5 years ago[NFC][InstCombine] Redundant masking before left-shift: tests with assume
Roman Lebedev [Fri, 19 Jul 2019 11:29:04 +0000 (11:29 +0000)]
[NFC][InstCombine] Redundant masking before left-shift: tests with assume

If the legality check is `(shiftNbits-maskNbits) s>= 0`,
then we can simplify it to `shiftNbits u>= maskNbits`,
which is easier to check for.

However, currently switching the `dropRedundantMaskingOfLeftShiftInput()`
to `SimplifyICmpInst()` does not catch these cases and regresses
currently-handled cases, so i'll leave it as is for now.

https://rise4fun.com/Alive/25P

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

5 years agoFix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.
Simon Pilgrim [Fri, 19 Jul 2019 11:18:46 +0000 (11:18 +0000)]
Fix MSVC "result of 32-bit shift implicitly converted to 64 bits" warning. NFCI.

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

5 years agoDon't update NoTrappingFPMath and FPDenormalMode in resetTargetOptions
Oliver Stannard [Fri, 19 Jul 2019 10:37:37 +0000 (10:37 +0000)]
Don't update NoTrappingFPMath and FPDenormalMode in resetTargetOptions

We'd like to remove this whole function, because these are properties of
functions, not the target as a whole. These two are easy to remove
because they are only used for emitting ARM build attributes, which
expects them to represent the defaults for the whole module, not just
the last function generated.

This is needed to get correct build attributes when using IPRA on ARM,
because IPRA causes resetTargetOptions to get called before
ARMAsmPrinter::emitAttributes.

Differential revision: https://reviews.llvm.org/D64929

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

5 years ago[llvm-readelf] - A fix for: "--hash-symbols asserts for 64-bit ELFs"
George Rimar [Fri, 19 Jul 2019 10:15:03 +0000 (10:15 +0000)]
[llvm-readelf] - A fix for: "--hash-symbols asserts for 64-bit ELFs"

Fixes https://bugs.llvm.org/show_bug.cgi?id=42622.
(--hash-symbols switch is currently broken for 64-bit ELF files, due to r352630.)

Differential revision: https://reviews.llvm.org/D64788

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

5 years ago[IPRA] Don't rely on non-exact function definitions
Oliver Stannard [Fri, 19 Jul 2019 09:59:26 +0000 (09:59 +0000)]
[IPRA] Don't rely on non-exact function definitions

If a function definition is not exact, then the linker could select a
differently-compiled version of it, which could use different registers.

https://reviews.llvm.org/D64909

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

5 years ago[ARM] Add <saturate> operand to SQRSHRL and UQRSHLL
Mikhail Maltsev [Fri, 19 Jul 2019 09:46:28 +0000 (09:46 +0000)]
[ARM] Add <saturate> operand to SQRSHRL and UQRSHLL

Summary:
According to the new Armv8-M specification
https://static.docs.arm.com/ddi0553/bh/DDI0553B_h_armv8m_arm.pdf the
instructions SQRSHRL and UQRSHLL now have an additional immediate
operand <saturate>. The new assembly syntax is:

SQRSHRL<c> RdaLo, RdaHi, #<saturate>, Rm
UQRSHLL<c> RdaLo, RdaHi, #<saturate>, Rm

where <saturate> can be either 64 (the existing behavior) or 48, in
that case the result is saturated to 48 bits.

The new operand is encoded as follows:
  #64 Encoded as sat = 0
  #48 Encoded as sat = 1
sat is bit 7 of the instruction bit pattern.

This patch adds a new assembler operand class MveSaturateOperand which
implements parsing and encoding. Decoding is implemented in
DecodeMVEOverlappingLongShift.

Reviewers: ostannard, simon_tatham, t.p.northover, samparker, dmgreen, SjoerdMeijer

Reviewed By: simon_tatham

Subscribers: javed.absar, kristof.beyls, hiraditya, pbarrio, llvm-commits

Tags: #llvm

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

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

5 years ago[sanitizers] Use covering ObjectFormatType switches
Hubert Tong [Fri, 19 Jul 2019 08:46:18 +0000 (08:46 +0000)]
[sanitizers] Use covering ObjectFormatType switches

Summary:
This patch removes the `default` case from some switches on
`llvm::Triple::ObjectFormatType`, and cases for the missing enumerators
(`UnknownObjectFormat`, `Wasm`, and `XCOFF`) are then added.

For `UnknownObjectFormat`, the effect of the action for the `default`
case is maintained; otherwise, where `llvm_unreachable` is called,
`report_fatal_error` is used instead.

Where the `default` case returns a default value, `report_fatal_error`
is used for XCOFF as a placeholder. For `Wasm`, the effect of the action
for the `default` case in maintained.

The code is structured to avoid strongly implying that the `Wasm` case
is present for any reason other than to make the switch cover all
`ObjectFormatType` enumerator values.

Reviewers: sfertile, jasonliu, daltenty

Reviewed By: sfertile

Subscribers: hiraditya, aheejin, sunfish, llvm-commits, cfe-commits

Tags: #clang, #llvm

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

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

5 years ago[AMDGPU] Simplify the exclusive scan used for optimized atomics
Jay Foad [Fri, 19 Jul 2019 08:40:37 +0000 (08:40 +0000)]
[AMDGPU] Simplify the exclusive scan used for optimized atomics

Summary:
Change the scan algorithm to use only power-of-two shifts (1, 2, 4, 8,
16, 32) instead of starting off shifting by 1, 2 and 3 and then doing
a 3-way ADD, because:

1. It simplifies the compiler a little.
2. It minimizes vgpr pressure because each instruction is now of the
   form vn = vn + vn << c.
3. It is more friendly to the DPP combiner, which currently can't
   combine into an ADD3 instruction.

Because of #2 and #3 the end result is improved from this:

  v_add_u32_dpp v4, v3, v3  row_shr:1 row_mask:0xf bank_mask:0xf bound_ctrl:0
  v_mov_b32_dpp v5, v3  row_shr:2 row_mask:0xf bank_mask:0xf
  v_mov_b32_dpp v1, v3  row_shr:3 row_mask:0xf bank_mask:0xf
  v_add3_u32 v1, v4, v5, v1
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:4 row_mask:0xf bank_mask:0xe
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:8 row_mask:0xf bank_mask:0xc
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_bcast:15 row_mask:0xa bank_mask:0xf
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_bcast:31 row_mask:0xc bank_mask:0xf

To this:

  v_add_u32_dpp v1, v1, v1  row_shr:1 row_mask:0xf bank_mask:0xf bound_ctrl:0
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:2 row_mask:0xf bank_mask:0xf bound_ctrl:0
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:4 row_mask:0xf bank_mask:0xe
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_shr:8 row_mask:0xf bank_mask:0xc
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_bcast:15 row_mask:0xa bank_mask:0xf
  s_nop 1
  v_add_u32_dpp v1, v1, v1  row_bcast:31 row_mask:0xc bank_mask:0xf

I.e. two fewer computational instructions, one extra nop where we could
schedule something else.

Reviewers: arsenm, sheredom, critson, rampitec, vpykhtin

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[Loop Peeling] Enable peeling of multiple exits by default.
Serguei Katkov [Fri, 19 Jul 2019 08:35:45 +0000 (08:35 +0000)]
[Loop Peeling] Enable peeling of multiple exits by default.

Enable loop peeling with multiple exits where all non-latch exits
ends up with deopt by default.

Reviewers: reames, fhahn
Reviewed By: reames
Subscribers: xbolva00, hiraditya, zzheng, llvm-commits
Differential Revision: https://reviews.llvm.org/D64619

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

5 years ago[InstCombine] Dropping redundant masking before left-shift [5/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:58 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [5/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
f. `((x << MaskShAmt) a>> MaskShAmt) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
f. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

Normally, the inner pattern is sign-extend,
but for our purposes it's no different to other patterns:

alive proofs:
f: https://rise4fun.com/Alive/7U3

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

https://bugs.llvm.org/show_bug.cgi?id=42563

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

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

5 years ago[InstCombine] Dropping redundant masking before left-shift [4/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:47 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [4/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
e. `((x << MaskShAmt) l>> MaskShAmt) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
e. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
e: https://rise4fun.com/Alive/0FT

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

https://bugs.llvm.org/show_bug.cgi?id=42563

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

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

5 years ago[InstCombine] Dropping redundant masking before left-shift [3/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:37 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [3/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
d. `(x & ((-1 << MaskShAmt) >> MaskShAmt)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
d. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
d: https://rise4fun.com/Alive/I5Y

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

https://bugs.llvm.org/show_bug.cgi?id=42563

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

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

5 years ago[InstCombine] Dropping redundant masking before left-shift [2/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:25 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [2/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
c. `(x & (-1 >> MaskShAmt)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
c. `(ShiftShAmt-MaskShAmt) s>= 0` (i.e. `ShiftShAmt u>= MaskShAmt`)

alive proofs:
c: https://rise4fun.com/Alive/RgJh

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

https://bugs.llvm.org/show_bug.cgi?id=42563

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

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

5 years ago[InstCombine] Dropping redundant masking before left-shift [1/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:26:13 +0000 (08:26 +0000)]
[InstCombine] Dropping redundant masking before left-shift [1/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
b. `(x & (~(-1 << maskNbits))) << shiftNbits`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
b. `(MaskShAmt+ShiftShAmt) u>= bitwidth(x)`

alive proof:
b: https://rise4fun.com/Alive/y8M

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

https://bugs.llvm.org/show_bug.cgi?id=42563

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

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

5 years ago[InstCombine] Dropping redundant masking before left-shift [0/5] (PR42563)
Roman Lebedev [Fri, 19 Jul 2019 08:25:43 +0000 (08:25 +0000)]
[InstCombine] Dropping redundant masking before left-shift [0/5] (PR42563)

Summary:
If we have some pattern that leaves only some low bits set, and then performs
left-shift of those bits, if none of the bits that are left after the final
shift are modified by the mask, we can omit the mask.

There are many variants to this pattern:
a. `(x & ((1 << MaskShAmt) - 1)) << ShiftShAmt`
All these patterns can be simplified to just:
`x << ShiftShAmt`
iff:
a. `(MaskShAmt+ShiftShAmt) u>= bitwidth(x)`

alive proof:
a: https://rise4fun.com/Alive/wi9

Indeed, not all of these patterns are canonical.
But since this fold will only produce a single instruction
i'm really interested in handling even uncanonical patterns,
since i have this general kind of pattern in hotpaths,
and it is not totally outlandish for bit-twiddling code.

For now let's start with patterns where both shift amounts are variable,
with trivial constant "offset" between them, since i believe this is
both simplest to handle and i think this is most common.
But again, there are likely other variants where we could use
ValueTracking/ConstantRange to handle more cases.

https://bugs.llvm.org/show_bug.cgi?id=42563

Reviewers: spatel, nikic, huihuiz, xbolva00

Reviewed By: xbolva00

Subscribers: efriedma, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC] Fix an indentation issue in llvm/Support/TargetRegistry.h
Hubert Tong [Fri, 19 Jul 2019 07:21:59 +0000 (07:21 +0000)]
[NFC] Fix an indentation issue in llvm/Support/TargetRegistry.h

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

5 years ago[DebugInfo] Some fields do not need relocations even relax is enabled.
Hsiangkai Wang [Fri, 19 Jul 2019 06:10:36 +0000 (06:10 +0000)]
[DebugInfo] Some fields do not need relocations even relax is enabled.

In debug frame information, some fields, e.g., Length in CIE/FDE and
Offset in FDE are attributes to describe the structure of CIE/FDE. They
are not related to the relaxed code. However, these attributes are
symbol differences. So, in current design, these attributes will be
filled as zero and LLVM generates relocations for them.

We only need to generate relocations for symbols in executable sections.
So, if the symbols are not located in executable sections, we still
evaluate their values under relaxation.

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

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

5 years agounbreak links
Chris Lattner [Fri, 19 Jul 2019 05:49:11 +0000 (05:49 +0000)]
unbreak links

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

5 years agoreplace the old kaleidoscope tutorial files with orphaned pages that forward to the...
Chris Lattner [Fri, 19 Jul 2019 05:23:17 +0000 (05:23 +0000)]
replace the old kaleidoscope tutorial files with orphaned pages that forward to the new copy.

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

5 years agoPoint to the dusted off version of the kaleidoscope tutorial.
Chris Lattner [Fri, 19 Jul 2019 05:15:57 +0000 (05:15 +0000)]
Point to the dusted off version of the kaleidoscope tutorial.

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

5 years ago[test] [llvm-objcopy] Fix broken test case
Alex Brachet [Fri, 19 Jul 2019 02:31:21 +0000 (02:31 +0000)]
[test] [llvm-objcopy] Fix broken test case

Summary: The test case added in D62718 did not work unless the user was root because write bits were not set for the output file. This change uses only permissions with user write (0200) to ensure tests pass regardless of the users permissions.

Reviewers: jhenderson, rupprecht, MaskRay, espindola, alexshap

Reviewed By: MaskRay

Subscribers: emaste, arichardson, jakehehrlich, llvm-commits

Tags: #llvm

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

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

5 years ago[NFC][PowerPC] Modify the test case add_cmp.ll
Kang Zhang [Fri, 19 Jul 2019 02:23:26 +0000 (02:23 +0000)]
[NFC][PowerPC] Modify the test case add_cmp.ll

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

5 years ago[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
Hsiangkai Wang [Fri, 19 Jul 2019 02:03:34 +0000 (02:03 +0000)]
[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.

It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.

There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.

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

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

5 years agoUse the MachineBasicBlock symbol for a callbr target
Bill Wendling [Fri, 19 Jul 2019 01:10:28 +0000 (01:10 +0000)]
Use the MachineBasicBlock symbol for a callbr target

Summary:
Inline asm doesn't use labels when compiled as an object file. Therefore, we
shouldn't create one for the (potential) callbr destination. Instead, use the
symbol for the MachineBasicBlock.

Reviewers: nickdesaulniers, craig.topper

Reviewed By: nickdesaulniers

Subscribers: xbolva00, llvm-commits

Tags: #llvm

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

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

5 years ago[GlobalISel] Translate calls to memcpy et al to G_INTRINSIC_W_SIDE_EFFECTs and legali...
Amara Emerson [Fri, 19 Jul 2019 00:24:45 +0000 (00:24 +0000)]
[GlobalISel] Translate calls to memcpy et al to G_INTRINSIC_W_SIDE_EFFECTs and legalize later.

I plan on adding memcpy optimizations in the GlobalISel pipeline, but we can't
do that unless we delay lowering to actual function calls. This patch changes
the translator to generate G_INTRINSIC_W_SIDE_EFFECTS for these functions, and
then have each target specify that using the new custom legalizer for intrinsics
hook that they want it expanded it a libcall.

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

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

5 years ago[cmake] Fix typo where a varible was checked for Apple instead of Darwin
Nathan Lanza [Fri, 19 Jul 2019 00:20:58 +0000 (00:20 +0000)]
[cmake] Fix typo where a varible was checked for Apple instead of Darwin

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years ago[cmake] Convert the NATIVE llvm build process to be project agnostic
Nathan Lanza [Fri, 19 Jul 2019 00:10:06 +0000 (00:10 +0000)]
[cmake] Convert the NATIVE llvm build process to be project agnostic

lldb recently added a tablegen tool. In order to properly cross compile
lldb standalone there needs to be a mechanism to generate the native
lldb build, analgous to what's done for the NATIVE llvm build. Thus,
we can simply modify this setup to allow for any project to be used.

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

5 years agoReapply [llvm-lipo] Implement -create (with hardcoded alignments)
Shoaib Meenai [Thu, 18 Jul 2019 22:48:38 +0000 (22:48 +0000)]
Reapply [llvm-lipo] Implement -create (with hardcoded alignments)

This reapplies r366142 with a fix for the failing Windows test.

Original commit message:

Creates universal binary output file from input files. Currently uses
hard coded value for alignment.  Want to get the create functionality
approved before implementing the alignment function.

Patch by Anusha Basana <anusha.basana@gmail.com>

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

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

5 years ago[AMDGPU] Drop Reg32 and use regular AsmName
Stanislav Mekhanoshin [Thu, 18 Jul 2019 22:18:33 +0000 (22:18 +0000)]
[AMDGPU] Drop Reg32 and use regular AsmName

This allows to reduce generated AMDGPUGenAsmWriter.inc by ~100Kb.

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

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

5 years ago[GlobalISel][AArch64] Add support for base register + offset register loads
Jessica Paquette [Thu, 18 Jul 2019 21:50:11 +0000 (21:50 +0000)]
[GlobalISel][AArch64] Add support for base register + offset register loads

Add support for folding G_GEPs into loads of the form

```
ldr reg, [base, off]
```

when possible. This can save an add before the load. Currently, this is only
supported for loads of 64 bits into 64 bit registers.

Add a new addressing mode function, `selectAddrModeRegisterOffset` which
performs this folding when it is profitable.

Also add a test for addressing modes for G_LOAD.

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

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

5 years agoCodeGen: Allow !associated metadata to point to aliases.
Peter Collingbourne [Thu, 18 Jul 2019 21:37:16 +0000 (21:37 +0000)]
CodeGen: Allow !associated metadata to point to aliases.

This is a small extension of !associated, mostly useful for the implementation
convenience of instrumentation passes that RAUW globals with aliases, such
as LowerTypeTests.

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

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

5 years agoRevert [X86] EltsFromConsecutiveLoads - support common source loads
Reid Kleckner [Thu, 18 Jul 2019 21:26:41 +0000 (21:26 +0000)]
Revert [X86] EltsFromConsecutiveLoads - support common source loads

This reverts r366441 (git commit 48104ef7c9c653bbb732b66d7254957389fea337)

This causes clang to fail to compile some file in Skia. Reduction soon.

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

5 years ago[WebAssembly] Fix __builtin_wasm_tls_base intrinsic
Guanzhong Chen [Thu, 18 Jul 2019 21:17:52 +0000 (21:17 +0000)]
[WebAssembly] Fix __builtin_wasm_tls_base intrinsic

Summary:
Properly generate the outchain for the `__builtin_wasm_tls_base` intrinsic.

Also marked the intrinsic pure, per @sunfish's suggestion.

Reviewers: tlively, aheejin, sbc100, sunfish

Reviewed By: tlively

Subscribers: dschuff, jgravelle-google, hiraditya, cfe-commits, llvm-commits, sunfish

Tags: #clang, #llvm

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

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

5 years ago[cmake] Only run llvm-codesign if targetting apple on an apple host
Nathan Lanza [Thu, 18 Jul 2019 21:14:26 +0000 (21:14 +0000)]
[cmake] Only run llvm-codesign if targetting apple on an apple host

Summary:
Other platforms don't have the capability to perform llvm_codesign
step. If LLVM_CODESIGNING_IDENTITY is set then this chunk of code would
attempt to codesign if the target was Apple. But when cross compiling
to Darwin from Linux, for example, this step would fail. So test if the
host is Apple as well.

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

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

5 years agoFix typo in r366494. Spotted by Yuanfang Chen.
Peter Collingbourne [Thu, 18 Jul 2019 21:03:37 +0000 (21:03 +0000)]
Fix typo in r366494. Spotted by Yuanfang Chen.

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

5 years agoRemove the static initialize introduced in r365099
Steven Wu [Thu, 18 Jul 2019 21:01:21 +0000 (21:01 +0000)]
Remove the static initialize introduced in r365099

Summary:
Some polish for r365099 which adds a static initializer to
MachOObjectFile. Remove it by moving it to file scope.

Reviewers: smeenai, alexshap, compnerd, mtrent, anushabasana

Reviewed By: smeenai

Subscribers: hiraditya, jkorous, dexonsmith, llvm-commits

Tags: #llvm

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

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

5 years agoIR: Teach Constant::needsRelocation() that relative pointers don't need to be relocated.
Peter Collingbourne [Thu, 18 Jul 2019 20:56:21 +0000 (20:56 +0000)]
IR: Teach Constant::needsRelocation() that relative pointers don't need to be relocated.

This causes sections with relative pointers to be marked as read only,
which means that they won't end up sharing pages with writable data.

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

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