platform/upstream/llvm.git
4 years ago[libc++abi] Fix incorrect XFAILs for mis-aligned _Unwind_Exception on Apple
Louis Dionne [Wed, 3 Jun 2020 14:06:56 +0000 (10:06 -0400)]
[libc++abi] Fix incorrect XFAILs for mis-aligned _Unwind_Exception on Apple

The problem mentioned in the XFAILs has been resolved in macosx10.15, so
the test is now XPASSing on that platform.

rdar://63640184

4 years ago[llvm][SVE] IR intrinsic for LD1RO.
Francesco Petrogalli [Wed, 27 May 2020 19:58:04 +0000 (19:58 +0000)]
[llvm][SVE] IR intrinsic for LD1RO.

Reviewers: sdesmalen, efriedma

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

Tags: #llvm

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

4 years agoAdd support for `nullptr` in SyntaxTrees
Eduardo Caldas [Wed, 3 Jun 2020 13:34:25 +0000 (15:34 +0200)]
Add support for `nullptr` in SyntaxTrees

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[PowerPC] Replace subtract-from-zero float in version with fneg in PowerPC special...
Andrew Wock [Tue, 2 Jun 2020 17:42:48 +0000 (13:42 -0400)]
[PowerPC] Replace subtract-from-zero float in version with fneg in PowerPC special fma compiler builtins

This is a re-revert with a corrected test.

This patch adds a test for the PowerPC fma compiler builtins, some variations
of which negate inputs and outputs. The code to generate IR for these
builtins was untested before this patch.

Originally, the code used the outdated method of subtracting floating point
values from -0.0 as floating point negation. This patch remedies that.

Patch by: Drew Wock <drew.wock@sas.com>
Differential Revision: https://reviews.llvm.org/D76949

4 years ago[clangd] Add std::move() to a return statement to please some compilers.
Martin Boehme [Wed, 3 Jun 2020 11:07:13 +0000 (13:07 +0200)]
[clangd] Add std::move() to a return statement to please some compilers.

This has been causing build errors in Swift CI.

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

4 years ago[libc++] Remove the c++98 Lit feature from the test suite
Louis Dionne [Mon, 1 Jun 2020 14:38:23 +0000 (10:38 -0400)]
[libc++] Remove the c++98 Lit feature from the test suite

C++98 and C++03 are effectively aliases as far as Clang is concerned.
As such, allowing both std=c++98 and std=c++03 as Lit parameters is
just slightly confusing, but provides no value. It's similar to allowing
both std=c++17 and std=c++1z, which we don't do.

This was discovered because we had an internal bot that ran the test
suite under both c++98 AND c++03 -- one of which is redundant.

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

4 years ago[mlir] DialectConversion: remove vtable from TypeConverter
Alex Zinenko [Tue, 2 Jun 2020 11:35:43 +0000 (13:35 +0200)]
[mlir] DialectConversion: remove vtable from TypeConverter

The original design of TypeConverter expected specific converters to derive the
class and override virtual functions for conversions and materializations. This
did not scale well to multi-dialect conversions, so the design was changed to
register a list of converter and materializer functions, removing the need for
virtual functions. The only remaining virtual function, `convertSignatureArg`
is never overridden in-tree. Make it non-virtual, drop the virtual destructor
and thus remove vtable from TypeConverter.

If there exist TypeConverter users that need custom `convertSignatureArg`
behavior, it should be implemented using the callback registration mechanism
similar to that of conversions and materializations.

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

4 years ago[OPENMP]Fix PR46170: partial mapping for array sections of data members.
Alexey Bataev [Tue, 2 Jun 2020 18:26:28 +0000 (14:26 -0400)]
[OPENMP]Fix PR46170: partial mapping for array sections of data members.

Summary:
If the data member is mapped as an array section, need to emit the
pointer to the last element of this array section and use this pointer
as the highest element in partial struct data.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin

Tags: #clang

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

4 years agoReplaced C++2a with C++20 in clang-tools-extra
Dmitri Gribenko [Wed, 3 Jun 2020 12:53:59 +0000 (14:53 +0200)]
Replaced C++2a with C++20 in clang-tools-extra

Reviewers: hlopko, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: wuzish, aaron.ballman, nemanjai, kbarton, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[libcxx testing] Fix lingering bugs in notify_one.pass.cpp
David Zarzycki [Wed, 3 Jun 2020 12:44:45 +0000 (08:44 -0400)]
[libcxx testing] Fix lingering bugs in notify_one.pass.cpp

This test is arguably fatally flawed, at least as long as C++ condition
variables are just trivial wrappers around POSIX. I've added some notes
to the test for future authors to consider.

4 years ago[InstSimplify] add/move tests for or with not op (PR46083); NFC
Sanjay Patel [Wed, 3 Jun 2020 12:00:35 +0000 (08:00 -0400)]
[InstSimplify] add/move tests for or with not op (PR46083); NFC

4 years ago[VE] Support a basic disassembler for Aurora VE target
Kazushi (Jam) Marukawa [Wed, 3 Jun 2020 11:48:32 +0000 (13:48 +0200)]
[VE] Support a basic disassembler for Aurora VE target

Summary:
Add a basic disassember and regression tests of LEA/LD/ST
instructions.  This patch also removes DecoderMethod declarations for
branch and call since those are not implemented in this patch.  They
will be added again later.  This patch also corrects DecoderMethod for
LD/ST instructions for one byte or two.

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

4 years agoFix gcc "enumeral and non-enumeral type in conditional expression" warning. NFCI.
Simon Pilgrim [Wed, 3 Jun 2020 11:37:31 +0000 (12:37 +0100)]
Fix gcc "enumeral and non-enumeral type in conditional expression" warning. NFCI.

