platform/upstream/llvm.git
4 years ago[LoopIdiomRecognize] Remove unnecessary MaybeAlign use (NFC)
Nikita Popov [Fri, 5 Jun 2020 21:11:04 +0000 (23:11 +0200)]
[LoopIdiomRecognize] Remove unnecessary MaybeAlign use (NFC)

Loads and stores always have an alignment now.

4 years ago[ASan][Test] Fix globals test for Mach-O
Marco Elver [Fri, 5 Jun 2020 20:56:24 +0000 (22:56 +0200)]
[ASan][Test] Fix globals test for Mach-O

Summary: Use a portable section name, as for the test's purpose any name will do.

Reviewers: nickdesaulniers, thakis

Reviewed By: thakis

Subscribers: cfe-commits

Tags: #clang

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

4 years agoRevert "Migrate Binary::checkOffset from error_code to Error, NFC"
Nico Weber [Fri, 5 Jun 2020 21:00:20 +0000 (17:00 -0400)]
Revert "Migrate Binary::checkOffset from error_code to Error, NFC"

This reverts commit 74bd98829d82312676a60c5c2d142e20691b2f13.
Breaks LLVM::section-headers.test everywhere, see e.g.
http://lab.llvm.org:8011/builders/clang-x86_64-debian-fast/builds/29940/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Asection-headers.test

4 years agoFix an oversight in GetXcodeContentsDirectory()
Adrian Prantl [Fri, 5 Jun 2020 18:58:05 +0000 (11:58 -0700)]
Fix an oversight in GetXcodeContentsDirectory()

Since FindXcodeContentsDirectoryInPath expects the *.app/Contents and
DEVELOPER_DIR is supposed to point to Xcode.app, we need to append the
Contents path first.

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

4 years agoFactor out GetEnvDeveloperDir() (NFC)
Adrian Prantl [Fri, 5 Jun 2020 18:38:59 +0000 (11:38 -0700)]
Factor out GetEnvDeveloperDir() (NFC)

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

4 years ago[X86] Fold undef elts to 0 in getTargetVShiftByConstNode.
Craig Topper [Fri, 5 Jun 2020 18:46:07 +0000 (11:46 -0700)]
[X86] Fold undef elts to 0 in getTargetVShiftByConstNode.

Similar to D81212.

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

4 years agoMigrate Binary::checkOffset from error_code to Error, NFC
Reid Kleckner [Fri, 5 Jun 2020 20:32:33 +0000 (13:32 -0700)]
Migrate Binary::checkOffset from error_code to Error, NFC

In my use case, this saved 100ms of time doing one-time-initialization
for std::error_code().

4 years agoAMDGPU/GlobalISel: cmp/select method for extract element
Stanislav Mekhanoshin [Wed, 27 May 2020 20:09:00 +0000 (13:09 -0700)]
AMDGPU/GlobalISel: cmp/select method for extract element

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

4 years ago[codeview] Put !heapallocsite on calls to operator new
Reid Kleckner [Tue, 2 Jun 2020 00:11:06 +0000 (17:11 -0700)]
[codeview] Put !heapallocsite on calls to operator new

Clang marks calls to operator new as heap allocation sites, but the
operator declared at global scope returns a void pointer. There is no
explicit cast in the code, so the compiler has to write down the
allocated type itself.

Also generalize a cast to use CallBase, so that we mark heap alloc sites
when exceptions are enabled.

Reviewed By: MaskRay

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

4 years ago[gn build] Port 8a8c6913a93
LLVM GN Syncbot [Fri, 5 Jun 2020 19:48:20 +0000 (19:48 +0000)]
[gn build] Port 8a8c6913a93

4 years agoSROA: Remove pointer from visited along with instruction
Stanislav Mekhanoshin [Mon, 1 Jun 2020 21:35:12 +0000 (14:35 -0700)]
SROA: Remove pointer from visited along with instruction

If an instruction is erased we also need to remove it from
Visited set. There is a very small chance that an another
newly created instruction will be created with the same
pointer value in place of an erased one.

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

4 years agoRevert "[HIP] Add default header and include path"
Yaxun (Sam) Liu [Fri, 5 Jun 2020 19:41:00 +0000 (15:41 -0400)]
Revert "[HIP] Add default header and include path"

This reverts commit 11d06b9511bd25aabbfad10dff548b0ce29135a5.

4 years agoAttempt to fix hip-include-path.hip
Yaxun (Sam) Liu [Fri, 5 Jun 2020 19:31:11 +0000 (15:31 -0400)]
Attempt to fix hip-include-path.hip

4 years agolld: use modern library search ordering
Saleem Abdulrasool [Fri, 5 Jun 2020 00:40:41 +0000 (17:40 -0700)]
lld: use modern library search ordering

This merges the static and shared library and behaves as if
`-search_paths_first` was specified which is also the default behaviour
on ld64 (and now lld). Unify the paths, and use `llvm::sys::path` to
deal with the path to be truly agnostic to the host.

4 years ago[llvm-pdbutil] Add missing --id-stats to dump the IPI stream
Alexandre Ganea [Thu, 4 Jun 2020 19:30:45 +0000 (15:30 -0400)]
[llvm-pdbutil] Add missing --id-stats to dump the IPI stream

Before this patch, llvm-pdbutil supported only --type-stats to dump stats about a PDB TPI stream.
Adding --id-stats for completion.

4 years agoGlobalISel: Add helper for constructing load from offset
Matt Arsenault [Sun, 31 May 2020 00:28:36 +0000 (20:28 -0400)]
GlobalISel: Add helper for constructing load from offset

