platform/upstream/llvm.git
3 years agoFix typo in llvm/lib/Target/README.txt
Siddhesh Poyarekar [Wed, 9 Dec 2020 08:29:06 +0000 (09:29 +0100)]
Fix typo in llvm/lib/Target/README.txt

Trivial typo, replace __builtin_objectsize with __builtin_object_size.

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

3 years ago[compiler-rt sanitizer] Use our own PTRACE_GETREGSET if it does not exist.
Jeroen Dobbelaere [Wed, 9 Dec 2020 08:59:47 +0000 (00:59 -0800)]
[compiler-rt sanitizer] Use our own PTRACE_GETREGSET if it does not exist.

On RH66 does not support 'PTRACE_GETREGSET'. This change makes this part of compiler-rt build again on older os-es

Reviewed By: vitalybuka

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

3 years ago[lldb] Fix a failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.
Haojian Wu [Wed, 9 Dec 2020 08:32:13 +0000 (09:32 +0100)]
[lldb] Fix a failure test after 843f2dbf003f2a51d0d4ab8cf40647c99ded2e93.

The behavior of -gsplit-dwarf is changed because of the new commit.

Restore the old behavior by replacing -gsplit-dwarf with -gsplit-dwarf -g.

3 years ago[clang][cli] CompilerInvocationTest: add tests for boolean options
Jan Svoboda [Tue, 8 Dec 2020 11:29:14 +0000 (12:29 +0100)]
[clang][cli] CompilerInvocationTest: add tests for boolean options

Add more tests of the command line marshalling infrastructure.

The new tests now make a "round-trip": from arguments, to CompilerInvocation instance to arguments again in a single test case.

The TODOs are resolved in a follow-up patch.

Depends on D92830.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: join and add test cases
Jan Svoboda [Tue, 8 Dec 2020 11:15:35 +0000 (12:15 +0100)]
[clang][cli] CompilerInvocationTest: join and add test cases

Depends on D92829.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: check arg parsing does not produce diagnostics
Jan Svoboda [Tue, 8 Dec 2020 09:52:31 +0000 (10:52 +0100)]
[clang][cli] CompilerInvocationTest: check arg parsing does not produce diagnostics

Depends on D92828.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: remove unnecessary command line arguments
Jan Svoboda [Tue, 8 Dec 2020 09:44:03 +0000 (10:44 +0100)]
[clang][cli] CompilerInvocationTest: remove unnecessary command line arguments

Depends on D92827.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: split enum test into two
Jan Svoboda [Tue, 8 Dec 2020 09:37:16 +0000 (10:37 +0100)]
[clang][cli] CompilerInvocationTest: split enum test into two

Depends on D92826.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: rename member variable in fixture
Jan Svoboda [Tue, 8 Dec 2020 09:31:12 +0000 (10:31 +0100)]
[clang][cli] CompilerInvocationTest: rename member variable in fixture

Depends on D92825.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] CompilerInvocationTest: join two test fixtures into one
Jan Svoboda [Tue, 8 Dec 2020 09:28:18 +0000 (10:28 +0100)]
[clang][cli] CompilerInvocationTest: join two test fixtures into one

Reviewed By: dexonsmith

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

3 years ago[ARM] Common inverse constant predicates to VPNOT
David Green [Wed, 9 Dec 2020 07:56:45 +0000 (07:56 +0000)]
[ARM] Common inverse constant predicates to VPNOT

This scans through blocks looking for constants used as predicates in
MVE instructions. When two constants are found which are the inverse of
one another, the second can be replaced by a VPNOT of the first,
potentially allowing that not to be folded away into an else predicate
of a vpt block.

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

3 years ago[lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)
Dave Lee [Mon, 7 Dec 2020 18:38:14 +0000 (10:38 -0800)]
[lldb] Remove unused IsFunctionType is_variadic_ptr parameter (NFC)

`is_variadic_ptr` is unused.

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

3 years ago[ARM] Constant Mask VPT block tests. NFC
David Green [Wed, 9 Dec 2020 07:44:49 +0000 (07:44 +0000)]
[ARM] Constant Mask VPT block tests. NFC

3 years ago[RISCV] Use SDLoc created early in RISCVDAGToDAGISel::Select instead of recreating...
Craig Topper [Wed, 9 Dec 2020 05:12:34 +0000 (21:12 -0800)]
[RISCV] Use SDLoc created early in RISCVDAGToDAGISel::Select instead of recreating it in multiple cases in the switch. NFC

3 years ago[lldb] Fix -Wformat warning in debugserver unit test
Jonas Devlieghere [Wed, 9 Dec 2020 03:30:10 +0000 (19:30 -0800)]
[lldb] Fix -Wformat warning in debugserver unit test

RNBSocketTest.cpp:31:35: warning: format specifies type 'char *' but the
argument has type 'const void *' [-Wformat]

3 years ago[RISCV] Add a table showing the layout of the fields in VTYPE. Rename MaskedOffAgnost...
Craig Topper [Wed, 9 Dec 2020 04:40:15 +0000 (20:40 -0800)]
[RISCV] Add a table showing the layout of the fields in VTYPE. Rename MaskedOffAgnostic->MaskAgnostic. NFC

3 years ago[PowerPC] Set SubRegIndex offset for sub_vsx1/sub_pair1
Jinsong Ji [Wed, 9 Dec 2020 03:29:38 +0000 (22:29 -0500)]
[PowerPC] Set SubRegIndex offset for sub_vsx1/sub_pair1

We defined SubRegIndex for 256/512 regs,
but we did not set the offset for higher part,
so the offset of lower and higher part are the same.
This may cause problem in assessing ranges of SubReg,
it is great that this haven't affected any testcases,
but I think we should fix it to avoid hidden bugs in the future.

Reviewed By: bsaleil, #powerpc

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

3 years ago[PowerPC] Precommit testcases for regpressure compute fix
Jinsong Ji [Wed, 9 Dec 2020 03:15:45 +0000 (03:15 +0000)]
[PowerPC] Precommit testcases for regpressure compute fix

3 years agoFix MLIR Python bindings build after changes to the C API to use StringRef (NFC)
Mehdi Amini [Wed, 9 Dec 2020 03:26:37 +0000 (03:26 +0000)]
Fix MLIR Python bindings build after changes to the C API to use StringRef (NFC)

