]> granicus.if.org Git - llvm/log
llvm
5 years ago[DFAPacketizer] Use DFAEmitter. NFC.
James Molloy [Thu, 17 Oct 2019 08:34:29 +0000 (08:34 +0000)]
[DFAPacketizer] Use DFAEmitter. NFC.

Summary:
This is a NFC change that removes the NFA->DFA construction and emission logic from DFAPacketizerEmitter and instead uses the generic DFAEmitter logic. This allows DFAPacketizer to use the Automaton class from Support and remove a bunch of logic there too.

After this patch, DFAPacketizer is mostly logic for grepping Itineraries and collecting functional units, with no state machine logic. This will allow us to modernize by removing the 16-functional-unit limit and supporting non-itinerary functional units. This is all for followup patches.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[DAGCombine][ARM] Enable extending masked loads
Sam Parker [Thu, 17 Oct 2019 07:55:55 +0000 (07:55 +0000)]
[DAGCombine][ARM] Enable extending masked loads

Add generic DAG combine for extending masked loads.

Allow us to generate sext/zext masked loads which can access v4i8,
v8i8 and v4i16 memory to produce v4i32, v8i16 and v4i32 respectively.

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

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

5 years ago[Alignment][NFC] Use Align for TargetFrameLowering/Subtarget
Guillaume Chatelet [Thu, 17 Oct 2019 07:49:39 +0000 (07:49 +0000)]
[Alignment][NFC] Use Align for TargetFrameLowering/Subtarget

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

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

5 years ago[ThinLTO] Import virtual method with single implementation in hybrid mode
Eugene Leviant [Thu, 17 Oct 2019 07:46:18 +0000 (07:46 +0000)]
[ThinLTO] Import virtual method with single implementation in hybrid mode

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

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

5 years ago[llvm-ar] Simplify and make two global variables static. NFC
Fangrui Song [Thu, 17 Oct 2019 06:15:34 +0000 (06:15 +0000)]
[llvm-ar] Simplify and make two global variables static. NFC

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

5 years agoClang-formatting of some files in LiveRangeCalc header (LiveRangeCalc.h)
Marcello Maggioni [Thu, 17 Oct 2019 03:12:58 +0000 (03:12 +0000)]
Clang-formatting of some files in LiveRangeCalc header (LiveRangeCalc.h)

NFC

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

5 years agoMove LiveRangeCalc header to publicily available position. NFC
Marcello Maggioni [Thu, 17 Oct 2019 03:12:51 +0000 (03:12 +0000)]
Move LiveRangeCalc header to publicily available position. NFC

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

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

5 years agoCorrect placement of #ifndef NDEBUG in r375067
Daniel Sanders [Thu, 17 Oct 2019 01:21:53 +0000 (01:21 +0000)]
Correct placement of #ifndef NDEBUG in r375067

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

5 years agoFix unused variable in r375066
Daniel Sanders [Thu, 17 Oct 2019 01:21:40 +0000 (01:21 +0000)]
Fix unused variable in r375066

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

5 years ago[gicombiner] Add the run-time rule disable option
Daniel Sanders [Thu, 17 Oct 2019 00:37:04 +0000 (00:37 +0000)]
[gicombiner] Add the run-time rule disable option

Summary:
Each generated helper can be configured to generate an option that disables
rules in that helper. This can be used to bisect rulesets.

The disable bits are stored in a SparseVector as this is very cheap for the
common case where nothing is disabled. It gets more expensive the more rules
are disabled but you're generally doing that for debug purposes where
performance is less of a concern.

Depends on D68426

Reviewers: volkan, bogner

Reviewed By: volkan

Subscribers: hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years ago[GISel][CombinerHelper] Add concat_vectors(build_vector, build_vector) => build_vector
Quentin Colombet [Thu, 17 Oct 2019 00:34:32 +0000 (00:34 +0000)]
[GISel][CombinerHelper] Add concat_vectors(build_vector, build_vector) => build_vector

Teach the combiner helper how to flatten concat_vectors of build_vectors
into a build_vector.

Add this combine as part of AArch64 pre-legalizer combiner.

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

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

5 years ago[lit] Improve lit.Run class
Julian Lettner [Thu, 17 Oct 2019 00:29:59 +0000 (00:29 +0000)]
[lit] Improve lit.Run class

* Push timing of overall test time into run module
* Make lit.Run a proper class
* Add a few TODO comments

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

5 years ago[gicombiner] Hoist pure C++ combine into the tablegen definition
Daniel Sanders [Wed, 16 Oct 2019 23:53:35 +0000 (23:53 +0000)]
[gicombiner] Hoist pure C++ combine into the tablegen definition

Summary:
This is just moving the existing C++ code around and will be NFC w.r.t
AArch64. Renamed 'CombineBr' to something more descriptive
('ElideByByInvertingCond') at the same time.

The remaining combines in AArch64PreLegalizeCombiner require features that
aren't implemented at this point and will be hoisted as they are added.

Depends on D68424

Reviewers: bogner, volkan

Subscribers: kristof.beyls, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

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

5 years ago[lit] Remove unnecessary usage of lit.Run
Julian Lettner [Wed, 16 Oct 2019 23:31:32 +0000 (23:31 +0000)]
[lit] Remove unnecessary usage of lit.Run

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

5 years ago[lit] Do not create semaphores when we do not need them
Julian Lettner [Wed, 16 Oct 2019 23:25:46 +0000 (23:25 +0000)]
[lit] Do not create semaphores when we do not need them

Parallelism groups and semaphores are only required for parallel
execution.

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

5 years ago[lit] Factor out separate methods for parallel and serial execution
Julian Lettner [Wed, 16 Oct 2019 23:25:41 +0000 (23:25 +0000)]
[lit] Factor out separate methods for parallel and serial execution

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

5 years ago[NFC] Fix unused var in release builds
Jordan Rupprecht [Wed, 16 Oct 2019 23:09:56 +0000 (23:09 +0000)]
[NFC] Fix unused var in release builds

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