4 years agoTeach GetXcodeSDK to look in the Xcode that contains LLDB
Adrian Prantl [Fri, 5 Jun 2020 02:02:11 +0000 (19:02 -0700)]
Teach GetXcodeSDK to look in the Xcode that contains LLDB

instead of preferring the one chosen with xcode-select.

<rdar://problem/64000666>

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

4 years agoMove GetXcode*Directory into HostInfo (NFC)
Adrian Prantl [Fri, 5 Jun 2020 00:57:11 +0000 (17:57 -0700)]
Move GetXcode*Directory into HostInfo (NFC)

These functions really don't belong into PlatformDarwin, since they
actualy query state of the Host and not of the remote platform.

4 years agoGlobalISel: Make known bits/alignment API more consistent
Matt Arsenault [Thu, 4 Jun 2020 02:06:49 +0000 (22:06 -0400)]
GlobalISel: Make known bits/alignment API more consistent

Just computing the alignment makes sense without caring about the
general known bits, such as for non-integral pointers. Separate the
two and start calling into the TargetLowering hooks for frame indexes.

Start calling the TargetLowering implementation for FrameIndexes,
which improves the AMDGPU matching for stack addressing modes. Also
introduce a new hook for returning known alignment of target
instructions. For AMDGPU, it would be useful to report the known
alignment implied by certain intrinsic calls.

Also stop using MaybeAlign.

4 years agoGlobalISel: Add G_EXTRACT/G_INSERT offset to legalize info
Matt Arsenault [Sat, 16 May 2020 14:41:35 +0000 (10:41 -0400)]
GlobalISel: Add G_EXTRACT/G_INSERT offset to legalize info

Immediate legalize fields were added for G_SEXT_INREG. Simiarly, these
are likely not legal except for certain offsets.

4 years agoRevert "[WebAssembly] Improve clang diagnostics for wasm attributes"
Dan Gohman [Fri, 5 Jun 2020 18:52:11 +0000 (11:52 -0700)]
Revert "[WebAssembly] Improve clang diagnostics for wasm attributes"

It broke clang-check.

This reverts commit 931fcd3ba011c27626a95e5e35b657763284882a.

4 years agoCorrectly report modified status for AMDGPUUnifyDivergentExitNodes
Jay Foad [Fri, 5 Jun 2020 16:12:32 +0000 (17:12 +0100)]
Correctly report modified status for AMDGPUUnifyDivergentExitNodes

Related to https://reviews.llvm.org/D80916

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

4 years agoFix -Wunused-variable after D80515
Fangrui Song [Fri, 5 Jun 2020 18:46:50 +0000 (11:46 -0700)]
Fix -Wunused-variable after D80515

4 years ago[gn build] (manually) merge 5eedf07ab999d
Nico Weber [Fri, 5 Jun 2020 18:39:04 +0000 (14:39 -0400)]
[gn build] (manually) merge 5eedf07ab999d

4 years agoAttempt to fix hip-include-path.hip
Yaxun (Sam) Liu [Fri, 5 Jun 2020 18:36:17 +0000 (14:36 -0400)]
Attempt to fix hip-include-path.hip

4 years agoAMDGPU: Fix incorrect selection of buffer atomic fadd
Matt Arsenault [Fri, 5 Jun 2020 17:57:29 +0000 (13:57 -0400)]
AMDGPU: Fix incorrect selection of buffer atomic fadd

There were additional standalone patterns for these nodes which were
missing the subtarget predicate.

4 years agoAMDGPU: Fix missing immarg on buffer.atomic.fadd intrinsic
Matt Arsenault [Fri, 5 Jun 2020 17:48:59 +0000 (13:48 -0400)]
AMDGPU: Fix missing immarg on buffer.atomic.fadd intrinsic

4 years ago[X86] Teach combineVectorShiftImm to constant fold undef elements to 0 not undef.
Craig Topper [Fri, 5 Jun 2020 17:49:21 +0000 (10:49 -0700)]
[X86] Teach combineVectorShiftImm to constant fold undef elements to 0 not undef.

Shifts are supposed to always shift in zeros or sign bits regardless of their inputs. It's possible the input value may have been replaced with undef by SimplifyDemandedBits, but the shift in zeros are still demanded.

This issue was reported to me by ispc from 10.0. Unfortunately their failing test does not fail on trunk. Seems to be because the shl is optimized out earlier now and doesn't become VSHLI.

ispc bug https://github.com/ispc/ispc/issues/1771

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

4 years ago[WebAssembly] Improve clang diagnostics for wasm attributes
Dan Gohman [Sat, 21 Dec 2019 06:11:03 +0000 (22:11 -0800)]
[WebAssembly] Improve clang diagnostics for wasm attributes

This patch addresses the review comments on r352930:

 - Removes redundant diagnostic checking code
 - Removes errnoneous use of diag::err_alias_is_definition, which
   turned out to be ineffective anyway since functions can be defined later
   in the translation unit and avoid detection.
 - Adds a test for various invalid cases for import_name and import_module.

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

4 years ago[hwasan] Disable malloc-fill by default.
Evgenii Stepanov [Fri, 5 Jun 2020 17:57:44 +0000 (10:57 -0700)]
[hwasan] Disable malloc-fill by default.

Summary: Non-zero malloc fill is causing way too many hard to debug issues.

Reviewers: kcc, pcc, hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[KernelAddressSanitizer] Make globals constructors compatible with kernel
Marco Elver [Fri, 29 May 2020 10:52:27 +0000 (12:52 +0200)]
[KernelAddressSanitizer] Make globals constructors compatible with kernel