3 years ago[MemorySSA] Remove unused declaration determineInsertionPoint (NFC)
Kazu Hirata [Wed, 9 Dec 2020 03:21:44 +0000 (19:21 -0800)]
[MemorySSA] Remove unused declaration determineInsertionPoint (NFC)

The declaration was introduced without a corresponding definition on
Feb 2, 2016 in commit e1100f533f0a48f55e80e1152b06f5deab5f9b30.

3 years ago[IR] Use llvm::is_contained (NFC)
Kazu Hirata [Wed, 9 Dec 2020 03:06:37 +0000 (19:06 -0800)]
[IR] Use llvm::is_contained (NFC)

3 years ago[WebAssembly] Fix code generated for atomic operations in PIC mode
Sam Clegg [Mon, 7 Dec 2020 05:13:55 +0000 (21:13 -0800)]
[WebAssembly] Fix code generated for atomic operations in PIC mode

The main this this test does is to add the `IsNotPIC` predicate to the
all the atomic instructions pattern that directly refer to
`tglobaladdr`.

This is because in PIC mode we need to generate separate instruction
sequence (either a direct global.get, or __memory_base + offset) for
accessing global addresses.

As part of this change I noticed that many of the `Requires` attributes
added to the instruction in `WebAssemblyInstrAtomics.td` were being
honored.  This is because the wrapped in a `let Predicates =
[HasAtomics]` block and it seems that that outer wrapping overrides any
`Requires` on defs within it.   As a workaround I removed the outer
`let` and added `HasAtomics` to all the inner `Requires`.  I believe
that all the instrucitons that don't have `Requires` explicit bottom out
in `ATOMIC_I` and `ATOMIC_NRI` which have `HasAtomics` so this should
not remove this predicate from any patterns (at least that is the idea).

The alternative to this approach looks like implementing something
like `PredicateControl` in `Mips.td` where we can split the predicates
into groups so they don't clobber each other.

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

3 years ago[NFC] Added test for PR33549
Dávid Bolvanský [Wed, 9 Dec 2020 02:20:02 +0000 (03:20 +0100)]
[NFC] Added test for PR33549

3 years agoBasic: Add hashing support for FileEntryRef and DirectoryEntryRef
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 22:25:44 +0000 (18:25 -0400)]
Basic: Add hashing support for FileEntryRef and DirectoryEntryRef

Allow hashing FileEntryRef and DirectoryEntryRef via `hash_value`, and
use that to implement `DenseMapInfo`. This hash should be equal whenever
the entry is the same (the name used to reference it is not relevant).

Also add `DirectoryEntryRef::isSameRef` to simplify the implementation
and facilitate testing.

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

3 years ago[PowerPC] prepare more dq form for P10 pair load/store
Chen Zheng [Tue, 1 Dec 2020 13:48:17 +0000 (08:48 -0500)]
[PowerPC] prepare more dq form for P10 pair load/store

Reviewed By: steven.zhang

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

3 years agoSupport: Add RedirectingFileSystem::create from simple list of redirections
Duncan P. N. Exon Smith [Thu, 12 Nov 2020 04:03:38 +0000 (23:03 -0500)]
Support: Add RedirectingFileSystem::create from simple list of redirections

Add an overload of `RedirectingFileSystem::create` that builds a
redirecting filesystem off of a simple vector of string pairs. This is
intended to be used to support `clang::arcmt::FileRemapper` and
`clang::PreprocessorOptions::RemappedFiles`.

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

3 years agoVFS: Return new file systems as uniquely owned when possible, almost NFC
Duncan P. N. Exon Smith [Tue, 8 Dec 2020 22:58:46 +0000 (14:58 -0800)]
VFS: Return new file systems as uniquely owned when possible, almost NFC

Uniformly return uniquely-owned filesystems from VFS creation APIs. The
one exception is `getRealFileSystem`, which has a single instance and
needs to be shared.

This is almost NFC, except that it fixes a memory leak in
`vfs::collectVFSFromYAML()`.

Depends on https://reviews.llvm.org/D92888

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

3 years agoADT: Allow IntrusiveRefCntPtr construction from std::unique_ptr, NFC
Duncan P. N. Exon Smith [Tue, 8 Dec 2020 22:54:55 +0000 (14:54 -0800)]
ADT: Allow IntrusiveRefCntPtr construction from std::unique_ptr, NFC

Allow a `std::unique_ptr` to be moved into the an `IntrusiveRefCntPtr`,
and remove a couple of now-unnecessary `release()` calls.

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

3 years ago[SampleFDO] Store fixed length MD5 in NameTable instead of using ULEB128 if
Wei Mi [Thu, 3 Dec 2020 20:19:25 +0000 (12:19 -0800)]
[SampleFDO] Store fixed length MD5 in NameTable instead of using ULEB128 if
MD5 is used.

Currently during sample profile loading, NameTable has to be loaded entirely
up front before any name string is retrieved. That is because NameTable is
stored using ULEB128 encoding and cannot be directly accessed like an array.
However, if MD5 is used to represent name in the NameTable, it has fixed
length. If MD5 names are stored in uint64_t type instead of ULEB128, NameTable
can be accessed like an array then in many cases only part of the NameTable
has to be read. This is helpful for reducing compile time especially when
small source file is compiled. We find that after this change, the elapsed
time to build a large application distributively is reduced by 5% and the
accumulative cpu time used for building is also reduced by 5%. The size of
the profile is slightly reduced with this change by ~0.2%, and that also
indicates encoding MD5 in ULEB128 doesn't save the storage space.

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

3 years ago[OpenMP] Add doxygen generation for the runtime
Giorgis Georgakoudis [Fri, 4 Dec 2020 20:50:52 +0000 (12:50 -0800)]
[OpenMP] Add doxygen generation for the runtime

Reviewed By: jdoerfert

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

3 years ago[RISCV] Share VTYPE encoding code between the assembler and the CustomInserter for...
Craig Topper [Wed, 9 Dec 2020 00:02:00 +0000 (16:02 -0800)]
[RISCV] Share VTYPE encoding code between the assembler and the CustomInserter for adding VSETVLI before vector instructions

This merges the SEW and LMUL enums that each used into singles enums in RISCVBaseInfo.h. The patch also adds a new encoding helper to take SEW, LMUL, tail agnostic, mask agnostic and turn it into a vtype immediate.

I also stopped storing the Encoding in the VTYPE operand in the assembler. It is easy to calculate when adding the operand which should only happen once per instruction.

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