4 years ago[DAG] GetDemandedBits - don't bother asserting for a non-null cast<> result. NFC.
Simon Pilgrim [Wed, 3 Jun 2020 11:30:27 +0000 (12:30 +0100)]
[DAG] GetDemandedBits - don't bother asserting for a non-null cast<> result. NFC.

cast<> will assert on failure anyhow.

This lets us fold the cast<> with the getAPIntValue() that uses it.

4 years ago[clang][Sema] SequenceChecker: C++17 sequencing rule for call expressions.
Bruno Ricci [Wed, 3 Jun 2020 11:35:12 +0000 (12:35 +0100)]
[clang][Sema] SequenceChecker: C++17 sequencing rule for call expressions.

In C++17 the postfix-expression of a call expression is sequenced before
each expression in the expression-list and any default argument.

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

Reviewed By: rsmith

4 years agoRevert "[Dexter] Add DexLimitSteps command and ConditionalController"
Tom Weaver [Wed, 3 Jun 2020 11:28:26 +0000 (12:28 +0100)]
Revert "[Dexter] Add DexLimitSteps command and ConditionalController"

This reverts commit 81e836a5a675f6a3d9d35560fddbbb87fdf66201.

Accidentally committed a diff file.

4 years ago[lldb/cmake] Tweak descriptions of swig rules
Pavel Labath [Wed, 3 Jun 2020 11:10:00 +0000 (13:10 +0200)]
[lldb/cmake] Tweak descriptions of swig rules

This descriptions are printed while running the command, and so the
continuous tense is more appropriate and consistent.

4 years ago[Scalar] Fix assignment operator for long long.
Andy Yankovsky [Wed, 3 Jun 2020 11:08:00 +0000 (13:08 +0200)]
[Scalar] Fix assignment operator for long long.

Summary:
Assignment operator `operator=(long long)` currently allocates `sizeof(long)`.
On some platforms it works as they have `sizeof(long) == sizeof(long long)`,
but on others (e.g. Windows) it's not the case.

Reviewed By: labath

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

4 years ago[LLDB] skip TestCreateDuringInstructionStep on arm/linux
Muhammad Omair Javaid [Wed, 3 Jun 2020 09:46:20 +0000 (14:46 +0500)]
[LLDB] skip TestCreateDuringInstructionStep on arm/linux

There are sporadic failures in this test on arm. I am marking it
skipped as labath suggested flaky decorators no longer work.

4 years ago[VPlan] Support extracting lanes for defs managed in VPTransformState.
Florian Hahn [Wed, 3 Jun 2020 10:30:06 +0000 (11:30 +0100)]
[VPlan] Support extracting lanes for defs managed in VPTransformState.

Currently extracting a lane for a VPValue def is not supported, if it is
managed directly by VPTransformState (e.g. because it is created by a
VPInstruction or an external VPValue def).

For now, simply extract the requested lane. In the future, we should
also cache the extracted scalar values, similar to LV.

Reviewers: Ayal, rengolin, gilr, SjoerdMeijer

Reviewed By: SjoerdMeijer

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

4 years ago[gn build] Port add51e152aa
LLVM GN Syncbot [Wed, 3 Jun 2020 10:50:20 +0000 (10:50 +0000)]
[gn build] Port add51e152aa

4 years agoattempt to fix build after add51e152aa
Nico Weber [Wed, 3 Jun 2020 10:49:50 +0000 (06:49 -0400)]
attempt to fix build after add51e152aa

4 years ago[lldb] Pass fewer parameters by non-const reference to DWARFASTParserClang::ParseSing...
Raphael Isemann [Wed, 3 Jun 2020 08:34:11 +0000 (10:34 +0200)]
[lldb] Pass fewer parameters by non-const reference to DWARFASTParserClang::ParseSingleMember

These parameters are only passed on by value or const reference, so we should
do the same when calling this function.

4 years ago[AMDGPU] Fold llvm.amdgcn.cos and llvm.amdgcn.sin intrinsics (fix tests)
Jay Foad [Wed, 3 Jun 2020 10:36:09 +0000 (11:36 +0100)]
[AMDGPU] Fold llvm.amdgcn.cos and llvm.amdgcn.sin intrinsics (fix tests)

Try to fix Windows buildbots.

4 years ago[Clang][AArch64] Capturing proper pointer alignment for Neon vld1 intrinsicts
Lucas Prates [Tue, 5 May 2020 10:52:09 +0000 (11:52 +0100)]
[Clang][AArch64] Capturing proper pointer alignment for Neon vld1 intrinsicts

Summary:
During CodeGen for AArch64 Neon intrinsics, Clang was incorrectly
assuming all the pointers from which loads were being generated for vld1
intrinsics were aligned according to the intrinsics result type, causing
alignment faults on the code generated by the backend.

This patch updates vld1 intrinsics' CodeGen to properly capture the
correct load alignment based on the type of the pointer provided as
input for the intrinsic.

Reviewers: t.p.northover, ostannard, pcc, efriedma

Reviewed By: ostannard, efriedma

Subscribers: echristo, plotfi, nickdesaulniers, efriedma, kristof.beyls, danielkiss, cfe-commits

Tags: #clang

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

4 years ago[LangRef] Fix description of shape args for matrix.multiply.
Braedy Kuzma [Wed, 3 Jun 2020 10:23:16 +0000 (11:23 +0100)]
[LangRef] Fix description of shape args for matrix.multiply.

Currently all code instances within the matrix lowering pass consider
matrix A to be MxN and B to be NxK, producing C which is MxK. Anyone
interacting with this API after reading the docs but without reading the pass
would expect A: MxK, B: KxN, and C: MxN. These changes bring the documentation
in line with the implementation.