Summary:
This makes -fsanitize=kernel-address emit the correct globals
constructors for the kernel. We had to do the following:

- Disable generation of constructors that rely on linker features such
  as dead-global elimination.

- Only emit constructors for globals *not* in explicit sections. The
  kernel uses sections for special globals, which we should not touch.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203493

Tested:
1. With 'clang/test/CodeGen/asan-globals.cpp'.
2. With test_kasan.ko, we can see:

   BUG: KASAN: global-out-of-bounds in kasan_global_oob+0xb3/0xba [test_kasan]

Reviewers: glider, andreyknvl

Reviewed By: glider

Subscribers: cfe-commits, nickdesaulniers, hiraditya, llvm-commits

Tags: #llvm, #clang

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

4 years ago[LiveDebugValues] Fix output stream (NFC)
Nikita Popov [Sat, 30 May 2020 14:07:44 +0000 (16:07 +0200)]
[LiveDebugValues] Fix output stream (NFC)

This should dump to the provided Out, rather than dbgs(), though
they coincide in current usage.

4 years ago[LiveDebugValues] Remove PendingInLocs (NFC)
Nikita Popov [Sat, 30 May 2020 14:13:41 +0000 (16:13 +0200)]
[LiveDebugValues] Remove PendingInLocs (NFC)

PendingInLocs ends up having the same value as InLocs, just computed
a bit more indirectly. It is a leftover of a previous implementation
approach.

This patch drops PendingInLocs, as well as the Diff and Removed
calulations, which are no longer needed.

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

4 years agoAMDGPU/GlobalISel: Fix some broken YAML in MIR test
Matt Arsenault [Sun, 31 May 2020 18:59:52 +0000 (14:59 -0400)]
AMDGPU/GlobalISel: Fix some broken YAML in MIR test

Different tools seem to be more or less strict with the markers
between different functions.

4 years agoGlobalISel: Infer nofpexcept flag during selection for non-strict ops
Matt Arsenault [Sun, 31 May 2020 18:19:46 +0000 (14:19 -0400)]
GlobalISel: Infer nofpexcept flag during selection for non-strict ops

Match SelectionDAG's behavior of adding nofpexcept to out instructions
that may raise fp exceptions that are selected from instructions that
do not.

4 years ago[apple clang] disable in-process CC1 to preserve crashlog compatibility
Alex Lorenz [Fri, 5 Jun 2020 17:54:03 +0000 (10:54 -0700)]
[apple clang] disable in-process CC1 to preserve crashlog compatibility

The in-process CC1 currently doesn't interoperate with the macOS crash analytics,
which we would like to keep enabled for Apple clang. This commit restores the
out-of-process CC1 to the Apple clang CMake configuration for now.

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

4 years ago[llvm-objcopy] Reorder --dump-section for MachO
Sameer Arora [Fri, 5 Jun 2020 17:47:05 +0000 (10:47 -0700)]
[llvm-objcopy] Reorder --dump-section for MachO

Reorder `DumpSection` under `handleArgs` in file `MachOObjcopy.cpp`. The
operation to dump a section is now performed before both add and remove
section operations for MachO file format.

Change for the ELF format at D81097. Together fixes
https://bugs.llvm.org/show_bug.cgi?id=44283

Reviewed By: jhenderson

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

4 years ago[mlir][test][CPU] Reduce the size of mlir-cpu-runner-tests
Nicolas Vasilache [Fri, 5 Jun 2020 17:41:05 +0000 (13:41 -0400)]
[mlir][test][CPU] Reduce the size of mlir-cpu-runner-tests

Two tests regularly show up on the long tail when testing MLIR.
This revision reduces their size.

4 years ago[llvm-objcopy] Reorder --dump-section before --remove-section for ELF
Sameer Arora [Fri, 5 Jun 2020 17:42:19 +0000 (10:42 -0700)]
[llvm-objcopy] Reorder --dump-section before --remove-section for ELF

Reorder `DumpSection` under `handleArgs` in file `ELFObjcopy.cpp`.
`DumpSection` is placed before `replaceAndRemoveSections` and is
therefore now the first operation under `handleArgs`. Thus, it is now
performed before both `add` and `remove` section operations.

Change for the MachO format at D81123. Together fixes https://bugs.llvm.org/show_bug.cgi?id=44283.

Reviewed By: alexshap, jhenderson, MaskRay

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

4 years ago[libc++] Avoid passing -xc++ in Lit feature detection
Louis Dionne [Fri, 5 Jun 2020 17:39:49 +0000 (13:39 -0400)]
[libc++] Avoid passing -xc++ in Lit feature detection

Otherwise, if %{flags} contain other files like static libraries, those
files are treated as C++ source files instead of object files, and the
compiler gets all confused.

4 years ago[ARM] VQMOVN demand bits analysis
David Green [Fri, 5 Jun 2020 14:34:15 +0000 (15:34 +0100)]
[ARM] VQMOVN demand bits analysis

Similar to VMOVN, a VQMOVN will only demand the top/bottom lanes of it's
first input. However unlike VMOVN it will need access to the entire
second argument, as that value is saturated not just moved in place.

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

4 years ago[llvm-ar] Update error messages and tests as per latest preferred style
Sameer Arora [Fri, 5 Jun 2020 17:29:24 +0000 (10:29 -0700)]
[llvm-ar] Update error messages and tests as per latest preferred style

It updates two error messages under `performOperation` in the file
llvm-ar.cpp. Furthermore, it also updates tests that print out these
error messages: `llvm/test/Object/ar-create.test` and
`llvm/test/tools/llvm-ar/print.test`.