3 years agoPrevent FENTRY_CALL reordering
Ilya Leoshkevich [Tue, 8 Dec 2020 21:04:00 +0000 (22:04 +0100)]
Prevent FENTRY_CALL reordering

FEntryInserter prepends FENTRY_CALL to the first basic block. In case
there are other instructions, PostRA Machine Instruction Scheduler can
move FENTRY_CALL call around. This actually occurs on SystemZ (see the
testcase). This is bad for the following reasons:

* FENTRY_CALL clobbers registers.
* Linux Kernel depends on whatever FENTRY_CALL expands to to be the very
  first instruction in the function.

Fix by adding isCall attribute to FENTRY_CALL, which prevents reordering
by making it a scheduling boundary for PostRA Machine Instruction
Scheduler.

Reviewed By: niravd

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

3 years ago[indvars] Common a bit of code [NFC]
Philip Reames [Tue, 8 Dec 2020 23:25:22 +0000 (15:25 -0800)]
[indvars] Common a bit of code [NFC]

3 years agoADT: Add hash_value overload for Optional
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 03:26:56 +0000 (19:26 -0800)]
ADT: Add hash_value overload for Optional

Add a `hash_value` for Optional so that other data structures with
optional fields can easily hash them. I have a use for this in an
upcoming patch.

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

3 years agoADT: Remove the unused explicit `OptionalTest` fixture, NFC
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 19:27:02 +0000 (11:27 -0800)]
ADT: Remove the unused explicit `OptionalTest` fixture, NFC

`OptionalTest` was empty; drop it and switch all the tests to use the
shorter `TEST` instead of `TEST_F`.

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

3 years ago[gold][NPM] Use NPM with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
Arthur Eubanks [Tue, 8 Dec 2020 18:29:05 +0000 (10:29 -0800)]
[gold][NPM] Use NPM with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER

Reviewed By: MaskRay

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

3 years ago[ELF][LTO][NPM] Use NPM with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
Arthur Eubanks [Tue, 8 Dec 2020 22:27:39 +0000 (14:27 -0800)]
[ELF][LTO][NPM] Use NPM with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER

Reviewed By: MaskRay

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

3 years ago[clang-tidy][NFC] Made Globlist::contains const
Nathan James [Tue, 8 Dec 2020 22:26:55 +0000 (22:26 +0000)]
[clang-tidy][NFC] Made Globlist::contains const

3 years ago[libc++] Mark my new <algorithm> test unsupported on clang-8.
Arthur O'Dwyer [Tue, 8 Dec 2020 22:23:47 +0000 (17:23 -0500)]
[libc++] Mark my new <algorithm> test unsupported on clang-8.

Because in C++20 mode, it tests that `copy_n` is constexpr;
so it depends on the compiler supporting `is_constant_evaluated`.

3 years ago[AArch64][GlobalISel] Swap select operands when inverting condition code
Jessica Paquette [Tue, 8 Dec 2020 22:05:38 +0000 (14:05 -0800)]
[AArch64][GlobalISel] Swap select operands when inverting condition code

This was not obvious when reading the imported tablegen patterns in
AArch64GenDAGISel.

Update select-select.mir.

3 years ago[ScalarizeMaskedMemIntrin] Add new PM support
Anna Thomas [Mon, 7 Dec 2020 03:51:23 +0000 (22:51 -0500)]
[ScalarizeMaskedMemIntrin] Add new PM support

This patch adds new PM support for the pass and the pass can be now used
during middle-end transforms. The old pass is remamed to
ScalarizeMaskedMemIntrinLegacyPass.

Reviewed-By: skatkov, aeubanks
Differential Revision: https://reviews.llvm.org/D92743

3 years ago[libc++] Add _VSTD:: qualifications to ADL-proof <algorithm>.
Arthur O'Dwyer [Sun, 22 Nov 2020 18:21:11 +0000 (13:21 -0500)]
[libc++] Add _VSTD:: qualifications to ADL-proof <algorithm>.

Relevant blog post: https://quuxplusone.github.io/blog/2019/09/26/uglification-doesnt-stop-adl/

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

3 years ago[libc++] ADL-proof __libcpp_is_nothrow_constructible.
Arthur O'Dwyer [Tue, 8 Dec 2020 20:41:48 +0000 (15:41 -0500)]
[libc++] ADL-proof __libcpp_is_nothrow_constructible.

The GCC C++20 buildbot hit this ADL call; Clang doesn't,
presumably because it uses a compiler builtin instead of
this codepath in <type_traits>.
https://buildkite.com/llvm-project/libcxx-ci/builds/674

3 years ago[DFSan] Add pthread and other functions to ABI list.
Matt Morehouse [Tue, 8 Dec 2020 21:55:25 +0000 (13:55 -0800)]
[DFSan] Add pthread and other functions to ABI list.

The non-pthread functions are all clear discard functions.

Some of the pthread ones could clear shadow, but aren't worth writing
custom wrappers for.  I can't think of any reasonable scenario where we
would pass tainted memory to these pthread functions.

Reviewed By: stephan.yichao.zhao

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

3 years agoPin -loop-reduce to legacy PM
Arthur Eubanks [Mon, 7 Dec 2020 23:25:43 +0000 (15:25 -0800)]
Pin -loop-reduce to legacy PM

LSR currently only runs in the codegen pass manager.
There are a couple issues with LSR and the NPM.
1) Lots of tests assume that LCSSA isn't run before LSR. This breaks a
bunch of tests' expected output. This is fixable with some time put in.
2) LSR doesn't preserve LCSSA. See
llvm/test/Analysis/MemorySSA/update-remove-deadblocks.ll. LSR's use of
SCEVExpander is the only use of SCEVExpander where the PreserveLCSSA option is
off. Turning it on causes some code sinking out of loops to fail due to
SCEVExpander's inability to handle the newly created trivial PHI nodes in the
broken critical edge (I was looking at
llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll).
I also tried simply just calling formLCSSA() at the end of LSR, but the extra
PHI nodes cause regressions in codegen tests.

We'll delay figuring these issues out until later.

This causes the number of check-llvm failures with -enable-new-pm true
by default to go from 60 to 29.

Reviewed By: asbirlea

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

3 years ago[AArch64][GlobalISel] Check if G_SELECT has been optimized when folding binops
Jessica Paquette [Tue, 8 Dec 2020 21:39:28 +0000 (13:39 -0800)]
[AArch64][GlobalISel] Check if G_SELECT has been optimized when folding binops