One point of concern with this, the original signature as described in the docs
may be better or at least more expected. The interface as it was written
reflected other common matrix multiplication interfaces such as BLAS'[1], where
the matrices are MxK, KxN, MxN respectively. Choosing to honor this requires
changing code and tests instead, but should be mostly just renaming of variables.

Patch by Braedy Kuzma <braedy@ualberta.ca>

[1] http://www.netlib.org/lapack/explore-html/db/dc9/group__single__blas__level3_gafe51bacb54592ff5de056acabd83c260.html#gafe51bacb54592ff5de056acabd83c260

Reviewers: anemet, LuoYuanke, nicolasvasilache, fhahn

Reviewed By: fhahn

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

4 years ago[clang-tidy] add new check readability-use-anyofallof
Matthias Gehre [Wed, 2 Oct 2019 22:39:46 +0000 (00:39 +0200)]
[clang-tidy] add new check readability-use-anyofallof

Summary:
Finds range-based for loops that can be replaced by a call to ``std::any_of`` or
``std::all_of``. In C++ 20 mode, suggests ``std::ranges::any_of`` or
``std::ranges::all_of``.
For now, no fixits are produced.

Reviewers: aaron.ballman, alexfh, hokein

Subscribers: mgorny, xazax.hun, cfe-commits

Tags: #clang

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

4 years agoFix MSVC "not all control paths return a value" warning. NFC.
Simon Pilgrim [Wed, 3 Jun 2020 10:10:18 +0000 (11:10 +0100)]
Fix MSVC "not all control paths return a value" warning. NFC.

Add llvm_unreachable after switch statement for CheckerRegistry::StateFromCmdLine enum

4 years agoTargetFrameLowering.h - remove unnecessary includes. NFC.
Simon Pilgrim [Tue, 2 Jun 2020 17:52:40 +0000 (18:52 +0100)]
TargetFrameLowering.h - remove unnecessary includes. NFC.

Move TargetFrameLowering.h include to the top of the TargetFrameLoweringImpl.cpp includes (clang-format doesn't do this by default as the filenames don't match).

4 years ago[mlir][Linalg] NFC - Make markers use Identifier instead of StringRef
Nicolas Vasilache [Tue, 2 Jun 2020 19:14:32 +0000 (15:14 -0400)]
[mlir][Linalg] NFC - Make markers use Identifier instead of StringRef

Summary: This removes string ownership worries by putting everything into the context and allows more constructing identifiers programmatically.

Reviewers: ftynse

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

Tags: #mlir

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

4 years ago[llvm] Fix unused variable warnings
Kadir Cetinkaya [Wed, 3 Jun 2020 09:49:01 +0000 (11:49 +0200)]
[llvm] Fix unused variable warnings

4 years ago[NFC,StackSafety] Fix template arg name
Vitaly Buka [Wed, 3 Jun 2020 09:38:49 +0000 (02:38 -0700)]
[NFC,StackSafety] Fix template arg name

4 years ago[CSInfo][MIPS][DwarfDebug] Add support for delay slots
Djordje Todorovic [Wed, 3 Jun 2020 08:37:41 +0000 (10:37 +0200)]
[CSInfo][MIPS][DwarfDebug] Add support for delay slots

This adds call site info support for call instructions with delay slot.
Search for instructions inside call delay slot, which load value
into parameter forwarding registers.
Return address of the call points to instruction after call delay slot,
which is not the one, immediately after the call instruction.

Patch by Nikola Tesic

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

4 years agoSplit syntax tree tests into more granular ones
Dmitri Gribenko [Wed, 3 Jun 2020 09:17:10 +0000 (11:17 +0200)]
Split syntax tree tests into more granular ones

Summary:
Doing so allows us to increase test coverage by removing unnecessary
language restrictions.

Reviewers: hlopko, eduucaldas

Reviewed By: hlopko, eduucaldas

Subscribers: gribozavr2, cfe-commits

Tags: #clang

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

4 years agoSyntax tree: ignore implicit expressions at the top level of statements
Dmitri Gribenko [Wed, 3 Jun 2020 08:50:57 +0000 (10:50 +0200)]
Syntax tree: ignore implicit expressions at the top level of statements

Summary:
I changed `markStmtChild` to ignore implicit expressions the same way as
`markExprChild` does it already. The test that I modified crashes
without this change.

Reviewers: hlopko, eduucaldas

Reviewed By: hlopko, eduucaldas

Subscribers: gribozavr2, cfe-commits

Tags: #clang

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

4 years ago[AMDGPU] Fold llvm.amdgcn.cos and llvm.amdgcn.sin intrinsics (fix)
Jay Foad [Wed, 3 Jun 2020 08:44:00 +0000 (09:44 +0100)]
[AMDGPU] Fold llvm.amdgcn.cos and llvm.amdgcn.sin intrinsics (fix)

Try to fix Windows buildbots.

4 years agoRevert "[Support] Add file lock/unlock functions"
Serge Pavlov [Wed, 3 Jun 2020 08:40:12 +0000 (15:40 +0700)]
Revert "[Support] Add file lock/unlock functions"

