OSDN Git Service

android-x86/external-llvm.git
6 years ago[docs] Stop trying to parse the ThinLTO summary IR fragments with the
Chandler Carruth [Mon, 6 Aug 2018 09:46:59 +0000 (09:46 +0000)]
[docs] Stop trying to parse the ThinLTO summary IR fragments with the
`llvm` syntax in Sphinx. This appears to just fail and create errors on
the docs buildbot.

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

6 years agoRevert rL338990 to see if it causes sanitizer failures
Max Kazantsev [Mon, 6 Aug 2018 08:10:28 +0000 (08:10 +0000)]
Revert rL338990 to see if it causes sanitizer failures

Multiple failues reported by sanitizer-x86_64-linux, seem to be caused by this
patch. Reverting to see if they sustain without it.

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

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

6 years agoTry to fix buildbot
Max Kazantsev [Mon, 6 Aug 2018 06:35:21 +0000 (06:35 +0000)]
Try to fix buildbot

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

6 years ago[ValueTracking] Teach isKnownNonNullFromDominatingCondition about AND
Max Kazantsev [Mon, 6 Aug 2018 06:11:36 +0000 (06:11 +0000)]
[ValueTracking] Teach isKnownNonNullFromDominatingCondition about AND

`isKnownNonNullFromDominatingCondition` is able to prove non-null basing on `br` or `guard`
by `%p != null` condition, but is unable to do so basing on `(%p != null) && %other_cond`.
This patch allows it to do so.

Differential Revision: https://reviews.llvm.org/D50172
Reviewed By: reames

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

6 years ago[GuardWidening] Widen guards with conditions of frequently taken dominated branches
Max Kazantsev [Mon, 6 Aug 2018 05:49:19 +0000 (05:49 +0000)]
[GuardWidening] Widen guards with conditions of frequently taken dominated branches

If there is a frequently taken branch dominated by a guard, and its condition is available
at the point of the guard, we can widen guard with condition of this branch and convert
the branch into unconditional:

  guard(cond1)
  if (cond2) {
    // taken in 99.9% cases
    // do something
  } else {
    // do something else
  }

Converts to

  guard(cond1 && cond2)
  // do something

Differential Revision: https://reviews.llvm.org/D49974
Reviewed By: reames

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

6 years ago[NFC] Fix typo
Xin Tong [Mon, 6 Aug 2018 05:03:21 +0000 (05:03 +0000)]
[NFC] Fix typo

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

6 years ago[NFC] Fixed unused function warning
David Bolvansky [Mon, 6 Aug 2018 04:45:46 +0000 (04:45 +0000)]
[NFC] Fixed unused function warning

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

6 years ago[DebugInfo] Refactor DbgInfoIntrinsic class hierarchy.
Hsiangkai Wang [Mon, 6 Aug 2018 03:59:47 +0000 (03:59 +0000)]
[DebugInfo] Refactor DbgInfoIntrinsic class hierarchy.

In the past, DbgInfoIntrinsic has a strong assumption that these
intrinsics all have variables and expressions attached to them.
However, it is too strong to derive the class for other debug entities.
Now, it has problems for debug labels.

In order to make DbgInfoIntrinsic as a base class for 'debug info', I
create a class for 'variable debug info', DbgVariableIntrinsic.

DbgDeclareInst, DbgAddrIntrinsic, and DbgValueInst will be derived from it.

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

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

6 years ago[docs] Switch debug info metadata blocks to use `text` instead of `llvm`
Chandler Carruth [Mon, 6 Aug 2018 03:35:36 +0000 (03:35 +0000)]
[docs] Switch debug info metadata blocks to use `text` instead of `llvm`
highlighting syntax.

Most of them already were like this, and the Sphinx runs on the docs
build bot seems to be substantially more picky and/or not have support
for a bunch of the syntax here. Hopefully this will let it progress past
this.

My previous attempt to fix the syntax made the `opt` tool happy, but no
idea what the Sphinx stuff is really looking for, and the fact that
other blocks already just use `text` led me to this solution.

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

6 years ago[docs] Correct the basic syntax structure of the DISubrange example.
Chandler Carruth [Mon, 6 Aug 2018 02:30:01 +0000 (02:30 +0000)]
[docs] Correct the basic syntax structure of the DISubrange example.

Notably, just close two of the debug info metadata nodes early rather
than leaving them open with `...` which won't ever lex correctly. And
add the missing `:` on the count labels.

Slowly progressing through all of the warnings on the documentation
build bot. Sorry to do this one commit at a time, but despite my best
efforts I can't trigger these errors locally.

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

6 years ago[docs] Remove an example that isn't well formed LLVM IR and trips up the
Chandler Carruth [Mon, 6 Aug 2018 02:02:09 +0000 (02:02 +0000)]
[docs] Remove an example that isn't well formed LLVM IR and trips up the
Sphinx syntax highlighter.

This example also doesn't really make sense. There is no control flow or
clarification of what the `Safe:` block exists to do... If we want
examples here, we should make them much more clear in addition to making
them well formed IR sequences.

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

6 years ago[docs] Fix an LLVM-syntax code block to actually be valid LLVM synatx.
Chandler Carruth [Mon, 6 Aug 2018 01:41:25 +0000 (01:41 +0000)]
[docs] Fix an LLVM-syntax code block to actually be valid LLVM synatx.

Hopefully fixes an issue on the docs build bot.

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

6 years ago[docs] Turn of `nasm` highlighting for a code block.
Chandler Carruth [Mon, 6 Aug 2018 01:19:43 +0000 (01:19 +0000)]
[docs] Turn of `nasm` highlighting for a code block.

This appears to produce a warning on the docs build bot. It doesn't
reproduce for me, likely because I have a newer (or more full featured)
pygments install.

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