`TryFoldBinOpIntoSelect` didn't have a check for `Optimized`, meaning you could
end up folding twice. (e.g. a select with a G_ADD on the true side, and a G_SUB
on the false side)

Add in the missing `if` and a test.

3 years agoARCMigrate: Use hash_combine in the DenseMapInfo for EditEntry
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 03:05:11 +0000 (19:05 -0800)]
ARCMigrate: Use hash_combine in the DenseMapInfo for EditEntry

Simplify the DenseMapInfo for `EditEntry` by migrating from
`FoldingSetNodeID` to `llvm::hash_combine`. Besides the cleanup, this
reduces the diff for a future patch which changes the type of one of the
fields.

There should be no real functionality change here, although I imagine
the hash value will churn since its a different hashing infrastructure.

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

3 years ago[NFC] Rename IsCodeGenPass to ShouldPinPassToLegacyPM
Arthur Eubanks [Tue, 8 Dec 2020 07:14:49 +0000 (23:14 -0800)]
[NFC] Rename IsCodeGenPass to ShouldPinPassToLegacyPM

Codegen-specific passes are being ported to the NPM. Rename for better
clarity and note that ported passes that fully work with the NPM should
be removed from these lists.

Reviewed By: asbirlea

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

3 years ago[VE] Correct LVLGen (LVL instruction insert pass)
Kazushi (Jam) Marukawa [Sat, 5 Dec 2020 07:53:39 +0000 (16:53 +0900)]
[VE] Correct LVLGen (LVL instruction insert pass)

SX Aurora VE uses an intermediate representation similar to VP as its MIR.
VE itself uses invidiual VL register as its own vector length register at
the hardware level.  So, LLVM needs to insert load VL (LVL) instruction just
before vector instructions if the value of VL is changed.  This LVLGen pass
generates LVL instructions for such purpose.  Previously, a bug is pointed
out in D91416.  This patch correct this bug and add a regression test.

Reviewed By: craig.topper

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

3 years ago[Driver] Add -gno-split-dwarf which can disable debug fission
Fangrui Song [Tue, 8 Dec 2020 21:24:58 +0000 (13:24 -0800)]
[Driver] Add -gno-split-dwarf which can disable debug fission

Currently when -gsplit-dwarf is specified (could be buried in a build system),
there is no convenient way to cancel debug fission without affecting the debug
information amount (all of -g0, -g1 -fsplit-dwarf-inlining and -gline-directives-only
can, but they affect the debug information amount).

Reviewed By: #debug-info, dblaikie

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

3 years ago[libc] Raise x87 exceptions by synchronizing with "fwait".
Siva Chandra Reddy [Tue, 8 Dec 2020 06:46:03 +0000 (22:46 -0800)]
[libc] Raise x87 exceptions by synchronizing with "fwait".

Couple of helper functions enableExcept and disableExcept have been
added. In a later round, they will be used to implemented the GNU
extension functions feenableexcept and fedisableexcept.

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

3 years agoAPINotes: add bitcode format schema definitions
Saleem Abdulrasool [Fri, 6 Nov 2020 00:01:20 +0000 (00:01 +0000)]
APINotes: add bitcode format schema definitions

This adds the bitcode format schema required for serialization of the
YAML data to a binary format.  APINotes are pre-compiled and re-used in
the binary format from the frontend.  These definitions provide the data
layout representation enabling writing (and eventually) reading of the
data in bitcode format.

This is extracted from the code contributed by Apple at
https://github.com/llvm/llvm-project-staging/tree/staging/swift/apinotes.

Differential Revision: https://reviews.llvm.org/D91997
Reviewed By: Gabor Marton

3 years agoBitcode: add some convenience helpers for streaming bitcode
Saleem Abdulrasool [Tue, 29 Sep 2020 21:16:02 +0000 (21:16 +0000)]
Bitcode: add some convenience helpers for streaming bitcode

This adds a set of metaprogramming helpers to help define records and
serialize them out.  This is motivated by API Notes which use the
bitcode format to serialize out a binary representation of the data.
These helpers are generically useful though and could help simplify some
of the existing bitcode consumers as well.

This is extracted from the code contributed by Apple at
https://github.com/llvm/llvm-project-staging/tree/staging/swift/apinotes.

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

3 years ago[Driver] Don't make -gsplit-dwarf imply -g2
Fangrui Song [Tue, 8 Dec 2020 21:14:34 +0000 (13:14 -0800)]
[Driver] Don't make -gsplit-dwarf imply -g2

RFC: http://lists.llvm.org/pipermail/cfe-dev/2020-May/065430.html
Agreement from GCC: https://sourceware.org/pipermail/gcc-patches/2020-May/545688.html

g_flags_Group options generally don't affect the amount of debugging
information. -gsplit-dwarf is an exception. Its order dependency with
other gN_Group options make it inconvenient in a build system:

* -g0 -gsplit-dwarf -> level 2
   -gsplit-dwarf "upgrades" the amount of debugging information despite
   the previous intention (-g0) to drop debugging information
* -g1 -gsplit-dwarf -> level 2
  -gsplit-dwarf "upgrades" the amount of debugging information.
* If we have a higher-level -gN, -gN -gsplit-dwarf will supposedly decrease the
  amount of debugging information. This happens with GCC -g3.

The non-orthogonality has confused many users. GCC 11 will change the semantics
(-gsplit-dwarf no longer implies -g2) despite the backwards compatibility break.
This patch matches its behavior.

New semantics:

* If there is a g_Group, allow split DWARF if useful
  (none of: -g0, -gline-directives-only, -g1 -fno-split-dwarf-inlining)
* Otherwise, no-op.

To restore the original behavior, replace -gsplit-dwarf with -gsplit-dwarf -g.

Reviewed By: dblaikie

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

3 years ago[AArch64] Fix rottype use in complex instr defs.
Florian Hahn [Tue, 8 Dec 2020 20:20:17 +0000 (20:20 +0000)]
[AArch64] Fix rottype use in complex instr defs.

It seems like the order here is wrong. Types like i32 do not take any
arguments.

Currently this is not a problem, because the patterns are not actually
used with any nodes, but will fail once it is used with real ISD nodes.

Reviewed By: dmgreen

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

3 years ago[X86] Handle localdynamic TLS model in x32 mode
Harald van Dijk [Tue, 8 Dec 2020 21:06:00 +0000 (21:06 +0000)]
[X86] Handle localdynamic TLS model in x32 mode

