platform/upstream/llvm.git
6 years ago[InstCombine] Unify handling of atomic memtransfer with non-atomic memtransfer
Daniel Neilson [Fri, 11 May 2018 14:30:02 +0000 (14:30 +0000)]
[InstCombine] Unify handling of atomic memtransfer with non-atomic memtransfer

Summary:
This change reworks the handling of atomic memcpy within the instcombine pass.
Previously, a constant length atomic memcpy would be lowered into loads & stores
as long as no more than 16 load/store pairs are created. This is quite different
from the lowering done for a non-atomic memcpy; which only ever lowers into a single
load/store pair of no more than 8 bytes. Larger constant-sized memcpy calls are
expanded to load/stores in later passes, such as SelectionDAG lowering.

In this change the behaviour for atomic memcpy is unified with non-atomic memcpy;
atomic memcpy is now treated in the same was as non-atomic memcpy has always been.
We leave it to later passes to lower longer-length atomic memcpy calls.

Due to the structure of the pass's handling of memtransfer intrinsics, this change
also gives us handling of atomic memmove that we did not previously have.

Reviewers: apilipenko, skatkov, mkazantsev, anna, reames

Reviewed By: reames

Subscribers: reames, llvm-commits

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

llvm-svn: 332093

6 years ago[ASan] Fix range check in AddrIsInHighShadow
David Major [Fri, 11 May 2018 14:23:39 +0000 (14:23 +0000)]
[ASan] Fix range check in AddrIsInHighShadow

This appears to be a copy/paste artifact from `AddrIsInHighMem`. It was caught by Firefox's jit-tests on Win64.

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

llvm-svn: 332092

6 years ago[X86] Assume alignment of movdir64b dst argument
Gabor Buella [Fri, 11 May 2018 14:22:04 +0000 (14:22 +0000)]
[X86] Assume alignment of movdir64b dst argument

Reviewers: craig.topper

Reviewed By: craig.topper

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

llvm-svn: 332091

6 years ago[X86] Added scheduler helper classes to split move/load/store by size
Simon Pilgrim [Fri, 11 May 2018 12:46:54 +0000 (12:46 +0000)]
[X86] Added scheduler helper classes to split move/load/store by size

Nothing uses this yet but this will allow us to specialize MMX/XMM/YMM/ZMM vector moves.

llvm-svn: 332090

6 years ago[clangd] Move helpers that convert Replacements to TextEdits to SourceCode.h
Eric Liu [Fri, 11 May 2018 12:12:08 +0000 (12:12 +0000)]
[clangd] Move helpers that convert Replacements to TextEdits to SourceCode.h

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, MaskRay, jkorous, cfe-commits

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

llvm-svn: 332089

6 years agoRemove custom path manipulation functions from FileSpec
Pavel Labath [Fri, 11 May 2018 11:55:34 +0000 (11:55 +0000)]
Remove custom path manipulation functions from FileSpec

Summary:
now that llvm supports host-agnostic path manipulation functions (and
most of their kinks have been ironed out), we can remove our copies of
the path parsing functions in favour of the llvm ones.

This should be NFC except for the slight difference in handling of the
"//" path, which is now normalized to "/" (this only applies to the
literal "//" path; "//net" and friends still get to keep the two
slashes).

Reviewers: zturner, clayborg

Subscribers: lldb-commits

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

llvm-svn: 332088

6 years ago[APFloat] Set losesInfo on no-op convert
Sven van Haastregt [Fri, 11 May 2018 09:45:42 +0000 (09:45 +0000)]
[APFloat] Set losesInfo on no-op convert

losesInfo would be left unset when no conversion needs to be done.  A
caller such as InstCombine's fitsInFPType would then branch on an
uninitialized value.

Caught using valgrind on an out-of-tree target.

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

llvm-svn: 332087

6 years ago[IRTests] Verify PDT instead of DT
Jakub Kuderski [Fri, 11 May 2018 09:30:29 +0000 (09:30 +0000)]
[IRTests] Verify PDT instead of DT

Summary: Fix two typos which result in verifying wrong data structures (DT) instead of PDT in DominatorTreeBatchUpdatesTest.

Reviewers: davide, kuhar, grosser, dberlin

Reviewed By: davide, kuhar, dberlin

Subscribers: llvm-commits

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

llvm-svn: 332086

6 years ago[ELF] - Revert of: r332038, r332054, r332060, r332061, r332062, r332063
George Rimar [Fri, 11 May 2018 08:11:25 +0000 (08:11 +0000)]
[ELF] - Revert of: r332038, r332054, r332060, r332061, r332062, r332063

This reverts "Mitigate relocation overflow [part 1 of 2]." and the following commits which
were trying to fix the bots.

At the moment of r332082, bots are still failing and we need to find the reason of test case breakages first of all.
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/17042/steps/test/logs/stdio
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/29845/steps/test/logs/stdio

llvm-svn: 332085

6 years agoAMDGPU/GlobalISel: Implement select() for 32-bit G_FPTOUI
Tom Stellard [Fri, 11 May 2018 05:44:16 +0000 (05:44 +0000)]
AMDGPU/GlobalISel: Implement select() for 32-bit G_FPTOUI

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 332082

6 years ago[llvm-strip] Add support for -remove-section
Alexander Shaposhnikov [Fri, 11 May 2018 05:27:06 +0000 (05:27 +0000)]
[llvm-strip] Add support for -remove-section

This diff adds support for -remove-section to llvm-strip.

Test plan: make check-all

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

llvm-svn: 332081