6 years ago[docs] Reinstate r337730 - Add support for Markdown documentation in
Chandler Carruth [Mon, 6 Aug 2018 00:38:31 +0000 (00:38 +0000)]
[docs] Reinstate r337730 - Add support for Markdown documentation in
Sphinx.

We think the bot is updated now, so trying this again. I'm landing it
(with permission) as Michael is at a con at the moment.

Actual patch largely by Michael Spencer.

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

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

6 years ago[ORC] Remove an incorrect use of 'cantFail'.
Lang Hames [Sun, 5 Aug 2018 23:55:35 +0000 (23:55 +0000)]
[ORC] Remove an incorrect use of 'cantFail'.

This code was moved out from BasicObjectLayerMaterializationUnit, which required
the supplied object to be well formed. The getObjectSymbolFlags function does
not require a well-formed object, so we have to propagate the error here.

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

6 years ago[ORC] Change JITSymbolFlags debug output, add a function for getting a symbol
Lang Hames [Sun, 5 Aug 2018 22:35:37 +0000 (22:35 +0000)]
[ORC] Change JITSymbolFlags debug output, add a function for getting a symbol
flags map from a buffer representing an object file.

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

6 years ago[NFC] Fixed inliner tests - 2
David Bolvansky [Sun, 5 Aug 2018 16:53:36 +0000 (16:53 +0000)]
[NFC] Fixed inliner tests - 2

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

6 years ago[NFC] Fixed inliner tests
David Bolvansky [Sun, 5 Aug 2018 16:30:46 +0000 (16:30 +0000)]
[NFC] Fixed inliner tests

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

6 years agoEnrich inline messages
David Bolvansky [Sun, 5 Aug 2018 14:53:08 +0000 (14:53 +0000)]
Enrich inline messages

Summary:
This patch improves Inliner to provide causes/reasons for negative inline decisions.
1. It adds one new message field to InlineCost to report causes for Always and Never instances. All Never and Always instantiations must provide a simple message.
2. Several functions that used to return the inlining results as boolean are changed to return InlineResult which carries the cause for negative decision.
3. Changed remark priniting and debug output messages to provide the additional messages and related inline cost.
4. Adjusted tests for changed printing.

Patch by: yrouban (Yevgeny Rouban)

Reviewers: craig.topper, sammccall, sgraenitz, NutshellySima, shchenz, chandlerc, apilipenko, javed.absar, tejohnson, dblaikie, sanjoy, eraman, xbolva00

Reviewed By: tejohnson, xbolva00

Subscribers: xbolva00, llvm-commits, arsenm, mehdi_amini, eraman, haicheng, steven_wu, dexonsmith

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

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

6 years agoRevert "Add a warning if someone attempts to add extra section flags to sections"
Eric Christopher [Sun, 5 Aug 2018 14:23:37 +0000 (14:23 +0000)]
Revert "Add a warning if someone attempts to add extra section flags to sections"

There are a bunch of edge cases and inconsistencies in how we're emitting sections
cause this warning to fire and it needs more work.

This reverts commit r335558.

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

6 years ago[NFC][InstCombine] Add tests for sinking 'not' into 'xor' (PR38446)
Roman Lebedev [Sun, 5 Aug 2018 10:15:04 +0000 (10:15 +0000)]
[NFC][InstCombine] Add tests for sinking 'not' into 'xor' (PR38446)

https://rise4fun.com/Alive/IT3