D92346 added TLS_(base_)addrX32 to handle TLS in x32 mode, but missed the
different TLS models. This diff fixes the logic for the local dynamic model
where `RAX` was used when `EAX` should be, and extends the tests to cover
all four TLS models.

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

Reviewed By: RKSimon

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

3 years agoFrontend: Clarify logic for using the preamble in ASTUnit::CodeComplete, almost NFC
Duncan P. N. Exon Smith [Tue, 10 Nov 2020 15:25:48 +0000 (10:25 -0500)]
Frontend: Clarify logic for using the preamble in ASTUnit::CodeComplete, almost NFC

Clarify the logic for using the preamble (and overriding the main file
buffer) in `ASTUnit::CodeComplete` by factoring out a couple of lambdas
(`getUniqueID` and `hasSameUniqueID`).  While refactoring the logic,
hoist the check for `Line > 1` and locally check if the filenames are
equal (both to avoid unnecessary `stat` calls) and skip copying out the
filenames to `std::string`.

Besides fewer calls to `stat`, there's no functionality change here.

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

3 years ago[libc++] Implement missing feature-test macro __cpp_lib_shared_ptr_arrays
Louis Dionne [Tue, 8 Dec 2020 20:45:57 +0000 (15:45 -0500)]
[libc++] Implement missing feature-test macro __cpp_lib_shared_ptr_arrays

This was forgotten when we implemented support for arrays in std::shared_ptr
in https://reviews.llvm.org/D62259.

3 years ago[libc++] NFC: Indent feature-test macro script consistently
Louis Dionne [Tue, 8 Dec 2020 20:42:33 +0000 (15:42 -0500)]
[libc++] NFC: Indent feature-test macro script consistently

3 years ago[clang-tidy] Add support for diagnostics with no location
Nathan James [Tue, 8 Dec 2020 20:28:42 +0000 (20:28 +0000)]
[clang-tidy] Add support for diagnostics with no location

Add methods for emitting diagnostics with no location as well as a special diagnostic for configuration errors.
These show up in the errors as [clang-tidy-config].
The reason to use a custom name rather than the check name is to distinguish the error isn't the same category as the check that reported it.

Reviewed By: aaron.ballman

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

3 years ago[AMDGPU] Add new pseudos for indirect addressing with VGPR Indexing
Austin Kerbow [Fri, 6 Nov 2020 07:43:58 +0000 (23:43 -0800)]
[AMDGPU] Add new pseudos for indirect addressing with VGPR Indexing

It is possible for copies or spills to be inserted in the middle of indirect
addressing sequences which use VGPR indexing. Spills to accvgprs could be
effected by the indexing mode.

Add new pseudo instructions that are expanded after register allocation to avoid
the problematic spill or copy placement.

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

3 years ago[RISCV] Add isel patterns for SBCLRI/SBSETI/SBINVI(W) instruction
Craig Topper [Tue, 8 Dec 2020 19:29:05 +0000 (11:29 -0800)]
[RISCV] Add isel patterns for SBCLRI/SBSETI/SBINVI(W) instruction

We can use these instructions for single bit immediates that are too large for ANDI/ORI/CLRI.

The _10 test cases are to make sure that we still use ANDI/ORI/CLRI for small immediates.

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

3 years ago[gn build] Port 39431e479ff
LLVM GN Syncbot [Tue, 8 Dec 2020 20:15:45 +0000 (20:15 +0000)]
[gn build] Port 39431e479ff

3 years ago[gn build] Port 1821265db68
LLVM GN Syncbot [Tue, 8 Dec 2020 20:15:44 +0000 (20:15 +0000)]
[gn build] Port 1821265db68

3 years ago[flang][openacc] Avoid use of init, shutdown and set in compute construct
Valentin Clement [Tue, 8 Dec 2020 20:14:24 +0000 (15:14 -0500)]
[flang][openacc] Avoid use of init, shutdown and set in compute construct

init, shutdown and set directive are not allowed in compute construct.

Reviewed By: SouraVX

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

3 years ago[clang-tidy] Introduce misc No Integer To Pointer Cast check
Roman Lebedev [Tue, 8 Dec 2020 19:54:56 +0000 (22:54 +0300)]
[clang-tidy] Introduce misc No Integer To Pointer Cast check

While casting an (integral) pointer to an integer is obvious - you just get
the integral value of the pointer, casting an integer to an (integral) pointer
is deceivingly different. While you will get a pointer with that integral value,
if you got that integral value via a pointer-to-integer cast originally,
the new pointer will lack the provenance information from the original pointer.

So while (integral) pointer to integer casts are effectively no-ops,
and are transparent to the optimizer, integer to (integral) pointer casts
are *NOT* transparent, and may conceal information from optimizer.

While that may be the intention, it is not always so. For example,
let's take a look at a routine to align the pointer up to the multiple of 16:
The obvious, naive implementation for that is:

```
  char* src(char* maybe_underbiased_ptr) {
    uintptr_t maybe_underbiased_intptr = (uintptr_t)maybe_underbiased_ptr;
    uintptr_t aligned_biased_intptr = maybe_underbiased_intptr + 15;
    uintptr_t aligned_intptr = aligned_biased_intptr & (~15);
    return (char*)aligned_intptr; // warning: avoid integer to pointer casts [misc-no-inttoptr]
  }
```

The check will rightfully diagnose that cast.

But when provenance concealment is not the goal of the code, but an accident,
this example can be rewritten as follows, without using integer to pointer cast:

```
  char*
  tgt(char* maybe_underbiased_ptr) {
      uintptr_t maybe_underbiased_intptr = (uintptr_t)maybe_underbiased_ptr;
      uintptr_t aligned_biased_intptr = maybe_underbiased_intptr + 15;
      uintptr_t aligned_intptr = aligned_biased_intptr & (~15);
      uintptr_t bias = aligned_intptr - maybe_underbiased_intptr;
      return maybe_underbiased_ptr + bias;
  }
```