This reverts commit f51bc4fb60fbcef26d18eff549fc68307fd46489.
It broke the Solaris buildbots (Builder clang-solaris11-sparcv9 Build #5494
<http://lab.llvm.org:8014/builders/clang-solaris11-sparcv9/builds/54).

4 years ago[StackSafety,NFC] Convert to template internal stuff
Vitaly Buka [Tue, 2 Jun 2020 09:51:35 +0000 (02:51 -0700)]
[StackSafety,NFC] Convert to template internal stuff

It's going to be usefull for ThinLTO.

4 years ago[StackSafety,NFC] Rename internal class
Vitaly Buka [Tue, 2 Jun 2020 09:37:24 +0000 (02:37 -0700)]
[StackSafety,NFC] Rename internal class

4 years ago[AMDGPU] Fold llvm.amdgcn.cos and llvm.amdgcn.sin intrinsics
Jay Foad [Thu, 28 May 2020 09:29:16 +0000 (10:29 +0100)]
[AMDGPU] Fold llvm.amdgcn.cos and llvm.amdgcn.sin intrinsics

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

4 years ago[AMDGPU/MemOpsCluster] Code clean-up around accessing of memory operand width
hsmahesha [Wed, 3 Jun 2020 08:31:17 +0000 (14:01 +0530)]
[AMDGPU/MemOpsCluster] Code clean-up around accessing of memory operand width

Summary:
Clean-up the width computing logic given a memory operand, and re-arrange code to avoid
code duplication.

Reviewers: foad, rampitec, arsenm, vpykhtin, javedabsar

Reviewed By: foad

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

Tags: #llvm

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

4 years ago[gn build] Port 755a8959152
LLVM GN Syncbot [Wed, 3 Jun 2020 08:27:24 +0000 (08:27 +0000)]
[gn build] Port 755a8959152

4 years agoRevert "[WebAssembly] Eliminate range checks on br_tables"
Thomas Lively [Wed, 3 Jun 2020 08:26:53 +0000 (01:26 -0700)]
Revert "[WebAssembly] Eliminate range checks on br_tables"

This reverts commit f99d5f8c32a822580a732d15a34e8197da55d22b.
The change was causing UBSan and other failures on some bots.

4 years ago[clang-tidy] Added MacroDefiniton docs for readability-identifier-naming
Nathan James [Wed, 3 Jun 2020 08:23:32 +0000 (09:23 +0100)]
[clang-tidy] Added MacroDefiniton docs for readability-identifier-naming

Updates the docs to include `MacroDefinition` documentation. The docs are still missing `ObjCIVar` however I don't have a clue about how that looks in code. If someone wants to show the code block needed for the example I'll add that in too.

Reviewed By: aaron.ballman

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

4 years ago[StackSafety] Skip non-pointer parameters
Vitaly Buka [Mon, 1 Jun 2020 07:26:29 +0000 (00:26 -0700)]
[StackSafety] Skip non-pointer parameters

Summary: Depends on D80908.

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[NFC, StackSafety] Change type of internal container
Vitaly Buka [Fri, 29 May 2020 22:10:50 +0000 (15:10 -0700)]
[NFC, StackSafety] Change type of internal container

Summary: Depends on D80771.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: mehdi_amini, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Driver] Add negative option for -fkeep-static-consts
Shengchen Kan [Wed, 3 Jun 2020 06:54:56 +0000 (14:54 +0800)]
[Driver] Add negative option for -fkeep-static-consts

4 years ago[NFC][PowerPC] Remove unused node PPCISD::VMADDFP and PPCISD::VNMSUBFP
QingShan Zhang [Wed, 3 Jun 2020 06:32:53 +0000 (06:32 +0000)]
[NFC][PowerPC] Remove unused node PPCISD::VMADDFP and PPCISD::VNMSUBFP

These two nodes were added by 69caef2b781130a7d0eeaf8898eb346b6423ae03 in 2005
and they are not used by PowerPC backend anymore. And the ISD::FMA is a prefer
way for VMADDFP if we really want to create that node. For VNMSUBFP, we will
also add a more generic node FNMSUB in D76585 if we really want it.

Reviewed By: qiucf

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

4 years ago[CodeGen] Fix warnings in getPackedVectorTypeFromPredicateType
David Sherwood [Tue, 26 May 2020 15:33:06 +0000 (16:33 +0100)]
[CodeGen] Fix warnings in getPackedVectorTypeFromPredicateType

Use getVectorElementCount() instead of getVectorNumElements().
The code changed in this patch is covered by an existing test:

  CodeGen/AArch64/sve-intrinsics-contiguous-prefetches.ll

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

4 years ago[X86] Add CLWB to Tremont CPU. Remove CLDEMOTE, MOVDIRI, MOVDIR64B, and WAITPKG to...
Craig Topper [Wed, 3 Jun 2020 05:21:12 +0000 (22:21 -0700)]
[X86] Add CLWB to Tremont CPU. Remove CLDEMOTE, MOVDIRI, MOVDIR64B, and WAITPKG to match gcc.

4 years ago[Support] Add file lock/unlock functions
Serge Pavlov [Wed, 22 Apr 2020 16:00:12 +0000 (23:00 +0700)]
[Support] Add file lock/unlock functions

New functions `lockFile`, `tryLockFile` and `unlockFile` implement
simple file locking. They lock or unlock entire file. This must be
enough to support simulataneous writes to log files in parallel builds.

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

4 years ago[flang] Implemented 2 Semantic checks for DATA statement and fixed a few bugs
Anchu Rajendran [Wed, 3 Jun 2020 04:56:10 +0000 (10:26 +0530)]
[flang] Implemented 2 Semantic checks for DATA statement and fixed a few bugs

Summary
  - Implemented C876, C877
  - Fixed IsConstantExpr to check C879
  - Fixed bugs in few test cases - data01.f90, block-data01.f90,
  pre-fir-tree02.f90
  - Modified implementation of C8106 to identify all automatic objects
  and modified equivalence01.f90 to reflect the changes

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

4 years ago[lldb/Interpreter] Remove redundant argument (NFC)
Jonas Devlieghere [Wed, 3 Jun 2020 04:21:20 +0000 (21:21 -0700)]
[lldb/Interpreter] Remove redundant argument (NFC)

4 years agoFix build: TableGen uses `is<T>` instead of `isa<T>` as predicate
Mehdi Amini [Wed, 3 Jun 2020 04:05:47 +0000 (04:05 +0000)]
Fix build: TableGen uses `is<T>` instead of `isa<T>` as predicate

