platform/upstream/llvm.git
4 years ago[libcxx] Fix C++14 and up constexpr members in MoveOnly.
zoecarver [Sat, 23 May 2020 21:43:12 +0000 (14:43 -0700)]
[libcxx] Fix C++14 and up constexpr members in MoveOnly.

Summary: a4b8ee6 made all MoveOnly members constexpr but, some members and constructors contain expressions that are only valid in C++14 and later. This patch prefixes those methods and constructors with TEST_CONSTEXPR_CXX14.

Reviewers: ldionne, #libc!

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

4 years ago[gn build] Port ba92b274225
LLVM GN Syncbot [Mon, 25 May 2020 18:14:50 +0000 (18:14 +0000)]
[gn build] Port ba92b274225

4 years agoRevert "[PGO] Fix computation of function Hash"
Benjamin Kramer [Mon, 25 May 2020 18:13:03 +0000 (20:13 +0200)]
Revert "[PGO] Fix computation of function Hash"

This reverts commit 7c298c104bfe725d4315926a656263e8a5ac3054.
Fails make check-clang.

Failing Tests (8):
Clang :: Profile/c-counter-overflows.c
Clang :: Profile/c-general.c
Clang :: Profile/c-unprofiled-blocks.c
Clang :: Profile/cxx-rangefor.cpp
Clang :: Profile/cxx-throws.cpp
Clang :: Profile/misexpect-switch-default.c
Clang :: Profile/misexpect-switch-nonconst.c
Clang :: Profile/misexpect-switch.c

4 years ago[lldb/Test] Add a trace method to replace print statements.
Jonas Devlieghere [Mon, 25 May 2020 17:59:39 +0000 (10:59 -0700)]
[lldb/Test] Add a trace method to replace print statements.

Many tests use (commented out) print statement for debugging the test
itself. This patch adds a new trace method to lldbtest to reuse the
existing tracing infrastructure and replace these print statements.

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

4 years ago[AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions
stevewan [Mon, 25 May 2020 17:43:22 +0000 (13:43 -0400)]
[AIX] Add '-bcdtors:all:0:s' to linker to gather static init functions

Summary: On AIX, add '-bcdtors:all:0:s' to the linker implicitly through the driver so that we can collect all static constructor and destructor functions.

Reviewers: hubert.reinterpretcast, Xiangling_L, ZarkoCA, daltenty

Reviewed By: hubert.reinterpretcast

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[AMDGPU][MC][GFX8+] Enabled clamp for v_add_u16, v_sub_u16 and v_subrev_u16
Dmitry Preobrazhensky [Mon, 25 May 2020 16:55:38 +0000 (19:55 +0300)]
[AMDGPU][MC][GFX8+] Enabled clamp for v_add_u16, v_sub_u16 and v_subrev_u16

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

Reviewers: arsenm, rampitec, vpykhtin

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

4 years agoMake mlir::Value's bool conversion operator explicit
Benjamin Kramer [Sun, 24 May 2020 21:08:27 +0000 (23:08 +0200)]
Make mlir::Value's bool conversion operator explicit

This still allows `if (value)` while requiring an explicit cast when not
in a boolean context. This means things like `std::set<Value>` will no
longer compile.

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

4 years agoRe-commit "[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake"
Sergej Jaskiewicz [Tue, 5 May 2020 22:10:57 +0000 (01:10 +0300)]
Re-commit "[cmake] Allow std::filesystem tests in CrossWinToARMLinux.cmake"

https://reviews.llvm.org/D78200 has been re-committed, so we can now
enable building std::filesystem and running tests for it.

4 years agoRe-commit "[libc++] [test] Generate static_test_env on the fly"
Sergej Jaskiewicz [Mon, 25 May 2020 16:08:49 +0000 (19:08 +0300)]
Re-commit "[libc++] [test] Generate static_test_env on the fly"

Don't use std::filesystem APIs for CWDGuard, use POSIX functions
instead. This way the tests don't rely on the correctness of
the functionality they're testing.

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

4 years ago[analyzer] Improved RangeSet::Negate support of unsigned ranges
Denys Petrov [Thu, 9 Apr 2020 13:20:07 +0000 (16:20 +0300)]
[analyzer] Improved RangeSet::Negate support of unsigned ranges

Summary:
This fixes https://bugs.llvm.org/show_bug.cgi?id=41588
RangeSet Negate function shall handle unsigned ranges as well as signed ones.
RangeSet getRangeForMinusSymbol function shall use wider variety of ranges, not only concrete value ranges.
RangeSet Intersect functions shall not produce assertions.

Changes:
Improved safety of RangeSet::Intersect function. Added isEmpty() check to prevent an assertion.
Added support of handling unsigned ranges to RangeSet::Negate and RangeSet::getRangeForMinusSymbol.
Extended RangeSet::getRangeForMinusSymbol to return not only range sets with single value [n,n], but with wide ranges [n,m].
Added unit test for Negate function.
Added regression tests for unsigned values.

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

4 years ago[PGO] Fix computation of function Hash
serge-sans-paille [Thu, 14 May 2020 05:23:10 +0000 (07:23 +0200)]
[PGO] Fix computation of function Hash

Previous implementation was incorrectly passing an uint64_t, that got converted
to an uint8_t, to finalize the hash computation. This led to different functions
having the same hash if they only differ by the remaining statements, which is
incorrect.

Added a new test case that trivially tests that a small function change is
reflected in the hash value.

Not that as this patch fixes the hash computation, it invalidates all hashes
computed before that patch applies, which could be an issue for large build
system that pre-compute the profile data and let client download them as part of
the build process.

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

4 years ago[AMDGPU] Added 'A' constraint for inline assembler
Dmitry Preobrazhensky [Mon, 25 May 2020 14:45:18 +0000 (17:45 +0300)]
[AMDGPU] Added 'A' constraint for inline assembler

Summary: 'A' constraint requires an immediate int or fp constant that can be inlined in an instruction encoding.
This is the second part of the change. The llvm part has been committed as b087b91c9170.
See https://reviews.llvm.org/D78494

Reviewers: arsenm, rampitec

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

4 years agoMustExecute.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 25 May 2020 14:35:47 +0000 (15:35 +0100)]
MustExecute.h - remove unnecessary includes. NFC.