Comes up in the [most ugliest]  signed int -> signed char  case of
-fsanitize=implicit-conversion (https://reviews.llvm.org/D50250)

Not sure if we want to do it always, or only when it is free to invert.

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

6 years ago[NFC][InstCombine] Regenerate set.ll test
Roman Lebedev [Sun, 5 Aug 2018 08:53:40 +0000 (08:53 +0000)]
[NFC][InstCombine] Regenerate set.ll test

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

6 years ago[X86] Remove stale comments from a test. NFC
Craig Topper [Sun, 5 Aug 2018 06:25:01 +0000 (06:25 +0000)]
[X86] Remove stale comments from a test. NFC

The 16-bit case was recently fixed so this comment no longer applies.

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

6 years ago[InstCombine] [NFC] Tests for strcmp to memcmp transformation
David Bolvansky [Sun, 5 Aug 2018 05:46:56 +0000 (05:46 +0000)]
[InstCombine] [NFC] Tests for strcmp to memcmp transformation

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

6 years ago[ADT] Add an early-increment iterator-like type and range adaptor.
Chandler Carruth [Sat, 4 Aug 2018 08:17:26 +0000 (08:17 +0000)]
[ADT] Add an early-increment iterator-like type and range adaptor.

This allows us to model the common LLVM idiom of incrementing
immediately after dereferencing so that we can remove or update the
entity w/o losing our ability to reach the "next".

However, these are not real or proper iterators. They are just enough to
allow range based for loops and very simple range algorithms to work,
but should not be considered full general.

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

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

6 years ago[TailCallElim] Preserve DT and PDT
Chijun Sima [Sat, 4 Aug 2018 08:13:47 +0000 (08:13 +0000)]
[TailCallElim] Preserve DT and PDT

Summary:
Previously, in the NewPM pipeline, TailCallElim recalculates the DomTree when it modifies any instruction in the Function.
For example,
```
CallInst *CI = dyn_cast<CallInst>(&I);
...
CI->setTailCall();
Modified = true;
...
if (!Modified || ...)
  return PreservedAnalyses::all();
```
After applying this patch, the DomTree only recalculates if needed (plus an extra insertEdge() + an extra deleteEdge() call).

When optimizing SQLite with `-passes="default<O3>"` pipeline of the newPM, the number of DomTree recalculation decreases by 6.2%, the number of nodes visited by DFS decreases by 2.9%. The time used by DomTree will decrease approximately 1%~2.5% after applying the patch.

Statistics:
```
Before the patch:
 23010 dom-tree-stats               - Number of DomTree recalculations
489264 dom-tree-stats               - Number of nodes visited by DFS -- DomTree
After the patch:
 21581 dom-tree-stats               - Number of DomTree recalculations
475088 dom-tree-stats               - Number of nodes visited by DFS -- DomTree
```

Reviewers: kuhar, dmgreen, brzycki, grosser, davide

Reviewed By: kuhar, brzycki

Subscribers: llvm-commits

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

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

6 years ago[llvm-objdump] Remove continue after report_error which is unreachable
Fangrui Song [Sat, 4 Aug 2018 05:19:00 +0000 (05:19 +0000)]
[llvm-objdump] Remove continue after report_error which is unreachable

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

6 years ago[ADCE] Remove the need of DomTree
Chijun Sima [Sat, 4 Aug 2018 02:50:12 +0000 (02:50 +0000)]
[ADCE] Remove the need of DomTree

Summary: ADCE doesn't need to query domtree.

Reviewers: kuhar, brzycki, dmgreen, davide, grosser

Reviewed By: kuhar

Subscribers: llvm-commits

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

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

6 years agoReverted r338825 and all the following tries to fix issues introduced by that commit...
Galina Kistanova [Sat, 4 Aug 2018 01:59:12 +0000 (01:59 +0000)]
Reverted r338825 and all the following tries to fix issues introduced by that commit (r338826, r338827, r338829, r338880).

This commit has broken build bots and has been left unattended for too long.

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

6 years ago[GISel]: Add Opcodes for CTLZ/CTTZ/CTPOP
Aditya Nandakumar [Sat, 4 Aug 2018 01:22:12 +0000 (01:22 +0000)]
[GISel]: Add Opcodes for CTLZ/CTTZ/CTPOP

https://reviews.llvm.org/D48600

Added IRTranslator support to translate these known intrinsics into GISel opcodes.

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

6 years agoFix buildbot breakage.
Rui Ueyama [Sat, 4 Aug 2018 00:23:37 +0000 (00:23 +0000)]
Fix buildbot breakage.

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

6 years agoUse the same constants as zlib to represent compression level.
Rui Ueyama [Sat, 4 Aug 2018 00:13:13 +0000 (00:13 +0000)]
Use the same constants as zlib to represent compression level.

This change allows users pass compression level that was not listed
in the enum. Also, I think using different values than zlib's
compression levels was just confusing.

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

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

6 years ago[X86] Add isel patterns for atomic_load+sub+atomic_sub.
Craig Topper [Fri, 3 Aug 2018 22:08:30 +0000 (22:08 +0000)]
[X86] Add isel patterns for atomic_load+sub+atomic_sub.

Despite the comment removed in this patch, this is beneficial when the RHS of the sub is a register.

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

6 years ago[X86] Add test cases to show missed opportunity to use RMW for atomic_load+sub+atomic...
Craig Topper [Fri, 3 Aug 2018 22:08:28 +0000 (22:08 +0000)]
[X86] Add test cases to show missed opportunity to use RMW for atomic_load+sub+atomic_store.

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

6 years ago[X86] Re-generate abi-isel.ll checks with update_llc_test_checks.py
Reid Kleckner [Fri, 3 Aug 2018 21:58:25 +0000 (21:58 +0000)]
[X86] Re-generate abi-isel.ll checks with update_llc_test_checks.py

These tests were clearly auto-generated when they were converted to
FileCheck back in r80019 (2009), but we didn't have a fancy script to
keep them up to date then. I've reviewed the diff, and we should be
generating the exact same code sequences we used to.

After this, I plan to commit a change that changes our output slightly,
but in a way that is still correct. It will generate a large diff, and I
want it to be clearly correct, so I am regenerating these checks in
preparation for that.

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

6 years ago[X86] Make abi-isel.ll like update_llc_test_checks.py output
Reid Kleckner [Fri, 3 Aug 2018 21:58:12 +0000 (21:58 +0000)]
[X86] Make abi-isel.ll like update_llc_test_checks.py output

- Remove -asm-verbose=0 from every llc command. The tests still pass.
- Reorder the RUN lines to match CHECKs.
- Use -LABEL like update_llc_test_checks.py does.

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

6 years ago[X86] Layout tests exactly as update_llc_test_checks.py would
Reid Kleckner [Fri, 3 Aug 2018 21:57:59 +0000 (21:57 +0000)]
[X86] Layout tests exactly as update_llc_test_checks.py would

Put the LLVM IR at the bottom of the function instead of the top.  In my
next patch, I will run update_llc_test_checks.py on this file, and I
want to only highlight the diffs in the CHECK lines. Hopefully by doing
this change first, the patch will be more understandable.

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

6 years ago[X86] Remove RELEASE_ and ACQUIRE_ pseudo instructions. Use isel patterns and the...
Craig Topper [Fri, 3 Aug 2018 21:40:44 +0000 (21:40 +0000)]
[X86] Remove RELEASE_ and ACQUIRE_ pseudo instructions. Use isel patterns and the normal instructions instead

At one point in time acquire implied mayLoad and mayStore as did release. Thus we needed separate pseudos that also carried that property. This appears to no longer be the case. I believe it was changed in 2012 with a comment saying that atomic memory accesses are marked volatile which preserves the ordering.

So from what I can tell we shouldn't need additional pseudos since they aren't carry any flags that are different from the normal instructions. The only thing I can think of is that we may consider them for load folding candidates in the peephole pass now where we didn't before. If that's important hopefully there's something in the memory operand we can check to prevent the folding without relying on pseudo instructions.

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

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

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Fri, 3 Aug 2018 20:58:14 +0000 (20:58 +0000)]
[X86] Autogenerate complete checks. NFC

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

6 years ago[TRE][DebugInfo] Preserve Debug Location in new branch instruction
Anastasis Grammenos [Fri, 3 Aug 2018 20:27:13 +0000 (20:27 +0000)]
[TRE][DebugInfo] Preserve Debug Location in new branch instruction