Reviewed By: jhenderson, MaskRay

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

4 years ago[llvm-ar] Add more tests for errors in opening archives
Sameer Arora [Fri, 5 Jun 2020 17:29:18 +0000 (10:29 -0700)]
[llvm-ar] Add more tests for errors in opening archives

Add 2 more tests for the function performOperation under llvm-ar.cpp. It
tests the scenario when the archive could not be opened for reasons
other than `no_such_file_or_directory` In particular, it tests for the
cases `permission_denied` and `is_a_directory` for the target archive.

Reviewed By: alexshap, jhenderson, smeenai, MaskRay

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

4 years ago[mlir][Vector] Add folding of memref_cast into vector_transfer ops
Nicolas Vasilache [Fri, 5 Jun 2020 17:20:59 +0000 (13:20 -0400)]
[mlir][Vector] Add folding of memref_cast into vector_transfer ops

Summary:
This revision adds a common folding pattern that starts appearing on
vector_transfer ops.

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

4 years ago[gn build] Port 11d06b9511b
LLVM GN Syncbot [Fri, 5 Jun 2020 17:22:19 +0000 (17:22 +0000)]
[gn build] Port 11d06b9511b

4 years agoFix lit tests hip-include-path.hip and hip-host-cpu-macros.cu
Yaxun (Sam) Liu [Fri, 5 Jun 2020 17:21:24 +0000 (13:21 -0400)]
Fix lit tests hip-include-path.hip and hip-host-cpu-macros.cu

4 years agoReland D80640: [CodeGen][SVE] Calculate correct type legalization for scalable vectors.
Sander de Smalen [Fri, 5 Jun 2020 15:46:25 +0000 (16:46 +0100)]
Reland D80640: [CodeGen][SVE] Calculate correct type legalization for scalable vectors.

This reverts commit 9bcef270d7a319c6c0fdffc6c80984a8f0a30ecb.

4 years ago[libc++abi] Properly fix XFAILs for exception alignment
Louis Dionne [Fri, 5 Jun 2020 17:06:37 +0000 (13:06 -0400)]
[libc++abi] Properly fix XFAILs for exception alignment

Since <unwind.h> is in the SDK, not in /usr/include, the XFAILs must
be predicated on the compiler version (ideally even on the SDK version)
instead of the target system version.

4 years ago[mlir][Linalg] NFC - Cleanup debug, address post-commit review.
Nicolas Vasilache [Fri, 5 Jun 2020 17:02:13 +0000 (13:02 -0400)]
[mlir][Linalg] NFC - Cleanup debug, address post-commit review.

4 years ago[mlir] Add verify method to adaptor
Jacques Pienaar [Fri, 5 Jun 2020 16:47:37 +0000 (09:47 -0700)]
[mlir] Add verify method to adaptor