Reduce to forward declarations and fix implicit LoopInfo.h dependency in Attributor.h

4 years ago[X86] Add PTEST tests showing failure to extract allsign cases
Simon Pilgrim [Mon, 25 May 2020 14:33:44 +0000 (15:33 +0100)]
[X86] Add PTEST tests showing failure to extract allsign cases

As discussed on PR42035, we can often use MOVMSK to avoid a cmpgt/ashr by just analysing the extracted signbits.

4 years agoAdd AIX to the test macro-same-context XFAIL list
Shuhong Liu [Mon, 25 May 2020 14:11:55 +0000 (10:11 -0400)]
Add AIX to the test macro-same-context XFAIL list

Summary: Since the integrated assembly parser was not implemented yet for AIX and macro is not part of the native assembly dialect on AIX, the test macro-same-context is expected to fail for AIX; hence added AIX to XFAIL list.

Reviewers: hubert.reinterpretcast, daltenty, jasonliu

Reviewed By: daltenty

Subscribers: jasonliu, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Remove custom DWARF expression printing code
Pavel Labath [Mon, 25 May 2020 13:59:48 +0000 (15:59 +0200)]
[lldb] Remove custom DWARF expression printing code

The llvm DWARFExpression dump is nearly identical, but better -- for
example it does print a spurious space after zero-argument expressions.

Some parts of our code (variable locations) have been already switched
to llvm-based expression dumping. This switches the remainder: unwind
plans and some unit tests.

4 years ago[ManagedStatic] Fix build errors with clang-tblgen in Debug mode using MSVC 2019...
Denys Petrov [Fri, 22 May 2020 10:10:37 +0000 (13:10 +0300)]
[ManagedStatic] Fix build errors with clang-tblgen in Debug mode using MSVC 2019 v16.6

After updating MSVS19 from v16.4 to v16.6 I faced with a build errors compiling in Debug mode.
It complains on clang-tblgen.exe and llvm-tblgen.exe cmd line args.
VS compiler had a bug. It dynamically creates an object with constexpr ctor in Debug mode. This bug was fixed in VS2019 v16.5.
A workaround was implemented for that and everything works until v16.5 comes.
The workaround became irrelevant since v16.5 and caused build errors.
So I disabled the workaround for VS2019 v16.5 and higher.

This relates to http://llvm.org/PR41367.

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

4 years agoStack clash: update live-ins
serge-sans-paille [Mon, 25 May 2020 13:56:48 +0000 (15:56 +0200)]
Stack clash: update live-ins

This fixes http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-debian/builds/7150

4 years ago[LoopUtils] Use llvm::find
Whitney Tsang [Mon, 25 May 2020 13:31:57 +0000 (13:31 +0000)]
[LoopUtils] Use llvm::find

Summary: Fixes this build error:

llvm/lib/Transforms/Utils/LoopUtils.cpp:679:26: error: no matching
function for call to 'find'
      Loop::iterator I = find(ParentLoop->begin(), ParentLoop->end(),
L);
                         ^~~~
Authored By: orivej
Reviewer: Whitney
Reviewed By: Whitney
Subscribers: hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D80473

4 years agoMake FEATURE_AVX512VP2INTERSECT match between compiler-rt and LLVM
Benjamin Kramer [Mon, 25 May 2020 13:12:08 +0000 (15:12 +0200)]
Make FEATURE_AVX512VP2INTERSECT match between compiler-rt and LLVM

compiler-rt also doesn't support bits >= 64 as far as I know.

4 years agoMemoryLocation.h - reduce Instructions.h include to Instruction.h include. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:59:46 +0000 (13:59 +0100)]
MemoryLocation.h - reduce Instructions.h include to Instruction.h include. NFC.

Add forward declarations for the few Instr classes we reference.

4 years agoImprove stack-clash implementation on x86
serge-sans-paille [Wed, 6 May 2020 11:42:01 +0000 (13:42 +0200)]
Improve stack-clash implementation on x86

- test both 32 and 64 bit version
- probe the tail in dynamic-alloca
- generate more concise code

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

4 years agoMemoryBuiltins.h - remove unnecessary TargetLibraryInfo forward declaration. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:44:27 +0000 (13:44 +0100)]
MemoryBuiltins.h - remove unnecessary TargetLibraryInfo forward declaration. NFC.

We already have to include TargetLibraryInfo.h

4 years agoLoopInfo.h - remove unnecessary PHINode forward declaration. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:43:20 +0000 (13:43 +0100)]
LoopInfo.h - remove unnecessary PHINode forward declaration. NFC.

This is directly defined in Instructions.h

4 years agoInstructionSimplify.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:27:10 +0000 (13:27 +0100)]
InstructionSimplify.h - remove unnecessary includes. NFC.