6 years ago[X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.
Craig Topper [Fri, 11 May 2018 04:33:18 +0000 (04:33 +0000)]
[X86] Remove and autoupgrade the avx512.mask.store.ss intrinsic.

llvm-svn: 332079

6 years ago[llvm-objcopy] Update remove-section.test
Alexander Shaposhnikov [Fri, 11 May 2018 04:30:57 +0000 (04:30 +0000)]
[llvm-objcopy] Update remove-section.test

Verify that the input binary is not getting modified
and add an invocation which uses -remove-section instead of -R.

Test plan: make check-all

llvm-svn: 332078

6 years ago[Coroutines] PR34897: Fix incorrect elisions
Brian Gesiak [Fri, 11 May 2018 03:12:28 +0000 (03:12 +0000)]
[Coroutines] PR34897: Fix incorrect elisions

Summary:
https://bugs.llvm.org/show_bug.cgi?id=34897 demonstrates an incorrect
coroutine frame allocation elision in the coro-elide pass. The elision
is performed on the basis that the SSA variables from all llvm.coro.begin
are directly referenced in subsequent llvm.coro.destroy instructions.

However, this ignores the fact that the function may exit through paths
that do not run these destroy instructions. In the sample program from
PR34897, for example, the llvm.coro.destroy instruction is only
executed in exception handling code. When the coroutine function exits
normally, llvm.coro.destroy is not called. Eliding the allocation in
this case causes a subsequent reference to the coroutine handle from
outside of the function to access freed memory.

To fix the issue, when finding an llvm.coro.destroy for each llvm.coro.begin,
only consider llvm.coro.destroy that are executed along non-exceptional paths.

Test Plan:
1. Download the sample program from
   https://bugs.llvm.org/show_bug.cgi?id=34897, compile it with
   `clang++ -fcoroutines-ts -stdlib=libc++ -std=c++1z -O2`, and run it.
   It should print `"run1\ncheck1\nrun2\ncheck2"` and then exit
   successfully.
2. Compile https://godbolt.org/g/mCKfnr and confirm it is still
   optimized to a single instruction, 'return 1190'.
3. `check-llvm`

Reviewers: rsmith, GorNishanov, eric_niebler

Reviewed By: GorNishanov

Subscribers: andrewrk, lewissbaker, EricWF, llvm-commits

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

llvm-svn: 332077

6 years agoImprove diagnostics and error recovery for template name lookup.
Richard Smith [Fri, 11 May 2018 02:43:08 +0000 (02:43 +0000)]
Improve diagnostics and error recovery for template name lookup.

For 'x::template y', consistently give a "no member named 'y' in 'x'"
diagnostic if there is no such member, and give a 'template keyword not
followed by a template' name error if there is such a member but it's not a
template. In the latter case, add a note pointing at the non-template.

Don't suggest inserting a 'template' keyword in 'X::Y<' if X is dependent
if the lookup of X::Y was actually not a dependent lookup and found only
non-templates.

llvm-svn: 332076

6 years ago[Support] Add docs for 'openFileFor{Write,Read}'
Brian Gesiak [Fri, 11 May 2018 01:47:27 +0000 (01:47 +0000)]
[Support] Add docs for 'openFileFor{Write,Read}'

Summary:
Add documentation for the LLVM Support functions `openFileForWrite` and
`openFileForRead`. The `openFileForRead` parameter `RealPath`, in
particular, I think warranted some explanation.

In addition, make the behavior of the functions more consistent across
platforms. Prior to this patch, Windows would set or not set the result
file descriptor based on the nature of the error, whereas Unix would
consistently set it to `-1` if the open failed. Make Windows
consistently set it to `-1` as well.

Test Plan:
1. `ninja check-llvm`
2. `ninja docs-llvm-html`

Reviewers: zturner, rnk, danielmartin, scanon

Reviewed By: danielmartin, scanon

Subscribers: scanon, danielmartin, llvm-commits

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

llvm-svn: 332075

6 years agoDon't propagate dllimport to base class template static data members
Reid Kleckner [Fri, 11 May 2018 01:26:11 +0000 (01:26 +0000)]
Don't propagate dllimport to base class template static data members

MSVC doesn't, so we shouldn't. Fixes PR37232.

llvm-svn: 332074

6 years ago[libFuzzer] refactor the implementation of -print_coverage
Kostya Serebryany [Fri, 11 May 2018 01:17:52 +0000 (01:17 +0000)]
[libFuzzer] refactor the implementation of -print_coverage

llvm-svn: 332073

6 years ago[sanitizer-coverage] don't instrument a function if it's entry block ends with 'unrea...
Kostya Serebryany [Fri, 11 May 2018 01:09:39 +0000 (01:09 +0000)]
[sanitizer-coverage] don't instrument a function if it's entry block ends with 'unreachable'

llvm-svn: 332072

6 years agoSupport XRay in the NetBSD driver
Kamil Rytarowski [Fri, 11 May 2018 01:00:38 +0000 (01:00 +0000)]
Support XRay in the NetBSD driver

Summary:
While there, perform a small cleanup, reducing delta
with drivers for other OSes.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, dberris

Reviewed By: dberris

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 332071

6 years agoPermit -fxray-instrument for NetBSD/amd64
Kamil Rytarowski [Fri, 11 May 2018 00:58:55 +0000 (00:58 +0000)]
Permit -fxray-instrument for NetBSD/amd64

Summary:
Use the same branch as FreeBSD and OpenBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dberris, vitalybuka

Reviewed By: vitalybuka

Subscribers: emaste, llvm-commits

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

llvm-svn: 332070

6 years agoRegister NetBSD/i386 in AddressSanitizer.cpp
Kamil Rytarowski [Fri, 11 May 2018 00:58:01 +0000 (00:58 +0000)]
Register NetBSD/i386 in AddressSanitizer.cpp

Summary:
Ship kNetBSD_ShadowOffset32 set to 1ULL << 30.

This is prepared for the amd64 kernel runtime.

Sponsored by <The NetBSD Foundation>

Reviewers: vitalybuka, joerg, kcc

Reviewed By: vitalybuka

Subscribers: llvm-commits

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

llvm-svn: 332069

6 years ago[InstCombine] Add tests for cases where we don't recognize type promoted rotate idioms.
Craig Topper [Fri, 11 May 2018 00:46:09 +0000 (00:46 +0000)]
[InstCombine] Add tests for cases where we don't recognize type promoted rotate idioms.

These rotates take the form

(x << (n & mask)) | (x >> (-n & mask)) where mask is bitwidth - 1.

If x has been promoted to a wider type than its original bit width due to type promotion we fail to narrower it and therefore don't recognize it as a rotate.

llvm-svn: 332068

6 years agoRetrieve the deployment target when retrieving an object file's triple.
Adrian Prantl [Fri, 11 May 2018 00:41:20 +0000 (00:41 +0000)]
Retrieve the deployment target when retrieving an object file's triple.

Getting the deployment target can be significant information when
rebuilding clang modules since availability information could depend
on it.

rdar://problem/40039633

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

llvm-svn: 332067

6 years agoFix failing test due to incorrect use of noexcept
Eric Fiselier [Fri, 11 May 2018 00:33:20 +0000 (00:33 +0000)]
Fix failing test due to incorrect use of noexcept

llvm-svn: 332066

6 years agoSupport Unsupported Tests in xunit output
Chris Matthews [Fri, 11 May 2018 00:25:43 +0000 (00:25 +0000)]
Support Unsupported Tests in xunit output

We were reporting  "Unsupported" tests in xunit as passes, however since
they are not run, it make more sense to mark them as skipped. The Junit
xml standard has support for that, so lets use it.

llvm-svn: 332065

6 years agoRefactor xunit test case builder to not use as much str addition
Chris Matthews [Fri, 11 May 2018 00:25:42 +0000 (00:25 +0000)]
Refactor xunit test case builder to not use as much str addition

String concatenation in python is slow.  Refactor to not concatenate the
possibly large strings of test output and instead write them directly
to the output file.

llvm-svn: 332064

6 years ago[ELF] Fix test
Fangrui Song [Thu, 10 May 2018 23:57:38 +0000 (23:57 +0000)]
[ELF] Fix test

llvm-svn: 332063

6 years ago[ELF] Fix tests after rL332038
Fangrui Song [Thu, 10 May 2018 23:55:41 +0000 (23:55 +0000)]
[ELF] Fix tests after rL332038

llvm-svn: 332062

6 years ago[ELF] --warn-backref: don't report backref to weak symbols.
Fangrui Song [Thu, 10 May 2018 23:53:05 +0000 (23:53 +0000)]
[ELF] --warn-backref: don't report backref to weak symbols.

Summary:
Suppose we visit symbols in this order:

1. weak definition of foo in a lazy object
2. reference of foo
3 (optional). definition of foo

bfd/gold allows 123 but not 12.

Current --warn-backrefs implementation will report both cases as a backward reference. With this change, both 123 (intended) and 12 (unintended) are allowed. The usage of weak definitions usually imply there are also global definitions, so the trade-off is justified.

Reviewers: ruiu, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 332061

6 years ago[ELF] Fix two tests after D45788
Fangrui Song [Thu, 10 May 2018 23:51:37 +0000 (23:51 +0000)]
[ELF] Fix two tests after D45788

llvm-svn: 332060

6 years agoCOFF: Allow ICF on vtable sections.
Peter Collingbourne [Thu, 10 May 2018 23:31:58 +0000 (23:31 +0000)]
COFF: Allow ICF on vtable sections.

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

llvm-svn: 332059

6 years ago[SampleFDO] Don't treat warm callsite with inline instance in the profile as cold
Wei Mi [Thu, 10 May 2018 23:02:27 +0000 (23:02 +0000)]
[SampleFDO] Don't treat warm callsite with inline instance in the profile as cold

We found current sampleFDO had a performance issue when triaging a regression.
For a callsite with inline instance in the profile, even if hot callsite inliner
cannot inline it, it may still execute enough times and should not be treated as
cold in regular inliner later. However, currently if such callsite is not inlined
by hot callsite inliner, and the BB where the callsite locates doesn't get
samples from other instructions inside of it, the callsite will have no profile
metadata annotated. In regular inliner cost analysis, if the callsite has no
profile annotated and its caller has profile information, it will be treated as
cold.

The fix changes the isCallsiteHot check and chooses to compare
CallsiteTotalSamples with hot cutoff value computed by ProfileSummaryInfo.

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

llvm-svn: 332058

6 years ago[STLExtras] Add distance() for ranges, pred_size(), and succ_size()
Vedant Kumar [Thu, 10 May 2018 23:01:54 +0000 (23:01 +0000)]
[STLExtras] Add distance() for ranges, pred_size(), and succ_size()

This commit adds a wrapper for std::distance() which works with ranges.
As it would be a common case to write `distance(predecessors(BB))`, this
also introduces `pred_size()` and `succ_size()` helpers to make that
easier to write.

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

llvm-svn: 332057

6 years ago[LIT] Move xunit tests tests into their own location, and and add failures
Chris Matthews [Thu, 10 May 2018 22:51:28 +0000 (22:51 +0000)]
[LIT] Move xunit tests tests into their own location, and and add failures

Failures will increase coverage.

llvm-svn: 332056

6 years ago[InstCombine] Replace an 'if' that should always be true with an assert.
Craig Topper [Thu, 10 May 2018 22:45:28 +0000 (22:45 +0000)]
[InstCombine] Replace an 'if' that should always be true with an assert.

The bitwidth of the operation should always be wider than the result width of the truncate since we don't recurse through any width changing operations.

llvm-svn: 332055

6 years agoFix test cases failure caused by revision 332038.
Han Shen [Thu, 10 May 2018 22:32:39 +0000 (22:32 +0000)]
Fix test cases failure caused by revision 332038.

The previous CL changes the order of output sections, which causes address changes in test cases.

Review: https://reviews.llvm.org/D46730
llvm-svn: 332054

6 years ago[clang-cl] Make -f[no-]coverage-mapping available
Reid Kleckner [Thu, 10 May 2018 22:24:00 +0000 (22:24 +0000)]
[clang-cl] Make -f[no-]coverage-mapping available

llvm-svn: 332053

6 years ago[WebAssembly] Initial Disassembler.
Sam Clegg [Thu, 10 May 2018 22:16:44 +0000 (22:16 +0000)]
[WebAssembly] Initial Disassembler.

This implements a new table-gen emitter to create tables for
a wasm disassembler, and a dissassembler to use them.

Comes with 2 tests, that tests a few instructions manually. Is also able to
disassemble large .wasm files with objdump reasonably.

Not working so well, to be addressed in followups:
- objdump appears to be passing an incorrect starting point.
- since the disassembler works an instruction at a time, and it is
  disassembling stack instruction, it has no idea of pseudo register assignments.
  These registers are required for the instruction printing code that follows.
  For now, all such registers appear in the output as $0.

Patch by Wouter van Oortmerssen

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

llvm-svn: 332052

6 years agoEnable SANITIZER_INTERCEPTOR_HOOKS for NetBSD
Kamil Rytarowski [Thu, 10 May 2018 22:09:24 +0000 (22:09 +0000)]
Enable SANITIZER_INTERCEPTOR_HOOKS for NetBSD

Summary:
This feature is required for proper libFuzzer support.

Adding SI_NETBSD to the list of OSes, fixes breakage in several
libFuzzer tests. It has been debugged with aid from kcc@.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 332051

6 years agoFix the code that gets the Xcode path. After path normalization this could was failing.
Greg Clayton [Thu, 10 May 2018 22:09:01 +0000 (22:09 +0000)]
Fix the code that gets the Xcode path. After path normalization this could was failing.

This meant if the "debugserver" binary was removed from the LLDB.framework, lldb wouldn't be able to find debugserver.

llvm-svn: 332050

6 years ago[X86] Add new patterns for masked scalar load/store to match clang's codegen from...
Craig Topper [Thu, 10 May 2018 21:49:16 +0000 (21:49 +0000)]
[X86] Add new patterns for masked scalar load/store to match clang's codegen from r331958.

Clang's codegen now uses 128-bit masked load/store intrinsics in IR. The backend will widen to 512-bits on AVX512F targets.

So this patch adds patterns to detect codegen's widening and patterns for AVX512VL that don't get widened.

We may be able to drop some of the old patterns, but I leave that for a future patch.

llvm-svn: 332049

6 years ago[tsan] Add debugging API to retrieve the "external tag" from reports
Kuba Mracek [Thu, 10 May 2018 21:46:00 +0000 (21:46 +0000)]
[tsan] Add debugging API to retrieve the "external tag" from reports

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

llvm-svn: 332048

6 years ago[asan] Enable memtrinsics interception for RTEMS
Walter Lee [Thu, 10 May 2018 21:45:13 +0000 (21:45 +0000)]
[asan] Enable memtrinsics interception for RTEMS

Replace decltype(memcpy) with decltype(__asan_memcpy) because memcpy
has not been defined in any headers on RTEMS.  Similarly for memmove
and memset.

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

llvm-svn: 332047

6 years ago[sanitizer] Port fast stack unwinder to sparcv8
Walter Lee [Thu, 10 May 2018 21:40:16 +0000 (21:40 +0000)]
[sanitizer] Port fast stack unwinder to sparcv8

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

llvm-svn: 332046

6 years agoimplementing Cursor.get_included_file in python bindings
Jonathan Coe [Thu, 10 May 2018 21:39:29 +0000 (21:39 +0000)]
implementing Cursor.get_included_file in python bindings

Summary:
adding function: `Cursor.get_included_file` , so the C API's `clang_getIncludedFile` function is available on the python binding interface
also adding test to unittests

related ticket: https://bugs.llvm.org/show_bug.cgi?id=15223

Reviewers: mgorny, arphaman, jbcoe

Reviewed By: jbcoe

Subscribers: cfe-commits

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

Patch by jlaz (József Láz)

llvm-svn: 332045

6 years agoRevert "[InstCombine] snprintf optimizations"
Martin Storsjo [Thu, 10 May 2018 21:23:36 +0000 (21:23 +0000)]
Revert "[InstCombine] snprintf optimizations"

This reverts commit SVN r331889, which could trigger failed
assertions for cases where the snprintf function is declared
with a vaguely differing signature (e.g. being defined as
static inline), see PR37408.

llvm-svn: 332043

6 years agoAMDGPU/GlobalISel: Implement select() for G_BITCAST s32 <--> <2 x s16>
Tom Stellard [Thu, 10 May 2018 21:20:10 +0000 (21:20 +0000)]
AMDGPU/GlobalISel: Implement select() for G_BITCAST s32 <--> <2 x s16>

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 332042

6 years ago[LLVM-C] Consolidate llgo's DIBuilder Bindings
Robert Widmann [Thu, 10 May 2018 21:10:06 +0000 (21:10 +0000)]
[LLVM-C] Consolidate llgo's DIBuilder Bindings

Summary: Move and correct LLVMDIBuilderCreateTypedef.  This is the last API in DIBuilderBindings.h, so it is being removed and the C API will now be re-exported from IRBindings.h.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 332041

6 years agoFix PR37407 - callable traits don't correctly check complete types.
Eric Fiselier [Thu, 10 May 2018 20:59:35 +0000 (20:59 +0000)]
Fix PR37407 - callable traits don't correctly check complete types.

Checking for complete types is really rather tricky when you consider
the amount of specializations required to check a function type. This
specifically caused PR37407 where we incorrectly diagnosed
noexcept function types as incomplete (but there were plenty of other
cases that would cause this).

This patch removes the complete type checking for now. I'm going
to look into adding a clang builtin to correctly do this for us.

llvm-svn: 332040

6 years agoAMDGPU/GlobalISel: Enable TableGen'd instruction selector
Tom Stellard [Thu, 10 May 2018 20:53:06 +0000 (20:53 +0000)]
AMDGPU/GlobalISel: Enable TableGen'd instruction selector

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, mgorny, yaxunl, rovka, kristof.beyls, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 332039

6 years agoMitigate relocation overflow [part 1 of 2].
Han Shen [Thu, 10 May 2018 20:44:42 +0000 (20:44 +0000)]
Mitigate relocation overflow [part 1 of 2].

This CL is to mitigate R_X86_64_PC32 relocation overflow problems for huge binaries that has near 4G allocated sections.

By examining those binaries, there're 2 issues contributes to the problem:
1). huge ".dynsym" and ".dynstr" stands in the way between .rodata and .text
2). _init_array_start/end are placed at 0 if no ".init_array" presents, this causes .text relocation against them become more prone to overflow.