4 years ago[AMDGPU] Make SGPR spills exec mask agnostic
Carl Ritson [Wed, 3 Jun 2020 03:34:17 +0000 (12:34 +0900)]
[AMDGPU] Make SGPR spills exec mask agnostic

Explicitly set the exec mask for SGPR spills and reloads.
This fixes a bug where SGPR spills to memory could be incorrect
if the exec mask was 0 (or differed between spill and reload).

Additionally pack scalar subregisters (upto 16/32 per VGPR),
so that the majority of scalar types can be spilt or reloaded
with a simple memory access.  This should amortize some of the
additional overhead of manipulating the exec mask.

Reviewed By: arsenm

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

4 years agoReplace dyn_cast<>() with isa<>() when the result isn't used (NFC)
Mehdi Amini [Wed, 3 Jun 2020 03:09:45 +0000 (03:09 +0000)]
Replace dyn_cast<>() with isa<>() when the result isn't used (NFC)

Fixed warning reported by some GCC version.

4 years agoRevert "[NFC, StackSafety] Change type of internal container"
Mehdi Amini [Wed, 3 Jun 2020 03:02:28 +0000 (03:02 +0000)]
Revert "[NFC, StackSafety] Change type of internal container"

This reverts commit f62813e7eae148a6175de28bfa384524a9f2bf94.
GCC 5.3 build is broken.

4 years ago[AArch64][GlobalISel] Select zip1 and zip2
Jessica Paquette [Tue, 2 Jun 2020 00:23:20 +0000 (17:23 -0700)]
[AArch64][GlobalISel] Select zip1 and zip2

Port the code to recognize a zip1/zip2 shuffle mask from AArch64ISelLowering
and put it into the post-legalizer combiner.

Add G_ZIP1 and G_ZIP2 to AArch64InstrGISel.td and hook them up as equivalent
nodes to AArch64zip1 and AArch64zip2. This allows us to select them.

Minor code size improvements for SPECINT2000 at -O3 on 197.parser, 252.eon, and
186.crafty.

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

4 years ago[JumpThreading] Simplify FindMostPopularDest (NFC)
Kazu Hirata [Wed, 3 Jun 2020 01:43:09 +0000 (18:43 -0700)]
[JumpThreading] Simplify FindMostPopularDest (NFC)

Summary:
This patch simplifies FindMostPopularDest without changing the
functionality.

Given a list of jump threading destinations, the function finds the
most popular destination.  To ensure determinism when there are
multiple destinations with the highest popularity, the function picks
the first one in the successor list with the highest popularity.

Without this patch:

- The function populates DestPopularity -- a histogram mapping
  destinations to their respective occurrence counts.

- Then we iterate over DestPopularity, looking for the highest
  popularity while building a vector of destinations with the highest
  popularity.

- Finally, we iterate the successor list, looking for the destination
  with the highest popularity.

With this patch:

- We implement DestPopularity with MapVector instead of DenseMap.  We
  populate the map with popularity 0 for all successors in the order
  they appear in the successor list.

- We build the histogram in the same way as before.

- We simply use std::max_element on DestPopularity to find the most
  popular destination.  The use of MapVector ensures determinism.

Reviewers: wmi, efriedma

Reviewed By: wmi

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC,MTE] Drop unneeded attribute from test
Vitaly Buka [Fri, 29 May 2020 21:19:11 +0000 (14:19 -0700)]
[NFC,MTE] Drop unneeded attribute from test

Summary: Depends on D80847.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: hiraditya, steven_wu, dexonsmith, cfe-commits

Tags: #clang

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

4 years ago[NFC, StackSafety] Change type of internal container
Vitaly Buka [Fri, 29 May 2020 22:10:50 +0000 (15:10 -0700)]
[NFC, StackSafety] Change type of internal container

Summary: Depends on D80771.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[MTE] Move tagging in pipeline
Vitaly Buka [Fri, 29 May 2020 07:56:30 +0000 (00:56 -0700)]
[MTE] Move tagging in pipeline

Summary:
This removes two analyses from pipeline.

Depends on D80771.

Reviewers: eugenis

Reviewed By: eugenis

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[SampleFDO] Add use-sample-profile function attribute.
Wei Mi [Thu, 14 May 2020 19:05:49 +0000 (12:05 -0700)]
[SampleFDO] Add use-sample-profile function attribute.

When sampleFDO is enabled, people may expect they can use
-fno-profile-sample-use to opt-out using sample profile for a certain file.
That could be either for debugging purpose or for performance tuning purpose.
However, when thinlto is enabled, if a function in file A compiled with
-fno-profile-sample-use is imported to another file B compiled with
-fprofile-sample-use, the inlined copy of the function in file B may still
get its profile annotated.

The inconsistency may even introduce profile unused warning because if the
target is not compiled with explicit debug information flag, the function
in file A won't have its debug information enabled (debug information will
be enabled implicitly only when -fprofile-sample-use is used). After it is
imported into file B which is compiled with -fprofile-sample-use, profile
annotation for the outline copy of the function will fail because the
function has no debug information, and that will trigger  profile unused
warning.

We add a new attribute use-sample-profile to control whether a function
will use its sample profile no matter for its outline or inline copies.
That will make the behavior of -fno-profile-sample-use consistent.

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

4 years agoRemove redundant code (NFC)
Adrian Prantl [Tue, 2 Jun 2020 23:37:59 +0000 (16:37 -0700)]
Remove redundant code (NFC)

This has no effect on the testsuite and was only needed in an early
prototype from before debugserver was able to report the correct
platform.