Remove unused User.h include.
Replace SetVector.h with forward declaration.
Sort the forward declarations + remove FastMathFlags (defined in Operator.h).
Fix implicit SetVector.h dependency in LowerConstantIntrinsics.cpp.

4 years agoInlineAdvisor.h - remove unnecessary PreservedAnalyses forward declaration. NFC.
Simon Pilgrim [Mon, 25 May 2020 12:09:30 +0000 (13:09 +0100)]
InlineAdvisor.h - remove unnecessary PreservedAnalyses forward declaration. NFC.

This is directly defined in PassManager.h

4 years ago[x86] favor vector constant load to avoid GPR to XMM transfer, part 2
Sanjay Patel [Mon, 25 May 2020 11:50:45 +0000 (07:50 -0400)]
[x86] favor vector constant load to avoid GPR to XMM transfer, part 2

This replaces the build_vector lowering code that was just added in
D80013
and matches the pattern later from the x86-specific "vzext_movl".
That seems to result in the same or better improvements and gets rid
of the 'TODO' items from that patch.

AFAICT, we always shrink wider constant vectors to 128-bit on these
patterns, so we still get the implicit zero-extension to ymm/zmm
without wasting space on larger vector constants. There's a trade-off
there because that means we miss potential load-folding.

Similarly, we could load scalar constants here with implicit
zero-extension even to 128-bit. That saves constant space, but it
means we forego load-folding, and so it increases register pressure.
This seems like a good middle-ground between those 2 options.

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

4 years agoFunctionLoweringInfo.h - move APInt.h dependency to FunctionLoweringInfo.cpp. NFC.
Simon Pilgrim [Mon, 25 May 2020 11:56:44 +0000 (12:56 +0100)]
FunctionLoweringInfo.h - move APInt.h dependency to FunctionLoweringInfo.cpp. NFC.

4 years agoFunctionLoweringInfo.h - remove orphan addSEHHandlersForLPads declaration. NFC.
Simon Pilgrim [Mon, 25 May 2020 11:52:14 +0000 (12:52 +0100)]
FunctionLoweringInfo.h - remove orphan addSEHHandlersForLPads declaration. NFC.

4 years agoAdded pow intrinsic to LLVMIR dialect
George Mitenkov [Mon, 25 May 2020 11:42:17 +0000 (07:42 -0400)]
Added pow intrinsic to LLVMIR dialect

Added pow intrinsic to LLVMIR dialect. Added a roundrip test for it.

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

4 years ago[PowerPC][NFC] Split PPCELFStreamer::emitInstruction
Stefan Pintilie [Mon, 25 May 2020 11:32:51 +0000 (06:32 -0500)]
[PowerPC][NFC] Split PPCELFStreamer::emitInstruction

Split off PPCELFStreamer::emitPrefixedInstruction from
PPCELFStreamer::emitInstruction.

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

4 years ago[ARM] VMULH tests for when other parts are working. NFC
David Green [Mon, 25 May 2020 11:25:03 +0000 (12:25 +0100)]
[ARM] VMULH tests for when other parts are working. NFC

4 years ago[ObjectYAML][DWARF] Remove unimplemented function.
Xing GUO [Mon, 25 May 2020 11:42:15 +0000 (19:42 +0800)]
[ObjectYAML][DWARF] Remove unimplemented function.

```
StringMap<std::unique_ptr<MemoryBuffer>>
EmitDebugSections(llvm::DWARFYAML::Data &DI, bool ApplyFixups);
```
is unimplemented and unused.

4 years ago[DAG] Add SimplifyDemandedVectorElts binop SimplifyMultipleUseDemandedBits handling
Simon Pilgrim [Mon, 25 May 2020 11:41:08 +0000 (12:41 +0100)]
[DAG] Add SimplifyDemandedVectorElts binop SimplifyMultipleUseDemandedBits handling

For the supported binops (basic arithmetic, logicals + shifts), if we fail to simplify the demanded vector elts, then call SimplifyMultipleUseDemandedBits and try to peek through ops to remove unnecessary dependencies.

This helps with PR40502.

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

4 years agoSystemZInstrBuilder.h - remove unnecessary PseudoSourceValue.h include. NFC.
Simon Pilgrim [Mon, 25 May 2020 11:20:58 +0000 (12:20 +0100)]
SystemZInstrBuilder.h - remove unnecessary PseudoSourceValue.h include. NFC.

4 years agoTargetInstrInfo.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 25 May 2020 11:11:53 +0000 (12:11 +0100)]
TargetInstrInfo.h - remove unnecessary includes. NFC.

4 years ago[AMDGPU][CODEGEN] Added 'A' constraint for inline assembler
Dmitry Preobrazhensky [Mon, 25 May 2020 11:19:22 +0000 (14:19 +0300)]
[AMDGPU][CODEGEN] Added 'A' constraint for inline assembler

Summary: 'A' constraint requires an immediate int or fp constant that can be inlined in an instruction encoding.

Reviewers: arsenm, rampitec

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

4 years ago[lldb][NFC] Pass DeclarationName to NameSearchContext by value
Raphael Isemann [Mon, 25 May 2020 10:14:21 +0000 (12:14 +0200)]
[lldb][NFC] Pass DeclarationName to NameSearchContext by value

DeclarationName is usually passed around by value as it's just a pointer.

4 years agoPrevent GetNumChildren from transitively walking pointer chains
Jaroslav Sevcik [Mon, 25 May 2020 09:17:48 +0000 (11:17 +0200)]
Prevent GetNumChildren from transitively walking pointer chains

Summary:

This is an attempt to fix https://bugs.llvm.org/show_bug.cgi?id=45988,
where SBValue::GetNumChildren returns 2, but SBValue::GetChildAtIndex(1) returns
an invalid value sentinel.