This CL addresses 1st problem (the 2nd will be addressed in another CL.) by assigning a smaller sortrank to .dynsym and .dynstr thus they no longer stand in between.

llvm-svn: 332038

6 years ago[libFuzzer] simplify tests, remove one redundant test; NFC
Kostya Serebryany [Thu, 10 May 2018 20:37:08 +0000 (20:37 +0000)]
[libFuzzer] simplify tests, remove one redundant test; NFC

llvm-svn: 332037

6 years ago[libFuzzer] remove the dump_coverage flag, it hasn't been working with the inline...
Kostya Serebryany [Thu, 10 May 2018 20:24:39 +0000 (20:24 +0000)]
[libFuzzer] remove the dump_coverage flag, it hasn't been working with the inline sanitizer coverage anyway

llvm-svn: 332036

6 years agoSetup ORIGIN/NetBSD option in sanitizer tests
Kamil Rytarowski [Thu, 10 May 2018 20:13:36 +0000 (20:13 +0000)]
Setup ORIGIN/NetBSD option in sanitizer tests

Summary:
NetBSD can use the approach that exists in FreeBSD, Linux and SunOS.

Pick the FreeBSD one as marking programs with "-z origin" is useful.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc

Reviewed By: vitalybuka

Subscribers: emaste, fedor.sergeev, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 332035

