platform/upstream/llvm.git
6 years ago[X86] Remove some InstRWs for plain store instructions on Sandy Bridge.
Craig Topper [Thu, 5 Apr 2018 04:42:01 +0000 (04:42 +0000)]
[X86] Remove some InstRWs for plain store instructions on Sandy Bridge.

We were forcing the latency of these instructions to 5 cycles, but every other scheduler model had them as 1 cycle. I'm sure I didn't get everything, but this gets a big portion.

llvm-svn: 329252

6 years ago[X86] Auto-generate complete checks. NFC
Craig Topper [Thu, 5 Apr 2018 04:41:59 +0000 (04:41 +0000)]
[X86] Auto-generate complete checks. NFC

llvm-svn: 329251

6 years ago[CallSiteSplitting] Do not perform callsite splitting inside landing pad
Taewook Oh [Thu, 5 Apr 2018 04:16:23 +0000 (04:16 +0000)]
[CallSiteSplitting] Do not perform callsite splitting inside landing pad

Summary:
If the callsite is inside landing pad, do not perform callsite splitting.

Callsite splitting uses utility function llvm::DuplicateInstructionsInSplitBetween, which eventually calls llvm::SplitEdge. llvm::SplitEdge calls llvm::SplitCriticalEdge with an assumption that the function returns nullptr only when the target edge is not a critical edge (and further assumes that if the return value was not nullptr, the predecessor of the original target edge always has a single successor because critical edge splitting was successful). However, this assumtion is not true because SplitCriticalEdge returns nullptr if the destination block is a landing pad. This invalid assumption results assertion failure.

Fundamental solution might be fixing llvm::SplitEdge to not to rely on the invalid assumption. However, it'll involve a lot of work because current API assumes that llvm::SplitEdge never fails. Instead, this patch makes callsite splitting to not to attempt splitting if the callsite is in a landing pad.

Attached test case will crash with assertion failure without the fix.

Reviewers: fhahn, junbuml, dberlin

Subscribers: llvm-commits

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

llvm-svn: 329250

6 years ago[gold] Add debug-pass-manager option, and use it to test new-pass-manager
Teresa Johnson [Thu, 5 Apr 2018 03:16:57 +0000 (03:16 +0000)]
[gold] Add debug-pass-manager option, and use it to test new-pass-manager

Summary: Follow up from r314963.

Reviewers: pcc

Subscribers: llvm-commits

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

llvm-svn: 329249

6 years ago[IR] Upgrade comment token in objc retain release marker
Gerolf Hoflehner [Thu, 5 Apr 2018 02:44:46 +0000 (02:44 +0000)]
[IR] Upgrade comment token in objc retain release marker

Older compiler issued '#' instead of ';'

llvm-svn: 329248

