platform/upstream/llvm.git
6 years ago[llvm-objcopy] [COFF] Fix the Object forward declaration
Martin Storsjo [Wed, 19 Dec 2018 07:45:06 +0000 (07:45 +0000)]
[llvm-objcopy] [COFF] Fix the Object forward declaration

This fixes build warnings with clang, and linker errors with MSVC.

llvm-svn: 349606

6 years ago[llvm-objcopy] Initial COFF support
Martin Storsjo [Wed, 19 Dec 2018 07:24:38 +0000 (07:24 +0000)]
[llvm-objcopy] Initial COFF support

This is an initial implementation of no-op passthrough copying of COFF
with objcopy.

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

llvm-svn: 349605

6 years agoUse "EvaluateAsRValue" instead of as a known int, because if it's not a known
Bill Wendling [Wed, 19 Dec 2018 04:54:29 +0000 (04:54 +0000)]
Use "EvaluateAsRValue" instead of as a known int, because if it's not a known
integer we want to emit a diagnostic instead of asserting.

llvm-svn: 349604

6 years agoRevert accidentally included code.
Bill Wendling [Wed, 19 Dec 2018 04:36:42 +0000 (04:36 +0000)]
Revert accidentally included code.

llvm-svn: 349603

6 years ago[DebugInfo] Make AsmPrinter struct HandlerInfo and Handlers protected
Yonghong Song [Wed, 19 Dec 2018 04:07:47 +0000 (04:07 +0000)]
[DebugInfo] Make AsmPrinter struct HandlerInfo and Handlers protected

In AsmPrinter, make struct HandlerInfo and SmallVector
Handlers protected, so target extended AsmPrinter will
be able to add their own handlers.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D55756

llvm-svn: 349602

6 years ago[bugpoint][PR29027] Reduce function attributes
Brian Gesiak [Wed, 19 Dec 2018 03:42:19 +0000 (03:42 +0000)]
[bugpoint][PR29027] Reduce function attributes

Summary:
In addition to reducing the functions in an LLVM module, bugpoint now
reduces the function attributes associated with each of the remaining
functions.

To test this, add a -bugpoint-crashfuncattr test pass, which crashes if
a function in the module has a "bugpoint-crash" attribute. A test case
demonstrates that the IR is reduced to just that one attribute.

Reviewers: MatzeB, silvas, davide, reames

Reviewed By: reames

Subscribers: reames, llvm-commits

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

llvm-svn: 349601

6 years agoFix use-after-free with profile remapping.
Richard Smith [Wed, 19 Dec 2018 03:24:03 +0000 (03:24 +0000)]
Fix use-after-free with profile remapping.

We need to keep the underlying profile reader alive as long as the
profile data, because the profile data may contain StringRefs referring
to strings in the reader's name table.

llvm-svn: 349600

6 years ago[PowerPC]Exploit P9 vabsdu for unsigned vselect patterns
Kewen Lin [Wed, 19 Dec 2018 03:04:07 +0000 (03:04 +0000)]
[PowerPC]Exploit P9 vabsdu for unsigned vselect patterns

For type v4i32/v8ii16/v16i8, do following transforms:
  (vselect (setcc a, b, setugt), (sub a, b), (sub b, a)) -> (vabsd a, b)
  (vselect (setcc a, b, setuge), (sub a, b), (sub b, a)) -> (vabsd a, b)
  (vselect (setcc a, b, setult), (sub b, a), (sub a, b)) -> (vabsd a, b)
  (vselect (setcc a, b, setule), (sub b, a), (sub a, b)) -> (vabsd a, b)

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

llvm-svn: 349599

6 years ago[gn build] Add build file for llvm-objcopy
Nico Weber [Wed, 19 Dec 2018 02:48:01 +0000 (02:48 +0000)]
[gn build] Add build file for llvm-objcopy

Needed by check-lld.

This should've been part of r349486 but I messed up.

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

llvm-svn: 349598

6 years agoRe-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"
Alexandre Ganea [Wed, 19 Dec 2018 01:30:29 +0000 (01:30 +0000)]
Re-land "Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen"

Previously, when compiling Visual Studio targets, one could see random build errors. This was caused by tablegen projects using the same build folders.
This workaround simply chains tablegen projects.

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

llvm-svn: 349596

6 years agoAdd llvm-objdump man page
Ed Maste [Wed, 19 Dec 2018 01:26:55 +0000 (01:26 +0000)]
Add llvm-objdump man page

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

llvm-svn: 349595

6 years ago[asan] Disable ODR test on Android
Vitaly Buka [Wed, 19 Dec 2018 00:07:25 +0000 (00:07 +0000)]
[asan] Disable ODR test on Android

llvm-svn: 349585

6 years agoUse unique_ptr to manage a TarWriter instance. NFC.
Rui Ueyama [Tue, 18 Dec 2018 23:50:37 +0000 (23:50 +0000)]
Use unique_ptr to manage a TarWriter instance. NFC.

llvm-svn: 349581

6 years agoDon't forget to free the libcompression scratch buffer in the dtor.
Jason Molenda [Tue, 18 Dec 2018 23:45:45 +0000 (23:45 +0000)]
Don't forget to free the libcompression scratch buffer in the dtor.

llvm-svn: 349580

6 years ago[lit] Rather than including stdio.h, forward-declare printf in TestConvenienceVariabl...
Stella Stamenova [Tue, 18 Dec 2018 23:36:35 +0000 (23:36 +0000)]
[lit] Rather than including stdio.h, forward-declare printf in TestConvenienceVariables.test

llvm-svn: 349573

