platform/upstream/llvm.git
4 years ago[x86][CGP] try to hoist funnel shift above select-of-splats
Sanjay Patel [Fri, 15 May 2020 19:22:30 +0000 (15:22 -0400)]
[x86][CGP] try to hoist funnel shift above select-of-splats

This is basically the same patch as D63233, but converted to
funnel shifts rather than regular shifts. I did not see a
way to effectively share code for these 2 cases though.

This follows D79718 and D79827 to re-fix PR37426 because
that gets canonicalized to funnel shift intrinsics in IR.

I did draft an alternative patch as an enhancement to
"shouldSinkOperands()", but that was awkward because
we have to key the transform from the select, but then
look at both its users and its operands.

4 years ago[ARM] Combines for VMOVN
David Green [Sat, 16 May 2020 14:12:41 +0000 (15:12 +0100)]
[ARM] Combines for VMOVN

This adds two combines for VMOVN, one to fold
VMOVN[tb](c, VQMOVNb(a, b)) => VQMOVN[tb](c, b)
The other to perform demand bits analysis on the lanes of a VMOVN. We
know that only the bottom lanes of the second operand and the top or
bottom lanes of the Qd operand are needed in the result, depending on if
the VMOVN is bottom or top.

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

4 years ago[ARM] MVE saturating truncates
David Green [Sat, 16 May 2020 13:54:33 +0000 (14:54 +0100)]
[ARM] MVE saturating truncates

This adds some custom lowering for VQMOVN, an instruction that can be
used to perform saturating truncates from a pair of min(max(X, -0x8000),
0x7fff), providing those constants are correct. This leaves a VQMOVNBs
which saturates the value and inserts that into the bottom lanes of an
existing vector. We then need to do something with the other lanes,
extending the value using a vmovlb.

Ideally, as will often be the case, only the bottom lane of what remains
will be demanded, allowing the vmovlb to be removed. Which should mean
the instruction is either equal or a win most of the time, and allows
some extra follow-up folding to happen.

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

4 years agoDIEHash.cpp - remove headers explicitly included in DIEHash.h. NFC.
Simon Pilgrim [Sat, 16 May 2020 13:40:00 +0000 (14:40 +0100)]
DIEHash.cpp - remove headers explicitly included in DIEHash.h. NFC.

Don't duplicate module header includes.

4 years agoAggressiveAntiDepBreaker.cpp - remove headers explicitly included in AggressiveAntiDe...
Simon Pilgrim [Sat, 16 May 2020 13:39:21 +0000 (14:39 +0100)]
AggressiveAntiDepBreaker.cpp - remove headers explicitly included in AggressiveAntiDepBreaker.h. NFC.

Don't duplicate module header includes.

4 years agoLLParser.cpp - remove headers explicitly included in LLParser.h. NFC.
Simon Pilgrim [Sat, 16 May 2020 13:38:40 +0000 (14:38 +0100)]
LLParser.cpp - remove headers explicitly included in LLParser.h. NFC.

Don't duplicate module header includes.

4 years agoFix -Wdocumentation warning. NFC.
Simon Pilgrim [Sat, 16 May 2020 12:28:59 +0000 (13:28 +0100)]
Fix -Wdocumentation warning. NFC.

Remove non-existant DataLayoutCallback param comment.

4 years ago[ARM] Extra VQMOVN/VQSHRN tests. NFC
David Green [Sat, 16 May 2020 13:23:26 +0000 (14:23 +0100)]
[ARM] Extra VQMOVN/VQSHRN tests. NFC

4 years ago[mlir][spirv] Handle debuginfo for control flow ops.
Denis Khalikov [Sat, 16 May 2020 07:56:58 +0000 (10:56 +0300)]
[mlir][spirv] Handle debuginfo for control flow ops.

Summary:
Handle debuginfo for control flow operations: spv.Selection,
spv.Loop, spv.BranchOp, spv.BranchConditional.

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

4 years ago[ValueTracking] Fix computeKnownBits() with bitwidth-changing ptrtoint
Nikita Popov [Fri, 1 May 2020 13:19:41 +0000 (15:19 +0200)]
[ValueTracking] Fix computeKnownBits() with bitwidth-changing ptrtoint

computeKnownBitsFromAssume() currently asserts if m_V matches a
ptrtoint that changes the bitwidth. Because InstCombine
canonicalizes ptrtoint instructions to use explicit zext/trunc,
we never ran into the issue in practice. I'm adding unit tests,
as I don't know if this can be triggered via IR anywhere.

Fix this by calling anyextOrTrunc(BitWidth) on the computed
KnownBits. Note that we are going from the KnownBits of the
ptrtoint result to the KnownBits of the ptrtoint operand,
so we need to truncate if the ptrtoint zexted and anyext if
the ptrtoint truncated.

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

4 years ago[libcxx testing] Remove ALLOW_RETRIES from last futures test
David Zarzycki [Sat, 16 May 2020 11:08:42 +0000 (07:08 -0400)]
[libcxx testing] Remove ALLOW_RETRIES from last futures test

Like other uses of ALLOW_RETRIES, this test tried to verify that an API
returned "quickly" but quick is not safe to define given slow and/or
busy machines.

Instead, we now verify that these "wait" APIs actually wait, which the
old test did not.

4 years ago[LegalizeDAG] Use getMemBasePlusOffset to simplify some code. Use other signature...
Craig Topper [Sat, 16 May 2020 08:02:06 +0000 (01:02 -0700)]
[LegalizeDAG] Use getMemBasePlusOffset to simplify some code. Use other signature of getMemBasePlusOffset in another location. NFCI

The code was calculating an offset from a stack pointer SDValue.
This is exactly what getMemBasePlusOffset does. I also replaced
sizeof(int) with a hardcoded 4. We know the type we're operating
on is 4 bytes. But the size of int that the source code is being
compiled with isn't guaranteed to be 4 bytes.

While here replace another use of getMemBasePlusOffset that was
proceeded with a call to getConstant with the other signature
that call getConstant internally.

4 years ago[LegalizeVectorTypes] Remove non-constnat INSERT_SUBVECTOR handling. NFC
Craig Topper [Fri, 15 May 2020 19:44:52 +0000 (12:44 -0700)]
[LegalizeVectorTypes] Remove non-constnat INSERT_SUBVECTOR handling. NFC

Now that D79814 has landed, we can assume that subvector ops use constant, in-range indices.