6 years ago[libFuzzer] remove the experimental support for clang coverage instrumentation. This...
Kostya Serebryany [Thu, 10 May 2018 20:12:15 +0000 (20:12 +0000)]
[libFuzzer] remove the experimental support for clang coverage instrumentation. This mode has not been used and our experiments with https://github.com/google/fuzzer-test-suite show that this signal is weaker than the SanitizerCoverage

llvm-svn: 332034

6 years ago[asan] Initialize fake stack during thread init
Walter Lee [Thu, 10 May 2018 20:09:03 +0000 (20:09 +0000)]
[asan] Initialize fake stack during thread init

If detect-stack-use-after-return is on, initialize fake stack during
AsanThread::Init(), rather than lazily.  This is required on Myriad.
From kcc: "There used to be a reason why this was done lazily, but I
don't remember if we still have that reason."  Tested on x86.

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

llvm-svn: 332033

6 years ago[InstCombine] add folds for minnum(-a, -b) --> -maxnum(a, b)
Sanjay Patel [Thu, 10 May 2018 20:03:13 +0000 (20:03 +0000)]
[InstCombine] add folds for minnum(-a, -b) --> -maxnum(a, b)

This is similar to what we do for integer min/max with 'not'
ops (rL321882).

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=37404
https://bugs.llvm.org/show_bug.cgi?id=37405