6 years agoRemove the zlib CFLAGS and LDFLAGS settings from the xcode project file.
Jason Molenda [Tue, 18 Dec 2018 23:33:42 +0000 (23:33 +0000)]
Remove the zlib CFLAGS and LDFLAGS settings from the xcode project file.
We're linking against libcompression all the time now, we don't need to
fall back to zlib.  zlib support will still be used when lldb is built on
linux et al systems, so I'm not removing any of the source support, but
when built on darwin with xcode, we'll be using libcompression.

llvm-svn: 349572

6 years agoFix error message.
Rui Ueyama [Tue, 18 Dec 2018 23:33:10 +0000 (23:33 +0000)]
Fix error message.

Previously, this code printed out an error message like this

  ld.lld: error: --reproduce: failed to open /foo: cannot open /foo

Apparently "failed to open /foo:" part is redundant.

llvm-svn: 349571

6 years ago[Driver] Also obey -nostdlib++ when rewriting -lstdc++.
Dan Albert [Tue, 18 Dec 2018 23:29:35 +0000 (23:29 +0000)]
[Driver] Also obey -nostdlib++ when rewriting -lstdc++.

Reviewers: pirama

Reviewed By: pirama

Subscribers: cfe-commits

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

llvm-svn: 349570

6 years ago[AArch64] Simplify the Exynos M3 pipeline model
Evandro Menezes [Tue, 18 Dec 2018 23:19:57 +0000 (23:19 +0000)]
[AArch64] Simplify the Exynos M3 pipeline model

llvm-svn: 349569

6 years ago[AArch64] Fix instructions order (NFC)
Evandro Menezes [Tue, 18 Dec 2018 23:19:55 +0000 (23:19 +0000)]
[AArch64] Fix instructions order (NFC)

llvm-svn: 349568

6 years ago[llvm-mca] Improve test (NFC)
Evandro Menezes [Tue, 18 Dec 2018 23:19:52 +0000 (23:19 +0000)]
[llvm-mca] Improve test (NFC)

Add more instruction variations for Exynos.

llvm-svn: 349567

6 years agoPortability fix: add missing includes and static_casts. Reviewed as https://reviews...
Marshall Clow [Tue, 18 Dec 2018 23:19:00 +0000 (23:19 +0000)]
Portability fix: add missing includes and static_casts. Reviewed as https://reviews.llvm.org/D55777. Thanks to Andrey Maksimov for the patch.

llvm-svn: 349566

6 years ago[NativePDB] Correctly reconstruct DeclContext for nested enums.
Zachary Turner [Tue, 18 Dec 2018 23:12:08 +0000 (23:12 +0000)]
[NativePDB] Correctly reconstruct DeclContext for nested enums.

We reconstruct the AST hierarchy by trying to hack up a mangled
name for the parent type using the child type's mangled name.
This was failing for enums because their tag type is represented
with two letters ("W4") instead of one letter ("T", "U", etc) as
it is with classes, structs, and unions.  After accounting for
this we can now correctly determine when an enum is nested
inside of a namespace or a class.

llvm-svn: 349565

6 years ago[DebugInfo] Move several private headers to include directory
Yonghong Song [Tue, 18 Dec 2018 23:10:17 +0000 (23:10 +0000)]
[DebugInfo] Move several private headers to include directory

This patch moved the following files in lib/CodeGen/AsmPrinter/
  AsmPrinterHandler.h
  DbgEntityHistoryCalculator.h
  DebugHandlerBase.h
to include/llvm/CodeGen directory.

Such a change will enable Target to extend DebugHandlerBase
and emit Target specific debug info sections.

Signed-off-by: Yonghong Song <yhs@fb.com>
Differential Revision: https://reviews.llvm.org/D55755

llvm-svn: 349564

6 years agoForce libcompression calls to be enabled when building on Darwin
Jason Molenda [Tue, 18 Dec 2018 23:02:50 +0000 (23:02 +0000)]
Force libcompression calls to be enabled when building on Darwin
systems.  It has been available in the OS over over three years
now.  If lldb doesn't link against -lcompression, it should be an
error.

Allocate a scratch buffer for libcompression to use when decoding
packets, instead of it having to allocate & free one on every call.

Fix a typeo with the size of the buffer that compression_decode_buffer()
is expanding into.

<rdar://problem/41601084>

llvm-svn: 349563

6 years ago[lit] Use the new build.py script in the lldb-mi tests
Stella Stamenova [Tue, 18 Dec 2018 22:54:17 +0000 (22:54 +0000)]
[lit] Use the new build.py script in the lldb-mi tests

This allows the tests to pass on Windows as well

llvm-svn: 349562

6 years agoEmit ASM input in a constant context
Bill Wendling [Tue, 18 Dec 2018 22:54:03 +0000 (22:54 +0000)]
Emit ASM input in a constant context

Summary:
Some ASM input constraints (e.g., "i" and "n") require immediate values. At O0,
very few code transformations are performed. So if we cannot resolve to an
immediate when emitting the ASM input we shouldn't delay its processing.

Reviewers: rsmith, efriedma

Reviewed By: efriedma

Subscribers: rehana, efriedma, craig.topper, jyknight, cfe-commits

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

llvm-svn: 349561

6 years ago[InstCombine] add tests for extract of vector load; NFC
Sanjay Patel [Tue, 18 Dec 2018 22:51:06 +0000 (22:51 +0000)]
[InstCombine] add tests for extract of vector load; NFC

There's a mismatch internally about how we are handling these patterns.
We count loads as cheapToScalarize(), but then we don't actually
scalarize them, so that can leave extra instructions compared to where
we started when scalarizing other ops. If it's cheapToScalarize, then
we should be scalarizing.

llvm-svn: 349560

6 years agoPreserve the linkage for objc* intrinsics as clang will set them to weak_external...
Pete Cooper [Tue, 18 Dec 2018 22:42:08 +0000 (22:42 +0000)]
Preserve the linkage for objc* intrinsics as clang will set them to weak_external in some cases