The root cause of this seems to be that GetNumChildren can return the number of
children of a wrong value. In particular, for pointers GetNumChildren just
recursively calls itself on the pointee type, so it effectively walks chains of
pointers. This is different from the logic of GetChildAtIndex, which only
recurses if pointee.IsAggregateType() returns true (IsAggregateType is false for
pointers and references), so it never follows chain of pointers.

This patch aims to make GetNumChildren (more) consistent with GetChildAtIndex by
only recursively calling GetNumChildren for aggregate types.

Ideally, GetNumChildren and GetChildAtIndex would share the code that decides
which pointers/references are followed, but that is a bit more invasive change.

Reviewers: teemperor, jingham, clayborg

Reviewed By: teemperor, clayborg

Subscribers: clayborg, labath, shafik, lldb-commits

Tags: #lldb

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

4 years ago[clangd] Enable cross-file-rename by default.
Haojian Wu [Tue, 5 May 2020 15:11:30 +0000 (17:11 +0200)]
[clangd] Enable cross-file-rename by default.

Summary:
The cross-file rename feature is stable enough to enable it (has been
rolled out internally for a few weeks).

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[AST] default implementation is possible for non-member functions in C++20.
mydeveloperday [Wed, 20 May 2020 06:22:01 +0000 (07:22 +0100)]
[AST] default implementation is possible for non-member functions in C++20.

Summary:
Make RAV not visit the default function decl by default.
Also update some stale comments on FunctionDecl::isDefault.

Fixes https://github.com/clangd/clangd/issues/383

Reviewers: sammccall, rsmith

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[LV] Clamp MaxVF to power of 2.
Ayal Zaks [Sun, 24 May 2020 13:22:39 +0000 (16:22 +0300)]
[LV] Clamp MaxVF to power of 2.

If a loop has a constant trip count known to be a multiple of MaxVF (times user
UF), LV infers that no tail will be generated for any chosen VF. This relies on
the chosen VF's being powers of 2 bound by MaxVF, and assumes MaxVF is a power
of 2. Make sure the latter holds, in particular when MaxVF is set by a memory
dependence distance which may not be a power of 2.

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

4 years ago[OpenMP] Fix a race in task queue reallocation
Joachim Protze [Mon, 25 May 2020 08:19:35 +0000 (10:19 +0200)]
[OpenMP] Fix a race in task queue reallocation

__kmp_realloc_task_deque implicitly assumes, that the task queue is full
(ntasks == size), therefore tail = size in line 319.
An assertion is added to document this assumption.

The first check for a full queue is before the locking and might not hold
when the lock is taken. So, we need to check again for this condition when
we have the lock.

Reviewed By: AndreyChurbanov

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

4 years ago[clangd] Log use of heuristic go-to-def. NFC
Sam McCall [Mon, 25 May 2020 08:19:34 +0000 (10:19 +0200)]
[clangd] Log use of heuristic go-to-def. NFC

Generally:
 - found results using this method -> log
 - no results using this method -> vlog
 - method wasn't applied because ineligible -> no log

4 years ago[VE][NFC] Correct sjlj_expection test
Kazushi (Jam) Marukawa [Mon, 25 May 2020 07:48:51 +0000 (09:48 +0200)]
[VE][NFC] Correct sjlj_expection test

Summary: '|&' works with bash only, so it should not be used in regression
tests.

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

4 years ago[CMake] Properly handle the LTO cache arguments for MinGW
Tobias Hieta [Mon, 25 May 2020 07:28:17 +0000 (10:28 +0300)]
[CMake] Properly handle the LTO cache arguments for MinGW

We want to make sure that LINKER_IS_LLD_LINK is properly set - in
this case it shouldn't be set when building for MinGW.

Then we want to make the test for it correct and finally include
the option to build with thinlto cache since the MinGW driver now
supports that.

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

4 years ago[MCDwarf] Delete unneeded DW_AT_unspecified_parameters
Fangrui Song [Mon, 25 May 2020 05:30:59 +0000 (22:30 -0700)]
[MCDwarf] Delete unneeded DW_AT_unspecified_parameters

4 years ago[MCDwarf] Delete unneeded DW_AT_prototyped for DW_TAG_label
Fangrui Song [Mon, 25 May 2020 05:19:22 +0000 (22:19 -0700)]
[MCDwarf] Delete unneeded DW_AT_prototyped for DW_TAG_label

4 years ago[mlir] Expand operand adapter to take attributes
Jacques Pienaar [Mon, 25 May 2020 03:42:58 +0000 (20:42 -0700)]
[mlir] Expand operand adapter to take attributes

* Enables using with more variadic sized operands;
* Generate convenience accessors for attributes;
  - The accessor are named the same as their name in ODS and returns attribute
    type (not convenience type) and no derived attributes.

This is first step to changing adapter to support verifying argument
constraints before the op is even created. This does not change the name of
adaptor nor does it require it except for ops with variadic operands to keep this change smaller.

Considered creating separate adapter but decided against that given operands also require attributes in general (and definitely for verification of operands and attributes).

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

4 years ago[TargetLoweringObjectFileImpl] Use llvm::transform
Orivej Desh [Mon, 25 May 2020 03:55:08 +0000 (20:55 -0700)]
[TargetLoweringObjectFileImpl] Use llvm::transform

Fixes a build issue with libc++ configured with _LIBCPP_RAW_ITERATORS (ADL not effective)