5 years agoRevert [support] GlobPattern: add support for `\` and `[!...]`, and allow `]` in...
Jordan Rupprecht [Wed, 16 Oct 2019 22:59:02 +0000 (22:59 +0000)]
Revert [support] GlobPattern: add support for `\` and `[!...]`, and allow `]` in more places

This reverts r375051 (git commit a409afaad64ce83ea44cc30ee5f96b6e613a6e98)

The patch does not work on Windows due to `\` in filenames being interpreted as escaping rather than literal path separators when used by lld linker scripts.

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

5 years ago[support] GlobPattern: add support for `\` and `[!...]`, and allow `]` in more places
Jordan Rupprecht [Wed, 16 Oct 2019 22:31:16 +0000 (22:31 +0000)]
[support] GlobPattern: add support for `\` and `[!...]`, and allow `]` in more places

Summary: Update GlobPattern in libSupport to handle a few more cases. It does not fully match the `fnmatch` used by GNU objcopy since named character classes (e.g. `[[:digit:]]`) are not supported, but this should support most existing use cases (mostly just `*` is what's used anyway).

This will be used to implement the `--wildcard` flag in llvm-objcopy to be more compatible with GNU objcopy.

This is split off of D66613 to land the libSupport changes separately. The llvm-objcopy part will land soon.

Reviewers: jhenderson, MaskRay, evgeny777, espindola, alexshap

Reviewed By: MaskRay

Subscribers: nickdesaulniers, emaste, arichardson, hiraditya, jakehehrlich, abrachet, seiya, llvm-commits

Tags: #llvm

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

undo objcopy changes to make this libsupport only

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

5 years ago[Utils] Cleanup similar cases to MergeBlockIntoPredecessor.
Alina Sbirlea [Wed, 16 Oct 2019 22:23:20 +0000 (22:23 +0000)]
[Utils] Cleanup similar cases to MergeBlockIntoPredecessor.

Summary:
There are two cases where a block is merged into its predecessor and the
MergeBlockIntoPredecessor API is not used. Update the API so it can be
reused in the other cases, in order to avoid code duplication.

Cleanup motivated by D68659.

Reviewers: chandlerc, sanjoy.google, george.burgess.iv

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[lit] Print warning if we fail to delete temp directory
Julian Lettner [Wed, 16 Oct 2019 22:20:28 +0000 (22:20 +0000)]
[lit] Print warning if we fail to delete temp directory

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

5 years ago[lit] Skip creation of tmp dir if we don't actually run any tests
Julian Lettner [Wed, 16 Oct 2019 22:20:25 +0000 (22:20 +0000)]
[lit] Skip creation of tmp dir if we don't actually run any tests

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

5 years ago[lit] Remove return value from print_summary function
Julian Lettner [Wed, 16 Oct 2019 21:58:21 +0000 (21:58 +0000)]
[lit] Remove return value from print_summary function

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

5 years ago[lit] Small refactoring and cleanups in main.py
Julian Lettner [Wed, 16 Oct 2019 21:53:20 +0000 (21:53 +0000)]
[lit] Small refactoring and cleanups in main.py

* Remove outdated precautions for Python versions < 2.7
* Remove dead code related to `maxIndividualTestTime` option
* Move printing of test and result summary out of main into its own
  function

Reviewed By: rnk

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

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

5 years agoUpdate ReleaseNotes: expand the section on enabling MemorySSA
Alina Sbirlea [Wed, 16 Oct 2019 21:52:09 +0000 (21:52 +0000)]
Update ReleaseNotes: expand the section on enabling MemorySSA

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

5 years ago[dsymutil] Print warning/error for unknown/missing arguments.
Jonas Devlieghere [Wed, 16 Oct 2019 21:48:41 +0000 (21:48 +0000)]
[dsymutil] Print warning/error for unknown/missing arguments.

After changing dsymutil to use libOption, we lost error reporting for
missing required arguments (input files). Additionally, we stopped
complaining about unknown arguments. This patch fixes both and adds a
test.

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

5 years ago[AArch64] Fix offset calculation
Shoaib Meenai [Wed, 16 Oct 2019 21:41:05 +0000 (21:41 +0000)]
[AArch64] Fix offset calculation

r374772 changed Offset to be an int64_t but left NewOffset as an int.
Scale is unsigned, so in the calculation `Offset - NewOffset * Scale`,
`NewOffset * Scale` was promoted to unsigned and was then zero-extended
to 64 bits, leading to an incorrect computation which manifested as an
out-of-memory when building the Swift standard library for Android
aarch64. Promote NewOffset to int64_t to fix this, and promote
EmittableOffset as well, since its one user passes it to a function
which takes an int64_t anyway.

Test case based on a suggestion by Sander de Smalen!

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

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

5 years agoGlobalISel: Implement lower for G_SADDO/G_SSUBO
Matt Arsenault [Wed, 16 Oct 2019 20:46:32 +0000 (20:46 +0000)]
GlobalISel: Implement lower for G_SADDO/G_SSUBO

Port directly from SelectionDAG, minus the path using
ISD::SADDSAT/ISD::SSUBSAT.

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

5 years ago[Symbolize] Use the local MSVC C++ demangler instead of relying on dbghelp. NFC.
Martin Storsjo [Wed, 16 Oct 2019 20:38:44 +0000 (20:38 +0000)]
[Symbolize] Use the local MSVC C++ demangler instead of relying on dbghelp. NFC.

This allows making a couple llvm-symbolizer tests run in all
environments.

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

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

5 years agoRemove a stale comment, noted in post commit review for rL375038
Philip Reames [Wed, 16 Oct 2019 20:27:10 +0000 (20:27 +0000)]
Remove a stale comment, noted in post commit review for rL375038

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

5 years ago[IndVars] Fix a miscompile in off-by-default loop predication implementation
Philip Reames [Wed, 16 Oct 2019 19:58:26 +0000 (19:58 +0000)]
[IndVars] Fix a miscompile in off-by-default loop predication implementation

The problem is that we can have two loop exits, 'a' and 'b', where 'a' and 'b' would exit at the same iteration, 'a' precedes 'b' along some path, and 'b' is predicated while 'a' is not. In this case (see the previously submitted test case), we causing the loop to exit through 'b' whereas it should have exited through 'a'.

This only applies to loop exits where the exit counts are not provably inequal, but that isn't as much of a restriction as it appears. If we could order the exit counts, we'd have already removed one of the two exits. In theory, we might be able to prove inequality w/o ordering, but I didn't really explore that piece. Instead, I went for the obvious restriction and ensured we didn't predicate exits following non-predicateable exits.

Credit goes to Evgeny Brevnov for figuring out the problematic case. Fuzzing probably also found it (failures seen), but due to some silly infrastructure problems I hadn't gotten to the results before Evgeny hand reduced it from a benchmark (he manually enabled the transform). Once this is fixed, I'll try to filter through the fuzzer failures to see if there's anything additional lurking.

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

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

5 years ago[AMDGPU] Do not combine dpp mov reading physregs
Stanislav Mekhanoshin [Wed, 16 Oct 2019 19:28:25 +0000 (19:28 +0000)]
[AMDGPU] Do not combine dpp mov reading physregs

We cannot be sure physregs will stay unchanged.

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

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

5 years ago[AMDGPU] Do not combine dpp with physreg def
Stanislav Mekhanoshin [Wed, 16 Oct 2019 18:48:54 +0000 (18:48 +0000)]
[AMDGPU] Do not combine dpp with physreg def

We will remove dpp mov along with the physreg def otherwise.

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

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

5 years ago[llvm-ar] Implement the V modifier as an alias for --version
Jordan Rupprecht [Wed, 16 Oct 2019 18:39:52 +0000 (18:39 +0000)]
[llvm-ar] Implement the V modifier as an alias for --version

Summary: Also update the help modifier (h) so that it works as a modifier and not just as a standalone `h`. For example, `llvm-ar h` prints the help message, but `llvm-ar xh` currently prints `unknown option h`.

Reviewers: MaskRay, gbreynoo

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years ago[SLP] avoid reduction transform on patterns that the backend can load-combine (2nd...
Sanjay Patel [Wed, 16 Oct 2019 18:06:24 +0000 (18:06 +0000)]
[SLP] avoid reduction transform on patterns that the backend can load-combine (2nd try)

The 1st attempt at this modified the cost model in a bad way to avoid the vectorization,
but that caused problems for other users (the loop vectorizer) of the cost model.

I don't see an ideal solution to these 2 related, potentially large, perf regressions:
https://bugs.llvm.org/show_bug.cgi?id=42708
https://bugs.llvm.org/show_bug.cgi?id=43146

We decided that load combining was unsuitable for IR because it could obscure other
optimizations in IR. So we removed the LoadCombiner pass and deferred to the backend.
Therefore, preventing SLP from destroying load combine opportunities requires that it
recognizes patterns that could be combined later, but not do the optimization itself (
it's not a vector combine anyway, so it's probably out-of-scope for SLP).

Here, we add a cost-independent bailout with a conservative pattern match for a
multi-instruction sequence that can probably be reduced later.

In the x86 tests shown (and discussed in more detail in the bug reports), SDAG combining
will produce a single instruction on these tests like:

  movbe   rax, qword ptr [rdi]

or:

  mov     rax, qword ptr [rdi]

Not some (half) vector monstrosity as we currently do using SLP:

  vpmovzxbq       ymm0, dword ptr [rdi + 1] # ymm0 = mem[0],zero,zero,..
  vpsllvq ymm0, ymm0, ymmword ptr [rip + .LCPI0_0]
  movzx   eax, byte ptr [rdi]
  movzx   ecx, byte ptr [rdi + 5]
  shl     rcx, 40
  movzx   edx, byte ptr [rdi + 6]
  shl     rdx, 48
  or      rdx, rcx
  movzx   ecx, byte ptr [rdi + 7]
  shl     rcx, 56
  or      rcx, rdx
  or      rcx, rax
  vextracti128    xmm1, ymm0, 1
  vpor    xmm0, xmm0, xmm1
  vpshufd xmm1, xmm0, 78          # xmm1 = xmm0[2,3,0,1]
  vpor    xmm0, xmm0, xmm1
  vmovq   rax, xmm0
  or      rax, rcx
  vzeroupper
  ret

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

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

5 years ago[lit] Fix a test case that r374652 missed
Joel E. Denny [Wed, 16 Oct 2019 17:56:12 +0000 (17:56 +0000)]
[lit] Fix a test case that r374652 missed

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

5 years ago[NFC][XCOFF][AIX] Rename ControlSections to CsectGroup
Jason Liu [Wed, 16 Oct 2019 17:36:31 +0000 (17:36 +0000)]
[NFC][XCOFF][AIX] Rename ControlSections to CsectGroup

The name of ControlSections is not expressive enough to convey what they really are.
CsectGroup can better communicate the concept of grouping csects together since they have similar property.

Reviewer: daltenty

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

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

5 years ago[lit] Fix internal diff's --strip-trailing-cr and use it
Joel E. Denny [Wed, 16 Oct 2019 17:21:57 +0000 (17:21 +0000)]
[lit] Fix internal diff's --strip-trailing-cr and use it

Using GNU diff, `--strip-trailing-cr` removes a `\r` appearing before
a `\n` at the end of a line.  Without this patch, lit's internal diff
only removes `\r` if it appears as the last character.  That seems
useless.  This patch fixes that.

This patch also adds `--strip-trailing-cr` to some tests that fail on
Windows bots when D68664 is applied.  Based on what I see in the bot
logs, I think the following is happening.  In each test there, lit
diff is comparing a file with `\r\n` line endings to a file with `\n`
line endings.  Without D68664, lit diff reads those files in text
mode, which in Windows causes `\r\n` to be replaced with `\n`.
However, with D68664, lit diff reads the files in binary mode instead
and thus reports that every line is different, just as GNU diff does
(at least under Ubuntu).  Adding `--strip-trailing-cr` to those tests
restores the previous behavior while permitting the behavior of lit
diff to be more like GNU diff.

Reviewed By: rnk

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

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

5 years agoCombinerHelper - silence dead assignment warnings. NFCI.
Simon Pilgrim [Wed, 16 Oct 2019 17:21:50 +0000 (17:21 +0000)]
CombinerHelper - silence dead assignment warnings. NFCI.

Copy the NewAlignment value to Alignment first and then use that to update the stack frame object alignments.

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

5 years ago[lit] Clean up internal diff's encoding handling
Joel E. Denny [Wed, 16 Oct 2019 17:21:24 +0000 (17:21 +0000)]
[lit] Clean up internal diff's encoding handling

As suggested by rnk at D67643#1673043, instead of reading files
multiple times until an appropriate encoding is found, read them once
as binary, and then try to decode what was read.

For Python >= 3.5, don't fail when attempting to decode the
`diff_bytes` output in order to print it.

Avoid failures for Python 2.7 used on some Windows bots by
transforming diff output with `lit.util.to_string` before writing it
to stdout.

Finally, add some tests for encoding handling.

Reviewed By: rnk

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

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

5 years ago[AMDGPU] Supress unused sdwa insts generation
Stanislav Mekhanoshin [Wed, 16 Oct 2019 16:58:06 +0000 (16:58 +0000)]
[AMDGPU] Supress unused sdwa insts generation

Do not generate non-existing sdwa instructions. It reduces the
number of generated instructions by 185.

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

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

5 years ago[Remarks] Fix warning for ambigous `else` behind EXPECT macro
Francis Visoiu Mistrih [Wed, 16 Oct 2019 16:43:34 +0000 (16:43 +0000)]
[Remarks] Fix warning for ambigous `else` behind EXPECT macro

http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/31902/steps/ninja%20check%201/logs/stdio

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

5 years ago[Remarks] Fix unit test by only checking for the path
Francis Visoiu Mistrih [Wed, 16 Oct 2019 16:35:09 +0000 (16:35 +0000)]
[Remarks] Fix unit test by only checking for the path

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/39536/steps/ninja%20check%201/logs/FAIL%3A%20LLVM-Unit%3A%3AYAMLRemarks.ParsingBadMeta

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

5 years ago[SVE][IR] Small TypeSize improvements left out of initial commit
Graham Hunter [Wed, 16 Oct 2019 16:33:41 +0000 (16:33 +0000)]
[SVE][IR] Small TypeSize improvements left out of initial commit

The commit for D53137 left out the last round of improvements
requested by reviewers. Adding those in now.

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

5 years ago[DWARF5] Added support for DW_AT_noreturn attribute to be emitted for
Adrian Prantl [Wed, 16 Oct 2019 16:30:38 +0000 (16:30 +0000)]
[DWARF5] Added support for DW_AT_noreturn attribute to be emitted for
C++ class member functions.

Patch by Sourabh Singh Tomar!

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

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

5 years ago[Remarks] Use StringRef::contains to avoid differences in error string
Francis Visoiu Mistrih [Wed, 16 Oct 2019 16:18:12 +0000 (16:18 +0000)]
[Remarks] Use StringRef::contains to avoid differences in error string

Different OSs have different error strings:

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/39534/steps/ninja%20check%201/logs/FAIL%3A%20LLVM-Unit%3A%3AYAMLRemarks.ParsingBadMeta

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

5 years ago[AArch64,Assembler] Compiler support for ID_MMFR5_EL1
Mark Murray [Wed, 16 Oct 2019 15:59:06 +0000 (15:59 +0000)]
[AArch64,Assembler] Compiler support for ID_MMFR5_EL1

Summary: Add read-only system register ID_MMFR5_EL1 and unit tests.

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years ago[Codegen] Adjust saturation test. NFC.
David Green [Wed, 16 Oct 2019 15:50:42 +0000 (15:50 +0000)]
[Codegen] Adjust saturation test. NFC.

Add some extra sat tests and adjust some of the existing tests to use signext where it would naturally be.

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

5 years ago[Remarks] Add support for prepending a path to external files
Francis Visoiu Mistrih [Wed, 16 Oct 2019 15:40:59 +0000 (15:40 +0000)]
[Remarks] Add support for prepending a path to external files

This helps with testing and debugging for paths that are assumed
absolute.

It also uses a FileError to provide the file path it's trying to open.

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

5 years agobpf: fix wrong truncation elimination when there is back-edge/loop
Jiong Wang [Wed, 16 Oct 2019 15:27:59 +0000 (15:27 +0000)]
bpf: fix wrong truncation elimination when there is back-edge/loop

Currently, BPF backend is doing truncation elimination. If one truncation
is performed on a value defined by narrow loads, then it could be redundant
given BPF loads zero extend the destination register implicitly.

When the definition of the truncated value is a merging value (PHI node)
that could come from different code paths, then checks need to be done on
all possible code paths.

Above described optimization was introduced as r306685, however it doesn't
work when there is back-edge, for example when loop is used inside BPF
code.

For example for the following code, a zero-extended value should be stored
into b[i], but the "and reg, 0xffff" is wrongly eliminated which then
generates corrupted data.

void cal1(unsigned short *a, unsigned long *b, unsigned int k)
{
  unsigned short e;

  e = *a;
  for (unsigned int i = 0; i < k; i++) {
    b[i] = e;
    e = ~e;
  }
}

The reason is r306685 was trying to do the PHI node checks inside isel
DAG2DAG phase, and the checks are done on MachineInstr. This is actually
wrong, because MachineInstr is being built during isel phase and the
associated information is not completed yet. A quick search shows none
target other than BPF is access MachineInstr info during isel phase.

For an PHI node, when you reached it during isel phase, it may have all
predecessors linked, but not successors. It seems successors are linked to
PHI node only when doing SelectionDAGISel::FinishBasicBlock and this
happens later than PreprocessISelDAG hook.

Previously, BPF program doesn't allow loop, there is probably the reason
why this bug was not exposed.

This patch therefore fixes the bug by the following approach:
 - The existing truncation elimination code and the associated
   "load_to_vreg_" records are removed.
 - Instead, implement truncation elimination using MachineSSA pass, this
   is where all information are built, and keep the pass together with other
   similar peephole optimizations inside BPFMIPeephole.cpp. Redundant move
   elimination logic is updated accordingly.
 - Unit testcase included + no compilation errors for kernel BPF selftest.

Patch Review
===
Patch was sent to and reviewed by BPF community at:

  https://lore.kernel.org/bpf

Reported-by: David Beckett <david.beckett@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@375007 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[RISCV] Add MachineInstr immediate verification
Luis Marques [Wed, 16 Oct 2019 15:06:02 +0000 (15:06 +0000)]
[RISCV] Add MachineInstr immediate verification

Summary:
This patch implements the `TargetInstrInfo::verifyInstruction` hook for RISC-V. Currently the hook verifies the machine instruction's immediate operands, to check if the immediates are within the expected bounds. Without the hook invalid immediates are not detected except when doing assembly parsing, so they are silently emitted (including being truncated when emitting object code).

The bounds information is specified in tablegen by using the `OperandType` definition, which sets the `MCOperandInfo`'s `OperandType` field. Several RISC-V-specific immediate operand types were created, which extend the `MCInstrDesc`'s `OperandType` `enum`.

To have the hook called with `llc` pass it the `-verify-machineinstrs` option. For Clang add the cmake build config `-DLLVM_ENABLE_EXPENSIVE_CHECKS=True`, or temporarily patch `TargetPassConfig::addVerifyPass`.

Review concerns:

- The patch adds immediate operand type checks that cover at least the base ISA. There are several other operand types for the C extension and one type for the F/D extensions that were left out of this initial patch because they introduced further design concerns that I felt were best evaluated separately.

- Invalid register classes (e.g. passing a GPR register where a GPRC is expected) are already caught, so were not included.

- This design makes the more abstract `MachineInstr` verification depend on MC layer definitions, which arguably is not the cleanest design, but is in line with how things are done in other parts of the target and LLVM in general.

- There is some duplication of logic already present in the `MCOperandPredicate`s. Since the `MachineInstr` and `MCInstr` notions of immediates are fundamentally different, this is currently necessary.

Reviewers: asb, lenary

Reviewed By: lenary

Subscribers: hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, s.egerton, pzheng, llvm-commits

Tags: #llvm

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

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

5 years ago[AMDGPU] Fix-up cases where writelane has 2 SGPR operands
David Stuttard [Wed, 16 Oct 2019 14:37:39 +0000 (14:37 +0000)]
[AMDGPU] Fix-up cases where writelane has 2 SGPR operands

Summary:
Even though writelane doesn't have the same constraints as other valu
instructions it still can't violate the >1 SGPR operand constraint

Due to later register propagation (e.g. fixing up vgpr operands via
readfirstlane) changing writelane to only have a single SGPR is tricky.

This implementation puts a new check after SIFixSGPRCopies that prevents
multiple SGPRs being used in any writelane instructions.

The algorithm used is to check for trivial copy prop of suitable constants into
one of the SGPR operands and perform that if possible. If this isn't possible
put an explicit copy of Src1 SGPR into M0 and use that instead (this is
allowable for writelane as the constraint is for SGPR read-port and not
constant-bus access).

Reviewers: rampitec, tpr, arsenm, nhaehnle

Reviewed By: rampitec, arsenm, nhaehnle

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, mgorny, yaxunl, tpr, t-tye, llvm-commits

Tags: #llvm

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

Change-Id: Ic7553fa57440f208d4dbc4794fc24345d7e0e9ea

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

5 years ago[llvm-ar] Make paths case insensitive when on windows
Owen Reynolds [Wed, 16 Oct 2019 14:07:57 +0000 (14:07 +0000)]
[llvm-ar] Make paths case insensitive when on windows

When on windows gnu-ar treats member names as case insensitive. This
commit implements the same behaviour.

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

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

5 years ago[Alignment][NFC] Optimize alignTo
Guillaume Chatelet [Wed, 16 Oct 2019 13:06:17 +0000 (13:06 +0000)]
[Alignment][NFC] Optimize alignTo

Summary: A small optimization suggested by jakehehrlich@ in D64790.

Reviewers: jakehehrlich, courbet

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years agoRedirectingFileSystem::openFileForRead - replace bitwise & with boolean && to fix...
Simon Pilgrim [Wed, 16 Oct 2019 11:17:08 +0000 (11:17 +0000)]
RedirectingFileSystem::openFileForRead - replace bitwise & with boolean && to fix warning

Seems to be just a typo - now matches other instances which do something similar

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

5 years agoRealFile - fix self-initialization warning in constructor.
Simon Pilgrim [Wed, 16 Oct 2019 11:16:59 +0000 (11:16 +0000)]
RealFile - fix self-initialization warning in constructor.

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

5 years ago[InstCombine][AMDGPU] Fix crash with v3i16/v3f16 buffer intrinsics
Piotr Sobczak [Wed, 16 Oct 2019 11:14:01 +0000 (11:14 +0000)]
[InstCombine][AMDGPU] Fix crash with v3i16/v3f16 buffer intrinsics

Summary:
This is something of a workaround to avoid a crash later on in type
legalizer (WidenVectorResult()).
Also added some f16 tests, including a non-working v3f16 case with
a FIXME.

Reviewers: arsenm, tpr, nhaehnle

Reviewed By: arsenm

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

Tags: #llvm

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

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

5 years agoRevert "[HardwareLoops] Optimisation remarks"
Sjoerd Meijer [Wed, 16 Oct 2019 10:55:06 +0000 (10:55 +0000)]
Revert "[HardwareLoops] Optimisation remarks"

while I investigate the PPC build bot failures.

This reverts commit ad763751565b9663bc338fa2ca5ade86c6ca22ec.

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

5 years ago[ARM] Add a register class for GPR pairs without SP and use it. NFCI
Mikhail Maltsev [Wed, 16 Oct 2019 10:40:57 +0000 (10:40 +0000)]
[ARM] Add a register class for GPR pairs without SP and use it. NFCI

Summary:
Currently Thumb2InstrInfo.cpp uses a register class which is
auto-generated by tablegen. Such approach is fragile because
auto-generated classes might change when other register classes are
added. For example, before https://reviews.llvm.org/D62667
we were using GPRPair_with_gsub_1_in_rGPRRegClass, but had to
change it to GPRPair_with_gsub_1_in_GPRwithAPSRnospRegClass
because the former class stopped being generated (this did not change
the functionality though).

This patch adds a register class consisting of even-odd GPR register
pairs from (R0, R1) to (R10, R11), which excludes (R12, SP) and uses
it in Thumb2InstrInfo.cpp instead of
GPRPair_with_gsub_1_in_GPRwithAPSRnospRegClass.

Reviewers: ostannard, simon_tatham, dmgreen, efriedma

Reviewed By: simon_tatham

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

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

5 years agoSimpleLoopUnswitch - fix uninitialized variable and null dereference warnings. NFCI.
Simon Pilgrim [Wed, 16 Oct 2019 10:38:18 +0000 (10:38 +0000)]
SimpleLoopUnswitch - fix uninitialized variable and null dereference warnings. NFCI.

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

5 years ago[AMDGPU] Extend the SI Load/Store optimizer
Piotr Sobczak [Wed, 16 Oct 2019 10:17:02 +0000 (10:17 +0000)]
[AMDGPU] Extend the SI Load/Store optimizer

Summary:
Extend the SI Load/Store optimizer to merge MIMG load instructions. Handle
different flavours of image_load and image_sample instructions.

When the instructions of the same subclass differ only in dmask, merge
them and update dmask accordingly.

Reviewers: nhaehnle

Reviewed By: nhaehnle

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

Tags: #llvm

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

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

5 years agogn build: Merge r374982
GN Sync Bot [Wed, 16 Oct 2019 09:59:01 +0000 (09:59 +0000)]
gn build: Merge r374982

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

5 years ago[ARM][ParallelDSP] Change smlad insertion order
Sam Parker [Wed, 16 Oct 2019 09:37:03 +0000 (09:37 +0000)]
[ARM][ParallelDSP] Change smlad insertion order

Instead of inserting everything after the 'root' of the reduction,
insert all instructions as close to their operands as possible. This
can help reduce register pressure.

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

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

5 years ago[HardwareLoops] Optimisation remarks
Sjoerd Meijer [Wed, 16 Oct 2019 09:09:55 +0000 (09:09 +0000)]
[HardwareLoops] Optimisation remarks

This adds the initial plumbing to support optimisation remarks in
the IR hardware-loop pass.

I have left a todo in a comment where we can improve the reporting,
and will iterate on that now that we have this initial support in.

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

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

5 years ago[NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap
Orlando Cazalet-Hyams [Wed, 16 Oct 2019 08:36:00 +0000 (08:36 +0000)]
[NFC] Replace a linked list in LiveDebugVariables pass with a DenseMap

In LiveDebugVariables.cpp:
Prior to this patch, UserValues were grouped into linked list chains. Each
chain was the union of two sets: { A: Matching Source variable } or
{ B: Matching virtual register }. A ptr to the heads (or 'leaders')
of each of these chains were kept in a map with the { Source variable } used
as the key (set A predicate) and another with { Virtual register } as key
(set B predicate).

There was a search through the chains in the function getUserValue looking for
UserValues with matching { Source variable, Complex expression, Inlined-at
location }. Essentially searching for a subset of A through two interleaved
linked lists of set A and B. Importantly, by design, the subset will only
contain one or zero elements here. That is to say a UserValue can be uniquely
identified by the tuple { Source variable, Complex expression, Inlined-at
 location } if it exists.

This patch removes the linked list and instead uses a DenseMap to map
the tuple { Source variable, Complex expression, Inlined-at location }
to UserValue ptrs so that the getUserValue search predicate is this map key.
The virtual register map now maps a vreg to a SmallVector<UserVal *> so that
set B is still available for quick searches.

Reviewers: aprantl, probinson, vsk, dblaikie

Reviewed By: aprantl

Subscribers: russell.gallop, gbedwell, bjope, hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

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

5 years ago[LegalizeTypes] Don't use PromoteTargetBoolean in WidenVecOp_SETCC.
Craig Topper [Wed, 16 Oct 2019 03:29:24 +0000 (03:29 +0000)]
[LegalizeTypes] Don't use PromoteTargetBoolean in WidenVecOp_SETCC.

Similar to r374970, but I don't have a test for this.

PromoteTargetBoolean is intended to be use for legalizing an
operand that needs to be promoted. It picks its type based on
the return from getSetccResultType and is intended to be used
when we have freedom to pick the new type. But the return type
we need for WidenVecOp_SETCC is completely determined by the
type of the input node.

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

5 years ago[LegalizeTypes] Don't call PromoteTargetBoolean from SplitVecOp_VSETCC.
Craig Topper [Wed, 16 Oct 2019 02:50:04 +0000 (02:50 +0000)]
[LegalizeTypes] Don't call PromoteTargetBoolean from SplitVecOp_VSETCC.

PromoteTargetBoolean calls getSetccResultType to get the return
type. But we were passing it the setcc result type rather than the
setcc input type. This causes an issue on X86 with avx512vl where
the setcc result type for vXf16 vectors is vXi16 while the
result type for vXi16 vectors is vXi1.

There's really no guarantee that getSetccResultType is the type
we need here. So now we just grab the extend type from
getExtendForContent and extend to the original result VT of the
node we're splitting.

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

5 years agoCodeExtractor: NFC: Use Range based loop
Aditya Kumar [Wed, 16 Oct 2019 01:50:21 +0000 (01:50 +0000)]
CodeExtractor: NFC: Use Range based loop

Reviewers: vsk, tejohnson, fhahn

Subscribers: llvm-commits

Tags: #llvm

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

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

5 years agoFix an unused variable introduced in rL374955 / rG21703543.
David L. Jones [Wed, 16 Oct 2019 00:52:00 +0000 (00:52 +0000)]
Fix an unused variable introduced in rL374955 / rG21703543.

Even though this is a unit test, it still may be run under optimization.

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

5 years ago[dsymutil] Support and relocate base address selection entries for debug_loc
Jonas Devlieghere [Tue, 15 Oct 2019 23:43:37 +0000 (23:43 +0000)]
[dsymutil] Support and relocate base address selection entries for debug_loc

Since r374600 clang emits base address selection entries. Currently
dsymutil does not support these entries and incorrectly interprets them
as location list entries.

This patch adds support for base address selection entries in dsymutil
and makes sure they are relocated correctly.

Thanks to Dave for coming up with the test case!

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

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

5 years ago[Reland][VirtualFileSystem] Support virtual working directory in the RedirectingFS
Jonas Devlieghere [Tue, 15 Oct 2019 23:08:57 +0000 (23:08 +0000)]
[Reland][VirtualFileSystem] Support virtual working directory in the RedirectingFS

Before this patch, changing the working directory of the RedirectingFS
would just forward to its external file system. This prevented us from
having a working directory that only existed in the VFS mapping.

This patch adds support for a virtual working directory in the
RedirectingFileSystem. It now keeps track of its own WD in addition to
updating the WD of the external file system. This ensures that we can
still fall through for relative paths.

This change was originally motivated by the reproducer infrastructure in
LLDB where we want to deal transparently with relative paths.

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

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

5 years ago[Orc] Add a method for ObjectLinkingLayer to return ownership of object buffers.
Lang Hames [Tue, 15 Oct 2019 21:41:12 +0000 (21:41 +0000)]
[Orc] Add a method for ObjectLinkingLayer to return ownership of object buffers.

RTDyldObjectLinkingLayer allowed clients to register a NotifyEmitted function to
reclaim ownership of object buffers once they had been linked. This patch adds
similar functionality to ObjectLinkingLayer: Clients can now optionally call the
ObjectLinkingLayer::setReturnObjectBuffer method to register a function that
will be called when discarding object buffers. If set, this function will be
called to return ownership of the object regardless of whether the link
succeeded or failed.

Use cases for this function include debug dumping (it provides a way to dump
all objects linked into JIT'd code) and object re-use (e.g. storing an
object in a cache).

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

5 years ago[Docs] Updates sidebar links and sets max-width property for div.body
DeForest Richards [Tue, 15 Oct 2019 21:27:20 +0000 (21:27 +0000)]
[Docs] Updates sidebar links and sets max-width property for div.body

Updates the sidebar links for Getting Started. Also sets max-width on div.body to 1000px.

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

5 years ago[JITLink] Switch to slab allocation for InProcessMemoryManager, re-enable test.
Lang Hames [Tue, 15 Oct 2019 21:06:57 +0000 (21:06 +0000)]
[JITLink] Switch to slab allocation for InProcessMemoryManager, re-enable test.

InProcessMemoryManager used to make separate memory allocation calls for each
permission level (RW, RX, RO), which could lead to target-out-of-range errors
if data and code were placed too far apart (this was the source of failures in
the JITLink/AArch64 testcase when it was first landed).

This patch updates InProcessMemoryManager to allocate a single slab which is
subdivided between text and data. This should guarantee that accesses remain
in-range provided that individual object files do not exceed 1Mb in size.
This patch also re-enables the JITLink/AArch64 testcase.

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

5 years ago[lit] Add back LitTestCase
Julian Lettner [Tue, 15 Oct 2019 20:57:20 +0000 (20:57 +0000)]
[lit] Add back LitTestCase

This essentially reverts a commit [1] that removed the adaptor for
Python unittests.  The code has been slightly refactored to make it more
additive: all code is contained in LitTestCase.py.

Usage sites will require a small adaption:
```
[old]
  import lit.discovery
  ...
  test_suite = lit.discovery.load_test_suite(...)