There are two branch instructions created
so the new test covers them both.

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

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

6 years ago[SelectionDAG] Teach LegalizeVectorTypes to widen the mask input to a masked store.
Craig Topper [Fri, 3 Aug 2018 20:14:18 +0000 (20:14 +0000)]
[SelectionDAG] Teach LegalizeVectorTypes to widen the mask input to a masked store.

The mask operand is visited before the data operand so we need to be able to widen it.

Fixes PR38436.

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

6 years ago[Support] Don't initialize compressed buffer allocated by zlib::compress
Fangrui Song [Fri, 3 Aug 2018 19:37:49 +0000 (19:37 +0000)]
[Support] Don't initialize compressed buffer allocated by zlib::compress

resize() (zeroing) makes every allocated page resident. The actual size of the compressed buffer is usually much
smaller. Making every page resident is wasteful.

When linking a test binary with ~1.9GiB uncompressed debug info with LLD, this optimization decreases max RSS by ~1.5GiB.

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

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

6 years agoDAG: Enhance isKnownNeverNaN
Matt Arsenault [Fri, 3 Aug 2018 18:27:52 +0000 (18:27 +0000)]
DAG: Enhance isKnownNeverNaN

Add a parameter for testing specifically for
sNaNs - at least one instruction pattern on AMDGPU
needs to check specifically for this.

Also handle more cases, and add a target hook
for custom nodes, similar to the hooks for known
bits.

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

6 years ago[NVPTX] Handle __nvvm_reflect("__CUDA_ARCH").
Artem Belevich [Fri, 3 Aug 2018 18:05:24 +0000 (18:05 +0000)]
[NVPTX] Handle __nvvm_reflect("__CUDA_ARCH").

Summary:
libdevice in recent CUDA versions relies on __nvvm_reflect() to select
GPU-specific bitcode. This patch addresses the requirement.

Reviewers: jlebar

Subscribers: jholewinski, sanjoy, hiraditya, bixia, llvm-commits

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

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

6 years ago[X86] Add a DAG combine for the __builtin_parity idiom used by clang to enable better...
Craig Topper [Fri, 3 Aug 2018 18:00:29 +0000 (18:00 +0000)]
[X86] Add a DAG combine for the __builtin_parity idiom used by clang to enable better codegen

Clang uses "ctpop & 1" to implement __builtin_parity. If the popcnt instruction isn't supported this generates a large amount of code to calculate the population count. Instead we can bisect the data down to a single byte using xor and then check the parity flag.

Even when popcnt is supported, its still a good idea to split 64-bit data on 32-bit targets using an xor in front of a single popcnt. Otherwise we get two popcnts and an add before the and.

I've specifically targeted this at the sizes supported by clang builtins, but we could generalize this if we think that's useful.

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

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

6 years ago[X86] Add test cases for the current codegen of __builtin_parity.
Craig Topper [Fri, 3 Aug 2018 18:00:23 +0000 (18:00 +0000)]
[X86] Add test cases for the current codegen of __builtin_parity.

Will be improved in a follow commit

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

6 years ago[SLC] Refactor shrinking of functions (NFC)
Evandro Menezes [Fri, 3 Aug 2018 17:50:16 +0000 (17:50 +0000)]
[SLC] Refactor shrinking of functions (NFC)

Merge the helper functions for shrinking unary and binary functions into a
single one, while keeping all their functionality.  Otherwise, NFC.

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

6 years agoFix crash in bounds checking.
Joel Galenson [Fri, 3 Aug 2018 17:12:23 +0000 (17:12 +0000)]
Fix crash in bounds checking.

In r337830 I added SCEV checks to enable us to insert fewer bounds checks.  Unfortunately, this sometimes crashes when multiple bounds checks are added due to SCEV caching issues.  This patch splits the bounds checking pass into two phases, one that computes all the conditions (using SCEV checks) and the other that adds the new instructions.

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

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

6 years ago[llvm-mca][docs] Move the code marker text into its own subsection. NFC.
Matt Davis [Fri, 3 Aug 2018 15:56:07 +0000 (15:56 +0000)]
[llvm-mca][docs] Move the code marker text into its own subsection. NFC.

Also fixed a few undecorated 'llvm-mca' references to be highlighted
with the 'program' emphasis.

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

6 years ago[X86] Fix line endings.
Simon Pilgrim [Fri, 3 Aug 2018 15:09:56 +0000 (15:09 +0000)]
[X86] Fix line endings.

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

6 years ago[Partial Inlining] Fix small bug in detecting if we did something
Graham Yiu [Fri, 3 Aug 2018 14:42:53 +0000 (14:42 +0000)]
[Partial Inlining] Fix small bug in detecting if we did something

- It's possible for 'Changed' to return as false even if we did
  partial inline something.  Fixed to accumulate return values

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

6 years ago[WebAssembly] Cleanup of the way globals and global flags are handled
Nicholas Wilson [Fri, 3 Aug 2018 14:33:37 +0000 (14:33 +0000)]
[WebAssembly] Cleanup of the way globals and global flags are handled

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

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

6 years ago[llvm-mca] Speed up the computation of the wait/ready/issued sets in the Scheduler.
Andrea Di Biagio [Fri, 3 Aug 2018 12:55:28 +0000 (12:55 +0000)]
[llvm-mca] Speed up the computation of the wait/ready/issued sets in the Scheduler.

This patch is a follow-up to r338702.

We don't need to use a map to model the wait/ready/issued sets. It is much more
efficient to use a vector instead.

This patch gives us an average 7.5% speedup (on top of the ~12% speedup obtained
after r338702).

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

6 years ago[Dominators] Make RemoveUnreachableBlocks return false if the BasicBlock is already...
Chijun Sima [Fri, 3 Aug 2018 12:45:29 +0000 (12:45 +0000)]
[Dominators] Make RemoveUnreachableBlocks return false if the BasicBlock is already awaiting deletion