```
llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1602:3: error: no matching function for call to 'transform'
  transform(HexString.begin(), HexString.end(), HexString.begin(), tolower);
  ^~~~~~~~~
```

Reviewed By: MaskRay

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

4 years ago[clang-format][PR46043] Parse git config w/ implicit values
Jake Merdich [Sun, 24 May 2020 02:21:10 +0000 (22:21 -0400)]
[clang-format][PR46043] Parse git config w/ implicit values

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

Git's config is generally of the format 'key=val', but a setting
'key=true' can be written as just 'key'.  The git-clang-format script
expects a value and crashes in this case; this change handles implicit
'true' values in the script.

Reviewers: MyDeveloperDay, krasimir, sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years agoChange default traversal in AST Matchers to ignore invisible nodes
Stephen Kelly [Sun, 12 Jan 2020 09:38:11 +0000 (09:38 +0000)]
Change default traversal in AST Matchers to ignore invisible nodes

This makes many scenarios simpler by not requiring the user to write
ignoringImplicit() all the time, nor to account for non-visible
cxxConstructExpr() and cxxMemberCalExpr() nodes. This is also, in part,
inclusive of the equivalent of adding a use of ignoringParenImpCasts()
between all expr()-related matchers in an expression.

The pre-existing traverse(TK_AsIs, ...) matcher can be used to explcitly
match on implicit/invisible nodes. See

  http://lists.llvm.org/pipermail/cfe-dev/2019-December/064143.html

for more

Reviewers: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[X86] Remove isCommutable flag from MULX instructions.
Craig Topper [Sun, 24 May 2020 19:34:56 +0000 (12:34 -0700)]
[X86] Remove isCommutable flag from MULX instructions.

The fixed register constraint on EDX/RDX as an input
makes this not really commutable.

4 years agoAdd missing test
Stephen Kelly [Sun, 24 May 2020 21:49:00 +0000 (22:49 +0100)]
Add missing test

4 years agoFix ignore-traversal to call correct method
Stephen Kelly [Sun, 24 May 2020 21:28:24 +0000 (22:28 +0100)]
Fix ignore-traversal to call correct method

As is done by ignoreParenImpCasts(). We were not previously calling the
correct internal method.  Adjust tests to account for this.

4 years ago[X86][AVX] Fold extract_subvector(subv_broadcast(x),c) -> (x)
Simon Pilgrim [Sun, 24 May 2020 17:49:39 +0000 (18:49 +0100)]
[X86][AVX] Fold extract_subvector(subv_broadcast(x),c) -> (x)

If we're extracting an subvector from a broadcasted subvector of the same type then we can use the source vector directly.