Clang uses weak linkage for objc runtime functions when they are not available on the platform.

The intrinsic has this linkage so we just need to pass that on to the runtime call.

llvm-svn: 349559

6 years agoAdd nonlazybind to objc_retain/objc_release when converting from intrinsics.
Pete Cooper [Tue, 18 Dec 2018 22:31:34 +0000 (22:31 +0000)]
Add nonlazybind to objc_retain/objc_release when converting from intrinsics.

For performance reasons, clang set nonlazybind on these functions.  Now that we
are using intrinsics instead of runtime calls, we should set this attribute when
creating the runtime functions.

llvm-svn: 349558

6 years agoReject .so files if -static is given.
Rui Ueyama [Tue, 18 Dec 2018 22:30:23 +0000 (22:30 +0000)]
Reject .so files if -static is given.

Previously, if you pass -static to lld, lld searches for only foo.a
and skips foo.so for -lfoo option. However, it didn't reject .so files
if you directly pass their pathnames via the command line, which is a bug.

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

llvm-svn: 349557

6 years ago[LAA] Introduce enum for vectorization safety status (NFC).
Florian Hahn [Tue, 18 Dec 2018 22:25:11 +0000 (22:25 +0000)]
[LAA] Introduce enum for vectorization safety status (NFC).

This patch adds a VectorizationSafetyStatus enum, which will be extended
in a follow up patch to distinguish between 'safe with runtime checks'
and 'known unsafe' dependences.

Reviewers: anemet, anna, Ayal, hsaito

Reviewed By: Ayal

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

llvm-svn: 349556

6 years ago[asan] Restore ODR-violation detection on vtables
Vitaly Buka [Tue, 18 Dec 2018 22:23:30 +0000 (22:23 +0000)]
[asan] Restore ODR-violation detection on vtables

Summary:
unnamed_addr is still useful for detecting of ODR violations on vtables

Still unnamed_addr with lld and --icf=safe or --icf=all can trigger false
reports which can be avoided with --icf=none or by using private aliases
with -fsanitize-address-use-odr-indicator

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: kubamracek, hiraditya, llvm-commits

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

llvm-svn: 349555

6 years ago[LoopVectorize] auto-generate complete checks; NFC
Sanjay Patel [Tue, 18 Dec 2018 22:23:04 +0000 (22:23 +0000)]
[LoopVectorize] auto-generate complete checks; NFC

The first test claims to show that the vectorizer will
generate a vector load/loop, but then this file runs
other passes which might scalarize that op. I'm removing
instcombine from the RUN line here to break that dependency.
Also, I'm generating full checks to make it clear exactly
what the vectorizer has done.

llvm-svn: 349554

6 years agoUn-conditionalize use of libcompression. debugserver only builds
Jason Molenda [Tue, 18 Dec 2018 22:21:48 +0000 (22:21 +0000)]
Un-conditionalize use of libcompression.  debugserver only builds
on Darwin systems and libcompression has been in the OS for over
three years.

Remove use of / linking to zlib.  We'll always have libcompression
available now.

Create a scratch buffer via compression_encode_scratch_buffer_size()
and use it in calls to compression_encode_buffer() to avoid
compression_encode_buffer having to malloc & free a scratch buffer
on each call.

Tested by forcing compression to be enabled on macos native (normally
only enabled on iOS et al devices), running the testsuite.

<rdar://problem/41601084>

llvm-svn: 349553

6 years agoRewrite objc intrinsics to runtime methods in PreISelIntrinsicLowering instead of...
Pete Cooper [Tue, 18 Dec 2018 22:20:03 +0000 (22:20 +0000)]
Rewrite objc intrinsics to runtime methods in PreISelIntrinsicLowering instead of SDAG.

SelectionDAG currently changes these intrinsics to function calls, but that won't work
for other ISel's.  Also we want to eventually support nonlazybind and weak linkage coming
from the front-end which we can't do in SelectionDAG.

llvm-svn: 349552

6 years ago[OPENMP] parsing and sema support for 'close' map-type-modifier
Kelvin Li [Tue, 18 Dec 2018 22:18:41 +0000 (22:18 +0000)]
[OPENMP] parsing and sema support for 'close' map-type-modifier

A map clause with the close map-type-modifier is a hint to
prefer that the variables are mapped using a copy into faster
memory.

Patch by Ahsan Saghir (saghir)

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

llvm-svn: 349551

6 years agoTestHelloWorld: Use a file on the target platform for synchronisation.
Adrian Prantl [Tue, 18 Dec 2018 22:17:38 +0000 (22:17 +0000)]
TestHelloWorld: Use a file on the target platform for synchronisation.

Thanks to Pavel Labath for the idea!

llvm-svn: 349550

6 years ago[AArch64] Avoid crashing on .seh directives in assembly
Martin Storsjo [Tue, 18 Dec 2018 22:10:17 +0000 (22:10 +0000)]
[AArch64] Avoid crashing on .seh directives in assembly

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

llvm-svn: 349549

6 years ago[InstCombine] auto-generate complete checks; NFC
Sanjay Patel [Tue, 18 Dec 2018 22:09:15 +0000 (22:09 +0000)]
[InstCombine] auto-generate complete checks; NFC

llvm-svn: 349548

6 years agoFix errors with the Clang natvis file.
Aaron Ballman [Tue, 18 Dec 2018 21:42:20 +0000 (21:42 +0000)]
Fix errors with the Clang natvis file.

This updates the FunctionProtoType visualizer to use the proper bits for determining parameter information and the DeclarationName visualizer to use the detail namespace. It also adds support for viewing newer special declaration names (like deduction guides).