Summary:
Previously, `removeUnreachableBlocks` still returns true (which indicates the CFG is changed) even when all the unreachable blocks found is awaiting deletion in the DDT class.
This makes code pattern like
```
// Code modified from lib/Transforms/Scalar/SimplifyCFGPass.cpp
bool EverChanged = removeUnreachableBlocks(F, nullptr, DDT);
...
do {
    EverChanged = someMightHappenModifications();
    EverChanged |= removeUnreachableBlocks(F, nullptr, DDT);
  } while (EverChanged);
```
become a dead loop.
Fix this by detecting whether a BasicBlock is already awaiting deletion.

Reviewers: kuhar, brzycki, dmgreen, grosser, davide

Reviewed By: kuhar, brzycki

Subscribers: llvm-commits

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

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

6 years ago[llvm-mca][docs] Improve the CommandLine documentation.
Andrea Di Biagio [Fri, 3 Aug 2018 12:44:56 +0000 (12:44 +0000)]
[llvm-mca][docs] Improve the CommandLine documentation.

This patch replaces all the remaining occurrences of string "MCA" with
":program:`llvm-mca`".  Somehow I missed those strings when I committed r338394.

This patch also improves section "Instruction Dispatch".

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

6 years agoconvert some tabs to spaces
Nico Weber [Fri, 3 Aug 2018 12:21:54 +0000 (12:21 +0000)]
convert some tabs to spaces

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

6 years ago[DebugInfo/Verifier] Don't emit error for missing module in index
Jonas Devlieghere [Fri, 3 Aug 2018 12:01:43 +0000 (12:01 +0000)]
[DebugInfo/Verifier] Don't emit error for missing module in index

We don't expect module names to be present in the index. This patch adds
DW_TAG_module to the blacklist.

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

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

6 years ago[SystemZ] Improve handling of instructions which expand to several groups
Jonas Paulsson [Fri, 3 Aug 2018 10:43:05 +0000 (10:43 +0000)]
[SystemZ]  Improve handling of instructions which expand to several groups

Some instructions expand to more than one decoder group.

This has been hitherto ignored, but is handled with this patch.

Review: Ulrich Weigand
https://reviews.llvm.org/D50187

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

6 years ago[NFC] Add missing comment
Max Kazantsev [Fri, 3 Aug 2018 10:41:51 +0000 (10:41 +0000)]
[NFC] Add missing comment

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

6 years ago[NFC] Move some methods into static functions
Max Kazantsev [Fri, 3 Aug 2018 10:16:40 +0000 (10:16 +0000)]
[NFC] Move some methods into static functions

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

6 years ago[Windows FS] Allow moving files in TempFile::keep
Jeremy Morse [Fri, 3 Aug 2018 10:13:35 +0000 (10:13 +0000)]
[Windows FS] Allow moving files in TempFile::keep

In r338216 / D49860 TempFile::keep was extended to allow keeping across
filesystems. The aim on Windows was to have this happen in rename_internal
using the existing system API. However, to fix an issue and preserve the
idea of "renaming" not being a move, put Windows keep-across-filesystem in
TempFile::keep.

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

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

6 years ago[TargetLowering] Generalise BuildSDIV function
Simon Pilgrim [Fri, 3 Aug 2018 10:00:54 +0000 (10:00 +0000)]
[TargetLowering] Generalise BuildSDIV function

First step towards a BuildSDIV equivalent to D49248 for non-uniform vector support - this just pushes the splat detection down into TargetLowering::BuildSDIV where its still used.

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

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

6 years ago[llvm-exegesis] Renaming classes and functions.
Guillaume Chatelet [Fri, 3 Aug 2018 09:29:38 +0000 (09:29 +0000)]
[llvm-exegesis] Renaming classes and functions.

Summary: Functional No Op.

Reviewers: gchatelet

Subscribers: tschuett, courbet, llvm-commits

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

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

6 years ago[ARM] FP16: support vector zip and unzip
Sjoerd Meijer [Fri, 3 Aug 2018 09:24:29 +0000 (09:24 +0000)]
[ARM] FP16: support vector zip and unzip

This is addressing PR38404.

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

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

6 years ago[XRay][tools] Use Support/JSON.h in llvm-xray convert
Dean Michael Berris [Fri, 3 Aug 2018 09:21:31 +0000 (09:21 +0000)]
[XRay][tools] Use Support/JSON.h in llvm-xray convert

Summary:
This change removes the ad-hoc implementation used by llvm-xray's
`convert` subcommand to generate JSON encoded catapult (AKA Chrome
Trace Viewer) trace output, to instead use the JSON encoder now in the
Support library.

Reviewers: kpw, zturner, eizan

Reviewed By: kpw

Subscribers: llvm-commits

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

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

6 years ago[X86] Add example of 'zero shift' guards on rotation patterns (PR34924)
Simon Pilgrim [Fri, 3 Aug 2018 09:20:02 +0000 (09:20 +0000)]
[X86] Add example of 'zero shift' guards on rotation patterns (PR34924)

Basic pattern that leaves an unnecessary select on a rotation by zero result. This variant is trivial - the more general case with a compare+branch to prevent execution of undefined shifts is more tricky.

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

6 years ago[ARM] FP16: support VFMA
Sjoerd Meijer [Fri, 3 Aug 2018 09:12:56 +0000 (09:12 +0000)]
[ARM] FP16: support VFMA

This is addressing PR38404.

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

6 years ago[XRay] fixup: add one more missing std::move(...)
Dean Michael Berris [Fri, 3 Aug 2018 09:06:11 +0000 (09:06 +0000)]
[XRay] fixup: add one more missing std::move(...)

Follow up to D48370.

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

6 years ago[XRay] fixup: Add missing std::move(...)
Dean Michael Berris [Fri, 3 Aug 2018 07:54:37 +0000 (07:54 +0000)]
[XRay] fixup: Add missing std::move(...)