4 years ago[X86][AVX] Fold extract_subvector(broadcast(x),c) -> extract_subvector(broadcast...
Simon Pilgrim [Sun, 24 May 2020 17:05:33 +0000 (18:05 +0100)]
[X86][AVX] Fold extract_subvector(broadcast(x),c) -> extract_subvector(broadcast(x),0) iff c != 0

If we're extracting an upper subvector from a broadcast we're better off extracting the lowest subvector instead as it avoids an actual extract instruction and might help SimplifyDemandedVectorElts further simplify the code.

4 years ago[Pass Manager] remove EarlyCSE as clean-up for VectorCombine
Sanjay Patel [Sun, 24 May 2020 16:20:22 +0000 (12:20 -0400)]
[Pass Manager] remove EarlyCSE as clean-up for VectorCombine

EarlyCSE was added with D75145, but the motivating test is
not regressed by removing the extra pass now. That might be
because VectorCombine altered the way it processes instructions,
or it might be from (re)moving VectorCombine in the pipeline.

The extra round of EarlyCSE appears to cost approximately
0.26% in compile-time as discussed in D80236, so we need some
evidence to justify its inclusion here, but we do not have
that (yet).

I suspect that between SLP and VectorCombine, we are creating
patterns that InstCombine and/or codegen are not prepared for,
but we will need to reduce those examples and include them as
PhaseOrdering and/or test-suite benchmarks.

4 years ago[LV] Either get invariant condition OR vector condition.
Florian Hahn [Sun, 24 May 2020 13:14:43 +0000 (14:14 +0100)]
[LV] Either get invariant condition OR vector condition.

Currently we unconditionally get the first lane of the condition
operand, even if we later use the full vector condition. This can result
in some unnecessary instructions being generated.

Suggested as follow-up in D80219.

4 years ago[PhaseOrdering] adjust test to use default alias analysis with new pass manager; NFC
Sanjay Patel [Sun, 24 May 2020 15:24:53 +0000 (11:24 -0400)]
[PhaseOrdering] adjust test to use default alias analysis with new pass manager; NFC

As discussed in D80236 - this test (like all PhaseOrdering tests?)
was intended to show that there is no difference with the new
pass manager, but the 'opt' command requires extra parameters
to make that happen.

4 years ago[X86] SimplifyMultipleUseDemandedBitsForTargetNode - add initial X86ISD::VSRAI handling.
Simon Pilgrim [Sun, 24 May 2020 15:07:46 +0000 (16:07 +0100)]
[X86] SimplifyMultipleUseDemandedBitsForTargetNode - add initial X86ISD::VSRAI handling.

This initial version only peeks through cases where we just demand the sign bit of an ashr shift, but we could generalize this further depending on how many sign bits we already have.

The pr18014.ll case is a minor annoyance - we've failed to to move the psrad/paddd after the blendvps which would have avoided the extra move, but we have still increased the ILP.

4 years agoAMDGPU.h - reduce TargetMachine.h include. NFC.
Simon Pilgrim [Sun, 24 May 2020 14:27:41 +0000 (15:27 +0100)]
AMDGPU.h - reduce TargetMachine.h include. NFC.

Replace TargetMachine.h include with forward declaration and CodeGen.h include in AMDGPU.h.

Exposes a couple of implicit dependencies that require additional forward declarations/includes.

4 years ago[PowerPC] Add some InstAlias definitions
Kang Zhang [Sun, 24 May 2020 14:05:28 +0000 (14:05 +0000)]
[PowerPC] Add some InstAlias definitions

Summary:
This patch add the InstAlias definitions for below instructions.

ADDI ADDIS ADDI8 ADDIS8
RLWINM8
ISEL ISEL8
OR OR_rec ORI ORI8 XORI8
CNTLZW8 CNTLZW8_rec
TEND TSR
RFEBB
NOR NOR_rec
MTCRF
SUBF SUBF_rec SUBFC SUBFC_rec
RLDICL_32_64
TW

Reviewed By: steven.zhang

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

4 years ago[clang-tidy] Fix potential assert in use-noexcept check
Nathan James [Sun, 24 May 2020 13:40:15 +0000 (14:40 +0100)]
[clang-tidy] Fix potential assert in use-noexcept check

Summary: Fix a potential assert in use-noexcept check if there is an issue getting the `TypeSourceInfo` as well as a small clean up.

Reviewers: aaron.ballman, alexfh, gribozavr2

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[InstCombine] fold FP trunc into exact itofp
Sanjay Patel [Sun, 24 May 2020 13:30:19 +0000 (09:30 -0400)]
[InstCombine] fold FP trunc into exact itofp

Similar to D79116 and rGbfd512160fe0 - if the 1st cast
is exact, then we can go directly to the destination
type because there is no double-rounding.

4 years ago[PatternMatch] abbreviate vector inst matchers; NFC
Sanjay Patel [Sat, 23 May 2020 14:13:50 +0000 (10:13 -0400)]
[PatternMatch] abbreviate vector inst matchers; NFC

Readability is not reduced with these opcodes/match lines,
so reduce odds of awkward wrapping from 80-col limit.

4 years agoAMDGPUInstPrinter.cpp - add CommandLine.h include. NFC.
Simon Pilgrim [Sun, 24 May 2020 13:16:03 +0000 (14:16 +0100)]
AMDGPUInstPrinter.cpp - add CommandLine.h include. NFC.

Fixes implicit dependency that will be exposed by a future patch.

4 years ago[VPlan] Use VPUser for VPWidenSelectRecipe operands (NFC).
Florian Hahn [Sun, 24 May 2020 12:36:42 +0000 (13:36 +0100)]
[VPlan] Use VPUser for VPWidenSelectRecipe operands (NFC).

VPWidenSelectRecipe already contains a VPUser, but it is not used. This
patch updates the code related to VPWidenSelectRecipe to use VPUser for
its operands.

Reviewers: Ayal, gilr, rengolin

Reviewed By: gilr

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

4 years agoAMDGPUTargetObjectFile.h - remove unnecessary includes. NFC.
Simon Pilgrim [Sun, 24 May 2020 12:57:02 +0000 (13:57 +0100)]
AMDGPUTargetObjectFile.h - remove unnecessary includes. NFC.

As we're inheriting from TargetLoweringObjectFileELF, TargetLoweringObjectFileImpl.h already declares all types we require in the overrides.

4 years agoAMDGPULibFunc - fix include order. NFC.
Simon Pilgrim [Sun, 24 May 2020 12:25:59 +0000 (13:25 +0100)]
AMDGPULibFunc - fix include order. NFC.

Ensure AMDGPULibFunc.h module header is first, and fix exposed missing forward declaration.

4 years agoLoopSimplify.h - reduce unnecessary includes to forward declarations. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:41:05 +0000 (12:41 +0100)]
LoopSimplify.h - reduce unnecessary includes to forward declarations. NFC.

4 years agoFix return values of some matcher functions
Stephen Kelly [Sat, 23 May 2020 20:57:01 +0000 (21:57 +0100)]
Fix return values of some matcher functions

The old return values mean

* implicit conversion
* not being able to write sizeOfExpr().bind() for example

4 years agoFix skip-invisible with overloaded method calls
Stephen Kelly [Sun, 24 May 2020 11:27:03 +0000 (12:27 +0100)]
Fix skip-invisible with overloaded method calls

4 years agoAdd explicit traversal mode to matchers for implicit constructors
Stephen Kelly [Sun, 24 May 2020 10:49:13 +0000 (11:49 +0100)]
Add explicit traversal mode to matchers for implicit constructors

4 years agoX86Subtarget.h - remove unnecessary TargetMachine.h include. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:30:22 +0000 (12:30 +0100)]
X86Subtarget.h - remove unnecessary TargetMachine.h include. NFC.

By moving X86Subtarget::isPositionIndependent() into X86Subtarget.cpp we can remove the header dependency and move the few uses into source files.

4 years ago[X86] Pull out repeated DemandedBits signmask variable. NFC.
Simon Pilgrim [Sun, 24 May 2020 11:01:58 +0000 (12:01 +0100)]
[X86] Pull out repeated DemandedBits signmask variable. NFC.

Both paths always create the same DemandedBits mask.

4 years ago[TargetLowering] Improve expandFunnelShift shift amount masking
Simon Pilgrim [Sun, 24 May 2020 10:25:09 +0000 (11:25 +0100)]
[TargetLowering] Improve expandFunnelShift shift amount masking

For the 'inverse shift', we currently always perform a subtraction of the original (masked) shift amount.