llvm-svn: 332031

6 years ago[DWARF] Fixing a bug in DWARF v5 string offsets tables where the length encoded the...
Wolfgang Pieb [Thu, 10 May 2018 20:02:34 +0000 (20:02 +0000)]
[DWARF] Fixing a bug in DWARF v5 string offsets tables where the length encoded the contribution
length excluding the table header. Instead it must encode the contribution length minus the length
field itself.

Reviewer: JDevliegehere

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

llvm-svn: 332030

6 years ago[libFuzzer] Experimental data flow tracer for fuzz targets.
Kostya Serebryany [Thu, 10 May 2018 19:59:01 +0000 (19:59 +0000)]
[libFuzzer] Experimental data flow tracer for fuzz targets.

Summary:
Experimental data flow tracer for fuzz targets.
Allows to tell which bytes of the input affect which functions of the fuzz target.

We previously attempted to use DFSan directly in the libFuzzer process,
and that didn't work nicely.
Now we will try to collect the data flow information for the seed corpus
in a separate process (using this tracer), and then use it in the regular libFuzzer runs.

Reviewers: morehouse, pcc, Dor1s

Reviewed By: morehouse, Dor1s

Subscribers: delcypher, #sanitizers, llvm-commits

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

llvm-svn: 332029

6 years ago[Itanium] Emit type info names with external linkage.
Eric Fiselier [Thu, 10 May 2018 19:51:56 +0000 (19:51 +0000)]
[Itanium] Emit type info names with external linkage.

Summary:
The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed.  Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos.
For example:

```
// header.h
struct T;
extern std::type_info const& Info;

// tu_one.cpp
#include "header.h"
std::type_info const& Info = typeid(T*);

// tu_two.cpp
#include "header.h"
struct T {};
int main() {
  auto &TI1 = Info;
  auto &TI2 = typeid(T*);
  assert(TI1 == TI2); // Fails
  assert(TI1.hash_code() == TI2.hash_code()); // Fails
}
```

This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type.

Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to:

(A) Always perform strcmp/string hashes.
(B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++.

Reviewers: rsmith, rjmccall, majnemer, vsapsai

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

llvm-svn: 332028

6 years agoRegister NetBSD/i386 in asan_mapping.h
Kamil Rytarowski [Thu, 10 May 2018 19:51:40 +0000 (19:51 +0000)]
Register NetBSD/i386 in asan_mapping.h

Summary:
Introduce kNetBSD_ShadowOffset32 and document
NetBSD/i386 (hosted on amd64 kernel) process virtual
address space ranges.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers

Tags: #sanitizers

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

llvm-svn: 332027

6 years ago[InstCombine] Moving overflow computation logic from InstCombine to ValueTracking...
Omer Paparo Bivas [Thu, 10 May 2018 19:46:19 +0000 (19:46 +0000)]
[InstCombine] Moving overflow computation logic from InstCombine to ValueTracking; NFC

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

Change-Id: Ifabcbe431a2169743b3cc310f2a34fd706f13f02
llvm-svn: 332026

6 years ago[InstCombine] add minnum/maxnum tests (PR37404, PR37405); NFC
Sanjay Patel [Thu, 10 May 2018 19:21:08 +0000 (19:21 +0000)]
[InstCombine] add minnum/maxnum tests (PR37404, PR37405); NFC

llvm-svn: 332025

6 years ago[X86] Initialize HasPTWRITE member of X86Subtarget
Gabor Buella [Thu, 10 May 2018 19:15:10 +0000 (19:15 +0000)]
[X86] Initialize HasPTWRITE member of X86Subtarget

This was missing from r331961.
Caught by sanitizer bots.

llvm-svn: 332024

6 years agoReland "[tools] Updating PPCallbacks::InclusionDirective calls"
Julie Hockett [Thu, 10 May 2018 19:13:14 +0000 (19:13 +0000)]
Reland "[tools] Updating PPCallbacks::InclusionDirective calls"

This commit relands r331905.

r331904 added SrcMgr::CharacteristicKind to the InclusionDirective
callback, this revision updates instances of it in clang-tools-extra.

llvm-svn: 332023

6 years ago[X86] Convert/Merge more instregex patterns to reduce InstrRW compile time.
Simon Pilgrim [Thu, 10 May 2018 19:08:06 +0000 (19:08 +0000)]
[X86] Convert/Merge more instregex patterns to reduce InstrRW compile time.

Use instrs lists or merge multiple instregex patterns.

llvm-svn: 332022

6 years agoReland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'
Julie Hockett [Thu, 10 May 2018 19:05:36 +0000 (19:05 +0000)]
Reland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'

This commit relands r331904.

Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective
in PPCallbacks, and updating calls to that function. This will be useful
in https://reviews.llvm.org/D43778 to determine which includes are
system
headers.

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

llvm-svn: 332021

6 years ago[lsan] Try to fix test failure due to compiler optimization
Peter Wu [Thu, 10 May 2018 19:02:32 +0000 (19:02 +0000)]
[lsan] Try to fix test failure due to compiler optimization

Summary:
The SanitizerCommon-lsan-x86_64-Linux test failed due to the address of
the very first allocation ending up in the stack through "delete[]".
Workaround this by performing another allocation. The issue was only
present with optimization enabled, the test would pass with -O0.

Reviewed By: vitalybuka

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

llvm-svn: 332020

6 years agoCOFF: Don't create unnecessary thunks.
Peter Collingbourne [Thu, 10 May 2018 19:01:28 +0000 (19:01 +0000)]
COFF: Don't create unnecessary thunks.

A thunk is only needed if a relocation points to the undecorated
import name.

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

llvm-svn: 332019

6 years agoAllow dllimport non-type template arguments in C++17
Reid Kleckner [Thu, 10 May 2018 18:57:35 +0000 (18:57 +0000)]
Allow dllimport non-type template arguments in C++17

Summary:
Fixes PR35772.

Reviewers: rsmith

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

llvm-svn: 332018

6 years agoAdd regression test for r331976
George Burgess IV [Thu, 10 May 2018 18:37:54 +0000 (18:37 +0000)]
Add regression test for r331976

In general, it's difficult to poke the ConstantExpr code in CFLAA, since
LLVM is so great at eagerly reducing ConstantExprs. :)

Sadly, this only shows a functional difference from before the patch
because CFLAA has some special logic around taking loads of non-pointers
into account. Namely, with the broken select behavior, CFLAA will
completely fail to take note of @g3. Since CFLAA doesn't have any record
about @g3 when we do an alias query for @g3 and %a, it conservatively
answers MayAlias. When we properly take @g3 into account with the new
select logic, we get NoAlias for this query.

I suspect that the aforementioned "special logic" isn't completely
correct, but this test-case should prevent future wonky aliasing results
from appearing for these flavors of ConstantExprs, so I think it's still
worth having.

llvm-svn: 332017

6 years ago[OPENMP, NVPTX] Initial support for L2 parallelism in SPMD mode.
Alexey Bataev [Thu, 10 May 2018 18:32:08 +0000 (18:32 +0000)]
[OPENMP, NVPTX] Initial support for L2 parallelism in SPMD mode.

Added initial support for L2 parallelism in SPMD mode. Note, though,
that the orphaned parallel directives are not currently supported in
SPMD mode.

llvm-svn: 332016

6 years ago[CGP] Split large data structres to sink more GEPs
Haicheng Wu [Thu, 10 May 2018 18:27:36 +0000 (18:27 +0000)]
[CGP] Split large data structres to sink more GEPs

Accessing the members of a large data structures needs a lot of GEPs which
usually have large offsets due to the size of the underlying data structure. If
the offsets are too large to fit into the r+i addressing mode, these GEPs cannot
be sunk to their users' blocks and many extra registers are needed then to carry
the values of these GEPs.

This patch tries to split a large data struct starting from %base like the
following.

Before:
BB0:
  %base     =

BB1:
  %gep0     = gep %base, off0
  %gep1     = gep %base, off1
  %gep2     = gep %base, off2

BB2:
  %load1    = load %gep0
  %load2    = load %gep1
  %load3    = load %gep2

After:
BB0:
  %base     =
  %new_base = gep %base, off0

BB1:
  %new_gep0 = %new_base
  %new_gep1 = gep %new_base, off1 - off0
  %new_gep2 = gep %new_base, off2 - off0

BB2:
  %load1    = load i32, i32* %new_gep0
  %load2    = load i32, i32* %new_gep1
  %load3    = load i32, i32* %new_gep2

In the above example, the struct is split into two parts. The first part still
starts from %base and the second part starts from %new_base. After the
splitting, %new_gep1 and %new_gep2 have smaller offsets and then can be sunk to
BB2 and folded into their users.

The algorithm to split data structure is simple and very similar to the work of
merging SExts. First, it collects GEPs that have large offsets when iterating
the blocks. Second, it splits the underlying data structures and updates the
collected GEPs to use smaller offsets.

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

llvm-svn: 332015

6 years ago[LLVM-C] Add Accessors for Common DIType and DILocation Properties
Robert Widmann [Thu, 10 May 2018 18:23:55 +0000 (18:23 +0000)]
[LLVM-C] Add Accessors for Common DIType and DILocation Properties

Summary:
- Adds getters for the line, column, and scope of a DILocation
- Adds getters for the name, size in bits, offset in bits, alignment in bits, line, and flags of a DIType

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 332014

6 years ago[WebAssembly] Add a flag to control merging data segments
Sam Clegg [Thu, 10 May 2018 18:23:51 +0000 (18:23 +0000)]
[WebAssembly] Add a flag to control merging data segments

Merging data segments produces smaller code sizes because each segment
has some boilerplate. Therefore, merging data segments is generally the
right approach, especially with wasm where binaries are typically
delivered over the network.