4 years ago[lldb/Test] Don't use the env to pass around configuration variables (NFC)
Jonas Devlieghere [Tue, 2 Jun 2020 23:49:03 +0000 (16:49 -0700)]
[lldb/Test] Don't use the env to pass around configuration variables (NFC)

Don't use the environment to pass values to the builder. Use the
configuration instead.

4 years ago[lldb/Test] Pass Make arguments in invocation instead of environment
Jonas Devlieghere [Tue, 2 Jun 2020 23:40:07 +0000 (16:40 -0700)]
[lldb/Test] Pass Make arguments in invocation instead of environment

The Darwin builder is passing some of the make arguments trough the
environment instead of the command line. Update the dsym builder to do
the same as the other variants.

4 years ago[mlir][spirv] Fix coop matrix getExtension
Thomas Raoux [Tue, 2 Jun 2020 23:30:43 +0000 (16:30 -0700)]
[mlir][spirv] Fix coop matrix getExtension

Stack variable was being used beyond its lifetime.

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

4 years ago[mlir][spirv] Fix encoding of cooperative matrix type to match SPIRV spec
Thomas Raoux [Tue, 2 Jun 2020 23:14:24 +0000 (16:14 -0700)]
[mlir][spirv] Fix encoding of cooperative matrix type to match SPIRV spec

Scope, rows and columns need to be encoded in a separate constant operation.

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

4 years ago[X86] Add a flag to guard the wide load
Guozhi Wei [Tue, 2 Jun 2020 23:12:50 +0000 (16:12 -0700)]
[X86] Add a flag to guard the wide load

As shown in http://lists.llvm.org/pipermail/llvm-dev/2020-May/141854.html,
widen load can also cause stall. Add a flag to guard the widening code,
so users can disable it and evaluate its performance impact.

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

4 years ago[lldb/Test] Don't use the env to pass around configuration variables (NFC)
Jonas Devlieghere [Tue, 2 Jun 2020 23:08:11 +0000 (16:08 -0700)]
[lldb/Test] Don't use the env to pass around configuration variables (NFC)

Don't use the environment to pass values to the builder that are present
in the dotest configuration module. A subsequent patch will pass the
remaining values through the configuration instead of the environment.

4 years ago[MTE] Convert StackSafety into analysis
Vitaly Buka [Fri, 29 May 2020 00:26:15 +0000 (17:26 -0700)]
[MTE] Convert StackSafety into analysis

This lets us to remove !stack-safe metadata and
better controll when to perform StackSafety
analysis.

Reviewers: eugenis

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

Tags: #clang, #llvm

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

4 years ago[StackSafety] Delete useless test
Vitaly Buka [Mon, 1 Jun 2020 07:21:55 +0000 (00:21 -0700)]
[StackSafety] Delete useless test

4 years ago[Analyzer][NFC] Fix markup in WebKit checkers documentation
Jan Korous [Tue, 2 Jun 2020 23:03:24 +0000 (16:03 -0700)]
[Analyzer][NFC] Fix markup in WebKit checkers documentation

4 years ago[Clang][A32/T32][Linux] -O1 implies -fomit-frame-pointer
Nick Desaulniers [Tue, 2 Jun 2020 22:54:09 +0000 (15:54 -0700)]
[Clang][A32/T32][Linux] -O1 implies -fomit-frame-pointer

Summary:
An upgrade of LLVM for CrOS [0] containing [1] triggered a bunch of
errors related to writing to reserved registers for a Linux kernel's
arm64 compat vdso (which is a aarch32 image).

After a discussion on LKML [2], it was determined that
-f{no-}omit-frame-pointer was not being specified. Comparing GCC and
Clang [3], it becomes apparent that GCC defaults to omitting the frame
pointer implicitly when optimizations are enabled, and Clang does not.
ie. setting -O1 (or above) implies -fomit-frame-pointer. Clang was
defaulting to -fno-omit-frame-pointer implicitly unless -fomit-frame-pointer
was set explicitly.

Why this becomes a problem is that the Linux kernel's arm64 compat vdso
contains code that uses r7. r7 is used sometimes for the frame pointer
(for example, when targeting thumb (-mthumb)). See useR7AsFramePointer()
in llvm/llvm-project/llvm/lib/Target/ARM/ARMSubtarget.h. This is mostly
for legacy/compatibility reasons, and the 2019 Q4 revision of the ARM
AAPCS looks to standardize r11 as the frame pointer for aarch32, though
this is not yet implemented in LLVM.

Users that are reliant on the implicit value if unspecified when
optimizations are enabled should explicitly choose -fomit-frame-pointer
(new behavior) or -fno-omit-frame-pointer (old behavior).

[0] https://bugs.chromium.org/p/chromium/issues/detail?id=1084372
[1] https://reviews.llvm.org/D76848
[2] https://lore.kernel.org/lkml/20200526173117.155339-1-ndesaulniers@google.com/
[3] https://godbolt.org/z/0oY39t

Reviewers: kristof.beyls, psmith, danalbert, srhines, MaskRay, ostannard, efriedma

Reviewed By: psmith, danalbert, srhines, MaskRay, efriedma

Subscribers: efriedma, olista01, MaskRay, vhscampos, cfe-commits, llvm-commits, manojgupta, llozano, glider, hctim, eugenis, pcc, peter.smith, srhines

Tags: #clang, #llvm

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

4 years ago[mlir][Affine] Enable fusion of loops with vector loads/stores
Diego Caballero [Tue, 2 Jun 2020 22:10:47 +0000 (01:10 +0300)]
[mlir][Affine] Enable fusion of loops with vector loads/stores

This patch enables affine loop fusion for loops with affine vector loads
and stores. For that, we only had to use affine memory op interfaces in
LoopFusionUtils.cpp and Utils.cpp so that vector loads and stores are
also taken into account.