Follow up to D48370.

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

6 years ago[XRay] Fixup: remove 'noexcept' in defaulted move members
Dean Michael Berris [Fri, 3 Aug 2018 07:41:34 +0000 (07:41 +0000)]
[XRay] Fixup: remove 'noexcept' in defaulted move members

This is to appease stage1 builds using gcc.

Follow-up to D48370.

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

6 years ago[XRay][llvm] Load XRay Profiles
Dean Michael Berris [Fri, 3 Aug 2018 07:18:39 +0000 (07:18 +0000)]
[XRay][llvm] Load XRay Profiles

Summary:
This change implements the profile loading functionality in LLVM to
support XRay's profiling mode in compiler-rt.

We introduce a type named `llvm::xray::Profile` which allows building a
profile representation. We can load an XRay profile from a file to build
Profile instances, or do it manually through the Profile type's API.

The intent is to get the `llvm-xray` tool to generate `Profile`
instances and use that as the common abstraction through which all
conversion and analysis can be done. In the future we can generate
`Profile` instances from `Trace` instances as well, through conversion
functions.

Some of the key operations supported by the `Profile` API are:

- Path interning (`Profile::internPath(...)`) which returns a unique path
  identifier.

- Block appending (`Profile::addBlock(...)`) to add thread-associated
  profile information.

- Path ID to Path lookup (`Profile::expandPath(...)`) to look up a
  PathID and return the original interned path.

- Block iteration.

A 'Path' in this context represents the function call stack in
leaf-to-root order. This is represented as a path in an internally
managed prefix tree in the `Profile` instance. Having a handle (PathID)
to identify the unique Paths we encounter for a particular Profile
allows us to reduce the amount of memory required to associate profile
data to a particular Path.

This is the first of a series of patches to migrate the `llvm-stacks`
tool towards using a single profile representation.

Depends on D48653.

Reviewers: kpw, eizan

Reviewed By: kpw

Subscribers: mgorny, llvm-commits, hiraditya

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

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

6 years ago[X86] Remove all the vector NOP bitcast patterns. Use a few lines of code in the...
Craig Topper [Fri, 3 Aug 2018 07:01:10 +0000 (07:01 +0000)]
[X86] Remove all the vector NOP bitcast patterns. Use a few lines of code in the Select method in X86ISelDAGToDAG.cpp instead.

There are a lot of permutations of types here generating a lot of patterns in the isel table. It's more efficient to just ReplaceUses and RemoveDeadNode from the Select function.

The test changes are because we have a some shuffle patterns that have a bitcast as their root node. But the behavior is identical to another instruction whose pattern doesn't start with a bitcast. So this isn't a functional change.

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

6 years agobuild_llvm_package.bat: Add OpenMP back
Hans Wennborg [Fri, 3 Aug 2018 07:00:08 +0000 (07:00 +0000)]
build_llvm_package.bat: Add OpenMP back

After r338721, it builds again.

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

6 years ago[Dominators] Refine the logic of recalculate() in the DomTreeUpdater
Chijun Sima [Fri, 3 Aug 2018 06:51:35 +0000 (06:51 +0000)]
[Dominators] Refine the logic of recalculate() in the DomTreeUpdater

Summary:
This patch refines the logic of `recalculate()` in the `DomTreeUpdater` in the following two aspects:
1. Previously, `recalculate()` tests whether there are pending updates/BBs awaiting deletion and then do recalculation under Lazy UpdateStrategy; and do recalculation immediately under Eager UpdateStrategy. (The former behavior is inherited from the `DeferredDominance` class). This is an inconsistency between two strategies and there is no obvious reason to do this. So the behavior is changed to always recalculate available trees when calling `recalculate()`.
2. Fix the issue of when DTU under Lazy UpdateStrategy holds nothing but with BBs awaiting deletion, after calling `recalculate()`, BBs awaiting deletion aren't flushed. An additional unittest is added to cover this case.

Reviewers: kuhar, dmgreen, brzycki, grosser, davide

Reviewed By: kuhar

Subscribers: llvm-commits

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

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

6 years ago[X86] Support fp128 and/or/xor/load/store with VEX and EVEX encoded instructions.
Craig Topper [Fri, 3 Aug 2018 06:12:56 +0000 (06:12 +0000)]
[X86] Support fp128 and/or/xor/load/store with VEX and EVEX encoded instructions.

Move all the patterns to X86InstrVecCompiler.td so we can keep SSE/AVX/AVX512 all in one place.

To save some patterns we'll use an existing DAG combine to convert f128 fand/for/fxor to integer when sse2 is enabled. This allows use to reuse all the existing patterns for v2i64.

I believe this now makes SHA instructions the only case where VEX/EVEX and legacy encoded instructions could be generated simultaneously.

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

6 years ago[InstSimplify] fold extracting from std::pair (2/2)
Hiroshi Inoue [Fri, 3 Aug 2018 05:39:48 +0000 (05:39 +0000)]
[InstSimplify] fold extracting from std::pair (2/2)

This is the second patch of the series which intends to enable jump threading for an inlined method whose return type is std::pair<int, bool> or std::pair<bool, int>.
The first patch is https://reviews.llvm.org/rL338485.

This patch handles code sequences that merges two values using `shl` and `or`, then extracts one value using `and`.

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

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

6 years ago[Dominators] Convert existing passes and utils to use the DomTreeUpdater class
Chijun Sima [Fri, 3 Aug 2018 05:08:17 +0000 (05:08 +0000)]
[Dominators] Convert existing passes and utils to use the DomTreeUpdater class