4 years ago[Windows EH] Fix the order of Nested try-catches in $tryMap$ table
Ten Tzen [Sat, 16 May 2020 05:03:43 +0000 (22:03 -0700)]
[Windows EH] Fix the order of Nested try-catches in $tryMap$ table

This bug is exposed by Test7 of ehthrow.cxx in MSVC EH suite where
a rethrow occurs in a try-catch inside a catch (i.e., a nested Catch
handlers). See the test code in
https://github.com/microsoft/compiler-tests/blob/master/eh/ehthrow.cxx#L346

When an object is rethrown in a Catch handler, the copy-ctor of this
object must be executed after the destructions of live objects, but
BEFORE the dtors of live objects in parent handlers.

Today Windows 64-bit runtime (__CxxFrameHandler3 & 4) expects nested Catch
handers
are stored in pre-order (outer first, inner next) in $tryMap$ table, so
that given a State, its Catch's beginning State can be properly
retrieved. The Catch beginning state (which is also the ending State) is
the State where rethrown object's copy-ctor must take place.

LLVM currently stores nested catch handlers in post-ordering because
it's the natural way to compute the highest State in Catch.
The fix is to simply store TryCatch handler in pre-order, but update
Catch's highest State after child Catches are all processed.

Differential Revision: https://reviews.llvm.org/D79474?id=263919

4 years agoRevert "[WebAssembly] Handle exception specifications"
Heejin Ahn [Sat, 16 May 2020 04:33:44 +0000 (21:33 -0700)]
Revert "[WebAssembly] Handle exception specifications"

This reverts commit bca347508c86647f9d44992275c9a364fbd9fb0d.

This broke clang/test/Misc/warning-flags.c, because the newly added
warning option in this commit didn't have a matching flag.

4 years ago[WebAssembly] Handle exception specifications
Heejin Ahn [Fri, 8 May 2020 23:19:46 +0000 (16:19 -0700)]
[WebAssembly] Handle exception specifications

Summary:
Wasm currently does not fully handle exception specifications. Rather
than crashing, this treats `throw()` in the same way as `noexcept`, and
ignores and prints a warning for `throw(type, ..)`, for a temporary
measure.

Reviewers: dschuff

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

Tags: #clang

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

4 years ago[AMDGPU] Allow use of StackPtrOffsetReg when building spills
Carl Ritson [Sat, 16 May 2020 02:54:31 +0000 (11:54 +0900)]
[AMDGPU] Allow use of StackPtrOffsetReg when building spills

Summary:
When spilling in the entry function we should be able to borrow
StackPtrOffsetReg as a last resort.  This restores behaviour
removed in D75138, and fixes failures when shaders use all
SGPRs, VGPRs and spill in the entry function.

Reviewers: scott.linder, arsenm, tpr

Reviewed By: scott.linder, arsenm

Subscribers: qcolombet, foad, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[flang] Constraint checks C751 to C760
Pete Steinfeld [Tue, 12 May 2020 16:53:58 +0000 (09:53 -0700)]
[flang] Constraint checks C751 to C760

Summary:
Many of these were already implemented, and I just annotated the tests and/or
the code.

C752 was a simple check to verify that CONTIGUOUS components are arrays with

C754 proved to be virtually identical to C750 that I implemented previously.
This caused me to remove the distinction between specification expressions for
type parameters and bounds expressions that I'd previously created.
the POINTER attribute.

I also changed the error messages to specify that errors in specification
expressions could arise from either bad derived type components or type
parameters.

In cases where we detect a type param that was not declared, I created a symbol
marked as erroneous.  That avoids subsequent semantic process for expressions
containing the symbol.  This change caused me to adjust tests resolve33.f90 and
resolve34.f90.  Also, I avoided putting out error messages for erroneous type
param symbols in `OkToAddComponent()` in resolve-names.cpp and in
`EvaluateParameters()`, type.cpp.

C756 checks that procedure components have the POINTER attribute.

Reviewers: tskeith, klausler, DavidTruby

Subscribers: llvm-commits

Tags: #llvm, #flang

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

4 years ago[clang-tidy] Transformer checks now store IncludeStyle option
Nathan James [Sat, 16 May 2020 00:14:55 +0000 (01:14 +0100)]
[clang-tidy] Transformer checks now store IncludeStyle option

4 years agoFix go bindings after FixedVectorType -> VectorType change.
Eric Christopher [Fri, 15 May 2020 23:30:11 +0000 (16:30 -0700)]
Fix go bindings after FixedVectorType -> VectorType change.

4 years agoPrevent register coalescing in functions whith setjmp
Diogo Sampaio [Fri, 15 May 2020 21:21:13 +0000 (22:21 +0100)]
Prevent register coalescing in functions whith setjmp

Summary:
In the the given example, a stack slot pointer is merged
between a setjmp and longjmp. This pointer is spilled,
so it does not get correctly restored, addinga undefined
behaviour where it shouldn't.

Change-Id: I60ec010844f2a24ce01ceccf12eb5eba5ab94abb

Reviewers: eli.friedman, thanm, efriedma

Reviewed By: efriedma

Subscribers: MatzeB, qcolombet, tpr, rnk, efriedma, hiraditya, llvm-commits, chill

Tags: #llvm

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

4 years ago[test] Improve FileCheck's numeric-expression.txt
Thomas Preud'homme [Tue, 12 May 2020 22:39:45 +0000 (23:39 +0100)]
[test] Improve FileCheck's numeric-expression.txt

Summary:
Various improvement for FileCheck's numeric-expression.txt test:
- remove unused values in USE DEF FMT IMPL MATCH section
- replace 14 literal for 0xe and 0xE to have example of hex literals
- rename variable to be more self-descriptive
- move CHECK as comment of the values being matched to help readability
- add conversion tests
- simplify test for use of several numeric variables by using existing
  variable
- adjust position of error message check to match the alignment of the
  error message wrt. the output matched by the previous check

Reviewed By: jhenderson, jdenny

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

4 years agoFix flang build after mlir SideEffects.h -> SideEffectInterfaces.h change.
Eric Christopher [Fri, 15 May 2020 22:50:28 +0000 (15:50 -0700)]
Fix flang build after mlir SideEffects.h -> SideEffectInterfaces.h change.

4 years agoCleanup some test issues:
Casey Carter [Fri, 15 May 2020 22:14:57 +0000 (15:14 -0700)]
Cleanup some test issues:

* improve coverage in `span`'s "conversion from `std::array`" test, while eliminating MSVC diagnostics about `testConstructorArray<T>() && testConstructorArray<const T, T>()` being redundant when `T` is already `const`.