Patch with help of Bruno Ricci.

llvm-svn: 349547

6 years ago[CMake] Don't require libcxxabi on darwin
Jonas Devlieghere [Tue, 18 Dec 2018 21:40:05 +0000 (21:40 +0000)]
[CMake] Don't require libcxxabi on darwin

Just libcxx should suffice.

llvm-svn: 349546

6 years agoRevert r349541 (Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen)
Alexandre Ganea [Tue, 18 Dec 2018 21:39:40 +0000 (21:39 +0000)]
Revert r349541 (Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen)

llvm-svn: 349545

6 years ago[asan] In llvm.asan.globals, allow entries to be non-GlobalVariable and skip over...
Kuba Mracek [Tue, 18 Dec 2018 21:20:17 +0000 (21:20 +0000)]
[asan] In llvm.asan.globals, allow entries to be non-GlobalVariable and skip over them

Looks like there are valid reasons why we need to allow bitcasts in llvm.asan.globals, see discussion at https://github.com/apple/swift-llvm/pull/133. Let's look through bitcasts when iterating over entries in the llvm.asan.globals list.

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

llvm-svn: 349544

6 years ago[AARCH64] Added test case for PR40091
Simon Pilgrim [Tue, 18 Dec 2018 21:05:22 +0000 (21:05 +0000)]
[AARCH64] Added test case for PR40091

llvm-svn: 349543

6 years ago[CodeGen] Handle mixed-width ops in mixed-sign mul-with-overflow lowering
Vedant Kumar [Tue, 18 Dec 2018 21:05:03 +0000 (21:05 +0000)]
[CodeGen] Handle mixed-width ops in mixed-sign mul-with-overflow lowering

The special lowering for __builtin_mul_overflow introduced in r320902
fixed an ICE seen when passing mixed-sign operands to the builtin.

This patch extends the special lowering to cover mixed-width, mixed-sign
operands. In a few common scenarios, calls to muloti4 will no longer be
emitted.

This should address the latest comments in PR34920 and work around the
link failure seen in:

  https://bugzilla.redhat.com/show_bug.cgi?id=1657544

Testing:
- check-clang
- A/B output comparison with: https://gist.github.com/vedantk/3eb9c88f82e5c32f2e590555b4af5081

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

llvm-svn: 349542

6 years agoFix MSVC dependency issue between Clang-tablegen and LLVM-tablegen
Alexandre Ganea [Tue, 18 Dec 2018 21:03:06 +0000 (21:03 +0000)]
Fix MSVC dependency issue between Clang-tablegen and LLVM-tablegen

Previously, when compiling Visual Studio targets, one could see random build errors. This was caused by tablegen projects using the same build folders.
This workaround simply chains tablegen projects.

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

llvm-svn: 349541

6 years ago[OPENMP][NVPTX]Emit shared memory buffer for reduction as 128 bytes
Alexey Bataev [Tue, 18 Dec 2018 21:01:42 +0000 (21:01 +0000)]
[OPENMP][NVPTX]Emit shared memory buffer for reduction as 128 bytes
buffer.

Seems to me, nvlink has a bug with the proper support of the weakly
linked symbols. It does not allow to define several shared memory buffer
with the different sizes even with the weak linkage. Instead we always
use 128 bytes buffer to prevent nvlink from the error message emission.

llvm-svn: 349540

6 years ago[cmake] Make libcxx(abi) a dependency when building in-tree clang for macOS
Jonas Devlieghere [Tue, 18 Dec 2018 20:59:23 +0000 (20:59 +0000)]
[cmake] Make libcxx(abi) a dependency when building in-tree clang for macOS

As discussed on IRC this morning, when building an in-tree clang for
testing we have to have libcxx and libcxxabi checked out. This is a
common pitfall. Not only are the resulting failures non-obvious, they
only manifest when running the test suite, *after* building lldb and
clang. By making them a hard dependency (on macOS) we fail earlier with
a more useful error message.

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

llvm-svn: 349539

6 years agoReenable FindLibXml2 on Windows and confirm its at least 2.8 or newer
Nathan Lanza [Tue, 18 Dec 2018 20:51:00 +0000 (20:51 +0000)]
Reenable FindLibXml2 on Windows and confirm its at least 2.8 or newer

Summary:
GnuWin32 installs libxml2 2.4. This isn't recent enough for lldb's
usage and thus the build fails. Searching for libxml2 was disabled
due to this build failure.

However, the gdb-remote plugin requires libxml2 to parse various
gdb-remote protocol packets. Thus check and confirm that the libxml2
version is at least 2.8 and disable it if not.

Reviewers: compnerd, zturner

Reviewed By: compnerd

Subscribers: mgorny

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

llvm-svn: 349538

6 years ago[llvm-mca] Update the Exynos test cases (NFC)
Evandro Menezes [Tue, 18 Dec 2018 20:46:03 +0000 (20:46 +0000)]
[llvm-mca] Update the Exynos test cases (NFC)

Add more entropy to the test cases.

llvm-svn: 349537

6 years ago[llvm-mca] Dump mask in hex
Evandro Menezes [Tue, 18 Dec 2018 20:45:50 +0000 (20:45 +0000)]
[llvm-mca] Dump mask in hex

Dump the resources masks as hexadecimal.

llvm-svn: 349536

6 years agoGenerate objc intrinsics instead of runtime calls as the ARC optimizer now works...
Pete Cooper [Tue, 18 Dec 2018 20:33:00 +0000 (20:33 +0000)]
Generate objc intrinsics instead of runtime calls as the ARC optimizer now works only on intrinsics

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

Reviewers: rjmccall
llvm-svn: 349535