Summary:
This patch is the second in a series of patches related to the [[ http://lists.llvm.org/pipermail/llvm-dev/2018-June/123883.html | RFC - A new dominator tree updater for LLVM ]].

It converts passes (e.g. adce/jump-threading) and various functions which currently accept DDT in local.cpp and BasicBlockUtils.cpp to use the new DomTreeUpdater class.
These converted functions in utils can accept DomTreeUpdater with either UpdateStrategy and can deal with both DT and PDT held by the DomTreeUpdater.

Reviewers: brzycki, kuhar, dmgreen, grosser, davide

Reviewed By: brzycki

Subscribers: llvm-commits

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

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

6 years ago[X86] When post-processing the DAG to remove zero extending moves for YMM/ZMM, make...
Craig Topper [Fri, 3 Aug 2018 04:49:42 +0000 (04:49 +0000)]
[X86] When post-processing the DAG to remove zero extending moves for YMM/ZMM, make sure the producing instruction is VEX/XOP/EVEX encoded.

If the producing instruction is legacy encoded it doesn't implicitly zero the upper bits. This is important for the SHA instructions which don't have a VEX encoded version. We might also be able to hit this with the incomplete f128 support that hasn't been ported to VEX.

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

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Fri, 3 Aug 2018 04:49:41 +0000 (04:49 +0000)]
[X86] Autogenerate complete checks. NFC

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

6 years ago[X86] Add R13D to the isInefficientLEAReg in FixupLEAs.
Craig Topper [Fri, 3 Aug 2018 03:45:19 +0000 (03:45 +0000)]
[X86] Add R13D to the isInefficientLEAReg in FixupLEAs.

I'm assuming the R13 restriction extends to R13D. Guessing this restriction is related to the funny encoding of this register as base always requiring a displacement to be encoded.

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

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Fri, 3 Aug 2018 01:28:12 +0000 (01:28 +0000)]
[X86] Autogenerate complete checks. NFC

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

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Fri, 3 Aug 2018 01:20:32 +0000 (01:20 +0000)]
[X86] Autogenerate complete checks. NFC

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

6 years ago[X86] Prevent promotion of i16 add/sub/and/or/xor to i32 if we can fold an atomic...
Craig Topper [Fri, 3 Aug 2018 00:37:34 +0000 (00:37 +0000)]
[X86] Prevent promotion of i16 add/sub/and/or/xor to i32 if we can fold an atomic load and atomic store.

This makes them consistent with i8/i32/i64. Which still seems to be more aggressive on folding than icc, gcc, or MSVC.

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

6 years ago[LICM] Remove unneccessary safety check to increase sinking effectiveness
Philip Reames [Fri, 3 Aug 2018 00:21:56 +0000 (00:21 +0000)]
[LICM] Remove unneccessary safety check to increase sinking effectiveness

This one requires a bit of explaination.  It's not every day you simply delete code to implement an optimization.  :)

The transform in question is sinking an instruction from a loop to the uses in loop exiting blocks.  We know (from LCSSA) that all of the uses outside the loop must be phi nodes, and after predecessor splitting, we know all phi users must have a single operand.  Since the use must be strictly dominated by the def, we know from the definition of dominance/ssa that the exit block must execute along a (non-strict) subset of paths which reach the def.  As a result, duplicating a potentially faulting instruction can not *introduce* a fault that didn't previously exist in the program.

The full story is that this patch builds on "rL338671: [LICM] Factor out fault legality from canHoistOrSinkInst [NFC]" which pulled this logic out of a common helper routine.  As best I can tell, this check was originally added to the helper function for hoisting legality, later an incorrect fastpath for loads/calls was added, and then the bug was fixed by duplicating the fault safety check in the hoist path.  This left the redundant check in the common code to pessimize sinking for no reason.  I split it out in an NFC, and am not removing the unneccessary check.  I wanted there to be something easy to revert in case I missed something.

Reviewed by: Anna Thomas (in person)

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

6 years agoobjdump: Better handling of Mach-O universal binaries
Dave Lee [Fri, 3 Aug 2018 00:06:38 +0000 (00:06 +0000)]
objdump: Better handling of Mach-O universal binaries

Summary:
With Mach-O, there is a flag requirement discrepancy between working with
universal binaries and thin binaries. Many flags that don't require the `-macho`
flag (for example `-private-headers` and `-disassemble`) fail to work on
universal binaries unless `-macho` is given. When this happens, the error
message is unhelpful, stating:

    The file was not recognized as a valid object file.

Which can lead to confusion.

This change allows generic flags to be used on universal binaries with and
without the `-macho` flag. This means flags that can be used for thin files can
be used consistently with fat files too.

To do this, the universal binary support within `ParseInputMachO()` is extracted
into a new function. This new function is called directly from `DumpInput()`
when the input binary is universal. Additionally the `-arch` flag validation in
`ParseInputMachO()` was extracted to be reused.

Reviewers: compnerd

Reviewed By: compnerd

Subscribers: keith, llvm-commits

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

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

6 years ago[GlobalMerge] Allow merging globals with explicit section markings.
Eli Friedman [Thu, 2 Aug 2018 23:54:16 +0000 (23:54 +0000)]
[GlobalMerge] Allow merging globals with explicit section markings.

At least on ELF, it's impossible to tell from the object file whether
two globals with the same section marking were merged: the merged global
uses "private" linkage to hide its symbol, and the aliases look like
regular symbols. I can't think of any other reason to disallow it.
(Of course, we can only merge globals in the same section.)

The weird alignment handling matches AsmPrinter; our alignment handling
for global variables should probably be refactored.

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

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

6 years ago[AMDGPU] Minor change to d16 buffer load implementation
Tim Renouf [Thu, 2 Aug 2018 23:33:01 +0000 (23:33 +0000)]
[AMDGPU] Minor change to d16 buffer load implementation

Summary:
By not reconstructing the operand list of the SDNode, this change makes
it easier to add the forthcoming new tbuffer and buffer intrinsics.

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits

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

Change-Id: I0cb79ef0801532645d7dd954a6d7355139db7b38

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

6 years ago[AMDGPU] Reworked SIFixWWMLiveness
Tim Renouf [Thu, 2 Aug 2018 23:31:32 +0000 (23:31 +0000)]
[AMDGPU] Reworked SIFixWWMLiveness