* Remove use of `is_assignable` that triggers UB due to an insufficiently-complete type argument in `std::function`'s assignment operator test.

* Don't test that `shared_ptr` initialization from an rvalue triggers the lvalue aliasing constructor on non-libc++; this is not the case for Standard Libraries that implement LWG-2996. (Ditto, I'd simply remove this but it's your library ;).)

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

4 years agoFix polly tests after D79968.
Eli Friedman [Fri, 15 May 2020 22:15:09 +0000 (15:15 -0700)]
Fix polly tests after D79968.

4 years ago[ARM] Change more triples to arm-none-none-eabi. NFC
David Green [Fri, 15 May 2020 20:55:15 +0000 (21:55 +0100)]
[ARM] Change more triples to arm-none-none-eabi. NFC

4 years agounwind: fix unwind build without heap
Saleem Abdulrasool [Fri, 15 May 2020 21:43:19 +0000 (14:43 -0700)]
unwind: fix unwind build without heap

Add a missing guard for `_LIBUNWIND_NO_HEAP` around code dealing with the
`.cfi_remember_state` and `.cfi_restore_state` instructions.

Patch by Amanieu d'Antras!

4 years ago[MLIR] Move JitRunner to live with ExecutionEngine
Stephen Neuendorffer [Wed, 13 May 2020 19:01:40 +0000 (12:01 -0700)]
[MLIR] Move JitRunner to live with ExecutionEngine

The JitRunner library is logically very close to the execution engine,
and shares similar dependencies.

find -name "*.cpp" -exec sed -i "s/Support\/JitRunner/ExecutionEngine\/JitRunner/" "{}" \;

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

4 years ago[MLIR][cmake] refactor lib/Interfaces/CMakeLists.txt
Stephen Neuendorffer [Wed, 13 May 2020 18:46:06 +0000 (11:46 -0700)]
[MLIR][cmake] refactor lib/Interfaces/CMakeLists.txt

Reduce the boilerplate here

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

4 years ago[MLIR] Continue renaming of "SideEffects"
Stephen Neuendorffer [Wed, 13 May 2020 17:27:19 +0000 (10:27 -0700)]
[MLIR] Continue renaming of "SideEffects"

MLIRSideEffects -> MLIRSideEffectInterfaces
SideEffects.h -> SideEffectInterfaces.h
SideEffects.cpp -> SideEffectInterface.cpp

Note that I haven't renamed TableGen/SideEffects.h or TableGen/SideEffects.cpp

find -name "*.h" -exec sed -i "s/SideEffects.h/SideEffectInterfaces.h/" "{}" \;
find -name "CMakeLists.txt" -exec sed -i "s/MLIRSideEffects/MLIRSideEffectInterfaces/" "{}" \;

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

4 years ago[MLIR] Update intrinsic test, because ptrmask changed.
Stephen Neuendorffer [Fri, 15 May 2020 21:32:58 +0000 (14:32 -0700)]
[MLIR] Update intrinsic test, because ptrmask changed.

See adda9c0a4f63.

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

4 years ago[CMake][AIX] Add `-bcdtors:mbr` option when building with IBM XL
Hubert Tong [Fri, 15 May 2020 21:15:04 +0000 (17:15 -0400)]
[CMake][AIX] Add `-bcdtors:mbr` option when building with IBM XL

Summary:
The `-bcdtors:mbr` option causes processing for constructors and
destructors to omit otherwise-unreferenced members of static libraries,
matching the processing done on Linux, where `--whole-archive` is not
the default. Applying this option is desirable for reducing the
footprint of an installation.

Reviewed By: daltenty

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

4 years ago[test][ARM][CMSE] Use clang_cc1 in arm_cmse.h tests
Hubert Tong [Fri, 15 May 2020 21:12:38 +0000 (17:12 -0400)]
[test][ARM][CMSE] Use clang_cc1 in arm_cmse.h tests

Summary:
The `arm_cmse.h` header includes standard headers, but some tests that
include this header explicitly specify a target. The standard headers
found via the standard include paths need not be compatible with the
explicitly-specified target from the tests. In order to avoid test
failures caused by such incompatibility, this patch uses `%clang_cc1`,
which doesn't pick up the host system headers.

Reviewed By: chill

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

4 years ago[tests][Driver] Set `--sysroot=""` to allow `DEFAULT_SYSROOT` build
Hubert Tong [Fri, 15 May 2020 21:09:08 +0000 (17:09 -0400)]
[tests][Driver] Set `--sysroot=""` to allow `DEFAULT_SYSROOT` build

Summary:
If `DEFAULT_SYSROOT` is configured to some path, some tests would fail.
This patch overrides `sysroot` to be the empty string in the style of
D66834 so that the tests will pass even when the build is configured
with a `DEFAULT_SYSROOT`.

Reviewed By: mstorsjo

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

4 years ago[MLIR] LinalgToStandard: use LINK_LIBS rather than target_link_libraries.
Stephen Neuendorffer [Fri, 15 May 2020 21:22:35 +0000 (14:22 -0700)]
[MLIR] LinalgToStandard: use LINK_LIBS rather than target_link_libraries.

Also, missing MLIRTransforms as a dependency.  This breaks BUILD_SHARED_LIBS=on

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

4 years ago[CMake] -gen-dag-isel: add -omit-comments if neither Debug nor RelWithDebInfo
Fangrui Song [Sun, 26 Apr 2020 19:12:43 +0000 (12:12 -0700)]
[CMake] -gen-dag-isel: add -omit-comments if neither Debug nor RelWithDebInfo

Omitting comments can make the output much smaller. Size/time impact on
my machine:

* lib/Target/AArch64/AArch64GenDAGISel.inc, 10MiB (8.89s) -> 5MiB (3.20s)
* lib/Target/X86/X86GenDAGISel.inc, 20MiB (6.48s) -> 8.5MiB (4.18s)