6 years agoChange the objc ARC optimizer to use the new objc.* intrinsics
Pete Cooper [Tue, 18 Dec 2018 20:32:49 +0000 (20:32 +0000)]
Change the objc ARC optimizer to use the new objc.* intrinsics

We're moving ARC optimisation and ARC emission in clang away from runtime methods
and towards intrinsics.  This is the part which actually uses the intrinsics in the ARC
optimizer when both analyzing the existing calls and emitting new ones.

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

Reviewers: ahatanak
llvm-svn: 349534

6 years agoFix REQUIRES line
Adrian Prantl [Tue, 18 Dec 2018 20:28:54 +0000 (20:28 +0000)]
Fix REQUIRES line

llvm-svn: 349533

6 years ago[SEH] Add initial support for AArch64
Martin Storsjo [Tue, 18 Dec 2018 20:05:59 +0000 (20:05 +0000)]
[SEH] Add initial support for AArch64

This doesn't yet implement inspecting the .pdata/.xdata to find the
LSDA pointer (in UnwindCursor::getInfoFromSEH), but normal C++
exception handling seems to run just fine without it. (The only
place I can see where it's even referenced is in
unwind_phase2_forced, and I can't find a codepath where libcxxabi
would end up calling that.)

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

llvm-svn: 349532

6 years ago[X86] Add BSR to isUseDefConvertible.
Craig Topper [Tue, 18 Dec 2018 20:03:54 +0000 (20:03 +0000)]
[X86] Add BSR to isUseDefConvertible.

We already had BSF here as part of __builtin_ffs improvements and I was just wondering yesterday whether we should have BSR there.

This addresses one issue from PR40090.

llvm-svn: 349531

6 years ago[InstCombine] Simplify cttz/ctlz + icmp eq/ne into mask check
Nikita Popov [Tue, 18 Dec 2018 19:59:50 +0000 (19:59 +0000)]
[InstCombine] Simplify cttz/ctlz + icmp eq/ne into mask check

Checking whether a number has a certain number of trailing / leading
zeros means checking whether it is of the form XXXX1000 / 0001XXXX,
which can be done with an and+icmp.

Related to https://bugs.llvm.org/show_bug.cgi?id=28668. As a next
step, this can be extended to non-equality predicates.

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

llvm-svn: 349530

6 years ago[AMDGPU] Removed the unnecessary operand size-check-assert from processBaseWithConstO...
Farhana Aleen [Tue, 18 Dec 2018 19:58:39 +0000 (19:58 +0000)]
[AMDGPU] Removed the unnecessary operand size-check-assert from processBaseWithConstOffset().

Summary: 32bit operand sizes are guaranteed by the opcode check AMDGPU::V_ADD_I32_e64 and
         AMDGPU::V_ADDC_U32_e64. Therefore, we don't any additional operand size-check-assert.

Author: FarhanaAleen
llvm-svn: 349529

6 years agoDebugInfo: Fix missing local imported entities after r349207
David Blaikie [Tue, 18 Dec 2018 19:40:22 +0000 (19:40 +0000)]
DebugInfo: Fix missing local imported entities after r349207

Post commit review/bug reported by Pavel Labath - thanks!

llvm-svn: 349528

6 years ago[SCCP] Get rid of redundant call for getPredicateInfoFor (NFC).
Florian Hahn [Tue, 18 Dec 2018 19:37:07 +0000 (19:37 +0000)]
[SCCP] Get rid of redundant call for getPredicateInfoFor (NFC).

We can use the result fetched a few lines above.

llvm-svn: 349527

6 years ago[X86] Don't use SplitOpsAndApply to create ISD::UADDSAT/ISD::USUBSAT nodes. Let type...
Craig Topper [Tue, 18 Dec 2018 19:29:08 +0000 (19:29 +0000)]
[X86] Don't use SplitOpsAndApply to create ISD::UADDSAT/ISD::USUBSAT nodes. Let type legalization and op legalization deal with it.

Now that we've switched to target independent nodes we can rely on generic infrastructure to do the legalization for us.

llvm-svn: 349526

6 years ago[OPENMP][NVPTX]Added extra sync point to the inter-warp copy function.
Alexey Bataev [Tue, 18 Dec 2018 19:20:15 +0000 (19:20 +0000)]
[OPENMP][NVPTX]Added extra sync point to the inter-warp copy function.

The parallel reduction operation requires an extra synchronization point
in the inter-warp copy function to avoid divergence.

llvm-svn: 349525

6 years ago[ELF] Place .note in the first page to ensure they are available in core files
Fangrui Song [Tue, 18 Dec 2018 19:16:37 +0000 (19:16 +0000)]
[ELF] Place .note in the first page to ensure they are available in core files

Summary:
Other large sections (e.g. .rela.dyn .dynstr) may push .note.* off the
first page. They won't be available in core files if RLIMIT_CORE is
limited.

This patch gives priority to alloctable SHT_NOTE sections so that they
are assuredly in the first page and will be available in core files.
They are small and contain important information (e.g. .note.gnu.build-id
identifies the origin of the core, .note.tag stores NT_FREEBSD_ABI_TAG).

Note: gold Output_section_order has a similar rule:

  // Loadable read-only note sections come next so that the PT_NOTE
  // segment is on the first page of the executable.
  ORDER_RO_NOTE,

Reviewers: ruiu, pcc, espindola

Subscribers: emaste, arichardson, llvm-commits

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

llvm-svn: 349524

6 years ago[InstCombine] refactor isCheapToScalarize(); NFC
Sanjay Patel [Tue, 18 Dec 2018 19:07:38 +0000 (19:07 +0000)]
[InstCombine] refactor isCheapToScalarize(); NFC

As the FIXME indicates, this has the potential to go
overboard. So I'm not sure if it's even worth keeping
this vs. iteratively doing simple matches, but we might
as well clean it up.