But for the case where we are handling power-of-2 type widths, we can replace:

(sub bw-1, (and amt, bw-1) ) -> (and (xor amt, bw-1), bw-1) -> (and ~amt, bw-1)

This allows x86 shifts to fold away the and-mask.

Followup to D77301 + D80466.

http://volta.cs.utah.edu:8080/z/Nod0Gr

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

4 years agoFix Wdocumentation warnings after argument renaming. NFC.
Simon Pilgrim [Sun, 24 May 2020 10:18:20 +0000 (11:18 +0100)]
Fix Wdocumentation warnings after argument renaming. NFC.

4 years ago[X86] Move CONCAT_VECTORS/INSERT_SUBVECTOR actions inside loop. NFC.
Simon Pilgrim [Sun, 24 May 2020 09:59:33 +0000 (10:59 +0100)]
[X86] Move CONCAT_VECTORS/INSERT_SUBVECTOR actions inside loop. NFC.

CONCAT_VECTORS/INSERT_SUBVECTOR both are custom on v32i1/v64i1 like the other ops in the loop.

4 years agoX86TargetMachine.h - remove unnecessary X86Subtarget forward declaration. NFC.
Simon Pilgrim [Sun, 24 May 2020 09:51:02 +0000 (10:51 +0100)]
X86TargetMachine.h - remove unnecessary X86Subtarget forward declaration. NFC.

We have to include X86Subtarget.h.

4 years ago[LLD/MinGW]: Expose --thinlto-cache-dir
Tobias Hieta [Sun, 24 May 2020 09:29:16 +0000 (12:29 +0300)]
[LLD/MinGW]: Expose --thinlto-cache-dir

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

4 years ago[X86][AVX] Call SimplifyDemandedBits on MaskedLoadSDNode with non-boolean masks
Simon Pilgrim [Sun, 24 May 2020 08:41:02 +0000 (09:41 +0100)]
[X86][AVX] Call SimplifyDemandedBits on MaskedLoadSDNode with non-boolean masks

On X86 (AVX1/AVX2), non-boolean masked loads only demand the sign bit of the mask, we already do the equivalent for masked stores.

Annoyingly I can't easily handle this inside TargetLowering::SimplifyDemandedBits as this is an x86 specific case for a generic node.

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

4 years ago[X86] Add family/model for Intel Comet Lake CPUs for -march=native and function multi...
Craig Topper [Wed, 20 May 2020 04:05:31 +0000 (21:05 -0700)]
[X86] Add family/model for Intel Comet Lake CPUs for -march=native and function multiversioning

This adds the family/model returned by CPUID for some Intel
Comet Lake CPUs. Instruction set and tuning wise these are
the same as "skylake".

These are not in the Intel SDM yet, but these should be correct.

4 years ago[X86] Fix typo in comment. NFC
Craig Topper [Sun, 24 May 2020 03:23:24 +0000 (20:23 -0700)]
[X86] Fix typo in comment. NFC

4 years ago[X86] Improve i8 + 'slow' i16 funnel shift codegen
Simon Pilgrim [Sun, 24 May 2020 07:08:34 +0000 (08:08 +0100)]
[X86] Improve i8 + 'slow' i16 funnel shift codegen

This is a preliminary patch before I deal with the xor+and issue raised in D77301.

We get much better code for i8/i16 funnel shifts by concatenating the operands together and performing the shift as a double width type, it avoids repeated use of the shift amount and partial registers.

fshl(x,y,z) -> (((zext(x) << bw) | zext(y)) << (z & (bw-1))) >> bw.
fshr(x,y,z) -> (((zext(x) << bw) | zext(y)) >> (z & (bw-1))) >> bw.

Alive2: http://volta.cs.utah.edu:8080/z/CZx7Cn

This doesn't do as well for i32 cases on x86_64 (the xor+and followup patch is much better) so I haven't bothered with that.

Cases with constant amounts are more dubious as well so I haven't currently bothered with those - its these kind of 'edge' cases that put me off trying to put this in TargetLowering::expandFunnelShift.

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

4 years ago[AArch64][GlobalISel] When generating SUBS for compares, don't write to wzr/xzr.
Amara Emerson [Fri, 22 May 2020 22:22:29 +0000 (15:22 -0700)]
[AArch64][GlobalISel] When generating SUBS for compares, don't write to wzr/xzr.

Although writing to wzr/xzr is correct since we don't care about the result
of the sub, only the flags, doing so causes tail merge blocks to fail.

Writing to an unused virtual register instead allows the optimization to fire,
improving performance significantly on 256.bzip2.

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

4 years ago[NFC, StackSafety] LTO tests for MTE and StackSafety
Vitaly Buka [Fri, 15 May 2020 21:44:52 +0000 (14:44 -0700)]
[NFC, StackSafety] LTO tests for MTE and StackSafety

Summary:
The test demonstrates the current state of the compiler and
I am going to resolve FIXME in followup patches.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: inglorion, hiraditya, steven_wu, dexonsmith, cfe-commits

Tags: #clang

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

4 years ago[clang driver] Spell "--export-dynamic-symbol" with two dashes.
Eli Friedman [Sat, 23 May 2020 22:46:28 +0000 (15:46 -0700)]
[clang driver] Spell "--export-dynamic-symbol" with two dashes.

This doesn't make a difference for linkers that support the option, but
it improves the error message from older linkers that don't support it.