[new]
  import lit.LitTestCase
  ...
  test_suite = lit.LitTestCase.load_test_suite(...)
```

This was put back on request by Daniel Dunbar, since I wrongly assumed
that the functionality is unused.  At least llbuild still uses this [2].

[1] 70ca752ccf6a8f362aea25ccd3ee2bbceca93b20
[2] https://github.com/apple/swift-llbuild/blob/master/utils/Xcode/LitXCTestAdaptor/LitTests.py#L16

Reviewed By: ddunbar

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

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

5 years ago[XCOFF]implement parsing relocation information for 32-bit xcoff object file
Digger Lin [Tue, 15 Oct 2019 20:42:11 +0000 (20:42 +0000)]
[XCOFF]implement parsing relocation information for 32-bit xcoff object file

Summary:
    Parsing the relocation entry information for 32-bit xcoff object file
including deal with the relocation overflow.

Reviewers: hubert.reinterpretcast, jasonliu, sfertile, xingxue.

Subscribers: hiraditya, rupprecht, seiya

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

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

5 years ago[llvm-lipo] Add missing cast
Alexander Shaposhnikov [Tue, 15 Oct 2019 20:10:34 +0000 (20:10 +0000)]
[llvm-lipo] Add missing cast

Add missing cast (to correctly sum 32-bit integers).

Test plan: make check-all

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

5 years agoAMDGPU: Fix infinite searches in SIFixSGPRCopies
Austin Kerbow [Tue, 15 Oct 2019 19:59:45 +0000 (19:59 +0000)]
AMDGPU: Fix infinite searches in SIFixSGPRCopies

Summary:
Two conditions could lead to infinite loops when processing PHI nodes in
SIFixSGPRCopies.

The first condition involves a REG_SEQUENCE that uses registers defined by both
a PHI and a COPY.

The second condition arises when a physical register is copied to a virtual
register which is then used in a PHI node. If the same virtual register is
copied to the same physical register, the result is an endless loop.

%0:sgpr_64 = COPY $sgpr0_sgpr1
%2 = PHI %0, %bb.0, %1, %bb.1
$sgpr0_sgpr1 = COPY %0

Reviewers: alex-t, rampitec, arsenm

Reviewed By: rampitec

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

Tags: #llvm

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

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

5 years ago[llvm-readobj][xcoff] implement parsing overflow section header.
Digger Lin [Tue, 15 Oct 2019 19:28:11 +0000 (19:28 +0000)]
[llvm-readobj][xcoff] implement parsing overflow section header.

SUMMARY:
in the xcoff, if the number of relocation entries or line number entries is
overflow(large than or equal 65535) , there will be overflow section for it.
The interpret of overflow section is different with generic section header,
the patch implement parsing the overflow section.

Reviewers: hubert.reinterpretcast,sfertile,jasonliu
Subscribers: rupprecht, seiya

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

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

5 years agoRevert "[VirtualFileSystem] Support virtual working directory in the RedirectingFS"
Jonas Devlieghere [Tue, 15 Oct 2019 18:37:00 +0000 (18:37 +0000)]
Revert "[VirtualFileSystem] Support virtual working directory in the  RedirectingFS"

This reverts the original commit and the follow up:

Revert "[VirtualFileSystem] Support virtual working directory in the  RedirectingFS"
Revert "[test] Update YAML mapping in VirtualFileSystemTest"

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

5 years agoAdded support for "#pragma clang section relro=<name>"
Dmitry Mikulin [Tue, 15 Oct 2019 18:31:10 +0000 (18:31 +0000)]
Added support for "#pragma clang section relro=<name>"

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

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

5 years ago[WebAssembly] Allow multivalue types in block signature operands
Thomas Lively [Tue, 15 Oct 2019 18:28:22 +0000 (18:28 +0000)]
[WebAssembly] Allow multivalue types in block signature operands

Summary:
Renames `ExprType` to the more apt `BlockType` and adds a variant for
multivalue blocks. Currently non-void blocks are only generated at the
end of functions where the block return type needs to agree with the
function return type, and that remains true for multivalue
blocks. That invariant means that the actual signature does not need
to be stored in the block signature `MachineOperand` because it can be
inferred by `WebAssemblyMCInstLower` from the return type of the
parent function. `WebAssemblyMCInstLower` continues to lower block
signature operands to immediates when possible but lowers multivalue
signatures to function type symbols. The AsmParser and Disassembler
are updated to handle multivalue block types as well.

Reviewers: aheejin, dschuff, aardappel

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

Tags: #llvm

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

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

5 years ago[llvm-objdump] Use a counter for llvm-objdump -h instead of the section index.
Jordan Rupprecht [Tue, 15 Oct 2019 18:13:20 +0000 (18:13 +0000)]
[llvm-objdump] Use a counter for llvm-objdump -h instead of the section index.

Summary:
When listing the index in `llvm-objdump -h`, use a zero-based counter instead of the actual section index (e.g. shdr->sh_index for ELF).

While this is effectively a noop for now (except one unit test for XCOFF), the index values will change in a future patch that filters certain sections out (e.g. symbol tables). See D68669 for more context. Note: the test case in `test/tools/llvm-objdump/X86/section-index.s` already covers the case of incrementing the section index counter when sections are skipped.

Reviewers: grimar, jhenderson, espindola

Reviewed By: grimar

Subscribers: emaste, sbc100, arichardson, aheejin, arphaman, seiya, llvm-commits, MaskRay

Tags: #llvm

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

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

5 years ago[test] Update YAML mapping in VirtualFileSystemTest
Jonas Devlieghere [Tue, 15 Oct 2019 18:05:44 +0000 (18:05 +0000)]
[test] Update YAML mapping in VirtualFileSystemTest

The 'bar' directory should be part of the root rather than the file
itself.

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

5 years ago[X86] combineX86ShufflesRecursively - split the getTargetShuffleInputs call from...
Simon Pilgrim [Tue, 15 Oct 2019 17:59:13 +0000 (17:59 +0000)]
[X86] combineX86ShufflesRecursively - split the getTargetShuffleInputs call from the resolveTargetShuffleAndZeroables call.

Exposes an issue in getFauxShuffleMask where the OR(SHUFFLE,SHUFFLE) decode should always resolve zero/undef elements.

Part of the fix for PR43024 where ideally we shouldn't call resolveTargetShuffleAndZeroables for Depth == 0

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

5 years ago[llvm-profdata] Reinstate tools/llvm-profdata/malformed-ptr-to-counter-array.test
Vedant Kumar [Tue, 15 Oct 2019 17:53:48 +0000 (17:53 +0000)]
[llvm-profdata] Reinstate tools/llvm-profdata/malformed-ptr-to-counter-array.test

I removed this test to unblock the ARM bots while looking into failures
(r374915), and am reinstating it now with a fix.

I believe the problem was that counter ptr address I used,
'\0\0\6\0\1\0\0\1', set the high bits of the pointer, not the low bits
like I wanted. On x86_64 this superficially looks like it tests r370826,
but it doesn't, as it would have been caught before r370826. However, on
ARM (or, 32-bit hosts more generally), I suspect the high bits were
cleared, and you get a 'valid' profile.

I verified that setting the *low* bits of the pointer does trigger the
new condition:

-// Note: The CounterPtr here is off-by-one. This should trigger a malformed profile error.
-RUN: printf '\0\0\6\0\1\0\0\1' >> %t.profraw
+// Note: The CounterPtr here is off-by-one.
+//
+// Octal '\11' is 9 in decimal: this should push CounterOffset to 1. As there are two counters,
+// the profile reader should error out.
+RUN: printf '\11\0\6\0\1\0\0\0' >> %t.profraw

This reverts commit c7cf5b3e4b918c9769fd760f28485b8d943ed968.

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

5 years ago[XCOFF] Output object text section header and symbol entry for program code.
Digger Lin [Tue, 15 Oct 2019 17:40:41 +0000 (17:40 +0000)]
[XCOFF] Output object text section header and symbol entry for program code.

This is remaining part of  rG41ca91f2995b: [AIX][XCOFF] Output XCOFF
object text section header and symbol entry for rogram code.

SUMMARY:
Original form of this patch is provided by Stefan Pintillie.

1. The patch try to output program code section header , symbol entry for
 program code (PR) and Instruction into the raw text section.
2. The patch include how to alignment and layout the CSection in the text
 section.
3. The patch also reorganize the code , put some codes into a function.
 (XCOFFObjectWriter::writeSymbolTableEntryForControlSection)

Additional: We can not add raw data of text section test in the patch, If want
 to output raw text section data,it need a function description patch first.

Reviewers: hubert.reinterpretcast, sfertile, jasonliu, xingxue.
Subscribers: wuzish, nemanjai, hiraditya, MaskRay, jsjji.

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

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

5 years ago[X86] Make memcmp() use PTEST if possible and also enable AVX1
David Zarzycki [Tue, 15 Oct 2019 17:40:12 +0000 (17:40 +0000)]
[X86] Make memcmp() use PTEST if possible and also enable AVX1

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

5 years ago[NewGVN] Check that call has an access.
Alina Sbirlea [Tue, 15 Oct 2019 17:25:36 +0000 (17:25 +0000)]
[NewGVN] Check that call has an access.

Check that a call has an attached MemoryAccess before calling
getClobbering on the instruction.
If no access is attached, the instruction does not access memory.

Resolves PR43441.

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

5 years ago[MemorySSA] Update DomTree before applying MSSA updates.
Alina Sbirlea [Tue, 15 Oct 2019 17:15:19 +0000 (17:15 +0000)]
[MemorySSA] Update DomTree before applying MSSA updates.

Update on the fix in rL374850.

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

5 years ago[VirtualFileSystem] Support virtual working directory in the RedirectingFS
Jonas Devlieghere [Tue, 15 Oct 2019 17:14:24 +0000 (17:14 +0000)]
[VirtualFileSystem] Support virtual working directory in the  RedirectingFS

Before this patch, changing the working directory of the RedirectingFS
would just forward to its external file system. This prevented us from
having a working directory that only existed in the VFS mapping.

This patch adds support for a virtual working directory in the
RedirectingFileSystem. It now keeps track of its own WD in addition to
updating the WD of the external file system. This ensures that we can
still fall through for relative paths.

This change was originally motivated by the reproducer infrastructure in
LLDB where we want to deal transparently with relative paths.

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

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

5 years ago[llvm-profdata] Remove tools/llvm-profdata/malformed-ptr-to-counter-array.test
Vedant Kumar [Tue, 15 Oct 2019 17:10:44 +0000 (17:10 +0000)]
[llvm-profdata] Remove tools/llvm-profdata/malformed-ptr-to-counter-array.test

This test is still failing on the ARM bots and I need time to
investigate.

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

5 years ago[AIX][XCOFF] Output XCOFF object text section header and symbol entry for program...
Digger Lin [Tue, 15 Oct 2019 17:09:54 +0000 (17:09 +0000)]
[AIX][XCOFF] Output XCOFF object text section header and symbol entry for program code.

SUMMARY
Original form of this patch is provided by Stefan Pintillie.

The patch try to output program code section header , symbol entry for program code (PR) and Instruction into the raw text section.
The patch include how to alignment and layout the CSection in the text section.
The patch also reorganize the code , put some codes into a function(XCOFFObjectWriter::writeSymbolTableEntryForControlSection)
Additional: We can not add raw data of text section test in the patch, If want to output raw text section data,it need a function description patch first.

Reviewers: hubert.reinterpretcast, sfertile, jasonliu, xingxue.
Subscribers: wuzish, nemanjai, hiraditya, MaskRay, jsjji.

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

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

5 years ago[AMDGPU] Support mov dpp with 64 bit operands
Stanislav Mekhanoshin [Tue, 15 Oct 2019 16:41:15 +0000 (16:41 +0000)]
[AMDGPU] Support mov dpp with 64 bit operands

We define mov/update dpp intrinsics as overloaded but do not
support i64, which is a practically useful type. Fix the
selection and lowering.

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

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

5 years ago[AMDGPU] Allow DPP combiner to work with REG_SEQUENCE
Stanislav Mekhanoshin [Tue, 15 Oct 2019 16:17:50 +0000 (16:17 +0000)]
[AMDGPU] Allow DPP combiner to work with REG_SEQUENCE

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

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

5 years agogn build: Merge r374903
GN Sync Bot [Tue, 15 Oct 2019 15:33:04 +0000 (15:33 +0000)]
gn build: Merge r374903

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

5 years ago[DAGCombiner] fold select-of-constants based on sign-bit test
Sanjay Patel [Tue, 15 Oct 2019 15:23:57 +0000 (15:23 +0000)]
[DAGCombiner] fold select-of-constants based on sign-bit test

Examples:
  i32 X > -1 ? C1 : -1 --> (X >>s 31) | C1
  i8 X < 0 ? C1 : 0 --> (X >>s 7) & C1

This is a small generalization of a fold requested in PR43650:
https://bugs.llvm.org/show_bug.cgi?id=43650

The sign-bit of the condition operand can be used as a mask for the true operand:
https://rise4fun.com/Alive/paT

Note that we already handle some of the patterns (isNegative + scalar) because
there's an over-specialized, yet over-reaching fold for that in foldSelectCCToShiftAnd().
It doesn't use any TLI hooks, so I can't easily rip out that code even though we're
duplicating part of it here. This fold is guarded by TLI.convertSelectOfConstantsToMath(),
so it should not cause problems for targets that prefer select over shift.

Also worth noting: I thought we could generalize this further to include the case where
the true operand of the select is not constant, but Alive says that may allow poison to
pass through where it does not in the original select form of the code.

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

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

5 years agogn build: Merge r374899
GN Sync Bot [Tue, 15 Oct 2019 14:53:40 +0000 (14:53 +0000)]
gn build: Merge r374899

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

5 years agorevert git test commit
Digger Lin [Tue, 15 Oct 2019 14:44:06 +0000 (14:44 +0000)]
revert git test commit

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

5 years agoa test commit access
Digger Lin [Tue, 15 Oct 2019 14:39:29 +0000 (14:39 +0000)]
a test commit access

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