llvm-svn: 349523

6 years agoRework the C strings tests to use ASSERT_SAME_TYPE. NFC there. Also change cwchar...
Marshall Clow [Tue, 18 Dec 2018 19:07:30 +0000 (19:07 +0000)]
Rework the C strings tests to use ASSERT_SAME_TYPE. NFC there. Also change cwchar.pass.cpp to avoid constructing a couple things from zero - since apparently they can be enums in some weird C library. NFC there, either, since the values were never used.

llvm-svn: 349522

6 years ago[Tests] [OpenMP] XFAIL also for ppc64le.
Stefan Pintilie [Tue, 18 Dec 2018 19:05:07 +0000 (19:05 +0000)]
[Tests] [OpenMP] XFAIL also for ppc64le.

Two tests were XFAILed for powerpc64le in r349512.
They should have also been XFAILed for ppc64le.

llvm-svn: 349521

6 years ago[X86] Use SADDSAT/SSUBSAT instead of ADDS/SUBS
Nikita Popov [Tue, 18 Dec 2018 18:28:22 +0000 (18:28 +0000)]
[X86] Use SADDSAT/SSUBSAT instead of ADDS/SUBS

Migrate the X86 backend from X86ISD opcodes ADDS and SUBS to generic
ISD opcodes SADDSAT and SSUBSAT. This also improves scodegen for
@llvm.sadd.sat() and @llvm.ssub.sat() intrinsics.

This is a followup to D55787 and part of PR40056.

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

llvm-svn: 349520

6 years ago[X86] Create PSUBUS from (add (umax X, C), -C)
Craig Topper [Tue, 18 Dec 2018 18:26:25 +0000 (18:26 +0000)]
[X86] Create PSUBUS from (add (umax X, C), -C)

InstCombine seems to canonicalize or PSUB patter into a max with the cosntant and an add with an inverse of the constant.

This patch recognizes this pattern and turns it into PSUBUS. Future work could improve undef element handling.

Fixes some of PR40053

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

llvm-svn: 349519

6 years agoBuildfix for r345516 (Clang compilation failing).
Alexandre Ganea [Tue, 18 Dec 2018 18:23:36 +0000 (18:23 +0000)]
Buildfix for r345516 (Clang compilation failing).

llvm-svn: 349518

6 years ago[CMake] Default options for faster executables on MSVC
Alexandre Ganea [Tue, 18 Dec 2018 18:17:00 +0000 (18:17 +0000)]
[CMake] Default options for faster executables on MSVC

- Disable incremental linking by default. /INCREMENTAL adds extra thunks in the EXE, which makes execution slower.
- Set /MT (static CRT lib) by default instead of CMake's default /MD (dll CRT lib). The previous default /MD makes all DLL functions to be thunked, thus making execution slower (memcmp, memset, etc.)
- Adds LLVM_ENABLE_INCREMENTAL_LINK which is set to OFF by default.

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

llvm-svn: 349517

6 years ago[llvm-symbolizer] Omit stderr output when symbolizing a crash
Alexandre Ganea [Tue, 18 Dec 2018 18:13:13 +0000 (18:13 +0000)]
[llvm-symbolizer] Omit stderr output when symbolizing a crash

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

llvm-svn: 349516

6 years ago[InstCombine] add tests for scalarization; NFC
Sanjay Patel [Tue, 18 Dec 2018 17:56:59 +0000 (17:56 +0000)]
[InstCombine] add tests for scalarization; NFC

We miss pattern matching a splat constant if it has undef elements.

llvm-svn: 349515

6 years agoAdd FMF management to common fp intrinsics in GlobalIsel
Michael Berg [Tue, 18 Dec 2018 17:54:52 +0000 (17:54 +0000)]
Add FMF management to common fp intrinsics in GlobalIsel

Summary: This the initial code change to facilitate managing FMF flags from Instructions to MI wrt Intrinsics in Global Isel.  Eventually the GlobalObserver interface will be added as well, where FMF additions can be tracked for the builder and CSE.

Reviewers: aditya_nandakumar, bogner

Reviewed By: bogner

Subscribers: rovka, kristof.beyls, javed.absar

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

llvm-svn: 349514

6 years ago[LoopVectorize] Rename pass options. NFC.
Michael Kruse [Tue, 18 Dec 2018 17:46:09 +0000 (17:46 +0000)]
[LoopVectorize] Rename pass options. NFC.

Rename:
NoUnrolling to InterleaveOnlyWhenForced
and
AlwaysVectorize to !VectorizeOnlyWhenForced

Contrary to what the name 'AlwaysVectorize' suggests, it does not
unconditionally vectorize all loops, but applies a cost model to
determine whether vectorization is profitable to all loops. Hence,
passing false will disable the cost model, except when a loop is marked
with llvm.loop.vectorize.enable. The 'OnlyWhenForced' suffix (suggested
by @hfinkel in D55716) better matches this behavior.

Similarly, 'NoUnrolling' disables the profitability cost model for
interleaving (a term to distinguish it from unrolling by the
LoopUnrollPass); rename it for consistency.

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

llvm-svn: 349513

6 years agoXFAIL Pair of OpenMP Tests for PowerPC LE Linux
Stefan Pintilie [Tue, 18 Dec 2018 17:39:22 +0000 (17:39 +0000)]
XFAIL Pair of OpenMP Tests for PowerPC LE Linux

XFAIL two tests that fail on PowerPC LE Linux due
to the change of default from PIC to no-PIC on that
platform.

A Bug has been opened for this:
https://bugs.llvm.org/show_bug.cgi?id=40082

The tests are:
runtime/test/ompt/misc/control_tool.c
runtime/test/ompt/synchronization/taskwait.c

llvm-svn: 349512