In total, this change decreases lib/Target/*/*GenDAGISel.inc from
71.4MiB to 30.1MiB.

As rnk suggested, we can consider an option next to LLVM_OPTIMIZED_TABLEGEN
once we have more needs like this.

Reviewed By: thakis

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

4 years ago[NFC,StackSafety] Rename local function
Vitaly Buka [Fri, 15 May 2020 20:24:08 +0000 (13:24 -0700)]
[NFC,StackSafety] Rename local function

4 years ago[gn build] Put HAVE_LIBZ and HAVE_ZLIB_H behind llvm_enable_zlib too.
Nico Weber [Fri, 15 May 2020 20:15:40 +0000 (16:15 -0400)]
[gn build] Put HAVE_LIBZ and HAVE_ZLIB_H behind llvm_enable_zlib too.

In the CMake build, the HAVE_ vars are set based on system inspection,
and LLVM_ENABLE_ZLIB is set to false if neither's found. The GN build
doesn't do autodetection like this.

With this change, people can set llvm_enable_zlib=true on Windows
and as long as they provide a zlib.lib things should actually work.

(https://reviews.llvm.org/D79219 will remove 2 of the 3 config.h
values, hopefully soon. This change here just makes things a tiny
bit easier until that change is in.)

4 years ago[lldb/Commands] Add ability to run shell command on the host.
Med Ismail Bennani [Sat, 9 May 2020 08:10:35 +0000 (10:10 +0200)]
[lldb/Commands] Add ability to run shell command on the host.

This patch introduces the `(-h|--host)` option to the `platform shell`
command. It allows the user to run shell commands from the host platform
(always available) without putting lldb in the background.

Since the default behaviour of `platform shell` is to run the command of
the selected platform, having such a choice can be quite handy when
debugging remote targets, for instances.

This patch also introduces a `shell` alias, to improve the command
discoverability and make it more convenient to use for the user.

rdar://62856024

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[lldb/Dataformatter] Add support to CF{Dictionary,Set}Ref types
Med Ismail Bennani [Thu, 7 May 2020 05:28:19 +0000 (07:28 +0200)]
[lldb/Dataformatter] Add support to CF{Dictionary,Set}Ref types

This patch improves data formatting for CFDictionaryRef and CFSetRef.
It uses the same data-formatter as NSCFDictionaries and NSCFSets introduced
previously but did require some adjustments in Core::ValueObject.

Since the "Ref" types are opaque pointers to the actual CF containers, if the
value object has a synthetic value, lldb will use the opaque pointer's pointee
type to create the new ValueObjectChild needed to dereference the ValueObject.
This allows the "Ref" types to behaves the same as CF containers when used with
the `frame variable` command, the SBAPI or in Xcode's variable inspector.

This patch also adds support for incomplete types in ValueObject.

rdar://53104287

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[clang-format] [PR44345] Long namespace closing comment is duplicated endlessly
mydeveloperday [Fri, 15 May 2020 19:51:08 +0000 (20:51 +0100)]
[clang-format] [PR44345] Long namespace closing comment is duplicated endlessly

Summary:
https://bugs.llvm.org/show_bug.cgi?id=44345

When namespaces get long the namespace end comment wraps onto the next line

```
namespace would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::
    went::mad::now {
void foo();
void bar();
} // namespace
  // would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now
```

If clang-format it applied successively it will duplicate the end comment

```
namespace would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::
    went::mad::now {
void foo();
void bar();
} // namespace
  // would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now
  // would::it::save::you::a::lot::of::time::if_::i::just::gave::up::and_::went::mad::now
```

This revision checks to ensure the end comment is not on the next line before adding yet another comment

Reviewed By: krasimir

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years ago[SVE] Remove usages of VectorType::getNumElements() from ARM
Christopher Tetreault [Fri, 15 May 2020 19:32:24 +0000 (12:32 -0700)]
[SVE] Remove usages of VectorType::getNumElements() from ARM

Reviewers: efriedma, fpetrogalli, kmclaughlin, grosbach, dmgreen

Reviewed By: dmgreen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, dmgreen, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[libc] Move implementations of expf and exp2f from the AOR to src/math.
Siva Chandra Reddy [Mon, 27 Apr 2020 18:32:11 +0000 (11:32 -0700)]
[libc] Move implementations of expf and exp2f from the AOR to src/math.

Reviewers: phosek

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

4 years ago[SVE] Remove usages of VectorType::getNumElements() from PowerPC
Christopher Tetreault [Fri, 15 May 2020 19:18:37 +0000 (12:18 -0700)]
[SVE] Remove usages of VectorType::getNumElements() from PowerPC

Reviewers: efriedma, sdesmalen, c-rhodes, hfinkel

Reviewed By: c-rhodes

Subscribers: wuzish, nemanjai, tschuett, hiraditya, kbarton, rkruppe, psnobl, shchenz, llvm-commits

Tags: #llvm

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

4 years agoRevert "Revert "[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs""
Mircea Trofin [Fri, 15 May 2020 05:38:41 +0000 (22:38 -0700)]
Revert "Revert "[llvm][NFC] Cleanup uses of std::function in Inlining-related APIs""

This reverts commit 454de99a6fec705e76ed7743bf538f7a77296f59.

The problem was that one of the ctor arguments of CallAnalyzer was left
to be const std::function<>&. A function_ref was passed for it, and then
the ctor stored the value in a function_ref field. So a std::function<>
would be created as a temporary, and not survive past the ctor
invocation, while the field would.

Tested locally by following https://github.com/google/sanitizers/wiki/SanitizerBotReproduceBuild

Original Differential Revision: https://reviews.llvm.org/D79917

4 years agoStoreInst should store Align, not MaybeAlign
Eli Friedman [Thu, 14 May 2020 21:48:10 +0000 (14:48 -0700)]
StoreInst should store Align, not MaybeAlign

This is D77454, except for stores.  All the infrastructure work was done
for loads, so the remaining changes necessary are relatively small.

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

4 years ago[clang][slh] Add test for SLH feature checking macro
Zola Bridges [Wed, 13 May 2020 18:43:15 +0000 (11:43 -0700)]
[clang][slh] Add test for SLH feature checking macro

Summary:
I forgot to include a test in this commit:
https://reviews.llvm.org/rG379e68a763097bed55556c6dc7453e4b732e3d68

Here's the test. It passes after that commit and fails before that commit.

Reviewed By: mattdr

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

4 years ago[NFC] Deduplicate comment in PromoteMemoryToRegister.cpp
Scott Linder [Fri, 15 May 2020 18:54:02 +0000 (14:54 -0400)]
[NFC] Deduplicate comment in PromoteMemoryToRegister.cpp

This has been duplicated since before
2372a193ba904fdc85de3cc559e0bc162f14f144, but that commit has it
appearing twice in the space of 10 lines of the same function body. It
could also be hoisted up to the point just after where the last
special-case is considered, but I want to keep the intent of the
original authors.

Committed as obvious without a review.

4 years ago[WebAssembly] Optimize splats of bitcasted vectors
Thomas Lively [Fri, 15 May 2020 19:12:20 +0000 (12:12 -0700)]
[WebAssembly] Optimize splats of bitcasted vectors

Summary:
This new custom DAG combine fixes a codegen issue with the
wasm_simd128.h intrinsics. Clang lowers the

  return (v128_t)(__f32x4){__a, __a, __a, __a};

body of f32x4_splat to a splat shuffle of a bitcasted vector, as seen
in the new simd-shuffle-bitcast.ll test. The bitcast interfered with
the target-independent DAG combine that combines splat shuffles into
BUILD_VECTOR nodes, so this patch introduces a new custom DAG combine
to hoist the bitcast out of the shuffle, allowing the
target-independent combine to work as intended.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

4 years ago[LLD][ELF] Use offset in thin archives to disambiguate thinLTO members
Hongtao Yu [Tue, 12 May 2020 05:39:59 +0000 (22:39 -0700)]
[LLD][ELF] Use offset in thin archives to disambiguate thinLTO members

This is fixing a thinLTO module collision issue for thin archives. The problem is that we always use a zero offset to name members in a thin archive and that causes the following build error:

    ld.lld: error: Expected at most one ThinLTO module per bitcode file

which happens to a thin archive that has two members with the same object file name (whose paths will be ignored by thinLTO driver)

The fix here is to use real member offset instead as is done for non-thin archives.

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

4 years ago[AArch64][SVE] Implement AArch64ISD::SETCC_PRED
Eli Friedman [Fri, 15 May 2020 00:29:55 +0000 (17:29 -0700)]
[AArch64][SVE] Implement AArch64ISD::SETCC_PRED

This unifies SETCC operations along the lines of other operations.

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

4 years ago[SVE] Restore broken LLVM-C ABI compatability
Christopher Tetreault [Fri, 15 May 2020 17:45:42 +0000 (10:45 -0700)]
[SVE] Restore broken LLVM-C ABI compatability

Reviewers: deadalnix, efriedma, rengolin, jyknight, joerg

Reviewed By: joerg

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoIR: Remove extra name mangling from llvm.ptrmask
Matt Arsenault [Fri, 15 May 2020 17:33:56 +0000 (13:33 -0400)]
IR: Remove extra name mangling from llvm.ptrmask

This should not be allowed to change the address space of the source
and result, so the pointer types should match. The only emitter of
this seems to be a disable clang change, so no tests to update.

4 years ago[NFC] Whitespace fix inside OptParserEmitter
Daniel Grumberg [Fri, 15 May 2020 18:26:07 +0000 (11:26 -0700)]
[NFC] Whitespace fix inside OptParserEmitter

4 years ago[compiler-rt][CMAKE] Only add cmake link flags in standalone build
Jinsong Ji [Fri, 15 May 2020 15:21:49 +0000 (15:21 +0000)]
[compiler-rt][CMAKE] Only add cmake link flags in standalone build

Only add CMAKE_EXE_LINKER_FLAGS when in a standalone bulid.
Or else CMAKE_EXE_LINKER_FLAGS contains flags for build compiler of Clang/llvm.
This might not be the same as what the COMPILER_RT_TEST_COMPILER supports.
eg: the build compiler use lld linker and we use it to build clang with
default ld linker then to be tested clang will complain about lld
options like --color-diagnostics.

Reviewed By: phosek

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

4 years ago[libc++] Remove -ftemplate-depth when running tests
Louis Dionne [Fri, 15 May 2020 18:20:59 +0000 (14:20 -0400)]
[libc++] Remove -ftemplate-depth when running tests

It doesn't appear to be needed anymore with the Clang on our build bots.

4 years ago[libc] Add implementation of fabs and fabsf.
Siva Chandra Reddy [Sat, 9 May 2020 06:19:17 +0000 (23:19 -0700)]
[libc] Add implementation of fabs and fabsf.

Reviewers: phosek

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

4 years ago[libc++] Do not set the runtime library path with DYLD_LIBRARY_PATH
Louis Dionne [Fri, 15 May 2020 17:54:23 +0000 (13:54 -0400)]
[libc++] Do not set the runtime library path with DYLD_LIBRARY_PATH

We already set it using -rpath when linking test executables, and using
DYLD_LIBRARY_PATH causes problems when running other commands that
shouldn't run against the just-built libc++ (e.g. `ls` in a ShTest).

rdar://63241847

4 years ago[libc] Consolidate floating point utils into a single utils library.
Siva Chandra Reddy [Fri, 8 May 2020 06:19:09 +0000 (23:19 -0700)]
[libc] Consolidate floating point utils into a single utils library.

A new utils library named 'fputil' is added. This library is used in
math tests and the MPFR wrapper. The math implementations will be
modified to use this library in a later round.

Reviewers: phosek

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

4 years ago[ELF] Enforce two dashes for Flag options not supported by GNU ld (i.e. no compatibil...
Fangrui Song [Fri, 15 May 2020 17:48:46 +0000 (10:48 -0700)]
[ELF] Enforce two dashes for Flag options not supported by GNU ld (i.e. no compatibility burden)

Announced on https://lists.llvm.org/pipermail/llvm-dev/2020-May/141416.html

Similar to D79371, but for `multiclass B` (convenience helper for defining --foo and --no-foo)

Some changed options are also used by gold, but I haven't seen their
one-dash use cases outside of lld's testsuite.

4 years ago[mlir] [VectorOps] Implement vector.create_mask lowering to LLVM IR
aartbik [Thu, 14 May 2020 19:03:43 +0000 (12:03 -0700)]
[mlir] [VectorOps] Implement vector.create_mask lowering to LLVM IR

Summary:
First, compact implementation of lowering to LLVM IR. A bit more
challenging than the constant mask due to the dynamic indices, of course.
I like to hear if there are more efficient ways of doing this in LLVM,
but this for now at least gives us a functional reference implementation.

Reviewers: nicolasvasilache, ftynse, bkramer, reidtatge, andydavis1, mehdi_amini

Reviewed By: nicolasvasilache

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits

Tags: #llvm

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

4 years agoFixed arm build bot failure after 4042ada1c1fe
Sourabh Singh Tomar [Fri, 15 May 2020 17:52:04 +0000 (23:22 +0530)]
Fixed arm build bot failure after 4042ada1c1fe

This fixes bot failure seen in
http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/7378
by adding `REQUIRES: x86_64-linux` to the test case

4 years ago[libc++] Remove workaround for DYLD_LIBRARY_PATH being passed to the compiler
Louis Dionne [Fri, 15 May 2020 17:45:45 +0000 (13:45 -0400)]
[libc++] Remove workaround for DYLD_LIBRARY_PATH being passed to the compiler

Since we're using the new testing format, DYLD_LIBRARY_PATH is not passed
to the compiler -- it's only passed to the programs we run as an argument
to the %{exec} substitution.

4 years ago[WebAssembly] Update latest implemented SIMD instructions
Thomas Lively [Fri, 15 May 2020 17:53:02 +0000 (10:53 -0700)]
[WebAssembly] Update latest implemented SIMD instructions

Summary:
Move instructions that have recently been implemented in V8 from the
`unimplemented-simd128` target feature to the `simd128` target
feature. The updated instructions match the update at
https://github.com/WebAssembly/simd/pull/223.

Reviewers: aheejin

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

Tags: #clang, #llvm

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

4 years ago[mlir] Fix incorrect indexing of subview in DimOp folding.
Nicolas Vasilache [Fri, 15 May 2020 17:45:06 +0000 (13:45 -0400)]
[mlir] Fix incorrect indexing of subview in DimOp folding.

DimOp folding is using bare accesses to underlying SubViewOp operands.
This is generally incorrect and is fixed in this revision.

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

4 years ago[WebAssembly] Fixed debugloc in DebugFixup pass
Wouter van Oortmerssen [Fri, 15 May 2020 17:09:36 +0000 (10:09 -0700)]
[WebAssembly] Fixed debugloc in DebugFixup pass

BuildMI requires this debug loc to be from the same sub program as the variable metadata passed in.

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

4 years agoFixed arm build bot failure after ab699d78a26f
Sourabh Singh Tomar [Fri, 15 May 2020 17:40:54 +0000 (23:10 +0530)]
Fixed arm build bot failure after ab699d78a26f

This fixes bot failure seen in
http://lab.llvm.org:8011/builders/llvm-clang-win-x-armv7l/builds/7378
by adding `REQUIRES: x86_64-linux` to the test case

4 years ago[IR] Convert null-pointer-is-valid into an enum attribute
Nikita Popov [Sat, 25 Apr 2020 10:57:07 +0000 (12:57 +0200)]
[IR] Convert null-pointer-is-valid into an enum attribute

The "null-pointer-is-valid" attribute needs to be checked by many
pointer-related combines. To make the check more efficient, convert
it from a string into an enum attribute.

In the future, this attribute may be replaced with data layout
properties.

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

4 years ago[MLIR] Allow unreachable blocks to violate dominance property.
Stephen Neuendorffer [Thu, 14 May 2020 05:32:21 +0000 (22:32 -0700)]
[MLIR] Allow unreachable blocks to violate dominance property.

It is possible for optimizations to create SSA code which violates
the dominance property in unreachable blocks.  Equivalently, dominance
computed using normal mechanisms is undefined in unreachable blocks.

See discussion here: https://llvm.discourse.group/t/rfc-allowing-dialects-to-relax-the-ssa-dominance-condition/833/51

This patch only checks the dominance condition inside blocks which are
reachable from the the entry block of their region.  Note that the
dominance conditions of regions contained in an unreachable block are
still checked.

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

4 years ago[X86] Remove some duplicate ConstantSDNode casts. NFC.
Simon Pilgrim [Fri, 15 May 2020 17:23:19 +0000 (18:23 +0100)]
[X86] Remove some duplicate ConstantSDNode casts. NFC.

Avoid repeated isa<> and cast<> by just performing a dyn_cast<ConstantSDNode>

4 years ago[IR] Trivial cleanups in Use. NFC.
Jay Foad [Fri, 15 May 2020 16:47:40 +0000 (17:47 +0100)]
[IR] Trivial cleanups in Use. NFC.

Remove Use::setPrev. It provided no value because it had the same
accessibility as the underlying field Prev, and there was no
corresponding setNext anyway.

Simplify Use::removeFromList.

4 years ago[x86][CGP] add more tests for PR37426; NFC
Sanjay Patel [Fri, 15 May 2020 16:33:03 +0000 (12:33 -0400)]
[x86][CGP] add more tests for PR37426; NFC

This broke when we started canonicalizing more code to funnel shift.
See D79718 and D79827 for related test/transforms.

4 years ago[libc++] Do not rely on use_system_cxx_lib to specify the path of the library to...
Louis Dionne [Fri, 15 May 2020 15:33:59 +0000 (11:33 -0400)]
[libc++] Do not rely on use_system_cxx_lib to specify the path of the library to run against

This is already handled by setting cxx_runtime_root instead -- I don't
see a reason to have two ways of setting the runtime path of the library
we're running against.

4 years ago[X86] Move expansion of MASKPAIR16LOAD and MASKPAIR16STORE from X86MCInstLower to...
Craig Topper [Fri, 15 May 2020 07:21:02 +0000 (00:21 -0700)]
[X86] Move expansion of MASKPAIR16LOAD and MASKPAIR16STORE from X86MCInstLower to X86ExpandPseudo.

It makes more sense to turn these into real instructions
a little earlier in the pipeline.

I've made sure to adjust the memoperand so the spill/reload
comments are printed correctly.

4 years ago[x86][NFC] Apply clang-format to X86ISelLowering.h
Alexey Lapshin [Fri, 15 May 2020 11:46:59 +0000 (14:46 +0300)]
[x86][NFC] Apply clang-format to X86ISelLowering.h

Summary:
  Apply clang-format to X86ISelLowering.h

Reviewed by: aeubanks

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

4 years ago[Clang][BPF] implement __builtin_btf_type_id() builtin function
Yonghong Song [Sat, 15 Feb 2020 00:46:49 +0000 (16:46 -0800)]
[Clang][BPF] implement __builtin_btf_type_id() builtin function

Such a builtin function is mostly useful to preserve btf type id
for non-global data. For example,
   extern void foo(..., void *data, int size);
   int test(...) {
     struct t { int a; int b; int c; } d;
     d.a = ...; d.b = ...; d.c = ...;
     foo(..., &d, sizeof(d));
   }

The function "foo" in the above only see raw data and does not
know what type of the data is. In certain cases, e.g., logging,
the additional type information will help pretty print.

This patch implemented a BPF specific builtin
  u32 btf_type_id = __builtin_btf_type_id(param, flag)
which will return a btf type id for the "param".
flag == 0 will indicate a BTF local relocation,
which means btf type_id only adjusted when bpf program BTF changes.
flag == 1 will indicate a BTF remote relocation,
which means btf type_id is adjusted against linux kernel or
future other entities.

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

4 years ago[X86] Use getConstantOperandVal helper in a few places. NFC.
Simon Pilgrim [Fri, 15 May 2020 16:30:55 +0000 (17:30 +0100)]
[X86] Use getConstantOperandVal helper in a few places. NFC.

Avoid raw cast<ConstantSDNode> calls.

4 years ago[X86] getFauxShuffle - remove (unused) ISD::TRUNCATE shuffle decoding.
Simon Pilgrim [Fri, 15 May 2020 16:18:21 +0000 (17:18 +0100)]
[X86] getFauxShuffle - remove (unused) ISD::TRUNCATE shuffle decoding.

4 years ago[libc++] Fix broken Lit features based on __config_site macros
Louis Dionne [Fri, 15 May 2020 16:24:05 +0000 (12:24 -0400)]
[libc++] Fix broken Lit features based on __config_site macros

Because of Python's funny scoping rules with lambdas, we were always
using the value of `macro` as set in the last iteration of the loop.
This problem was introduced by e7bdfba4f00d.

4 years ago[libc++] Segregate back-deployment dylibs into their own subdirectory
Louis Dionne [Fri, 15 May 2020 16:13:48 +0000 (12:13 -0400)]
[libc++] Segregate back-deployment dylibs into their own subdirectory

Otherwise, specifying (for example) the libc++.dylib from macos10.13
but the libc++abi.dylib from macos10.12 would end up adding library
paths for both the 10.12 and 10.13 dylibs, which would each contain
a copy of both libc++abi.dylib and libc++.dylib. By using a separate
directory for libc++.dylib and libc++abi.dylib, those do not conflict
anymore.

The back-deployment roots were updated to match this change.

4 years ago[ARM][MVE] Add support for incrementing scatters
Anna Welker [Fri, 15 May 2020 14:29:12 +0000 (15:29 +0100)]
[ARM][MVE] Add support for incrementing scatters

Adds support to build pre-incrementing scatters.
If the increment (i.e., add instruction) that is merged into
the scatter is the loop increment, an incrementing write-back
scatter can be built, which then assumes the role of the loop
increment.

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

4 years ago[ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace...
Fangrui Song [Fri, 15 May 2020 05:18:58 +0000 (22:18 -0700)]
[ELF] Use namespace qualifiers (lld:: or elf::) instead of `namespace lld { namespace elf {`

Similar to D74882. This reverts much code from commit
bd8cfe65f5fee4ad573adc2172359c9552e8cdc0 (D68323) and fixes some
problems before D68323.

Sorry for the churn but D68323 was a mistake. Namespace qualifiers avoid
bugs where the definition does not match the declaration from the
header. See
https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions (D74515)

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

4 years ago[libc++] Centralize where we set the libc++ and libc++abi paths in config.py
Louis Dionne [Fri, 15 May 2020 15:18:49 +0000 (11:18 -0400)]
[libc++] Centralize where we set the libc++ and libc++abi paths in config.py

It's just confusing to have them all over the place.

4 years ago[VectorUtils] Expose vector-function-abi-variant mangling as a utility.
Anna Thomas [Wed, 13 May 2020 15:01:23 +0000 (11:01 -0400)]
[VectorUtils] Expose vector-function-abi-variant mangling as a utility.

Summary:
This change exposes the vector name mangling with LLVM ISA (used as part
of vector-function-abi-variant) as a utility.
This can then be used by front-ends that add this attribute.
Note that all parameters passed in to the function will be mangled with
the "v" token to identify that they are of of vector type. So, it is the
responsibility of the caller to confirm that all parameters in the
vectorized variant is of vector type.

Added unit test to show vector name mangling.

Reviewed-By: fpetrogalli, simoll
Differential Revision: https://reviews.llvm.org/D79867

4 years ago[ARM][MachineOutliner] Fix memory leak #2.
Yvan Roux [Fri, 15 May 2020 15:31:55 +0000 (17:31 +0200)]
[ARM][MachineOutliner] Fix memory leak #2.

Use smart pointer instead of new/delete.

4 years ago[gn build] Port 6b01b465388
LLVM GN Syncbot [Fri, 15 May 2020 15:13:18 +0000 (15:13 +0000)]
[gn build] Port 6b01b465388

4 years ago[BPF] preserve debuginfo types for builtin __builtin__btf_type_id()
Yonghong Song [Wed, 12 Feb 2020 00:55:22 +0000 (16:55 -0800)]
[BPF] preserve debuginfo types for builtin __builtin__btf_type_id()

The builtin function
  u32 btf_type_id = __builtin_btf_type_id(param, 0)
can help preserve type info for the following use case:
  extern void foo(..., void *data, int size);
  int test(...) {
    struct t { int a; int b; int c; } d;
    d.a = ...; d.b = ...; d.c = ...;
    foo(..., &d, sizeof(d));
  }

The function "foo" in the above only see raw data and does not
know what type of the data is. In certain cases, e.g., logging,
the additional type information will help pretty print.

This patch handles the builtin in BPF backend. It includes
an IR pass to translate the IR intrinsic to a load of
a global variable which carries the metadata, and an MI
pass to remove the intermediate load of the global variable.
Finally, in AsmPrinter pass, proper instruction are generated.

In the above example, the second argument for __builtin_btf_type_id()
is 0, which means a relocation for local adjustment,
i.e., w.r.t. bpf program BTF change,  will be generated.
The value 1 for the second argument means
a relocation for remote adjustment, e.g., against vmlinux.

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

4 years ago[AMDGPU] Fix assertion failure in SIInsertHardClauses
Jay Foad [Fri, 15 May 2020 13:36:00 +0000 (14:36 +0100)]
[AMDGPU] Fix assertion failure in SIInsertHardClauses

This new pass failed an assertion whenever there were s_nops after the
end of clause.

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

4 years ago[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set
Francois Ferrand [Mon, 22 May 2017 09:23:08 +0000 (11:23 +0200)]
[clang-format] Fix AlignOperands when BreakBeforeBinaryOperators is set

Summary:
Even when BreakBeforeBinaryOperators is set, AlignOperands kept
aligning the beginning of the line, even when it could align the
actual operands (e.g. after an assignment).

With this patch, the operands are actually aligned, and the operator
gets aligned with the equal sign:

  int aaaaa = bbbbbb
            + cccccc;

This not happen in tests, to avoid 'breaking' the indentation:

  if (aaaaa
      && bbbbb)
    return;

Reviewers: krasimir, djasper, klimek, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: MyDeveloperDay, acoomans, cfe-commits, klimek

Tags: #clang, #clang-format

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

4 years agoclang-format: support aligned nested conditionals formatting
Francois Ferrand [Thu, 23 Apr 2020 13:56:47 +0000 (15:56 +0200)]
clang-format: support aligned nested conditionals formatting

Summary:
When multiple ternary operators are chained, e.g. like an if/else-if/
else-if/.../else sequence, clang-format will keep aligning the colon
with the question mark, which increases the indent for each
conditionals:

  int a = condition1 ? result1
                     : condition2 ? result2
                                  : condition3 ? result3
                                               : result4;

This patch detects the situation (e.g. conditionals used in false branch
of another conditional), to avoid indenting in that case:

  int a = condition1 ? result1
        : condition2 ? result2
        : condition3 ? result3
                     : result4;

When BreakBeforeTernaryOperators is false, this will format like this:

  int a = condition1 ? result1 :
          condition2 ? result2 :
          conditino3 ? result3 :
                       result4;

This formatting style is referenced here:
https://www.fluentcpp.com/2018/02/27/replace-else-if-ternary-operator/
and here:
https://marcmutz.wordpress.com/2010/10/14/top-5-reasons-you-should-love-your-ternary-operator/

Reviewers: krasimir, djasper, klimek, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: hokein, dyung, MyDeveloperDay, acoomans, cfe-commits

Tags: #clang, #clang-format

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

4 years agoRe-land [Debug][CodeView] Emit fully qualified names for globals
Alexandre Ganea [Fri, 15 May 2020 14:36:27 +0000 (10:36 -0400)]
Re-land [Debug][CodeView] Emit fully qualified names for globals

Before this patch, S_[L|G][THREAD32|DATA32] records were emitted with a simple name, not the fully qualified name (namespace + class scope).

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

4 years agoFix Linux build broken by f06e6564
James Henderson [Fri, 15 May 2020 14:35:52 +0000 (15:35 +0100)]
Fix Linux build broken by f06e6564

4 years ago[ARM][MachineOutliner] Fix memory leak.
Yvan Roux [Fri, 15 May 2020 14:21:20 +0000 (16:21 +0200)]
[ARM][MachineOutliner] Fix memory leak.

Fix sanitizer bots after 0e4827aa4e4ae25813f66d3b872db67d93813009

4 years ago[llvm-readobj] Implement --dependent-libraries for GNU output
James Henderson [Thu, 14 May 2020 12:48:13 +0000 (13:48 +0100)]
[llvm-readobj] Implement --dependent-libraries for GNU output

Previously, the option was only implemented for LLVM output. This fixes
https://bugs.llvm.org/show_bug.cgi?id=45695.

At the current time, GNU readelf does not support this option.
Consequently, this patch simply attempts to roughly follow the output
style for similar options like --syms/--notes etc, combined with
--string-dump output.

Reviewed by: MaskRay, grimar

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

4 years ago[TSAN] Add option to allow instrumenting reads of reads-before-writes
Dmitry Vyukov [Fri, 15 May 2020 12:14:18 +0000 (14:14 +0200)]
[TSAN] Add option to allow instrumenting reads of reads-before-writes

Add -tsan-instrument-read-before-write which allows instrumenting reads
of reads-before-writes.

This is required for KCSAN [1], where under certain configurations plain
writes behave differently (e.g. aligned writes up to word size may be
treated as atomic). In order to avoid missing potential data races due
to plain RMW operations ("x++" etc.), we will require instrumenting
reads of reads-before-writes.

[1] https://github.com/google/ktsan/wiki/KCSAN

Author: melver (Marco Elver)
Reviewed-in: https://reviews.llvm.org/D79983

4 years ago[CodeGen] Fix FoldConstantVectorArithmetic for scalable vectors
David Sherwood [Wed, 6 May 2020 07:03:15 +0000 (08:03 +0100)]
[CodeGen] Fix FoldConstantVectorArithmetic for scalable vectors

For now I have changed FoldConstantVectorArithmetic to return early
if we encounter a scalable vector, since the subsequent code assumes
you can perform lane-wise constant folds. However, in future work we
should be able to extend this to look at splats of a constant value
and fold those if possible. I have also added the same code to
FoldConstantArithmetic, since that deals with vectors too.

The warnings I fixed in this patch were being generated by this
existing test:

  CodeGen/AArch64/sve-int-arith.ll

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

4 years ago[IR][BFloat] Add BFloat IR type
Ties Stuij [Tue, 31 Mar 2020 22:49:38 +0000 (23:49 +0100)]
[IR][BFloat] Add BFloat IR type

Summary:
The BFloat IR type is introduced to provide support for, initially, the BFloat16
datatype introduced with the Armv8.6 architecture (optional from Armv8.2
onwards). It has an 8-bit exponent and a 7-bit mantissa and behaves like an IEEE
754 floating point IR type.

This is part of a patch series upstreaming Armv8.6 features. Subsequent patches
will upstream intrinsics support and C-lang support for BFloat.

Reviewers: SjoerdMeijer, rjmccall, rsmith, liutianle, RKSimon, craig.topper, jfb, LukeGeeson, sdesmalen, deadalnix, ctetreau

Subscribers: hiraditya, llvm-commits, danielkiss, arphaman, kristof.beyls, dexonsmith

Tags: #llvm

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

4 years agoAdd MSVC natvis visualisation of llvm::Type
Machiel van Hooren [Fri, 15 May 2020 13:38:37 +0000 (09:38 -0400)]
Add MSVC natvis visualisation of llvm::Type

llvm::Type has some difficult to decode member variables with different meanings
depending on the TypeID. Specifically SubclassData and ContainedTys. This natvis
visualisation decodes and visualises those members.

4 years ago[clang-format] C# property formatting can be controlled by config options
Jonathan Coe [Fri, 15 May 2020 12:55:48 +0000 (13:55 +0100)]
[clang-format] C# property formatting can be controlled by config options

Summary:
Allow brace wrapping in C# property accessors to be controlled by configuration options.

Add new tests and revert old test results for Microsoft style to their previous state (as intended).

`FormatStyle.BraceWrapping.AfterFunction = true;` will change automatic property formatting from

```
Type MyType { get; set }
```

to

```
Type MyType
{ get; set }
```

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir, MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang-format, #clang

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

4 years ago[NFC][ARM] Intrinsic CostModel Tests
Sam Parker [Fri, 15 May 2020 12:36:44 +0000 (13:36 +0100)]
[NFC][ARM] Intrinsic CostModel Tests

Add throughput tests for saturating, overflowing and reduction
operations.