This allows verifying op-indepent attributes (e.g., attributes that do not require the op to have been created) before constructing an operation. These include checking whether required attributes are defined or constraints on attributes (such as I32 attribute). This is not perfect (e.g., if one had a disjunctive constraint where one part relied on the op and the other doesn't, then this would not try and extract the op independent from the op dependent).

The next step is to move these out to a trait that could be verified earlier than in the generated method. The first use case is for inferring the return type while constructing the op. At that point you don't have an Operation yet and that ends up in one having to duplicate the same checks, e.g., verify that attribute A is defined before querying A in shape function which requires that duplication. Instead this allows one to invoke a method to verify all the traits and, if this is checked first during verification, then all other traits could use attributes knowing they have been verified.

It is a little bit funny to have these on the adaptor, but I see the adaptor as a place to collect information about the op before the op is constructed (e.g., avoiding stringly typed accessors, verifying what is possible to verify before the op is constructed) while being cheap to use even with constructed op (so layer of indirection between the op constructed/being constructed). And from that point of view it made sense to me.

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

4 years ago[CMake] Do not append -lm to CMAKE_REQUIRED_LIBRARIES on Apple
Louis Dionne [Fri, 5 Jun 2020 15:12:47 +0000 (11:12 -0400)]
[CMake] Do not append -lm to CMAKE_REQUIRED_LIBRARIES on Apple

On Apple platforms, linking against libSystem.dylib is sufficient, and
some Apple platforms don't provide libm.dylib. On those platforms, adding
-lm to CMAKE_REQUIRED_LIBRARIES causes all subsequent compile-flag checks
to fail due to the missing library.

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

4 years ago[HIP] Add default header and include path
Yaxun (Sam) Liu [Wed, 3 Jun 2020 14:05:52 +0000 (10:05 -0400)]
[HIP] Add default header and include path

To support std::complex and some other standard C/C++ functions in HIP device code,
they need to be forced to be __host__ __device__ functions by pragmas. This is done
by some clang standard C++ wrapper headers which are shared between cuda-clang and hip-Clang.

For these standard C++ wapper headers to work properly, specific include path order
has to be enforced:

  clang C++ wrapper include path
  standard C++ include path
  clang include path

Also, these C++ wrapper headers require device version of some standard C/C++ functions
must be declared before including them. This needs to be done by including a default
header which declares or defines these device functions. The default header is always
included before any other headers are included by users.

This patch adds the the default header and include path for HIP.

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

4 years agoScalarEvolutionNormalization.h - reduce ScalarEvolutionExpressions.h include to forwa...
Simon Pilgrim [Fri, 5 Jun 2020 16:40:19 +0000 (17:40 +0100)]
ScalarEvolutionNormalization.h - reduce ScalarEvolutionExpressions.h include to forward declaration. NFC.

4 years agoTypeMetadataUtils.h - reduce Instructions.h include to forward declaration. NFC.
Simon Pilgrim [Fri, 5 Jun 2020 16:27:55 +0000 (17:27 +0100)]
TypeMetadataUtils.h - reduce Instructions.h include to forward declaration. NFC.

Move implicit include dependencies down to source file.

4 years ago[x86] form reduction intrinsics from vectorizers instead of raw IR
Sanjay Patel [Fri, 5 Jun 2020 16:20:13 +0000 (12:20 -0400)]
[x86] form reduction intrinsics from vectorizers instead of raw IR

Motivating examples are seen in the PhaseOrdering tests based on:
https://bugs.llvm.org/show_bug.cgi?id=43953#c2 - if we have
intrinsics there, some pass can fold them.

The intrinsics are still named "experimental" at this point, but
if there is no fallout from this patch, that will be a good
indicator that it is safe to finalize them.

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

4 years ago[PhaseOrdering] add tests for reductions; NFC (PR43953)
Sanjay Patel [Fri, 5 Jun 2020 14:11:21 +0000 (10:11 -0400)]
[PhaseOrdering] add tests for reductions; NFC (PR43953)

4 years ago[gn build] (manually) port a6fcf5ca033
Nico Weber [Fri, 5 Jun 2020 16:32:23 +0000 (12:32 -0400)]
[gn build] (manually) port a6fcf5ca033

4 years agoAdd ASan metadata globals to @llvm.compiler.used under COFF
Arthur Eubanks [Thu, 4 Jun 2020 16:48:42 +0000 (09:48 -0700)]
Add ASan metadata globals to @llvm.compiler.used under COFF

Summary:
This matches ELF.

This makes the number of ASan failures under the new pass manager on
Windows go from 18 to 1.

Under the old pass manager, the ASan module pass was one of the very
last things run, so these globals didn't get removed due to GlobalOpt.
But with the NPM the ASan module pass that adds these globals are run
much earlier in the pipeline and GlobalOpt ends up removing them.

Reviewers: vitalybuka, hans

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoMark lambda in use-after-scope-capture.cpp as noinline
Arthur Eubanks [Thu, 4 Jun 2020 20:08:35 +0000 (13:08 -0700)]
Mark lambda in use-after-scope-capture.cpp as noinline

Summary:
As explained in https://bugs.llvm.org/show_bug.cgi?id=46208,
symbolization on Windows after inlining and around
lambdas/std::functions doesn't work very well. Under the new pass
manager, there is inlining at -O1.
use-after-scope-capture.cpp checks that the symbolization points to the
line containing "return x;", but the combination of
Windows/inlining/lambdas makes the symbolization point to the line
"f = [&x]() {".

Mark the lambda as noinline since this test is not a test for
symbolization.

Reviewers: hans, dblaikie, vitalybuka

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[X86][SSE] Simplify MOVMSK patterns based on comparison
Simon Pilgrim [Fri, 5 Jun 2020 15:53:10 +0000 (16:53 +0100)]
[X86][SSE] Simplify MOVMSK patterns based on comparison

An initial patch adding combineSetCCMOVMSK to simplify MOVMSK and its vector input based on the comparison of the MOVMSK result.

This first stage just adds support for some simple MOVMSK(PACKSSBW()) cases where we remove the PACKSS if we're comparing ne/eq zero (any_of patterns), allowing us to directly compare against the v8i16 source vector(s) bitcasted to v16i8, with suitable masking to take into account of which signbits are valid.

Future combines could peek through further PACKSS, target shuffles, handle all_of patterns (ne/eq -1), optimize to a PTEST op, etc.

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

4 years agoFix the roundtrip test under llvm-profdata
Xun Li [Fri, 5 Jun 2020 15:51:54 +0000 (08:51 -0700)]
Fix the roundtrip test under llvm-profdata

Summary:
According to the comments, we want to convert the profile into two binary formats, and then into the md5text format.
We seems to have ignored the intermediate files.
This patch uses them to complete the full roundtrips.

Reviewers: wmi, wenlei

Reviewed By: wmi

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[flang] Fix crash on erroneous expressions
Pete Steinfeld [Wed, 3 Jun 2020 15:03:14 +0000 (08:03 -0700)]
[flang] Fix crash on erroneous expressions

Summary:
If you create an expression with parse errors, the `parser::Expr.typedExpr`
will be empty, which causes a compiler crash.  The crash is caused by the
check in check-do-forall.cpp that scans all expresssions to see if `DO`
variables are being modified.

It turned out that the problem was that I was fetching subexpressions of type
`parser::Expr`, which are not guaranteed to have a non-null `typedExpr`.  I
fixed this by only grabbing the top-level expression from which to gather
arguments as part of the DO loop analysis.  This, in turn, exposed a problem
where I wasn't collecting all of the actual arguments in an expression.  This
was caused by the fact that I wasn't recursing through the rest of the
expression after finding an argument.  I fixed this by recursing through the
argument in the member function in `CollectActualArgumentsHelper`.

Reviewers: klausler, tskeith, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[ELF] Handle -u before input files
Fangrui Song [Fri, 5 Jun 2020 15:41:03 +0000 (08:41 -0700)]
[ELF] Handle -u before input files

If both a.a and b.so define foo

```
ld.bfd -u foo a.a b.so  # foo is defined
ld.bfd a.a b.so -u foo  # foo is defined
ld.bfd -u foo b.so a.a  # foo is undefined (provided at runtime by b.so)
ld.bfd b.so a.a -u foo  # foo is undefined (provided at runtime by b.so)
```

In all cases we make foo undefined in the output.  I tend to think the
GNU ld behavior makes more sense.

* In their model, they have to treat -u as a fake object file with an
  undefined symbol before all input files, otherwise the first archive would not be fetched.
* Following their behavior allows us to drop a --warn-backrefs special case.

Reviewed By: psmith

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

4 years agoFix crash on misc-redundant-expression
Zinovy Nis [Sun, 31 May 2020 18:53:13 +0000 (21:53 +0300)]
Fix crash on misc-redundant-expression

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

4 years ago[dsymutil] Don't emit N_AST symbol entries in the Mach-O companion file
Jonas Devlieghere [Fri, 5 Jun 2020 15:39:02 +0000 (08:39 -0700)]
[dsymutil] Don't emit N_AST symbol entries in the Mach-O companion file

Treat N_AST symbol table entries like other debug entries and don't emit
them in the linked binary.

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

4 years ago[mlir][SCF] Add single iteration scf.for promotion to the FuncOp level helper.
Nicolas Vasilache [Fri, 5 Jun 2020 15:23:43 +0000 (11:23 -0400)]
[mlir][SCF] Add single iteration scf.for promotion to the FuncOp level helper.

Previously only the Affine version would be folded.

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

4 years ago[lit] Improve naming of test result categories
Julian Lettner [Wed, 8 Apr 2020 05:48:39 +0000 (22:48 -0700)]
[lit] Improve naming of test result categories

Improve consistency when printing test results:
Previously we were using different labels for group names (the header
for the list of, e.g., failing tests) and summary count lines.  For
example, "Failing Tests"/"Unexpected Failures".  This commit changes lit
to label things consistently.

Improve wording of labels:
When talking about individual test results, the first word in
"Unexpected Failures", "Expected Passes", and "Individual Timeouts" is
superfluous.  Some labels contain the word "Tests" and some don't.
Let's simplify the names.

Before:
```
Failing Tests (1):
  ...

Expected Passes    : 3
Unexpected Failures: 1
```

After:
```
Failed Tests (1):
  ...

Passed: 3
Failed: 1
```

Reviewed By: ldionne

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

4 years agoRevert "[CodeGen][SVE] Calculate correct type legalization for scalable vectors."
Sander de Smalen [Fri, 5 Jun 2020 15:03:13 +0000 (16:03 +0100)]
Revert "[CodeGen][SVE] Calculate correct type legalization for scalable vectors."

Seems to break some buildbots, reverting the patch for now.

This reverts commit 164f4b9d26fdf3cd640a09b63b5ec44d033cbe8a.

4 years ago[AST] Record SourceLocation for TypoExpr.
Haojian Wu [Tue, 2 Jun 2020 14:35:29 +0000 (16:35 +0200)]
[AST] Record SourceLocation for TypoExpr.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[VE] Support logical operation instructions in MC layer
Kazushi (Jam) Marukawa [Fri, 5 Jun 2020 14:57:37 +0000 (16:57 +0200)]
[VE] Support logical operation instructions in MC layer

Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
logical operation instructions. Also change asmparser to support CMOV
instruction. And, add new EQV/MRG/NND isntructions also.

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

4 years ago[mlir][gpu] Introduce mlir-rocm-runner.
Wen-Heng (Jack) Chung [Wed, 20 May 2020 21:07:49 +0000 (16:07 -0500)]
[mlir][gpu] Introduce mlir-rocm-runner.

Summary:
`mlir-rocm-runner` is introduced in this commit to execute GPU modules on ROCm
platform. A small wrapper to encapsulate ROCm's HIP runtime API is also inside
the commit.

Due to behavior of ROCm, raw pointers inside memrefs passed to `gpu.launch`
must be modified on the host side to properly capture the pointer values
addressable on the GPU.

LLVM MC is used to assemble AMD GCN ISA coming out from
`ConvertGPUKernelToBlobPass` to binary form, and LLD is used to produce a shared
ELF object which could be loaded by ROCm HIP runtime.

gfx900 is the default target be used right now, although it could be altered via
an option in `mlir-rocm-runner`. Future revisions may consider using ROCm Agent
Enumerator to detect the right target on the system.

Notice AMDGPU Code Object V2 is used in this revision. Future enhancements may
upgrade to AMDGPU Code Object V3.

Bitcode libraries in ROCm-Device-Libs, which implements math routines exposed in
`rocdl` dialect are not yet linked, and is left as a TODO in the logic.

Reviewers: herhut

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

Tags: #mlir, #llvm

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

4 years ago[CodeGen][SVE] Calculate correct type legalization for scalable vectors.
Sander de Smalen [Fri, 5 Jun 2020 11:54:39 +0000 (12:54 +0100)]
[CodeGen][SVE] Calculate correct type legalization for scalable vectors.

This patch updates TargetLoweringBase::computeRegisterProperties and
TargetLoweringBase::getTypeConversion to support scalable vectors,
and make the right calls on how to legalise them. These changes are required
to legalise both MVTs and EVTs.

Reviewers: efriedma, david-arm, ctetreau

Reviewed By: efriedma

Tags: #llvm

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

4 years ago[SCCP] Report changes after removing stores to constant global
serge-sans-paille [Thu, 4 Jun 2020 21:33:03 +0000 (23:33 +0200)]
[SCCP] Report changes after removing stores to constant global

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

4 years agoCorrectly report modified status for DivRemPairs
serge-sans-paille [Thu, 4 Jun 2020 20:24:31 +0000 (22:24 +0200)]
Correctly report modified status for DivRemPairs

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

4 years agoCorrectly report modified status for DSE
serge-sans-paille [Thu, 4 Jun 2020 20:23:32 +0000 (22:23 +0200)]
Correctly report modified status for DSE

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

4 years agoCorrectly report modified status for TailRecursionElimination
serge-sans-paille [Thu, 4 Jun 2020 20:24:03 +0000 (22:24 +0200)]
Correctly report modified status for TailRecursionElimination

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

4 years agoCorrectly report modified status for ObjCARCContract
serge-sans-paille [Thu, 4 Jun 2020 21:33:54 +0000 (23:33 +0200)]
Correctly report modified status for ObjCARCContract

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

4 years agoCorrectly report modified status for ObjCARCOpt
serge-sans-paille [Thu, 4 Jun 2020 13:38:32 +0000 (15:38 +0200)]
Correctly report modified status for ObjCARCOpt

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

4 years ago[llvm][AArch64] Fix unused variable
Kadir Cetinkaya [Fri, 5 Jun 2020 13:56:19 +0000 (15:56 +0200)]
[llvm][AArch64] Fix unused variable

4 years ago[libc++] Translate locale detection to the DSL
Louis Dionne [Fri, 17 Apr 2020 18:23:31 +0000 (14:23 -0400)]
[libc++] Translate locale detection to the DSL

4 years agoReturn "[InstCombine] Simplify compare of Phi with constant inputs against a constant"
Max Kazantsev [Fri, 5 Jun 2020 13:44:41 +0000 (20:44 +0700)]
Return "[InstCombine] Simplify compare of Phi with constant inputs against a constant"

This reverts commit c4b5a66e44f031eb89c9d6ea32b144f1169bdbae.

Returning along with Clang test fix

4 years agoCorrectly report modified status for LoopSimplify
serge-sans-paille [Thu, 4 Jun 2020 11:45:15 +0000 (13:45 +0200)]
Correctly report modified status for LoopSimplify

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

4 years agoFix return status of AddressSanitizer pass
serge-sans-paille [Thu, 4 Jun 2020 07:13:11 +0000 (09:13 +0200)]
Fix return status of AddressSanitizer pass

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

4 years ago[VE] Support branch instructions in MC layer
Kazushi (Jam) Marukawa [Fri, 5 Jun 2020 13:43:29 +0000 (15:43 +0200)]
[VE] Support branch instructions in MC layer

Summary:
Add regression tests of asmparser, mccodeemitter, and disassembler for
branch instructions.  In order to support them, we enhance asmparser
by adding splitting mnemonic mechanism, e.g. "bgt.l.t" into "b", "gt",
and ".l.t", and parsing mechanism for AS style memory addressing.
We also implment encoding and decoding mechanism for branch instructions.

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

4 years agoSyncDependenceAnalysis.h - remove orphan method declarations. NFCI.
Simon Pilgrim [Fri, 5 Jun 2020 11:47:50 +0000 (12:47 +0100)]
SyncDependenceAnalysis.h - remove orphan method declarations. NFCI.

These have been there since the header was added by D51491 but afaict without an implementation, all functionality is actually in DivergenceAnalysis

4 years agoTargetLibraryInfo.h - reduce Triple.h include to forward declaration. NFC.
Simon Pilgrim [Fri, 5 Jun 2020 11:17:32 +0000 (12:17 +0100)]
TargetLibraryInfo.h - reduce Triple.h include to forward declaration. NFC.

Move implicit include dependencies down to source files.

4 years agoScopedNoAliasAA.h - remove unnecessary InstrTypes.h include. NFC.
Simon Pilgrim [Fri, 5 Jun 2020 10:31:35 +0000 (11:31 +0100)]
ScopedNoAliasAA.h - remove unnecessary InstrTypes.h include. NFC.

4 years ago[clang][BFloat] Add create/set/get/dup intrinsics
Ties Stuij [Fri, 5 Jun 2020 13:26:51 +0000 (14:26 +0100)]
[clang][BFloat] Add create/set/get/dup intrinsics

Summary:
This patch is part of a series that adds support for the Bfloat16 extension of
the Armv8.6-a architecture, as detailed here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

The bfloat type and its properties are specified in the Arm Architecture
Reference Manual:

https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile

The following people contributed to this patch:
- Luke Cheeseman
- Momchil Velikov
- Luke Geeson
- Ties Stuij
- Mikhail Maltsev

Reviewers: t.p.northover, sdesmalen, fpetrogalli, LukeGeeson, stuij, labrinea

Reviewed By: labrinea

Subscribers: miyuki, dmgreen, labrinea, kristof.beyls, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[Alignment][NFC] Migrate CallingConv tablegen code
Guillaume Chatelet [Thu, 4 Jun 2020 21:56:01 +0000 (21:56 +0000)]
[Alignment][NFC] Migrate CallingConv tablegen code

Summary:
We first migrate the generated code, more patches to come.

This patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoFix a typo in AMDGPU docs
madhur13490 [Thu, 7 May 2020 17:27:32 +0000 (17:27 +0000)]
Fix a typo in AMDGPU docs

Reviewers: t-tye, arsenm

Reviewed By: arsenm

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

Tags: #llvm

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

4 years ago[libc++] Link against libatomic when it is found
Louis Dionne [Thu, 4 Jun 2020 18:54:38 +0000 (14:54 -0400)]
[libc++] Link against libatomic when it is found

Before this patch, we tried detecting whether small atomics were available
without linking against libatomic. However, that's not really what we want
to know -- instead, we want to know what's required in order to support
atomics fully, which is to link against libatomic when it's provided.

That is both much simpler, and it doesn't suffer the problem that we would
not link against libatomic when small atomics didn't require it, which
lead to non-lockfree atomics never working.

Furthermore, because we understand that some platforms might not want to
(or be able to) ship non-lockfree atomics, we add that notion to the test
suite, independently of a potential extern library.

After this patch, we therefore:
(1) Link against libatomic when it is provided
(2) Independently detect whether non-lockfree atomics are supported in
    the test suite, regardless of whether that means we're linking against
    an external library or not (which is an implementation detail).

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

4 years ago[clang][BFloat] add NEON emitter for bfloat
Ties Stuij [Fri, 5 Jun 2020 12:06:01 +0000 (13:06 +0100)]
[clang][BFloat] add NEON emitter for bfloat

Summary:
This patch adds the bfloat16_t struct typedefs (e.g. bfloat16x8x2_t) to
arm_neon.h

This patch is part of a series implementing the Bfloat16 extension of the
Armv8.6-a architecture, as detailed here:

https://community.arm.com/developer/ip-products/processors/b/processors-ip-blog/posts/arm-architecture-developments-armv8-6-a

The bfloat type, and its properties are specified in the Arm Architecture
Reference Manual:

https://developer.arm.com/docs/ddi0487/latest/arm-architecture-reference-manual-armv8-for-armv8-a-architecture-profile

The following people contributed to this patch:
- Luke Cheeseman
- Simon Tatham
- Ties Stuij

Reviewers: t.p.northover, fpetrogalli, sdesmalen, az, LukeGeeson

Reviewed By: fpetrogalli

Subscribers: SjoerdMeijer, LukeGeeson, pbarrio, mgorny, kristof.beyls, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[MLIR][SPIRV] Support flat, location, and noperspective decorations
HazemAbdelhafez [Fri, 5 Jun 2020 12:38:40 +0000 (08:38 -0400)]
[MLIR][SPIRV] Support flat, location, and noperspective decorations

Add support for flat, location, and noperspective decorations in the
serializer and deserializer to be able to process basic shader files
for graphics applications.

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

4 years agoFix build breakage caused by 66a1b83bf93ec46f6d7a06c47d5981ae154f9ea0
Denis Antrushin [Fri, 5 Jun 2020 12:52:14 +0000 (15:52 +0300)]
Fix build breakage caused by 66a1b83bf93ec46f6d7a06c47d5981ae154f9ea0

4 years ago[mlir][Vector] Move temporary alloc to top of the function alloca when lowering vecto...
Nicolas Vasilache [Fri, 5 Jun 2020 12:22:15 +0000 (08:22 -0400)]
[mlir][Vector] Move temporary alloc to top of the function alloca when lowering vector_transfers

Recently introduced allocation hoisting is quite conservative on the cases when it triggers.
This revision makes it such that the allocations for vector transfer lowerings are hoisted
to the top of the function.
This should be revisited in the context of parallelism and is a temporary workaround.

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

4 years ago[MsgPack] Added a convenience operator
Dineshkumar Bhaskaran [Fri, 5 Jun 2020 12:41:37 +0000 (12:41 +0000)]
[MsgPack] Added a convenience operator

Summary: Added "not equal to" operator for DocNode comparison

Reviewers: arsenm, scott.linder, saiislam

Reviewed By: saiislam

Subscribers: wdng, llvm-commits

Tags: #llvm

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

4 years agoRemove mention of counter from Archer readme
Joachim Protze [Fri, 5 Jun 2020 12:29:22 +0000 (14:29 +0200)]
Remove mention of counter from Archer readme

The feature was removed before upstreaming Archer, so the documentation is wrong

4 years ago[ARM] Add poly64_t on AArch32.
Ties Stuij [Fri, 5 Jun 2020 09:35:59 +0000 (10:35 +0100)]
[ARM] Add poly64_t on AArch32.

Summary:
The poly64 types are guarded with ifdefs for AArch64 only. This is wrong. This
was also incorrectly documented in the ACLE spec, but this has been rectified in
the latest release. See paragraph 13.1.2 "Vector data types":

https://developer.arm.com/docs/101028/latest

This patch was written by Alexandros Lamprineas.

Reviewers: ostannard, sdesmalen, fpetrogalli, labrinea, t.p.northover, LukeGeeson

Reviewed By: ostannard

Subscribers: pbarrio, LukeGeeson, kristof.beyls, danielkiss, cfe-commits

Tags: #clang

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

4 years ago[TargetLowering][NFC] More efficient emitPatchpoint().
Denis Antrushin [Thu, 4 Jun 2020 16:11:13 +0000 (19:11 +0300)]
[TargetLowering][NFC] More efficient emitPatchpoint().

Current implementation of emitPatchpoint() is very inefficient:
for every FrameIndex operand if creates new MachineInstr with
that operand expanded and all other copied as is.
Since PATCHPOINT/STATEPOINT instructions may have *a lot* of
FrameIndex operands, we end up creating and erasing many
machine instructions. But we can do it in single pass, with only
one new machine instruction generated.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D81181

4 years ago[Dexter] Add DexLimitSteps command and ConditionalController
Tom Weaver [Fri, 5 Jun 2020 11:53:56 +0000 (12:53 +0100)]
[Dexter] Add DexLimitSteps command and ConditionalController

* Adds DexLimitSteps Command.
* Add ConditionalController, a new DebuggerController type.
* 5 regression tests
* documentation

* recommit, fixed accidental adding of unnecessary file

Reviewers: jmorse

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