Reviewed By: andydavis1, ftynse

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

4 years ago[lld-macho] Fix PAGEZERO=4GB errors on Windows by ensuring enum is uint64_t
Jez Ng [Tue, 2 Jun 2020 22:22:45 +0000 (15:22 -0700)]
[lld-macho] Fix PAGEZERO=4GB errors on Windows by ensuring enum is uint64_t

It appears that MSVC doesn't resize the enum properly to fit the
constants.

4 years agoUndo initialization of TRI in CGP as this is unconditionally initialized
Eric Christopher [Tue, 2 Jun 2020 22:05:54 +0000 (15:05 -0700)]
Undo initialization of TRI in CGP as this is unconditionally initialized
later.

4 years ago[mlir] NFC - Add AffineMinMaxOpBase getDim/SymbolOperands
Nicolas Vasilache [Tue, 2 Jun 2020 22:04:10 +0000 (18:04 -0400)]
[mlir] NFC - Add AffineMinMaxOpBase getDim/SymbolOperands

4 years agoUndo removal of test for dr777.
Richard Smith [Tue, 2 Jun 2020 20:51:35 +0000 (13:51 -0700)]
Undo removal of test for dr777.

4 years ago[X86] Remove DeleteNode calls from PreprocessISelDAG. Rely on the RemoveDeadNodes...
Craig Topper [Tue, 2 Jun 2020 20:54:10 +0000 (13:54 -0700)]
[X86] Remove DeleteNode calls from PreprocessISelDAG. Rely on the RemoveDeadNodes call at the end.

Add a MadeChange flag so we don't call RemoveDeadNodes unless
something changed.

4 years ago[LLD] Have only one SpecificAllocator per type
Reid Kleckner [Tue, 2 Jun 2020 20:58:50 +0000 (13:58 -0700)]
[LLD] Have only one SpecificAllocator per type

Previously, the SpecificAllocator was a static local in the `make<T>`
function template. Using static locals is nice because they are only
constructed and registered if they are accessed. However, if there are
multiple calls to make<> with different constructor parameters, we would
get multiple static local variable instances. This is undesirable and
leads to extra memory allocations. I noticed there were two sources of
DefinedRegular allocations while checking heap profiles.

4 years ago[X86] Cleanup inconsistencies in our zext/sext vector patterns.
Craig Topper [Tue, 2 Jun 2020 19:24:26 +0000 (12:24 -0700)]
[X86] Cleanup inconsistencies in our zext/sext vector patterns.

-Fix one place where we had a X86vzload64 but should have had
 X86vzload32.
-Make sure all patterns that have scalar_to_vector+loadi64 also
have scalar_to_vector+f64 to match 32-bit codegen.
-Add some bitcasts that were missing from patterns.
-Make sure that if we have a scalar_to_vector+load pattern
 we also have a vzload pattern.

We probably need some better canonicalization to avoid having
so many patterns.

4 years agoPR23029 / C++ DR2233: Allow expanded parameter packs to follow
Richard Smith [Tue, 2 Jun 2020 17:42:36 +0000 (10:42 -0700)]
PR23029 / C++ DR2233: Allow expanded parameter packs to follow
parameters with default arguments.

Directly follow the wording by relaxing the AST invariant that all
parameters after one with a default arguemnt also have default
arguments, and removing the diagnostic on missing default arguments
on a pack-expanded parameter following a parameter with a default
argument.

Testing also revealed that we need to special-case explicit
specializations of templates with a pack following a parameter with a
default argument, as such explicit specializations are otherwise
impossible to write. The standard wording doesn't address this case; a
issue has been filed.

This exposed a bug where we would briefly consider a parameter to have
no default argument while we parse a delay-parsed default argument for
that parameter, which is also fixed.

Partially incorporates a patch by Raul Tambre.

4 years ago[llvm] Fix unused variable warning
Kadir Cetinkaya [Tue, 2 Jun 2020 20:46:24 +0000 (22:46 +0200)]
[llvm] Fix unused variable warning

4 years ago[gn build] Port f99d5f8c32a
LLVM GN Syncbot [Tue, 2 Jun 2020 20:36:52 +0000 (20:36 +0000)]
[gn build] Port f99d5f8c32a

4 years ago[libc] Remove integration test target from check libc.
Paula Toth [Tue, 2 Jun 2020 20:25:03 +0000 (13:25 -0700)]
[libc] Remove integration test target from check libc.

Summary:
This is failing on the asan build because we use `-nostdlib`.
I also took this opportunity to make the target name match the naming structure we've been using.

Reviewers: sivachandra

Reviewed By: sivachandra

Subscribers: mgorny, tschuett, ecnelises, libc-commits

Tags: #libc-project

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

4 years ago[mlir][spirv] Add support for matrix type
HazemAbdelhafez [Tue, 2 Jun 2020 20:22:38 +0000 (16:22 -0400)]
[mlir][spirv] Add support for matrix type

This commit adds basic matrix type support to the SPIR-V dialect
including type definition, IR assembly, parsing, printing, and
(de)serialization.

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

4 years agoFix up clang-tidy warnings around null and pointers.
Eric Christopher [Tue, 2 Jun 2020 20:23:41 +0000 (13:23 -0700)]
Fix up clang-tidy warnings around null and pointers.

4 years ago[DAGCombiner] Combine shifts into multiply-high
Amy Kwan [Tue, 2 Jun 2020 18:01:27 +0000 (13:01 -0500)]
[DAGCombiner] Combine shifts into multiply-high

This patch implements a target independent DAG combine to produce multiply-high
instructions from shifts. This DAG combine will combine shifts for any type as
long as the MULH on the narrow type is legal.