6 years ago[PPC64] Support got-based relocations.
Sean Fertile [Tue, 18 Dec 2018 17:34:26 +0000 (17:34 +0000)]
[PPC64] Support got-based relocations.

Differential Revison: https://reviews.llvm.org/D54859

llvm-svn: 349511

6 years ago[X86][SSE] Don't use 'sign bit select' vXi8 ROTL lowering for constant rotation amounts
Simon Pilgrim [Tue, 18 Dec 2018 17:31:11 +0000 (17:31 +0000)]
[X86][SSE] Don't use 'sign bit select' vXi8 ROTL lowering for constant rotation amounts

Noticed by @spatel on D55747 - we get much better codegen if we use the regular shift expansion.

llvm-svn: 349510

6 years ago[LoopUnroll] Honor '#pragma unroll' even with -fno-unroll-loops.
Michael Kruse [Tue, 18 Dec 2018 17:16:05 +0000 (17:16 +0000)]
[LoopUnroll] Honor '#pragma unroll' even with -fno-unroll-loops.

When using clang with `-fno-unroll-loops` (implicitly added with `-O1`),
the LoopUnrollPass is not not added to the (legacy) pass pipeline. This
also means that it will not process any loop metadata such as
llvm.loop.unroll.enable (which is generated by #pragma unroll or
WarnMissedTransformationsPass emits a warning that a forced
transformation has not been applied (see
https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20181210/610833.html).
Such explicit transformations should take precedence over disabling
heuristics.

This patch unconditionally adds LoopUnrollPass to the optimizing
pipeline (that is, it is still not added with `-O0`), but passes a flag
indicating whether automatic unrolling is dis-/enabled. This is the same
approach as LoopVectorize uses.

The new pass manager's pipeline builder has no option to disable
unrolling, hence the problem does not apply.

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

llvm-svn: 349509

6 years ago[Driver][PS4] Do not implicitly link against asan or ubsan if -nostdlib or -nodefault...
Pierre Gousseau [Tue, 18 Dec 2018 17:03:35 +0000 (17:03 +0000)]
[Driver][PS4] Do not implicitly link against asan or ubsan if -nostdlib or -nodefaultlibs on PS4.

NFC for targets other than PS4.

Respect -nostdlib and -nodefaultlibs when enabling asan or ubsan.

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

llvm-svn: 349508

6 years ago[NFC] Fix usage of Builder.insert(new Bitcast...)in CodeGenFunction
Erich Keane [Tue, 18 Dec 2018 16:22:21 +0000 (16:22 +0000)]
[NFC] Fix usage of Builder.insert(new Bitcast...)in CodeGenFunction

This is exactly a "CreateBitCast", so refactor this to get rid of a
'new'.

Note that this slightly changes the test, as the Builder is now
seemingly smart enough to fold one of the bitcasts into the annotation
call.

Change-Id: I1733fb1fdf91f5c9d88651067130b9a4e7b5ab67
llvm-svn: 349506

6 years agoPortable Python script across Python version
Serge Guelton [Tue, 18 Dec 2018 16:07:37 +0000 (16:07 +0000)]
Portable Python script across Python version

Make scripts more future-proof by importing most __future__ stuff.

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

llvm-svn: 349504

6 years agoPortable Python script across Python version
Serge Guelton [Tue, 18 Dec 2018 16:07:06 +0000 (16:07 +0000)]
Portable Python script across Python version

commands.getoutput has been move to subprocess module in Python3

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

llvm-svn: 349503

6 years ago[clangd] Try to fix buildbot failure after r349496
Eric Liu [Tue, 18 Dec 2018 16:06:29 +0000 (16:06 +0000)]
[clangd] Try to fix buildbot failure after r349496

Increase timeout from 10ms to 100ms.
See http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/27959

llvm-svn: 349502

6 years agoPortable Python script across Python version
Serge Guelton [Tue, 18 Dec 2018 16:04:21 +0000 (16:04 +0000)]
Portable Python script across Python version

In Python3, dict.items, dict.keys, dict.values, zip, map and filter no longer return lists, they create generator instead.

The portability patch consists in forcing an extra `list` call if the result is actually used as a list.
`map` are replaced by list comprehension and `filter` by filtered list comprehension.

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

llvm-svn: 349501

6 years ago[X86][SSE] Don't use 'sign bit select' vXi8 ROTL lowering for splat rotation amounts
Simon Pilgrim [Tue, 18 Dec 2018 16:02:23 +0000 (16:02 +0000)]
[X86][SSE] Don't use 'sign bit select' vXi8 ROTL lowering for splat rotation amounts

Noticed by @spatel on D55747 - we get much better codegen if we use the regular shift expansion.

llvm-svn: 349500

6 years ago[MIPS GlobalISel] Select G_SDIV, G_UDIV, G_SREM and G_UREM
Petar Avramovic [Tue, 18 Dec 2018 15:59:51 +0000 (15:59 +0000)]
[MIPS GlobalISel] Select G_SDIV, G_UDIV, G_SREM and G_UREM

Add support for s64 libcalls for G_SDIV, G_UDIV, G_SREM and G_UREM
and use integer type of correct size when creating arguments for
CLI.lowerCall.
Select G_SDIV, G_UDIV, G_SREM and G_UREM for types s8, s16, s32 and s64
on MIPS32.

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

llvm-svn: 349499

6 years agoELF: Don't create sections for section header index 0
Pavel Labath [Tue, 18 Dec 2018 15:56:45 +0000 (15:56 +0000)]
ELF: Don't create sections for section header index 0

Summary:
The first section header does not define a real section. Instead it is
used for various elf extensions. This patch skips creation of a section
for index 0.

This has one furtunate side-effect, in that it allows us to use the section
header index as the Section ID (where 0 is also invalid). This way, we
can get rid of a lot of spurious +1s in the ObjectFileELF code.

Reviewers: clayborg, krytarowski, joerg, espindola

Subscribers: emaste, lldb-commits, arichardson

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

llvm-svn: 349498

6 years agoEmit -Wformat properly for bit-field promotions.
Aaron Ballman [Tue, 18 Dec 2018 15:54:38 +0000 (15:54 +0000)]
Emit -Wformat properly for bit-field promotions.

Only explicitly look through integer and floating-point promotion where the result type is actually a promotion, which is not always the case for bit-fields in C.

Patch by Bevin Hansson.

llvm-svn: 349497

6 years ago[clangd] BackgroundIndex rebuilds symbol index periodically.
Eric Liu [Tue, 18 Dec 2018 15:39:33 +0000 (15:39 +0000)]
[clangd] BackgroundIndex rebuilds symbol index periodically.

Summary:
Currently, background index rebuilds symbol index on every indexed file,
which can be inefficient. This patch makes it only rebuild symbol index periodically.
As the rebuild no longer happens too often, we could also build more efficient
dex index.

Reviewers: ilya-biryukov, kadircet

Reviewed By: kadircet

Subscribers: dblaikie, MaskRay, jkorous, arphaman, jfb, cfe-commits

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

llvm-svn: 349496

6 years agoFix the "dangerous use of tempnam" warning in Host/SocketTest.cpp
Pavel Labath [Tue, 18 Dec 2018 15:33:50 +0000 (15:33 +0000)]
Fix the "dangerous use of tempnam" warning in Host/SocketTest.cpp

instead, create a unique temporary directory, and place the socket file
there.

llvm-svn: 349495

6 years ago[AST] Unify the code paths of traversing lambda expressions.
Haojian Wu [Tue, 18 Dec 2018 15:29:12 +0000 (15:29 +0000)]
[AST] Unify the code paths of traversing lambda expressions.

Summary:
This supposes to be a non-functional change. We have two code paths when
traversing lambda expressions:

1) traverse the function proto typeloc when parameters and return type
are explicit;
2) otherwise fallback to traverse parameter decls and return type loc
individually;