Summary:
I encountered some problems with SIFixWWMLiveness when WWM is in a loop:

1. It sometimes gave invalid MIR where there is some control flow path
   to the new implicit use of a register on EXIT_WWM that does not pass
   through any def.

2. There were lots of false positives of registers that needed to have
   an implicit use added to EXIT_WWM.

3. Adding an implicit use to EXIT_WWM (and adding an implicit def just
   before the WWM code, which I tried in order to fix (1)) caused lots
   of the values to be spilled and reloaded unnecessarily.

This commit is a rework of SIFixWWMLiveness, with the following changes:

1. Instead of considering any register with a def that can reach the WWM
   code and a def that can be reached from the WWM code, it now
   considers three specific cases that need to be handled.

2. A register that needs liveness over WWM to be synthesized now has it
   done by adding itself as an implicit use to defs other than the
   dominant one.

Also added the following fixmes:

FIXME: We should detect whether a register in one of the above
categories is already live at the WWM code before deciding to add the
implicit uses to synthesize its liveness.

FIXME: I believe this whole scheme may be flawed due to the possibility
of the register allocator doing live interval splitting.

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits

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

Change-Id: Ie7fba0ede0378849181df3f1a9a7a39ed1a94a94

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

6 years ago[X86] Allow 'atomic_store (neg/not atomic_load)' to isel to a RMW instruction.
Craig Topper [Thu, 2 Aug 2018 23:30:38 +0000 (23:30 +0000)]
[X86] Allow 'atomic_store (neg/not atomic_load)' to isel to a RMW instruction.

There was a FIXMe in the td file about a type inference issue that was easy to fix.

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

6 years ago[X86] Add NEG and NOT test cases to atomic_mi.ll in preparation for fixing the FIXME...
Craig Topper [Thu, 2 Aug 2018 23:30:31 +0000 (23:30 +0000)]
[X86] Add NEG and NOT test cases to atomic_mi.ll in preparation for fixing the FIXME in X86InstrCompiler.td to make these work for atomic load/store.

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

6 years ago[AMDGPU] Avoid using divergent value in mubuf addr64 descriptor
Tim Renouf [Thu, 2 Aug 2018 22:53:57 +0000 (22:53 +0000)]
[AMDGPU] Avoid using divergent value in mubuf addr64 descriptor

Summary:
This fixes a problem where a load from global+idx generated incorrect
code on <=gfx7 when the index is divergent.

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, t-tye, llvm-commits

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

Change-Id: Ib4d177d6254b1dd3f8ec0203fdddec94bd8bc5ed

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

6 years ago[MS Demangler] Fix some tests that are no longer broken.
Zachary Turner [Thu, 2 Aug 2018 22:37:40 +0000 (22:37 +0000)]
[MS Demangler] Fix some tests that are no longer broken.

These were fixed with earlier patches, but had not yet been
re-enabled.

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

6 years ago[Hexagon] Simplify CFG after atomic expansion
Krzysztof Parzyszek [Thu, 2 Aug 2018 22:17:53 +0000 (22:17 +0000)]
[Hexagon] Simplify CFG after atomic expansion

This will remove suboptimal branching from the generated ll/sc loops.
The extra simplification pass affects a lot of testcases, which have
been modified to accommodate this change: either by modifying the
test to become immune to the CFG simplification, or (less preferablt)
by adding option -hexagon-initial-cfg-clenaup=0.

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

6 years ago[WebAssembly] Support for atomic.wait / atomic.wake instructions
Heejin Ahn [Thu, 2 Aug 2018 21:44:24 +0000 (21:44 +0000)]
[WebAssembly] Support for atomic.wait / atomic.wake instructions

Summary:
This adds support for atomic.wait / atomic.wake instructions in the wasm
thread proposal.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

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

6 years ago[Unittests] Fix returning string in SolveQuadraticEquationWrap
Krzysztof Parzyszek [Thu, 2 Aug 2018 20:45:06 +0000 (20:45 +0000)]
[Unittests] Fix returning string in SolveQuadraticEquationWrap

Returning a Twine caused runtime failures. Convert it to std::string
before retuning.

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

6 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Thu, 2 Aug 2018 20:28:45 +0000 (20:28 +0000)]
[X86] Autogenerate complete checks. NFC

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

6 years ago[ORC] Add a re-exports fallback definition generator.
Lang Hames [Thu, 2 Aug 2018 20:13:58 +0000 (20:13 +0000)]
[ORC] Add a re-exports fallback definition generator.

An instance of ReexportsFallbackDefinitionGenerator can be attached to a VSO
(via setFallbackDefinitionGenerator) to re-export symbols on demandy from a
backing VSO.

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

6 years ago[Support] Add an enable bit to our DebugCounters
George Burgess IV [Thu, 2 Aug 2018 19:50:27 +0000 (19:50 +0000)]
[Support] Add an enable bit to our DebugCounters

r337748 made us start incrementing DebugCounters all of the time. This
makes tsan unhappy in multithreaded environments.

Since it doesn't make much sense to use DebugCounters with multiple
threads, this patch makes us only count anything if the user passed a
-debug-counter option or if some other piece of code explicitly asks
for it (e.g. the pass in D50031).

The amount of global state here makes writing a unittest for this
behavior somewhat awkward. So, no test is provided.

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

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

6 years agoUnbreak build after r338758: specify lambda return type explicitly
Krzysztof Parzyszek [Thu, 2 Aug 2018 19:38:18 +0000 (19:38 +0000)]
Unbreak build after r338758: specify lambda return type explicitly

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

6 years ago[DebugInfo/DWARF] Remove redundant iterator type. NFC
Paul Robinson [Thu, 2 Aug 2018 19:29:38 +0000 (19:29 +0000)]
[DebugInfo/DWARF] Remove redundant iterator type. NFC

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