4 years ago[TLI][PowerPC] Introduce TLI query to check if MULH is cheaper than MUL + SHIFT
Amy Kwan [Sat, 23 May 2020 21:46:33 +0000 (16:46 -0500)]
[TLI][PowerPC] Introduce TLI query to check if MULH is cheaper than MUL + SHIFT

This patch introduces a TargetLowering query, isMulhCheaperThanMulShift.

Currently in DAG Combine, it will transform mulhs/mulhu into a
wider multiply and a shift if the wide multiply is legal.

This TLI function is implemented on 64-bit PowerPC, as it is more desirable to
have multiply-high over multiply + shift for words and doublewords. Having
multiply-high can also aid in further transformations that can be done.

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

4 years ago[libcxx] Fix deprecation warning by suppressing deprecated around
zoecarver [Sat, 23 May 2020 21:32:12 +0000 (14:32 -0700)]
[libcxx] Fix deprecation warning by suppressing deprecated around
__test_has_construct.

In C++17 some tests started failing after a521532aa16df2c06c91488f2a4e787586f0a611. This fixes those errors by suppressing the deprecation warning when calling `construct` in `__test_has_construct`. This is the same solution as `__has_destroy_test` already uses.

Reviewers: ldionne, #libc!

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

4 years ago[CFIInstrInserter] Delete unneeded checks
Fangrui Song [Sat, 23 May 2020 21:00:33 +0000 (14:00 -0700)]
[CFIInstrInserter] Delete unneeded checks

4 years ago[NFC] Remove non-variadic overloads of allocator_traits::construct.
zoecarver [Sat, 23 May 2020 21:03:04 +0000 (14:03 -0700)]
[NFC] Remove non-variadic overloads of allocator_traits::construct.

Summary:
Libcxx only supports compilers with variadics. We can safely remove all "fake" variadic overloads of allocator_traits::construct.

This also provides the correct behavior if anything other than exactly one argument is supplied to allocator_traits::construct in C++03 mode.

Reviewers: ldionne, #libc!

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

4 years agoRevert "[lldb/Interpreter] Fix another eExpressionThreadVanished warning"
Jonas Devlieghere [Sat, 23 May 2020 20:37:46 +0000 (13:37 -0700)]
Revert "[lldb/Interpreter] Fix another eExpressionThreadVanished warning"

This reverts commit f2ffa33c79d3d0636d6c8eb7b5b7bcf8db7b397b. My local
checkout was behind and Eric already took care of it in the meantime.

4 years ago[lldb/Interpreter] Fix another eExpressionThreadVanished warning
Jonas Devlieghere [Sat, 23 May 2020 20:27:01 +0000 (13:27 -0700)]
[lldb/Interpreter] Fix another eExpressionThreadVanished warning

Fixes warning: enumeration value 'eExpressionThreadVanished' not handled
in switch [-Wswitch] in CommandInterpreter.cpp.

4 years ago[docs] Fix warnings in ConstantInterpreter
Jinsong Ji [Sat, 23 May 2020 19:01:37 +0000 (19:01 +0000)]
[docs] Fix warnings in ConstantInterpreter

Fixed following trivial issues that caught by warnings by adding
indents.

clang/docs/ConstantInterpreter.rst:133: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:136: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:153: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:195: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:225: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:370: WARNING: Bullet list ends
without a blank line; unexpected unindent.
clang/docs/ConstantInterpreter.rst:383: WARNING: Bullet list ends
without a blank line; unexpected unindent.

4 years ago[ValueTracking] Use assumptions in computeConstantRange.
Florian Hahn [Fri, 22 May 2020 18:16:15 +0000 (19:16 +0100)]
[ValueTracking] Use assumptions in computeConstantRange.

This patch updates computeConstantRange to optionally take an assumption
cache as argument and use the available assumptions to limit the range
of the result.

Currently this is limited to assumptions that are comparisons.

Reviewers: reames, nikic, spatel, jdoerfert, lebedev.ri

Reviewed By: nikic

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

4 years ago[DwarfEHPrepare] Don't prune unreachable resumes at optnone
Nikita Popov [Thu, 21 May 2020 17:40:43 +0000 (19:40 +0200)]
[DwarfEHPrepare] Don't prune unreachable resumes at optnone

Disable pruning of unreachable resumes in the DwarfEHPrepare pass
at optnone. While I expect the pruning itself to be essentially free,
this does require a dominator tree calculation, that is not used for
anything else. Saving this DT construction makes for a 0.4% O0
compile-time improvement.

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

4 years agoTargetLowering.h - remove unnecessary TargetMachine.h include. NFC
Simon Pilgrim [Sat, 23 May 2020 18:49:38 +0000 (19:49 +0100)]
TargetLowering.h - remove unnecessary TargetMachine.h include. NFC

Replace with forward declaration and move dependency down to source files that actually need it.

Both TargetLowering.h and TargetMachine.h are 2 of the most expensive headers (top 10) in the ClangBuildAnalyzer report when building llc.

4 years agoSimplifyCFG: Clean up optforfuzzing implementation
Matt Arsenault [Thu, 21 May 2020 00:05:07 +0000 (20:05 -0400)]
SimplifyCFG: Clean up optforfuzzing implementation

This should function as any other SimplifyCFGOption rather than having
the transform check and specially consider the attribute itself.

4 years agoAMDGPU: Refine rcp/rsq intrinsic folding for modern FP rules
Matt Arsenault [Fri, 22 May 2020 01:04:06 +0000 (21:04 -0400)]
AMDGPU: Refine rcp/rsq intrinsic folding for modern FP rules

We have to assume undef could be an snan, which would need quieting so
returning qnan is safer than undef. Also consider strictfp, and don't
care if the result rounded.