See also:
* D71499
* [[ https://www.cs.utah.edu/~regehr/oopsla18.pdf | Juneyoung Lee, Chung-Kil Hur, Ralf Jung, Zhengyang Liu, John Regehr, and Nuno P. Lopes. 2018. Reconciling High-Level Optimizations and Low-Level Code in LLVM. Proc. ACM Program. Lang. 2, OOPSLA, Article 125 (November 2018), 28 pages. ]]

Reviewed By: aaron.ballman

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

3 years ago[DebugInfo] Add handling of stringLengthExp operand of DIStringType.
Chih-Ping Chen [Tue, 8 Dec 2020 18:34:33 +0000 (13:34 -0500)]
[DebugInfo] Add handling of stringLengthExp operand of DIStringType.

This patch makes DWARF writer emit DW_AT_string_length using
the stringLengthExp operand of DIStringType.

This is part of the effort to add debug info support for
Fortran deferred length strings.

Also updated the tests to exercise the change.

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

3 years ago[llvm-lto2] Use NPM with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
Arthur Eubanks [Tue, 8 Dec 2020 18:30:45 +0000 (10:30 -0800)]
[llvm-lto2] Use NPM with ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER

Reviewed By: tejohnson

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

3 years ago[cmake] Make ExecutionEngine/Orc/Shared depend on intrinsics_gen to fix modules build
Raphael Isemann [Tue, 8 Dec 2020 19:40:59 +0000 (20:40 +0100)]
[cmake] Make ExecutionEngine/Orc/Shared depend on intrinsics_gen to fix modules build

The LLVM_ENABLE_MODULES builds currently randomly fail due depending on the
headers generated by the intrinsics_gen target, but the current dependency only model
the non-modules dependencies:

```
While building module 'LLVM_ExecutionEngine' imported from llvm-project/llvm/lib/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.cpp:13:
While building module 'LLVM_intrinsic_gen' imported from llvm-project/llvm/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h:17:
In file included from <module-includes>:1:
In file included from llvm-project/llvm/include/llvm/IR/Argument.h:18:
llvm/include/llvm/IR/Attributes.h:75:14: fatal error: 'llvm/IR/Attributes.inc' file not found
    #include "llvm/IR/Attributes.inc"
             ^~~~~~~~~~~~~~~~~~~~~~~~
```

Depending on whether intrinsics_gen runs before compiling Orc/Shared files we either fail or include an outdated Attributes.inc
in module builds. The Clang modules require these additional dependencies as including/importing one module requires all
includes headers by that module to be parsable.

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

3 years ago[flang][openacc] Update reference to OpenACC 3.1 specification
Valentin Clement [Tue, 8 Dec 2020 19:36:24 +0000 (14:36 -0500)]
[flang][openacc] Update reference to OpenACC 3.1 specification

Update all reference from the specification to the new OpenACC 3.1
document.

Reviewed By: SouraVX

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

3 years ago[gn build] Move ScalarizeMaskedMemIntrin.cpp
Arthur Eubanks [Tue, 8 Dec 2020 19:33:45 +0000 (11:33 -0800)]
[gn build] Move ScalarizeMaskedMemIntrin.cpp

3 years ago[RISCV] Detect more errors when parsing vsetvli in the assembler
Craig Topper [Tue, 8 Dec 2020 18:31:30 +0000 (10:31 -0800)]
[RISCV] Detect more errors when parsing vsetvli in the assembler

-Reject an "mf1" lmul
-Make sure tail agnostic is exactly "tu" or "ta" not just that it starts with "tu" or "ta"
-Make sure mask agnostic is exactly "mu" or "ma" not just that it starts with "mu" or "ma"

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

3 years ago[RISCV] When parsing vsetvli in the assembler, use StringRef::getAsInteger instead...
Craig Topper [Tue, 8 Dec 2020 18:30:06 +0000 (10:30 -0800)]
[RISCV] When parsing vsetvli in the assembler, use StringRef::getAsInteger instead of APInt's string constructor

APInt's string constructor asserts on error. Since this is the parser and we don't yet know if the string is a valid integer we shouldn't use that.

Instead use StringRef::getAsInteger which returns a bool to indicate success or failure.

Since we no longer need APInt, use 'unsigned' instead.

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

3 years ago[PPC] Fixing a typo in altivec.h. Commenting out an unnecessary macro
Masoud Ataei [Tue, 8 Dec 2020 19:21:02 +0000 (19:21 +0000)]
[PPC] Fixing a typo in altivec.h. Commenting out an unnecessary macro

3 years ago[flang][openacc] Add missing loop construct restriction and validity tests
Valentin Clement [Tue, 8 Dec 2020 19:11:18 +0000 (14:11 -0500)]
[flang][openacc] Add missing loop construct restriction and validity tests

Add restriction on loop construct associated with DO CONCURRENT. Add couple of tests to ensure
clause validity checks.

Reviewed By: sameeranjoshi

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

3 years ago[clangd] ExpandAutoType: Do not offer code action on lambdas.
Adam Czachorowski [Tue, 1 Dec 2020 15:53:21 +0000 (16:53 +0100)]
[clangd] ExpandAutoType: Do not offer code action on lambdas.

We can't expand lambda types anyway. Now we simply not offer the code
action instead of showing it and then returning an error in apply().

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

3 years ago[AArch64][GlobalISel] Fold G_SELECT cc, %t, (G_ADD %x, 1) -> CSINC %t, %x, cc
Jessica Paquette [Tue, 8 Dec 2020 18:20:44 +0000 (10:20 -0800)]
[AArch64][GlobalISel] Fold G_SELECT cc, %t, (G_ADD %x, 1) -> CSINC %t, %x, cc

This implements

```
G_SELECT cc, %true, (G_ADD %x, 1) -> CSINC %true, %x, cc
G_SELECT cc, (G_ADD %x, 1), %false -> CSINC %x, %false, inv_cc
```

Godbolt example: https://godbolt.org/z/eoPqKq

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

3 years ago[DFSan] Add several math functions to ABI list.
Matt Morehouse [Tue, 8 Dec 2020 18:47:49 +0000 (10:47 -0800)]
[DFSan] Add several math functions to ABI list.

These are all straightforward functional entries.

Reviewed By: stephan.yichao.zhao

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

3 years ago[libc++] Add std::hash<char8_t> specialization if char8_t is enabled
Yuriy Chernyshov [Tue, 8 Dec 2020 18:39:56 +0000 (13:39 -0500)]
[libc++] Add std::hash<char8_t> specialization if char8_t is enabled

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

3 years ago[AArch64][GlobalISel] Fold binops on the true side of G_SELECT
Jessica Paquette [Tue, 8 Dec 2020 17:34:42 +0000 (09:34 -0800)]
[AArch64][GlobalISel] Fold binops on the true side of G_SELECT

This implements the following folds:

```
G_SELECT cc, (G_SUB 0, %x), %false -> CSNEG %x, %false, inv_cc
G_SELECT cc, (G_XOR x, -1), %false -> CSINV %x, %false, inv_cc
```

This is similar to the folds introduced in
5bc0bd05e6a8d788e08cdf3d154f3a33202aee53.

In 5bc0bd05e6a8d788e08cdf3d154f3a33202aee53 I mentioned that we may prefer to do
this in AArch64PostLegalizerLowering.

I think that it's probably better to do this in the selector. The way we select
G_SELECT depends on what register banks end up being assigned to it. If we did
this in AArch64PostLegalizerLowering, then we'd end up checking *every* G_SELECT
to see if it's worth swapping operands. Doing it in the selector allows us to
restrict the optimization to only relevant G_SELECTs.

Also fix up some comments in `TryFoldBinOpIntoSelect` which are kind of
confusing IMO.

Example IR: https://godbolt.org/z/3qPGca

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

3 years ago[AArch64][GlobalISel] Don't explicitly write to the zero register in emitCMN
Jessica Paquette [Wed, 2 Dec 2020 00:21:41 +0000 (16:21 -0800)]
[AArch64][GlobalISel] Don't explicitly write to the zero register in emitCMN

This case was missed in 78ccb0359d8da3269636d85933dd8afe50a2211f.

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

3 years agoDenseMap: fix build with clang in C++20 mode
Nuno Lopes [Tue, 8 Dec 2020 18:36:24 +0000 (18:36 +0000)]
DenseMap: fix build with clang in C++20 mode
clang was complaing about this code:
llvm/include/llvm/IR/PassManager.h:715:17: error: ISO C++20 considers use of overloaded operator '!=' to be ambiguous despite there being a unique best viable function with non-reversed arguments [-Werror,-Wambiguous-reversed-operator]
      if (IMapI != IsResultInvalidated.end())
          ~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
llvm/include/llvm/ADT/DenseMap.h:1253:8: note: candidate function with non-reversed arguments
  bool operator!=(const ConstIterator &RHS) const {
       ^
llvm/include/llvm/ADT/DenseMap.h:1246:8: note: ambiguous candidate function with reversed arguments
  bool operator==(const ConstIterator &RHS) const {
       ^

The warning is triggered when the DenseMapIterator (lhs) is not const and so
the == operator is applied to different types on lhs/rhs.
Using a template allows the function to be available for both const/non-const
iterator types and gets rid of the warning

3 years ago[lld-macho] Support parsing of bitcode within archives
Jez Ng [Wed, 2 Dec 2020 22:12:51 +0000 (14:12 -0800)]
[lld-macho] Support parsing of bitcode within archives

Also error out if we find anything other than an object or bitcode file
in the archive.

Note that we were previously inserting the symbols and sections of the
unpacked ObjFile into the containing ArchiveFile. This was actually
unnecessary -- we can just insert the ObjectFile (or BitcodeFile) into
the `inputFiles` vector. This is the approach taken by LLD-ELF.

Reviewed By: thakis

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

3 years ago[lld-macho][nfc] Move some methods from InputFile to ObjFile
Jez Ng [Wed, 2 Dec 2020 03:57:37 +0000 (19:57 -0800)]
[lld-macho][nfc] Move some methods from InputFile to ObjFile

Additionally:
1. Move the helper functions in InputSection.h below the definition of
   `InputSection`, so the important stuff is on top
2. Remove unnecessary `explicit`

Reviewed By: #lld-macho, compnerd

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

3 years ago[mlir] Async: Add numWorkerThreads argument to createAsyncParallelForPass
Eugene Zhulenev [Tue, 8 Dec 2020 12:35:27 +0000 (04:35 -0800)]
[mlir] Async: Add numWorkerThreads argument to createAsyncParallelForPass

Add an option to pass the number of worker threads to select the number of async regions for parallel for transformation.
```
std::unique_ptr<OperationPass<FuncOp>> createAsyncParallelForPass(int numWorkerThreads);
```

Reviewed By: mehdi_amini

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

3 years ago[flang] Implement derived type description table encoding
peter klausler [Mon, 7 Dec 2020 22:46:24 +0000 (14:46 -0800)]
[flang] Implement derived type description table encoding

Define Fortran derived types that describe the characteristics
of derived types, and instantiations of parameterized derived
types, that are of relevance to the runtime language support
library.  Define a suite of corresponding C++ structure types
for the runtime library to use to interpret instances of the
descriptions.

Create instances of these description types in Semantics as
static initializers for compiler-created objects in the scopes
that define or instantiate user derived types.

Delete obsolete code from earlier attempts to package runtime
type information.

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

3 years ago[RISCV] Replace custom isel code for RISCVISD::READ_CYCLE_WIDE with isel pattern
Craig Topper [Tue, 8 Dec 2020 17:55:27 +0000 (09:55 -0800)]
[RISCV] Replace custom isel code for RISCVISD::READ_CYCLE_WIDE with isel pattern

This node returns 2 results and uses a chain. As long as we use a DAG as part of the pseudo instruction definition where we can use the "set" operator, it looks like tablegen can handle use a pattern for this without a problem. I believe the original implementation was copied from PowerPC.

This also fixes the pseudo instruction so that it is marked as having side effects to match the definition of CSRRS and the RV64 instruction. And we don't need to explicitly clear mayLoad/mayStore since those can be inferred now.

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

3 years ago[Time-report] Add a flag -ftime-report={per-pass,per-pass-run} to control the pass...
Yuanfang Chen [Wed, 2 Dec 2020 18:18:18 +0000 (10:18 -0800)]
[Time-report] Add a flag -ftime-report={per-pass,per-pass-run} to control the pass timing aggregation

Currently, -ftime-report + new pass manager emits one line of report for each
pass run. This potentially causes huge output text especially with regular LTO
or large single file (Obeserved in private tests and was reported in D51276).
The behaviour of -ftime-report + legacy pass manager is
emitting one line of report for each pass object which has relatively reasonable
text output size. This patch adds a flag `-ftime-report=` to control time report
aggregation for new pass manager.

The flag is for new pass manager only. Using it with legacy pass manager gives
an error. It is a driver and cc1 flag. `per-pass` is the new default so
`-ftime-report` is aliased to `-ftime-report=per-pass`. Before this patch,
functionality-wise `-ftime-report` is aliased to `-ftime-report=per-pass-run`.

* Adds an boolean variable TimePassesHandler::PerRun to control per-pass vs per-pass-run.
* Adds a new clang CodeGen flag CodeGenOptions::TimePassesPerRun to work with the existing CodeGenOptions::TimePasses.
* Remove FrontendOptions::ShowTimers, its uses are replaced by the existing CodeGenOptions::TimePasses.
* Remove FrontendTimesIsEnabled (It was introduced in D45619 which was largely reverted.)

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

3 years agocppcoreguidelines Narrowing Conversions Check: detect narrowing conversions involving...
Eric Seidel [Tue, 8 Dec 2020 18:09:12 +0000 (13:09 -0500)]
cppcoreguidelines Narrowing Conversions Check: detect narrowing conversions involving typedefs

The check 'cppcoreguidelines-narrowing-conversions' does not detect conversions
involving typedef. This notably includes the standard fixed-width integer types
like int32_t, uint64_t, etc. Now look through the typedefs at the desugared type.

3 years ago[compiler-rt santizer] Use clock_gettime instead of timespec_get
Jeroen Dobbelaere [Tue, 8 Dec 2020 16:33:14 +0000 (08:33 -0800)]
[compiler-rt santizer] Use clock_gettime instead of timespec_get

On RH66, timespec_get is not available. Use clock_gettime instead.

This problem was introduced with D87120

Reviewed By: tejohnson

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

3 years agoMove createScalarizeMaskedMemIntrinPass to Scalar.h
Benjamin Kramer [Tue, 8 Dec 2020 18:08:09 +0000 (19:08 +0100)]
Move createScalarizeMaskedMemIntrinPass to Scalar.h

3 years agoRemove unused include. NFC.
Benjamin Kramer [Tue, 8 Dec 2020 18:03:56 +0000 (19:03 +0100)]
Remove unused include. NFC.

This is also a layering violation.

3 years ago[test] Rewrite phi-empty.ll into a unittest
Arthur Eubanks [Tue, 8 Dec 2020 02:57:20 +0000 (18:57 -0800)]
[test] Rewrite phi-empty.ll into a unittest

phi-empty.ll does not pass under the new PM because the NPM runs
-loop-simplify. Running -loop-simplify ends up not reproing
https://llvm.org/PR48296.

Verified that this test fails when 9eb2c011 is reverted.

Reviewed By: spatel

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

3 years ago[VectorCombine] add tests for load of insert/extract; NFC
Sanjay Patel [Tue, 8 Dec 2020 16:21:08 +0000 (11:21 -0500)]
[VectorCombine] add tests for load of insert/extract; NFC

3 years ago[AArch64][SVE] Add lowering for llvm.maxnum|minnum for scalable type.
Huihui Zhang [Tue, 8 Dec 2020 17:32:33 +0000 (09:32 -0800)]
[AArch64][SVE] Add lowering for llvm.maxnum|minnum for scalable type.

LLVM intrinsic llvm.maxnum|minnum is overloaded intrinsic, can be used on any
floating-point or vector of floating-point type.
This patch extends current infrastructure to support scalable vector type.

This patch also fix a warning message of incorrect use of EVT::getVectorNumElements()
for scalable type, when DAGCombiner trying to split scalable vector.

Reviewed By: sdesmalen

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

3 years ago[LV] Make optimal-epilog-vectorization-profitability.ll more robust
Bardia Mahjour [Tue, 8 Dec 2020 17:21:26 +0000 (12:21 -0500)]
[LV] Make optimal-epilog-vectorization-profitability.ll more robust

Add a CHECK to properly limit the scope of CHECK-NOTs

3 years agoFix inconsistent availability attribute message string literal check.
Nigel Perks [Tue, 8 Dec 2020 17:33:59 +0000 (12:33 -0500)]
Fix inconsistent availability attribute message string literal check.

Function Parser::ParseAvailabilityAttribute checks that the message string of
an availability attribute is not a wide string literal. Test case
clang/test/Parser/attr-availability.c specifies that a string literal is
expected.

The code checked that the first token in a string concatenation is a string
literal, and then that the concatenated string consists of 1-byte characters.
On a target where wide character is 1 byte, a string concatenation "a" L"b"
passes both those checks, but L"b" alone is rejected. More generally, "a" u8"b"
passes the checks, but u8"b" alone is rejected.

So check isAscii() instead of character size.

3 years ago[ScalarizeMaskedMemIntrinsic] Move from CodeGen into Transforms
Anna Thomas [Wed, 2 Dec 2020 20:07:09 +0000 (15:07 -0500)]
[ScalarizeMaskedMemIntrinsic] Move from CodeGen into Transforms

ScalarizeMaskedMemIntrinsic is currently a codeGen level pass. The pass
is actually operating on IR level and does not use any code gen specific
passes.  It is useful to move it into transforms directory so that it
can be more widely used as a mid-level transform as well (apart from
usage in codegen pipeline).
In particular, we have a usecase downstream where we would like to use
this pass in our mid-level pipeline which operates on IR level.

The next change will be to add support for new PM.

Reviewers: craig.topper, apilipenko, skatkov
Reviewed-By: skatkov
Differential Revision: https://reviews.llvm.org/D92407

3 years ago[AArch64][GlobalISel] Select G_SADDO and G_SSUBO
Jessica Paquette [Thu, 3 Dec 2020 22:31:43 +0000 (14:31 -0800)]
[AArch64][GlobalISel] Select G_SADDO and G_SSUBO

We didn't have selector support for these.

Selection code is similar to `getAArch64XALUOOp` in AArch64ISelLowering. Similar
to that code, this returns the AArch64CC and the instruction produced. In SDAG,
this is used to optimize select + overflow and condition branch + overflow
pairs. (See `AArch64TargetLowering::LowerBR_CC` and
`AArch64TargetLowering::LowerSelect`)

(G_USUBO should be easy to add here, but it isn't legalized right now.)

This also factors out the existing G_UADDO selection code, and removes an
unnecessary check for s32/s64. AFAIK, we shouldn't ever get anything other than
s32/s64. It makes more sense for this to be handled by the type assertion in
`emitAddSub`.

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

3 years ago[clangd][NFC] Small tweak to combined provider
Nathan James [Tue, 8 Dec 2020 17:12:55 +0000 (17:12 +0000)]
[clangd][NFC] Small tweak to combined provider

This should address the FIXME about clang3.9 dervied to base unique_ptr constructor not working.

Reviewed By: sammccall

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