However, when analyzing wasm binaries, it can be helpful to get a
conservative picture of which functions are using which data
segments[0]. Perhaps there is a large data segment that you didn't
expect to be included in the wasm, introduced by some library you're
using, and you'd like to know which library it was. In this scenario,
merging data segments only makes the analysis worse.

Alternatively, perhaps you will remove some dead functions by-hand[1]
that can't be statically proven dead by the compiler or lld, and
removing these functions might make some data garbage collect-able, and
you'd like to run `--gc-sections` again so that this now-unused data can
be collected. If the segments were originally merged, then a single use
of the merged data segment will entrench all of the data.

[0] https://github.com/rustwasm/twiggy
[1] https://github.com/fitzgen/wasm-snip

Patch by Nick Fitzgerald!

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

llvm-svn: 332013

6 years agolld-link: Add --color-diagnostics(={always,never,auto})?, --no-color-diagnostics...
Nico Weber [Thu, 10 May 2018 18:19:02 +0000 (18:19 +0000)]
lld-link: Add --color-diagnostics(={always,never,auto})?, --no-color-diagnostics flags.

This is most useful when using lld-link on a non-Win host (but it might become
useful on Windows too if lld also grows a fansi-escape-codes flag).

Also make the help for --color-diagnostic mention the valid values in ELF and
wasm, and print the flag name with two dashes in diags, since the one-dash form
is seen as a list of many one-letter flags in some contexts.

https://reviews.llvm.org/D46693

llvm-svn: 332012

6 years ago[WebAssembly] Simplify writing of exports section. NFC.
Sam Clegg [Thu, 10 May 2018 18:10:34 +0000 (18:10 +0000)]
[WebAssembly] Simplify writing of exports section. NFC.

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

llvm-svn: 332011

6 years ago[LLVM-C] Move DIBuilder Bindings For Temporary MDNodes
Robert Widmann [Thu, 10 May 2018 18:09:53 +0000 (18:09 +0000)]
[LLVM-C] Move DIBuilder Bindings For Temporary MDNodes

Summary: Move LLVMTemporaryMDNode and LLVMMetadataReplaceAllUsesWith to the C bindings and add LLVMDeleteTemporaryMDNode for deleting non-RAUW'ed temporary nodes.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 332010

6 years ago[WebAssembly] Remove final -wasm component of target triple. NFC.
Sam Clegg [Thu, 10 May 2018 17:59:41 +0000 (17:59 +0000)]
[WebAssembly] Remove final -wasm component of target triple. NFC.

This has been the default for a while now.

llvm-svn: 332009

6 years ago[WebAsembly] Update default triple in test files to wasm32-unknown-unkown.
Sam Clegg [Thu, 10 May 2018 17:49:11 +0000 (17:49 +0000)]
[WebAsembly] Update default triple in test files to wasm32-unknown-unkown.

Summary: The final -wasm component has been the default for some time now.

Subscribers: jfb, dschuff, jgravelle-google, eraman, aheejin, JDevlieghere, sunfish, llvm-commits

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

llvm-svn: 332007

6 years ago[X86][Znver1] Remove unnecessary SchedWritePMULLD InstRW overrides.
Simon Pilgrim [Thu, 10 May 2018 17:42:26 +0000 (17:42 +0000)]
[X86][Znver1] Remove unnecessary SchedWritePMULLD InstRW overrides.

llvm-svn: 332006

6 years ago[WebAssembly] Create section start symbols automatically for all sections
Sam Clegg [Thu, 10 May 2018 17:38:35 +0000 (17:38 +0000)]
[WebAssembly] Create section start symbols automatically for all sections

These symbols only get included in the output symbols table if
they are used in a relocation.

This behaviour matches more closely the ELF object writer.

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

llvm-svn: 332005

6 years ago[PM/LoopUnswitch] Avoid pointlessly creating an exit block set.
Chandler Carruth [Thu, 10 May 2018 17:33:20 +0000 (17:33 +0000)]
[PM/LoopUnswitch] Avoid pointlessly creating an exit block set.

This code can just test whether blocks are *in* the loop, which we
already have a dedicated set tracking in the loop itself.

llvm-svn: 332004

6 years agowrong usages of sem_open in the libFuzzer
Kamil Rytarowski [Thu, 10 May 2018 17:31:06 +0000 (17:31 +0000)]
wrong usages of sem_open in the libFuzzer

Summary:
Fixed two non-standard usages of sem_open in the libFuzzer library and
one NetBSD-related modification with test script.

  - The return value to indicate error should be SEM_FAILED instead of
    (void *)-1 (please refer to "RETURN VALUE" section in this [[
    http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html
    | page ]]). Actually, SEM_FAILED != (void *)-1 holds in NetBSD.

  - The SharedMemoryRegion::SemName function should return name
    starting with slash. Because the behaviour of name which does not
    start with slash is unspecified as the [[
    http://pubs.opengroup.org/onlinepubs/9699919799/functions/sem_open.html
    | "DESCRIPTION" section ]] specified:

> If name does not begin with the <slash> character, the effect is implementation-defined.

  - The length of name is limited to 14 in NetBSD, it is suggested to
    reduce the length of equivalence server name in the test script.

Patch by: Yang Zheng

Reviewers: vitalybuka, krytarowski, kcc

Reviewed By: kcc

Subscribers: kcc, #sanitizers, llvm-commits, joerg

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

llvm-svn: 332003

6 years ago[X86][SNB] Fix typo in PEXTRDmr instregex, was missing VPEXTRDmr.
Simon Pilgrim [Thu, 10 May 2018 17:30:49 +0000 (17:30 +0000)]
[X86][SNB] Fix typo in PEXTRDmr instregex, was missing VPEXTRDmr.

llvm-svn: 332002

6 years agoMore notes on Rapperswil issues
Marshall Clow [Thu, 10 May 2018 17:07:38 +0000 (17:07 +0000)]
More notes on Rapperswil issues

llvm-svn: 332000