For now, it is enabled on PowerPC as PowerPC is the only target that has an
implementation of the isMulhCheaperThanMulShift TLI hook introduced in
D78271.

Moreover, this DAG combine focuses on catching the pattern:
(shift (mul (ext <narrow_type>:$a to <wide_type>), (ext <narrow_type>:$b to <wide_type>)), <narrow_width>)
to produce mulhs when we have a sign-extend, and mulhu when we have
a zero-extend.

The patch performs the following checks:
- Operation is a right shift arithmetic (sra) or logical (srl)
- Input to the shift is a multiply
- Both operands to the shift are sext/zext nodes
- The extends into the multiply are both the same
- The narrow type is half the width of the wide type
- The shift amount is the width of the narrow type
- The respective mulh operation is legal

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

4 years ago[Driver] Add multiclass OptInFlag and OptOutFlag to simplify boolean option definition
Fangrui Song [Tue, 2 Jun 2020 20:16:44 +0000 (13:16 -0700)]
[Driver] Add multiclass OptInFlag and OptOutFlag to simplify boolean option definition

Reviewed By: dblaikie, echristo

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

4 years ago[NFC][ASTMatchers] StringRef-ify and Twine-ify ASTMatchers tests.
Nathan James [Tue, 2 Jun 2020 20:20:58 +0000 (21:20 +0100)]
[NFC][ASTMatchers] StringRef-ify and Twine-ify ASTMatchers tests.

4 years ago[lld-macho] Ensure reads from nlist_64 structs are aligned when necessary
Jez Ng [Thu, 21 May 2020 22:26:35 +0000 (15:26 -0700)]
[lld-macho] Ensure reads from nlist_64 structs are aligned when necessary

My test refactoring in D80217 seems to have caused yaml2obj to emit
unaligned nlist_64 structs, causing ASAN'd lld to be unhappy. I don't
think this is an issue with yaml2obj though -- llvm-mc also seems to
emit unaligned nlist_64s. This diff makes lld able to safely do aligned
reads under ASAN builds while hopefully creating no overhead for regular
builds on architectures that support unaligned reads.

Reviewed By: thakis

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

4 years ago[lld-macho] Move all tests for erroneous inputs under invalid/
Jez Ng [Tue, 19 May 2020 14:57:14 +0000 (07:57 -0700)]
[lld-macho] Move all tests for erroneous inputs under invalid/

For consistency.

The no-id-dylib test was originally referencing the Inputs/ folder via a
relative path. Instead of updating that path, I decided to make the test
self-contained.

Reviewed By: MaskRay

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

4 years ago[lld-macho] Set __PAGEZERO size to 4GB
Jez Ng [Tue, 19 May 2020 03:28:50 +0000 (20:28 -0700)]
[lld-macho] Set __PAGEZERO size to 4GB

That's what ld64 uses for 64-bit targets. I figured it's best to make
this change sooner rather than later since a bunch of our tests are
relying on hardcoded addresses that depend on this value.

Reviewed By: smeenai

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

4 years ago[lld-macho] Error on encountering undefined symbols
Jez Ng [Mon, 18 May 2020 22:46:33 +0000 (15:46 -0700)]
[lld-macho] Error on encountering undefined symbols

... instead of silently emitting a reference to the zero address.

Reviewed By: smeenai

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

4 years ago[lld-macho] Add some relocation validation logic
Jez Ng [Fri, 15 May 2020 20:42:28 +0000 (13:42 -0700)]
[lld-macho] Add some relocation validation logic

I considered making a `Target::validate()` method, but I wasn't sure how
I felt about the overhead of doing yet another switch-dispatch on the
relocation type, so I put the validation in `relocateOne` instead...
might be a bit of a micro-optimization, but `relocateOne` does assume
certain things about the relocations it gets, and this error handling
makes that explicit, so it's not a totally unreasonable code
organization.

Reviewed By: smeenai

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

4 years agoFix test on PS4 linux bot.
Douglas Yung [Tue, 2 Jun 2020 20:14:09 +0000 (20:14 +0000)]
Fix test on PS4 linux bot.

Commit 301a6da8c24a09052e3bda10e90b450b7b39ffea changed the test and modified a CHECK
line that is inconsisent with similar lines elsewhere in the file and was causing failures
when run in slightly different configurations. This change makes the line more consistent
and should fix the bot failure.

link: http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/68593
4 years ago[WebAssembly] Eliminate range checks on br_tables
Thomas Lively [Tue, 2 Jun 2020 20:14:27 +0000 (13:14 -0700)]
[WebAssembly] Eliminate range checks on br_tables

Summary:
Jump tables for most targets cannot handle out of range indices by
themselves, so LLVM emits range checks to guard the jump
tables. WebAssembly, on the other hand, implements jump tables using
the br_table instruction, which takes a default branch target as an
operand, making the range checks redundant. This patch introduces a
new MachineFunction pass in the WebAssembly backend to find and
eliminate the redundant range checks.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

4 years ago[Analyzer][WebKit] Check record definition is available in NoUncountedMembers checker
Jan Korous [Tue, 2 Jun 2020 17:17:01 +0000 (10:17 -0700)]
[Analyzer][WebKit] Check record definition is available in NoUncountedMembers checker

isRefCountable asserts that the record passed as an argument has a definition available.

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

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

4 years ago[RISCV-V] Provide muldi3 builtin assembly implementation
kamlesh kumar [Tue, 2 Jun 2020 19:48:30 +0000 (20:48 +0100)]
[RISCV-V] Provide muldi3 builtin assembly implementation

Provides an assembly implementation of muldi3 for RISC-V, to solve bug 43388.
Since the implementation is the same as for mulsi3, that code was moved to
`riscv/int_mul_impl.inc` and is now reused by both `mulsi3.S` and `muldi3.S`.

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