6 years agoRevert r328680 ("[ObjC] Make C++ triviality type traits available to non-trivial...
Richard Smith [Thu, 5 Apr 2018 00:34:54 +0000 (00:34 +0000)]
Revert r328680 ("[ObjC] Make C++ triviality type traits available to non-trivial C structs.")

It unintentionally caused the values of the __has_* type traits to change in
C++ for trivially-copyable classes with volatile members.

llvm-svn: 329247

6 years ago[MIR-Canon] Improving performance by switching to named vregs.
Puyan Lotfi [Thu, 5 Apr 2018 00:27:15 +0000 (00:27 +0000)]
[MIR-Canon] Improving performance by switching to named vregs.

No more skipping thounsands of vregs. Much faster running time.

llvm-svn: 329246

6 years ago[coroutines] libcxx, noop_coroutine, make bots even more happy
Gor Nishanov [Thu, 5 Apr 2018 00:18:37 +0000 (00:18 +0000)]
[coroutines] libcxx, noop_coroutine, make bots even more happy

llvm-svn: 329245

6 years ago[AST] Don't track lambda captures when checking a potential constant expression.
Erik Pilkington [Thu, 5 Apr 2018 00:12:05 +0000 (00:12 +0000)]
[AST] Don't track lambda captures when checking a potential constant expression.

Fixes PR36054.

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

llvm-svn: 329244

6 years ago[MIR-Canon] Adding support for multi-def -> user distance reduction.
Puyan Lotfi [Thu, 5 Apr 2018 00:08:15 +0000 (00:08 +0000)]
[MIR-Canon] Adding support for multi-def -> user distance reduction.

llvm-svn: 329243

6 years agoInitialize OffsetMap earlier.
Rafael Espindola [Thu, 5 Apr 2018 00:01:57 +0000 (00:01 +0000)]
Initialize OffsetMap earlier.

Now that getSectionPiece uses OffsetMap, it is advantageous to
initialize it earlier.

llvm-svn: 329242

6 years agoEnable msan unconditionally on Linux.
Evgeniy Stepanov [Wed, 4 Apr 2018 23:48:06 +0000 (23:48 +0000)]
Enable msan unconditionally on Linux.

Memory sanitizer compatibility are already done in
MemorySanitizer::doInitialization. It verifies whether the necessary offsets
exist and bails out if not. For this reason it is no good to duplicate two
checks in two projects. This patch removes clang check and postpones msan
compatibility validation till MemorySanitizer::doInitialization.

Another reason for this patch is to allow using msan with any CPU (given
compatible runtime) and custom mapping provided via the arguments added by
https://reviews.llvm.org/D44926.

Patch by vit9696.

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

llvm-svn: 329241

6 years ago[coroutines] libcxx noop_coroutine. Make bots happier
Gor Nishanov [Wed, 4 Apr 2018 23:43:50 +0000 (23:43 +0000)]
[coroutines] libcxx noop_coroutine. Make bots happier

llvm-svn: 329240

6 years ago[coroutines] Allow compilation under c++03
Gor Nishanov [Wed, 4 Apr 2018 22:51:57 +0000 (22:51 +0000)]
[coroutines] Allow compilation under c++03

llvm-svn: 329239

6 years ago[WebAssembly] Only write 32-bits for WebAssembly::OPERAND_OFFSET32
Sam Clegg [Wed, 4 Apr 2018 22:27:58 +0000 (22:27 +0000)]
[WebAssembly] Only write 32-bits for WebAssembly::OPERAND_OFFSET32

A bug was found where an offset of -1 would generate an encoding
of max int64 which is invalid in the binary format.

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

llvm-svn: 329238

6 years ago[coroutines] Add noop_coroutine to <experimental/coroutine>
Gor Nishanov [Wed, 4 Apr 2018 22:18:03 +0000 (22:18 +0000)]
[coroutines] Add noop_coroutine to <experimental/coroutine>

A recent addition to Coroutines TS (https://wg21.link/p0913) adds a pre-defined
coroutine noop_coroutine that does nothing.

This patch implements require library types in <experimental/coroutine>

Related clang and llvm patches:

https://reviews.llvm.org/D45114
https://reviews.llvm.org/D45120

llvm-svn: 329237

6 years agoAArch64: Implement support for the shadowcallstack attribute.
Peter Collingbourne [Wed, 4 Apr 2018 21:55:44 +0000 (21:55 +0000)]
AArch64: Implement support for the shadowcallstack attribute.

The implementation of shadow call stack on aarch64 is quite different to
the implementation on x86_64. Instead of reserving a segment register for
the shadow call stack, we reserve the platform register, x18. Any function
that spills lr to sp also spills it to the shadow call stack, a pointer to
which is stored in x18.

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

llvm-svn: 329236

6 years agoDon't inline @llvm.icall.branch.funnel
Vitaly Buka [Wed, 4 Apr 2018 21:46:27 +0000 (21:46 +0000)]
Don't inline @llvm.icall.branch.funnel

Summary: @llvm.icall.branch.funnel is musttail with variable number of
arguments. After inlining current backend can't separate call targets from call
arguments.

Reviewers: pcc

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 329235

6 years ago[Driver] Include the Android multiarch includes.
Dan Albert [Wed, 4 Apr 2018 21:28:34 +0000 (21:28 +0000)]
[Driver] Include the Android multiarch includes.

Summary:
Most Android headers live in a single directory, but a small handful
live in multiarch directories.

Reviewers: srhines

Reviewed By: srhines

Subscribers: javed.absar, cfe-commits

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

llvm-svn: 329234

6 years agoDo not show alignment 0 because that is equivalent to 1.
Rui Ueyama [Wed, 4 Apr 2018 21:25:37 +0000 (21:25 +0000)]
Do not show alignment 0 because that is equivalent to 1.

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

llvm-svn: 329233

6 years ago[CUDA] Add amdgpu sub archs
Yaxun Liu [Wed, 4 Apr 2018 21:19:27 +0000 (21:19 +0000)]
[CUDA] Add amdgpu sub archs

Patch by Greg Rodgers.
Revised and lit tests added by Yaxun Liu.

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

llvm-svn: 329232

6 years ago[clang-format] In tests, expected code should be format-stable
Mark Zeren [Wed, 4 Apr 2018 21:09:00 +0000 (21:09 +0000)]
[clang-format] In tests, expected code should be format-stable

Summary: Extend various verifyFormat helper functions to check that the
expected text is "stable". This provides some protection against bugs
where formatting results are ocilating between two forms, or continually
change in some other way.

Testing Done:

* Ran unit tests.

* Reproduced a known instability in preprocessor indentation which was
  caught by this new check.

Reviewers: krasimir

Subscribers: cfe-commits

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

llvm-svn: 329231

6 years ago[MemorySSA] Fix spelling errors in MemorySSA.cpp. NFC
Zhaoshi Zheng [Wed, 4 Apr 2018 21:08:11 +0000 (21:08 +0000)]
[MemorySSA] Fix spelling errors in MemorySSA.cpp. NFC

llvm-svn: 329230

6 years agoRevert "[CUDA] Check initializers of instantiated template variables."
Artem Belevich [Wed, 4 Apr 2018 20:48:42 +0000 (20:48 +0000)]
Revert "[CUDA] Check initializers of instantiated template variables."

This (temporarily) reverts commit r329127 due to the problems
it exposed in TensorFlow.

llvm-svn: 329229

6 years agohwasan: add -hwasan-match-all-tag flag
Evgeniy Stepanov [Wed, 4 Apr 2018 20:44:59 +0000 (20:44 +0000)]
hwasan: add -hwasan-match-all-tag flag

Sometimes instead of storing addresses as is, the kernel stores the address of
a page and an offset within that page, and then computes the actual address
when it needs to make an access. Because of this the pointer tag gets lost
(gets set to 0xff). The solution is to ignore all accesses tagged with 0xff.

This patch adds a -hwasan-match-all-tag flag to hwasan, which allows to ignore
accesses through pointers with a particular pointer tag value for validity.

Patch by Andrey Konovalov.

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

llvm-svn: 329228

6 years agoCOFF: Sort non-discardable sections at the same time as other sections. NFC.
Peter Collingbourne [Wed, 4 Apr 2018 20:30:37 +0000 (20:30 +0000)]
COFF: Sort non-discardable sections at the same time as other sections. NFC.

This makes the sort order a little clearer.

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

llvm-svn: 329227

6 years ago[asan] Fix aligned_alloc test case
Kostya Kortchinsky [Wed, 4 Apr 2018 20:03:16 +0000 (20:03 +0000)]
[asan] Fix aligned_alloc test case

Summary:
Under some circumstances (that I haven't dug further into), the first stack
frame for the test looks like:
`#0 0x4e6038 in __interceptor_memalign.localalias.1 ...compiler-rt/lib/asan/asan_malloc_linux.cc:113`
which isn't matched by the current CHECK.

Expand the CHECK to match aligned_alloc or memalign. Hopefully this should fix
the PowerPC issue as well, otherwise we'll bring back the FIXME.

Reviewers: alekseyshl

Reviewed By: alekseyshl

Subscribers: srhines, kubamracek, delcypher, #sanitizers, llvm-commits

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

llvm-svn: 329226

6 years ago[analyzer][test] Set C++14 as language standard for test depending on new
Jan Korous [Wed, 4 Apr 2018 19:58:48 +0000 (19:58 +0000)]
[analyzer][test] Set C++14 as language standard for test depending on new
features

llvm-svn: 329225

6 years agoFix the test some more after r329221
Hans Wennborg [Wed, 4 Apr 2018 19:55:45 +0000 (19:55 +0000)]
Fix the test some more after r329221

llvm-svn: 329224

6 years agoFixes errors with FS iterators caused by https://reviews.llvm.org/D44960
Max Moroz [Wed, 4 Apr 2018 19:47:25 +0000 (19:47 +0000)]
Fixes errors with FS iterators caused by https://reviews.llvm.org/D44960

Summary:
In https://reviews.llvm.org/D44960, file status check is executed every
time a real file system directory iterator is constructed or
incremented, and emits an error code. This change list fixes the errors
in VirtualFileSystem caused by https://reviews.llvm.org/D44960.

Patch by Yuke Liao (@liaoyuke).

Reviewers: vsk, pcc, zturner, liaoyuke

Reviewed By: vsk

Subscribers: mgrang, cfe-commits

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

llvm-svn: 329223

6 years agoFix test after r329221
Hans Wennborg [Wed, 4 Apr 2018 19:36:27 +0000 (19:36 +0000)]
Fix test after r329221

It seems I accidentally overspecified the section size in my previous
commit, whereas it was previously carefully left out.

llvm-svn: 329222

6 years agoCOFF: Layout sections in the same order as link.exe
Hans Wennborg [Wed, 4 Apr 2018 19:15:55 +0000 (19:15 +0000)]
COFF: Layout sections in the same order as link.exe

One place where this seems to matter is to make sure the .rsrc section comes
after .text. The Win32 UpdateResource() function can change the contents of
.rsrc. It will move the sections that come after, but if .text gets moved, the
entry point header will not get updated and the executable breaks. This was
found by a test in Chromium.

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

llvm-svn: 329221

6 years ago[MachineOutliner] Add `useMachineOutliner` target hook
Jessica Paquette [Wed, 4 Apr 2018 19:13:31 +0000 (19:13 +0000)]
[MachineOutliner] Add `useMachineOutliner` target hook

The MachineOutliner has a bunch of target hooks that will call llvm_unreachable
if the target doesn't implement them. Therefore, if you enable the outliner on
such a target, it'll just crash. It'd be much better if it'd just *not* run
the outliner at all in this case.

This commit adds a hook to TargetInstrInfo that returns false by default.
Targets that implement the hook make it return true. The outliner checks the
return value of this hook to decide whether or not to continue.

llvm-svn: 329220

6 years agoDon't ignore addend in getOffset.
Rafael Espindola [Wed, 4 Apr 2018 19:13:30 +0000 (19:13 +0000)]
Don't ignore addend in getOffset.

We were ignoring the addend if the piece was dead. I don't expect this
to make a difference in any real world situations, but it is simpler
anyway.

llvm-svn: 329219

6 years ago[Analysis] Support aligned new/delete functions.
Eric Fiselier [Wed, 4 Apr 2018 19:01:51 +0000 (19:01 +0000)]
[Analysis] Support aligned new/delete functions.

Summary:
Clang's __builtin_operator_new/delete was recently taught about the aligned allocation overloads (r328134). This patch makes LLVM aware of them as well.
This allows the compiler to perform certain optimizations including eliding new/delete calls.

Reviewers: rsmith, majnemer, dblaikie, vsk, bkramer

Reviewed By: bkramer

Subscribers: ckennelly, llvm-commits

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

llvm-svn: 329218

6 years agoRevert "[Analysis] Support aligned new/delete functions."
Eric Fiselier [Wed, 4 Apr 2018 18:23:00 +0000 (18:23 +0000)]
Revert "[Analysis] Support aligned new/delete functions."

This reverts commit bee3bbd9bdd3ab3364b8fb0cdb6326bc1ae740e0.

llvm-svn: 329217

6 years ago[AArch64] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Wed, 4 Apr 2018 18:20:28 +0000 (18:20 +0000)]
[AArch64] Change std::sort to llvm::sort in response to r327219

Summary:
r327219 added wrappers to std::sort which randomly shuffle the container before sorting.
This will help in uncovering non-determinism caused due to undefined sorting
order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of std::sort.

Note: This patch is one of a series of patches to replace *all* std::sort to llvm::sort. Refer the comments section in D44363 for a list of all the required patches.

Reviewers: t.p.northover, jmolloy, RKSimon, rengolin

Reviewed By: rengolin

Subscribers: dexonsmith, rengolin, javed.absar, kristof.beyls, llvm-commits

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

llvm-svn: 329216

6 years ago[Analysis] Support aligned new/delete functions.
Eric Fiselier [Wed, 4 Apr 2018 18:12:01 +0000 (18:12 +0000)]
[Analysis] Support aligned new/delete functions.

Summary:
Clang's __builtin_operator_new/delete was recently taught about the aligned allocation overloads (r328134). This patch makes LLVM aware of them as well.
This allows the compiler to perform certain optimizations including eliding new/delete calls.

Reviewers: rsmith, majnemer, dblaikie, vsk, bkramer

Reviewed By: bkramer

Subscribers: ckennelly, llvm-commits

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

llvm-svn: 329215

6 years ago[Polly][IslAst] Fix minimal dependence distance.
Huihui Zhang [Wed, 4 Apr 2018 18:08:13 +0000 (18:08 +0000)]
[Polly][IslAst] Fix minimal dependence distance.

Summary:
When checking the parallelism of a scheduling dimension, we first check if excluding reduction dependences the loop is parallel or not.
If the loop is not parallel, then we need to return the minimal dependence distance of all data dependences, including the previously subtracted reduction dependences.

Reviewers: grosser, Meinersbur, efriedma, eli.friedman, jdoerfert, bollu

Reviewed By: Meinersbur

Subscribers: llvm-commits, pollydev

Tags: #polly

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

llvm-svn: 329214

6 years ago[MachineOutliner] Fix typo; NFC
Jessica Paquette [Wed, 4 Apr 2018 18:07:07 +0000 (18:07 +0000)]
[MachineOutliner] Fix typo; NFC

There was a typo in an unreachable statement in one of the outliner target
hooks.

llvm-svn: 329213

6 years ago[CMake] Support for monorepo layout
Petr Hosek [Wed, 4 Apr 2018 17:57:15 +0000 (17:57 +0000)]
[CMake] Support for monorepo layout

Support finding libcxx sources in monorepo style layout.

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

llvm-svn: 329212

6 years ago[X86] Separate BSWAP32r and BSWAP64r scheduling data in SandyBridge/Haswell/Broadwell...
Craig Topper [Wed, 4 Apr 2018 17:54:19 +0000 (17:54 +0000)]
[X86] Separate BSWAP32r and BSWAP64r scheduling data in SandyBridge/Haswell/Broadwell/Skylake scheduler models.

The BSWAP64r version is 2 uops and BSWAP32r is only 1 uop. The regular expressions also looked for a non-existant BSWAP16r.

llvm-svn: 329211

6 years agoAdd simple runtime tests for shadowcallstack
Vlad Tsyrklevich [Wed, 4 Apr 2018 17:53:33 +0000 (17:53 +0000)]
Add simple runtime tests for shadowcallstack

Summary:
ShadowCallStack does not yet have a runtime provided by compiler-rt, but
this change includes simple tests that make use of a very minimal
runtime in test/shadowcallstack/minimal_runtime.h

Reviewers: pcc, kcc, delcypher, eugenis, filcab

Reviewed By: pcc

Subscribers: kubamracek, mgorny, delcypher, llvm-commits, #sanitizers, kcc

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

llvm-svn: 329210

6 years agoFix a compilation failure with non MSVC compilers.
Zachary Turner [Wed, 4 Apr 2018 17:41:05 +0000 (17:41 +0000)]
Fix a compilation failure with non MSVC compilers.

llvm-svn: 329209

6 years ago[CMake] Support for monorepo layout
Petr Hosek [Wed, 4 Apr 2018 17:40:59 +0000 (17:40 +0000)]
[CMake] Support for monorepo layout

Support finding libcxx and libunwind sources in monorepo style layout.

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

llvm-svn: 329208

6 years ago[llvm-pdbutil] Add the ability to explain binary files.
Zachary Turner [Wed, 4 Apr 2018 17:29:09 +0000 (17:29 +0000)]
[llvm-pdbutil] Add the ability to explain binary files.

Using this, you can use llvm-pdbutil to export the contents of a
stream to a binary file, then run explain on the binary file so
that it treats the offset as an offset into the stream instead
of an offset into a file.  This makes it easy to compare the
contents of the same stream from two different files.

llvm-svn: 329207

6 years ago[Power9]Legalize and emit code for quad-precision fma instructions
Lei Huang [Wed, 4 Apr 2018 16:43:50 +0000 (16:43 +0000)]
[Power9]Legalize and emit code for quad-precision fma instructions

Legalize and emit code for the following quad-precision fma:

  * xsmaddqp
  * xsnmaddqp
  * xsmsubqp
  * xsnmsubqp

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

llvm-svn: 329206

6 years ago[CMake] Support statically linked libc++abi and libunwind
Petr Hosek [Wed, 4 Apr 2018 16:27:33 +0000 (16:27 +0000)]
[CMake] Support statically linked libc++abi and libunwind

This expands the CMake check to handle both statically and dynamically
linked version of libc++abi and libunwind and matches the implemnetation
used elsewhere in LLVM.

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

llvm-svn: 329205

6 years ago[sanitizer] Split stacktrace/symbolizer: Windows unwind
Kostya Kortchinsky [Wed, 4 Apr 2018 15:23:30 +0000 (15:23 +0000)]
[sanitizer] Split stacktrace/symbolizer: Windows unwind

Summary:
The purpose of this set of changes is to separate stackframe/symbolizer support into their own RT within sanitizer_common.
Sanitizers with no use for those could then be built without the extraneous dependencies pulled in by the default visibility interface functions.
I am aiming to do small changes for specific platforms.

In this one, we split the unwind functions from sanitizer_win.cc into their own sanitizer_unwind_win.cc.

Reviewers: alekseyshl, rnk

Reviewed By: alekseyshl, rnk

Subscribers: delcypher, #sanitizers, kubamracek, mgorny, llvm-commits

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

llvm-svn: 329204

6 years ago[ELF] - X86_64: Use white list for relocations checked by isPicRel.
George Rimar [Wed, 4 Apr 2018 15:21:21 +0000 (15:21 +0000)]
[ELF] - X86_64: Use white list for relocations checked by isPicRel.

isPicRel is used to check if we want to create the dynamic relocations.
Not all of the dynamic relocations we create are passing through this
check, but those that are, probably better be whitelisted.

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

llvm-svn: 329203

6 years agoFix build breakage from r329201
Pavel Labath [Wed, 4 Apr 2018 14:54:08 +0000 (14:54 +0000)]
Fix build breakage from r329201

Some compilers do not like having an enum type and a variable with the
same name (AccelTableKind). I rename the variable to TheAccelTableKind.

Suggestions for a better name welcome.

llvm-svn: 329202

6 years agoRe-commit r329179 after fixing build&test issues
Pavel Labath [Wed, 4 Apr 2018 14:42:14 +0000 (14:42 +0000)]
Re-commit r329179 after fixing build&test issues

- MSVC was not OK with a static_assert referencing a non-static member
  variable, even though it was just in a sizeof(expression). I move the
  assert into the emit function, where it is probably more useful.
- Tests were failing in builds which did not have the X86 target
  configured. Since this functionality is not target-specific, I have
  removed the target specifiers from the .ll files.

llvm-svn: 329201

6 years ago[llvm-exegesis] Temporarily disable a few tests.
Clement Courbet [Wed, 4 Apr 2018 14:32:09 +0000 (14:32 +0000)]
[llvm-exegesis] Temporarily disable a few tests.

These are failing on clang-ppc64le-linux-lnt, though the subdirectory is
not even supposed to be built in CMakeLists. Disable the tests until we
understand what's going on.

llvm-svn: 329200

6 years ago[libcxx][test] Fix fs::proximate tests on platforms where /net exists.
Jan Korous [Wed, 4 Apr 2018 14:23:51 +0000 (14:23 +0000)]
[libcxx][test] Fix fs::proximate tests on platforms where /net exists.

Following Eric's patch.

llvm-svn: 329199

6 years ago[InstCombine] [NFC] Add tests for getting rid of select of bittest (PR36950 / PR17564)
Roman Lebedev [Wed, 4 Apr 2018 14:10:13 +0000 (14:10 +0000)]
[InstCombine] [NFC] Add tests for getting rid of select of bittest (PR36950 / PR17564)

Summary: See [[ https://bugs.llvm.org/show_bug.cgi?id=36950 | PR36950 ]], [[ https://bugs.llvm.org/show_bug.cgi?id=17564 | PR17564 ]], D45065, D45108

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 329198

6 years ago[AMDGPU][MC] Enabled instruction TBUFFER_LOAD_FORMAT_XYZ for SI/CI
Dmitry Preobrazhensky [Wed, 4 Apr 2018 13:54:55 +0000 (13:54 +0000)]
[AMDGPU][MC] Enabled instruction TBUFFER_LOAD_FORMAT_XYZ for SI/CI

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

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 329197

6 years ago[SLPVectorizer][X86] Regenerate some tests. NFCI
Simon Pilgrim [Wed, 4 Apr 2018 13:53:51 +0000 (13:53 +0000)]
[SLPVectorizer][X86] Regenerate some tests. NFCI

llvm-svn: 329196

6 years ago[llvm-exegesis] Temporarily disable some tests.
Clement Courbet [Wed, 4 Apr 2018 13:33:21 +0000 (13:33 +0000)]
[llvm-exegesis] Temporarily disable some tests.

The tests fail on clang-x86-windows-msvc2015:
unknown file: error: SEH exception with code 0x3221225477 thrown in the test body.

llvm-svn: 329195

6 years ago[libcxx][test] Improve assert message
Jan Korous [Wed, 4 Apr 2018 13:31:39 +0000 (13:31 +0000)]
[libcxx][test] Improve assert message

llvm-svn: 329194

6 years ago[llvm-exegesis] Only run unit tests on x86_64 hosts.
Clement Courbet [Wed, 4 Apr 2018 13:30:23 +0000 (13:30 +0000)]
[llvm-exegesis] Only run unit tests on x86_64 hosts.

llvm-svn: 329193

6 years ago[X86][Btver2] Strip unnecessary check prefixes from resources tests
Simon Pilgrim [Wed, 4 Apr 2018 13:25:45 +0000 (13:25 +0000)]
[X86][Btver2] Strip unnecessary check prefixes from resources tests

llvm-svn: 329192

6 years agoRemove llvm-build's --write-make-fragment which looks like a remnant from the autocon...
Nico Weber [Wed, 4 Apr 2018 13:23:24 +0000 (13:23 +0000)]
Remove llvm-build's --write-make-fragment which looks like a remnant from the autoconf build.

llvm-svn: 329191

6 years agoRevert r329179 (and follow-up unsuccessful fix attempts 329184, 329186); it doesn...
Nico Weber [Wed, 4 Apr 2018 13:06:22 +0000 (13:06 +0000)]
Revert r329179 (and follow-up unsuccessful fix attempts 329184, 329186); it doesn't build.

llvm-svn: 329190

6 years ago[XRay][compiler-rt] Build XRay runtime for OpenBSD
Dean Michael Berris [Wed, 4 Apr 2018 13:04:15 +0000 (13:04 +0000)]
[XRay][compiler-rt] Build XRay runtime for OpenBSD

Summary:
This is D45125; the patch enables the build of XRay on OpenBSD. We also
introduce some OpenBSD specific changes to the runtime implementation,
involving how we get the TSC rate through the syscall interface specific
to OpenBSD.

Reviewers: dberris

Authored by: devnexen

Subscribers: dberris, mgorny, krytarowski, llvm-commits

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

llvm-svn: 329189

6 years agoAdd AMDPAL Code Conventions section to AMD docs
Tim Corringham [Wed, 4 Apr 2018 13:02:09 +0000 (13:02 +0000)]
Add AMDPAL Code Conventions section to AMD docs

Summary:
This is a first version of the AMDPAL code conventions.
Further updates will undoubtably be required to fully
document AMDPAL.

Subscribers: nhaehnle, llvm-commits

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

llvm-svn: 329188

6 years ago[AMDGPU][MC] Added support of 3-element addresses for MIMG instructions
Dmitry Preobrazhensky [Wed, 4 Apr 2018 13:01:17 +0000 (13:01 +0000)]
[AMDGPU][MC] Added support of 3-element addresses for MIMG instructions

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

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

Reviewers: artem.tamazov, arsenm, timcorringham
llvm-svn: 329187

6 years agoAttempt to fix bots more after r329179.
Nico Weber [Wed, 4 Apr 2018 12:58:49 +0000 (12:58 +0000)]
Attempt to fix bots more after r329179.

llvm-svn: 329186

6 years ago[llvm-exegesis] Add missing link libraries.
Clement Courbet [Wed, 4 Apr 2018 12:58:41 +0000 (12:58 +0000)]
[llvm-exegesis] Add missing link libraries.

llvm-svn: 329185

6 years agoAttempt to fix bots after r329179.
Nico Weber [Wed, 4 Apr 2018 12:54:34 +0000 (12:54 +0000)]
Attempt to fix bots after r329179.

llvm-svn: 329184

6 years ago[XRay][clang] Allow clang to build XRay instrumented binaries in OpenBSD
Dean Michael Berris [Wed, 4 Apr 2018 12:47:49 +0000 (12:47 +0000)]
[XRay][clang] Allow clang to build XRay instrumented binaries in OpenBSD

Summary:
This patch was originally reviewed in D45126. It enables clang to add
the XRay runtime and the link-time dependencies for XRay instrumentation
in OpenBSD.

Landing for devnexen.

Reviewers: brad, dberris

Subscribers: dberris, krytarowski, cfe-commits

Author: devnexen

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

llvm-svn: 329183

6 years ago[clang-tidy] Rename -warnings-as-errors tests. NFC.
Alexander Kornienko [Wed, 4 Apr 2018 12:40:00 +0000 (12:40 +0000)]
[clang-tidy] Rename -warnings-as-errors tests. NFC.

The tests will be more discoverable with proper names.

llvm-svn: 329182

6 years agoSort targetgen calls in lib/Target/*/CMakeLists.
Nico Weber [Wed, 4 Apr 2018 12:37:44 +0000 (12:37 +0000)]
Sort targetgen calls in lib/Target/*/CMakeLists.

Makes it easier to see mistakes such as the one fixed in r329178 and makes
the different target CMakeLists more consistent.

Also remove some stale-looking comments from the Nios2 target cmakefile.

No intended behavior change.

llvm-svn: 329181

6 years ago[ELF] - Use early return. NFC.
George Rimar [Wed, 4 Apr 2018 12:36:21 +0000 (12:36 +0000)]
[ELF] - Use early return. NFC.

llvm-svn: 329180

6 years ago[CodeGen] Generate DWARF v5 Accelerator Tables
Pavel Labath [Wed, 4 Apr 2018 12:28:20 +0000 (12:28 +0000)]
[CodeGen] Generate DWARF v5 Accelerator Tables

Summary:
This patch adds a DwarfAccelTableEmitter class, which generates an
accelerator table, as specified in DWARF v5 standard. At the moment it
only generates a DIE offset column and (if we are indexing more than one
compile unit) a CU column.

Indexing type units is not currently supported, as we don't even have
the ability to generate DWARF v5-compatible compile units.

The implementation is not data-source agnostic like the one generating
apple tables. This was not necessary as we currently only have one user
of this code, and without a second user it was not obvious to me how to
best abstract this. (The difference between these tables and the apple
ones is that they need a lot more metadata about the debug info they are
indexing).

The generation is triggered by the --accel-tables argument, which
supersedes the --dwarf-accel-tables arg -- the latter was a simple
on-off switch, but not we can choose between two kinds of accelerator
tables we can generate.

This is tested by parsing the generated tables with llvm-dwarfdump and
the DWARFVerifier, and I've also checked that GNU readelf is able to
make sense of the tables.

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

llvm-svn: 329179

6 years agoRemove duplicate tablegen lines from AVR target.
Nico Weber [Wed, 4 Apr 2018 12:27:43 +0000 (12:27 +0000)]
Remove duplicate tablegen lines from AVR target.

They were added in r285274, in what looks like a merge mishap.
AVRGenMCCodeEmitter.inc is the only non-dupe tablegen invocation added in that
revision.

Also sort the tablegen lines to make this easier to spot in the future.

llvm-svn: 329178

6 years ago[llvm-exegesis] Do not initialize FileDescriptor when libpfm is not
Clement Courbet [Wed, 4 Apr 2018 12:12:38 +0000 (12:12 +0000)]
[llvm-exegesis] Do not initialize FileDescriptor when libpfm is not
available.

llvm-svn: 329177

6 years ago[llvm-exegesis] Fix compilation on lld-x86_64-darwin13
Clement Courbet [Wed, 4 Apr 2018 12:01:46 +0000 (12:01 +0000)]
[llvm-exegesis] Fix compilation on lld-x86_64-darwin13

YAMLTraits does not know how to serialize `size_t` portably. Use `int`
instead.

llvm-svn: 329176

6 years ago[llvm-exegesis][NFC] Fix compilation warning.
Clement Courbet [Wed, 4 Apr 2018 12:01:43 +0000 (12:01 +0000)]
[llvm-exegesis][NFC] Fix compilation warning.

llvm-svn: 329175

6 years ago[llvm-exegesis][NFC] Fix a few warnings.
Clement Courbet [Wed, 4 Apr 2018 12:01:38 +0000 (12:01 +0000)]
[llvm-exegesis][NFC] Fix a few warnings.

llvm-svn: 329174

6 years ago[Tablegen] Slightly refactor method SubtargetEmitter::EmitExtraProcessorInfo.
Andrea Di Biagio [Wed, 4 Apr 2018 11:53:13 +0000 (11:53 +0000)]
[Tablegen] Slightly refactor method SubtargetEmitter::EmitExtraProcessorInfo.

This patch moves most of the logic from EmitExtraProcessorInfo to a couple of
helper functions. No functional change intended.

llvm-svn: 329173

6 years ago[llvm-exegesis] Fix build when libpfm is not available.
Clement Courbet [Wed, 4 Apr 2018 11:48:15 +0000 (11:48 +0000)]
[llvm-exegesis] Fix build when libpfm is not available.

llvm-svn: 329172

6 years ago[llvm-exegesis] Fix compilation on some clang versions.
Clement Courbet [Wed, 4 Apr 2018 11:45:53 +0000 (11:45 +0000)]
[llvm-exegesis] Fix compilation on some clang versions.

default initialization of an object of const type 'const llvm::DebugLoc' requires a user-provided default constructor.

llvm-svn: 329171

6 years agoMake helpers static. NFC.
Benjamin Kramer [Wed, 4 Apr 2018 11:45:11 +0000 (11:45 +0000)]
Make helpers static. NFC.

llvm-svn: 329170

6 years agoRe-land r329156 "Add llvm-exegesis tool."
Clement Courbet [Wed, 4 Apr 2018 11:37:06 +0000 (11:37 +0000)]
Re-land r329156 "Add llvm-exegesis tool."

Fixed to depend on and initialize the native target instead of X86.

llvm-svn: 329169

6 years ago[X86][CostModel] Use generic SSE levels instead of particular CPUs for shuffle costs
Simon Pilgrim [Wed, 4 Apr 2018 11:14:12 +0000 (11:14 +0000)]
[X86][CostModel] Use generic SSE levels instead of particular CPUs for shuffle costs

llvm-svn: 329168

6 years ago[libcxx][cmake] Remove libatomic temporarily from CMAKE_REQUIRED_LIBRARIES when confi...
Simon Dardis [Wed, 4 Apr 2018 11:05:03 +0000 (11:05 +0000)]
[libcxx][cmake] Remove libatomic temporarily from CMAKE_REQUIRED_LIBRARIES when configuring

When libcxx is built in tree for a host which requires libatomic, LLVM's
configuration steps will determine it is required and add it to
CMAKE_REQUIRED_LIBRARIES. When libcxx is later configured, it tests if it
has C++ atomics without libatomic. The test erroneously passes as libatomic
is already part of the set of required libraries.

In turn, a number of the atomic tests will fail as they require libatomic
but the test suite is configured not to use libatomic.

Address this by always dropping libatomic from the set of required libraries
before determining if LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB is true,
then restoring the set of required libraries.

Reviewers: EricWF

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

llvm-svn: 329167

6 years agoAMDGPU: Dimension-aware image intrinsics
Nicolai Haehnle [Wed, 4 Apr 2018 10:58:54 +0000 (10:58 +0000)]
AMDGPU: Dimension-aware image intrinsics

Summary:
These new image intrinsics contain the texture type as part of
their name and have each component of the address/coordinate as
individual parameters.

This is a preparatory step for implementing the A16 feature, where
coordinates are passed as half-floats or -ints, but the Z compare
value and texel offsets are still full dwords, making it difficult
or impossible to distinguish between A16 on or off in the old-style
intrinsics.

Additionally, these intrinsics pass the 'texfailpolicy' and
'cachectrl' as i32 bit fields to reduce operand clutter and allow
for future extensibility.

v2:
- gather4 supports 2darray images
- fix a bug with 1D images on SI

Change-Id: I099f309e0a394082a5901ea196c3967afb867f04

Reviewers: arsenm, rampitec, b-sumner

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

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

llvm-svn: 329166

6 years agoStructurizeCFG: Test for branch divergence correctly
Nicolai Haehnle [Wed, 4 Apr 2018 10:58:15 +0000 (10:58 +0000)]
StructurizeCFG: Test for branch divergence correctly

Fixes cases like the new test @nonuniform. In that test, %cc itself
is a uniform value; however, when reading it after the end of the loop in
basic block %if, its value is effectively non-uniform, so the branch is
non-uniform.

This problem was encountered in
https://bugs.freedesktop.org/show_bug.cgi?id=103743; however, this change
in itself is not sufficient to fix that bug, as there is another issue
in the AMDGPU backend.

As discovered after committing an earlier version of this change, this
exposes a subtle interaction between this pass and DivergenceAnalysis:
since we remove and re-create branch instructions, we can no longer rely
on DivergenceAnalysis for branches in subregions that were already
processed by the pass.

Explicitly remove branch instructions from DivergenceAnalysis to
avoid dangling pointers as a matter of defensive programming, and
change how we detect non-uniform subregions.

Change-Id: I32bbffece4a32f686fab54964dae1a5dd72949d4

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

llvm-svn: 329165

6 years agoAMDGPU: Fix copying i1 value out of loop with non-uniform exit
Nicolai Haehnle [Wed, 4 Apr 2018 10:57:58 +0000 (10:57 +0000)]
AMDGPU: Fix copying i1 value out of loop with non-uniform exit

Summary:
When an i1-value is defined inside of a loop and used outside of it, we
cannot simply use the SGPR bitmask from the loop's last iteration.

There are also useful and correct cases of an i1-value being copied between
basic blocks, e.g. when a condition is computed outside of a loop and used
inside it. The concept of dominators is not sufficient to capture what is
going on, so I propose the notion of "lane-dominators".

Fixes a bug encountered in Nier: Automata.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103743
Change-Id: If37b969ddc71d823ab3004aeafb9ea050e45bd9a

Reviewers: arsenm, rampitec

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

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

llvm-svn: 329164

6 years ago[AArch64] Add patterns matching (fabs (fsub x y)) to (fabd x y)
John Brawn [Wed, 4 Apr 2018 10:12:53 +0000 (10:12 +0000)]
[AArch64] Add patterns matching (fabs (fsub x y)) to (fabd x y)

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

llvm-svn: 329163

6 years ago[ELF] - Cleanup. NFCI.
George Rimar [Wed, 4 Apr 2018 09:39:05 +0000 (09:39 +0000)]
[ELF] - Cleanup. NFCI.

Rename field, added comments.

This is splitted from the D44894.
Requested to be committed as independent cleanup.

llvm-svn: 329162

6 years agoAs we don't use minor version anymore, let's remove it from the release notes too
Sylvestre Ledru [Wed, 4 Apr 2018 09:38:22 +0000 (09:38 +0000)]
As we don't use minor version anymore, let's remove it from the release notes too

llvm-svn: 329161

6 years ago[DAGCombine] Improve ReduceLoadWidth for SRL
Sam Parker [Wed, 4 Apr 2018 09:26:56 +0000 (09:26 +0000)]
[DAGCombine] Improve ReduceLoadWidth for SRL

Recommitting rL321259. Previosuly this caused an issue with PPCBE but
I didn't receieve a reproducer and didn't have the time to follow up.
If the issue appears again, please provide a reproducer so I can fix
it.

Original commit message:

If the SRL node is only used by an AND, we may be able to set the
ExtVT to the width of the mask, making the AND redundant. To support
this, another check has been added in isLegalNarrowLoad which queries
whether the load is valid.

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

llvm-svn: 329160

6 years ago[ELF] - Rename checkSectionOverlap() to checkSections(). NFC.
George Rimar [Wed, 4 Apr 2018 09:24:31 +0000 (09:24 +0000)]
[ELF] - Rename checkSectionOverlap() to checkSections(). NFC.

Renaming was requested in post commit review for D43820.

llvm-svn: 329159

6 years ago[ARM] Do not convert some vmov instructions
Mikhail Maltsev [Wed, 4 Apr 2018 08:54:19 +0000 (08:54 +0000)]
[ARM] Do not convert some vmov instructions

Summary:
Patch https://reviews.llvm.org/D44467 implements conversion of invalid
vmov instructions into valid ones. It turned out that some valid
instructions also get converted, for example

  vmov.i64 d2, #0xff00ff00ff00ff00 ->
  vmov.i16 d2, #0xff00

Such behavior is incorrect because according to the ARM ARM section
F2.7.7 Modified immediate constants in T32 and A32 Advanced SIMD
instructions, "On assembly, the data type must be matched in the table
if possible."

This patch fixes the isNEONmovReplicate check so that the above
instruction is not modified any more.

Reviewers: rengolin, olista01

Reviewed By: rengolin

Subscribers: javed.absar, kristof.beyls, rogfer01, llvm-commits

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

llvm-svn: 329158

6 years agoRevert r329156 "Add llvm-exegesis tool."
Clement Courbet [Wed, 4 Apr 2018 08:22:54 +0000 (08:22 +0000)]
Revert r329156 "Add llvm-exegesis tool."

Breaks a bunch of bots.

llvm-svn: 329157

6 years agoAdd llvm-exegesis tool.
Clement Courbet [Wed, 4 Apr 2018 08:13:32 +0000 (08:13 +0000)]
Add llvm-exegesis tool.

Summary:
[llvm-exegesis][RFC] Automatic Measurement of Instruction Latency/Uops

This is the code corresponding to the RFC "llvm-exegesis Automatic Measurement of Instruction Latency/Uops".

The RFC is available on the LLVM mailing lists as well as the following document
for easier reading:
https://docs.google.com/document/d/1QidaJMJUyQdRrFKD66vE1_N55whe0coQ3h1GpFzz27M/edit?usp=sharing

Subscribers: mgorny, gchatelet, orwant, llvm-commits

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

llvm-svn: 329156

6 years ago[ELF] - Revert r329060 "Simplify createFiles. NFCI."
George Rimar [Wed, 4 Apr 2018 08:13:28 +0000 (08:13 +0000)]
[ELF] - Revert r329060 "Simplify createFiles. NFCI."

Was requested during post commit review.

llvm-svn: 329155

6 years ago[X86] Use the same predicate for the load for PMOVSXBQ and PMOVZXBQ.
Craig Topper [Wed, 4 Apr 2018 07:00:24 +0000 (07:00 +0000)]
[X86] Use the same predicate for the load for PMOVSXBQ and PMOVZXBQ.

These both use a 16-bit load, but one used loadi16_anyext and the other used extloadi32i16. The only difference between them is that loadi16_anyext checked that the load was at least 2 byte aligned and non-volatile. But the alignment doesn't matter here. Just use extloadi32i16 for both.

llvm-svn: 329154

6 years ago[X86] Use loadi16/loadi32 predicates in multiply patterns
Craig Topper [Wed, 4 Apr 2018 07:00:19 +0000 (07:00 +0000)]
[X86] Use loadi16/loadi32 predicates in multiply patterns

llvm-svn: 329153