6 years ago[X86] Split WriteVecALU/WriteVecLogic/WriteShuffle/WriteVarShuffle/WritePSADBW/WriteP...
Simon Pilgrim [Thu, 10 May 2018 17:06:09 +0000 (17:06 +0000)]
[X86] Split WriteVecALU/WriteVecLogic/WriteShuffle/WriteVarShuffle/WritePSADBW/WritePHAdd scheduler classes

Split off XMM classes from the default (MMX) classes.

llvm-svn: 331999

6 years ago[InstCombine] regenerate full checks; NFC
Sanjay Patel [Thu, 10 May 2018 17:05:38 +0000 (17:05 +0000)]
[InstCombine] regenerate full checks; NFC

llvm-svn: 331998

6 years ago[mips] Accept 32-bit offsets for ld/sd/lld commands
Simon Atanasyan [Thu, 10 May 2018 16:01:36 +0000 (16:01 +0000)]
[mips] Accept 32-bit offsets for ld/sd/lld commands

This is a follow up to the rL330983. The patch teaches ld, sd, and lld
commands accept 32-bit memory offsets by replacing `mem_simm16` operand
to `mem_simmptr`. In fact, these commands should accept 64-bit offsets,
but so large offsets require another command expanding and will be
supported by a separate patch.

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

llvm-svn: 331997

6 years ago[mips] Accept 32-bit offsets for lh and lhu commands
Simon Atanasyan [Thu, 10 May 2018 16:01:18 +0000 (16:01 +0000)]
[mips] Accept 32-bit offsets for lh and lhu commands

This is a follow up to the rL330983. The patch teaches lh and lhu
commands accepts 32-bit memory offsets by replacing `mem_simm16` operand
to `mem_simmptr`.

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

llvm-svn: 331996

6 years ago[ELF][MIPS] Add test case to check some microMIPS R6 relocations. NFC
Simon Atanasyan [Thu, 10 May 2018 15:56:27 +0000 (15:56 +0000)]
[ELF][MIPS] Add test case to check some microMIPS R6 relocations. NFC

llvm-svn: 331995

6 years ago[ELF][MIPS] Add test case to check N32 ABI PLT generation. NFC
Simon Atanasyan [Thu, 10 May 2018 15:56:22 +0000 (15:56 +0000)]
[ELF][MIPS] Add test case to check N32 ABI PLT generation. NFC

llvm-svn: 331994

6 years ago[llvm-objcopy] Add tests for help messages
Alexander Shaposhnikov [Thu, 10 May 2018 15:56:04 +0000 (15:56 +0000)]
[llvm-objcopy] Add tests for help messages

This diff slightly reorganizes the tests  and improves
the test coverage of help messages / error reports.

Test plan: make check-all

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

llvm-svn: 331993

6 years ago[x86] fix fmaxnum/fminnum with nnan
Sanjay Patel [Thu, 10 May 2018 15:40:49 +0000 (15:40 +0000)]
[x86] fix fmaxnum/fminnum with nnan

With nnan, there's no need for the masked merge / blend
sequence (that probably costs much more than the min/max
instruction).

Somewhere between clang 5.0 and 6.0, we started producing
these intrinsics for fmax()/fmin() in C source instead of
libcalls or fcmp/select. The backend wasn't prepared for
that, so we regressed perf in those cases.

Note: it's possible that other targets have similar problems
as seen here.

Noticed while investigating PR37403 and related bugs:
https://bugs.llvm.org/show_bug.cgi?id=37403

The IR FMF propagation cases still don't work. There's
a proposal that might fix those cases in D46563.

llvm-svn: 331992

6 years ago[DSE] Teach the pass about partial overwrite of atomic memory intrinsics
Daniel Neilson [Thu, 10 May 2018 15:12:49 +0000 (15:12 +0000)]
[DSE] Teach the pass about partial overwrite of atomic memory intrinsics

Summary:
This change teaches DSE that the atomic memory intrinsics can be overwriten
partially in the same way as the non-atomic forms. Specifically, that the
atomic memcpy & memset can be shortened at the end and that the atomic memset
can be shortened at the beginning, if they partially overwritten
by later stores.

Reviewers: mkazantsev, skatkov, apilipenko, efriedma, rsmith, spatel, filcab, sanjoy

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 331991

6 years ago[PR37339] Fix assertion in FunctionComparator::cmpInlineAsm
whitequark [Thu, 10 May 2018 15:05:47 +0000 (15:05 +0000)]
[PR37339] Fix assertion in FunctionComparator::cmpInlineAsm

Fixes bug https://bugs.llvm.org/show_bug.cgi?id=37339.

InlineAsm is only uniqued if the FunctionTypes are exactly the
same, while cmpTypes() for example considers all pointer types
in the default address space to be the same. For this reason
the end of cmpInlineAsm() can be reached.

This patch replaces the unreachable assertion with a check that
the function types are not identical.

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

Reviewers: jfb
llvm-svn: 331990

6 years ago[x86] fix test names; NFC
Sanjay Patel [Thu, 10 May 2018 14:58:47 +0000 (14:58 +0000)]
[x86] fix test names; NFC

llvm-svn: 331989

6 years ago[x86] add tests for maxnum/minnum intrinsics with nnan; NFC
Sanjay Patel [Thu, 10 May 2018 14:48:42 +0000 (14:48 +0000)]
[x86] add tests for maxnum/minnum intrinsics with nnan; NFC

Clang 6.0 was updated to create these intrinsics rather than
libcalls or fcmp/select, but the backend wasn't prepared to
handle that optimally.

This bug is not the primary reason for PR37403:
https://bugs.llvm.org/show_bug.cgi?id=37403
...but it's probably more important for x86 perf.

llvm-svn: 331988

6 years agoDon't redefine a bunch of defines from llvm-config.h in config.h.
Nico Weber [Thu, 10 May 2018 14:45:05 +0000 (14:45 +0000)]
Don't redefine a bunch of defines from llvm-config.h in config.h.

r210144 made config.h include llvm-config.h and deduplicated defines. Then
rL239987 later added back some of the duplication.
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150914/300329.html
suggests this was done for the configure/make build, which no longer exists.

No intended behavior change.

https://reviews.llvm.org/D46288

llvm-svn: 331987