This patch unifies the code path to always traverse parameters and
return type, rather than relying on traversing the full type-loc.

Reviewers: ilya-biryukov

Subscribers: arphaman, cfe-commits

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

llvm-svn: 349494

6 years agoFix a gcc -Wpedantix warning
Nico Weber [Tue, 18 Dec 2018 15:17:01 +0000 (15:17 +0000)]
Fix a gcc -Wpedantix warning

llvm-svn: 349492

6 years agode-flake TestThreadStates.test_process_interrupt
Pavel Labath [Tue, 18 Dec 2018 15:15:02 +0000 (15:15 +0000)]
de-flake TestThreadStates.test_process_interrupt

the "self.assertEqual(thread.GetStopReason(), lldb.eStopReasonSignal)"
was occasionally failing because the stop reason would come out as
"trace" this happened if we issued the interrupt just as the processed
stopped due to single-stepping over the breakpoint (i.e., the it was not
necessary to send any signal).

Fix this by removing the breakpoint before resuming the process. This
ensures the process can run unobstructed.

After this, the test passed 200 consecutive runs successfully for me,
even while the system was under heavy load.

llvm-svn: 349491

6 years ago[gn build] Add build file for llvm-pdbutil
Nico Weber [Tue, 18 Dec 2018 15:09:07 +0000 (15:09 +0000)]
[gn build] Add build file for llvm-pdbutil

Needed for check-lld.

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

llvm-svn: 349490

6 years ago[PowerPC] Make no-PIC default to match GCC - CLANG
Stefan Pintilie [Tue, 18 Dec 2018 15:08:03 +0000 (15:08 +0000)]
[PowerPC] Make no-PIC default to match GCC - CLANG

Make -fno-PIC default on PowerPC for Little Endian Linux.

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

llvm-svn: 349489

6 years ago[gn build] Add build file for llvm-bcanalyzer
Nico Weber [Tue, 18 Dec 2018 14:58:48 +0000 (14:58 +0000)]
[gn build] Add build file for llvm-bcanalyzer

Needed for check-lld.

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

llvm-svn: 349488

6 years agoSkip TestMultithreaded.test_sb_api_listener_resume on linux
Pavel Labath [Tue, 18 Dec 2018 14:24:55 +0000 (14:24 +0000)]
Skip TestMultithreaded.test_sb_api_listener_resume on linux

The test still fails occasionally (1/100 runs). Upgrade the xfail to
skip.

llvm-svn: 349487

6 years ago[gn build] Add build files for llvm-ar, llvm-nm, llvm-objdump, llvm-readelf
Nico Weber [Tue, 18 Dec 2018 13:52:21 +0000 (13:52 +0000)]
[gn build] Add build files for llvm-ar, llvm-nm, llvm-objdump, llvm-readelf

Also add build files for deps DebugInfo/Symbolize, ToolDrivers/dll-tool.
Also add gn/build/libs/xar (needed by llvm-objdump).

Also delete an incorrect part of the symlink description in //BUILD.gn (it used
to be true before I made the symlink step write a stamp file; now it's no
longer true).

These are all binaries needed by check-lld that need symlinks.

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

llvm-svn: 349486

6 years agoUn-XFail TestYMMRegister on linux
Pavel Labath [Tue, 18 Dec 2018 13:50:38 +0000 (13:50 +0000)]
Un-XFail TestYMMRegister on linux

This test was disabled in r326756 as a part of "upstreaming debugserver
support for AVX-512 (zmm register set)". This looks like an error
because both register set and remote stubs are different.

In any case, the test passes now.

llvm-svn: 349485