platform/upstream/llvm.git
3 years ago[mlir][linalg] Add helper to update IndexOps after tiling (NFC).
Tobias Gysi [Fri, 17 Sep 2021 14:54:04 +0000 (14:54 +0000)]
[mlir][linalg] Add helper to update IndexOps after tiling (NFC).

Add the addTileLoopIvsToIndexOpResults method to shift the IndexOp results after tiling.

Reviewed By: nicolasvasilache

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

3 years ago[flang] Revamp C1502 checking of END INTERFACE [generic-spec]
peter klausler [Thu, 9 Sep 2021 22:23:48 +0000 (15:23 -0700)]
[flang] Revamp C1502 checking of END INTERFACE [generic-spec]

Validation of the optional generic-spec on an END INTERFACE statement
was missing many possible error cases; reimplement it.

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

3 years agoFix CodeGen/pgo-sample-thinlto-summary.c with old PM
Thomas Preud'homme [Fri, 17 Sep 2021 09:23:40 +0000 (10:23 +0100)]
Fix CodeGen/pgo-sample-thinlto-summary.c with old PM

Re-add -fexperimental-new-pass-manager to
Clang::CodeGen/pgo-sample-thinlto-summary.c for the test to work on
builds that still default to the old pass manager.

Reviewed By: tejohnson

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

3 years ago[HWASan] Intercept setjmp/longjmp on x86_64.
Matt Morehouse [Fri, 17 Sep 2021 14:08:57 +0000 (07:08 -0700)]
[HWASan] Intercept setjmp/longjmp on x86_64.

Reviewed By: xiangzhangllvm

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

3 years ago[flang][OpenMP] Add semantic checks for ordered construct
PeixinQiao [Fri, 17 Sep 2021 13:53:07 +0000 (21:53 +0800)]
[flang][OpenMP] Add semantic checks for ordered construct

This patch implements the following semantic checks according to
OpenMP Version 5.1 Ordered construct restriction:

```
At most one threads clause can appear on an ordered construct; At most
one simd clause can appear on an ordered construct; At most one
depend(source) clause can appear on an ordered construct; Either
depend(sink:vec) clauses or depend(source) clauses may appear on an
ordered construct, but not both.
```

This patch also implements the following semantic checks according to
the syntax and descriptions in OpenMP Version 5.1 Ordered construct:

```
The dependence types of sink or source are only allowed on an ordered
construct. The depend(*) clauses are not allowed when ordered construct
is a block construct with an ordered region. The threads or simd clauses
are not allowed when the ordered construct is a standalone construct
with no ordered region.
```

Co-authored-by: Sameeran Joshi <sameeranjayant.joshi@amd.com>
Reviewed By: kiranchandramohan

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

3 years ago[NFC] Added testcase for PR25725
Dávid Bolvanský [Fri, 17 Sep 2021 13:48:36 +0000 (15:48 +0200)]
[NFC] Added testcase for PR25725

3 years agoFix test failure from e3b10525b489b604d6a1e540be78bda80afb5868
Erich Keane [Fri, 17 Sep 2021 13:20:55 +0000 (06:20 -0700)]
Fix test failure from e3b10525b489b604d6a1e540be78bda80afb5868

Seemingly, names in anonymous namespaces are ALWAYS given the unique
internal linkage name on windows, and I was not aware of this when I put
the names in my test!  Replaced them with a wildcard.

3 years ago[OpenCL] Supports optional same image reads and writes in C++ for OpenCL 2021
Justas Janickas [Wed, 1 Sep 2021 14:20:01 +0000 (15:20 +0100)]
[OpenCL] Supports optional same image reads and writes in C++ for OpenCL 2021

Adds support for a feature macro `__opencl_c_read_write_images` in
C++ for OpenCL 2021 enabling a respective optional core feature
from OpenCL 3.0.

This change aims to achieve compatibility between C++ for OpenCL
2021 and OpenCL 3.0.

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

3 years ago[DebugInfo] DWARF - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 13:03:38 +0000 (14:03 +0100)]
[DebugInfo] DWARF - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[CodeGen] LiveDebug - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 13:00:16 +0000 (14:00 +0100)]
[CodeGen] LiveDebug - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[TableGen] X86EVEX2VEXTablesEmitter - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 12:36:42 +0000 (13:36 +0100)]
[TableGen] X86EVEX2VEXTablesEmitter - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[X86] X86PreTileConfig - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 12:35:59 +0000 (13:35 +0100)]
[X86] X86PreTileConfig - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years agoMake multiversioning work with internal linkage
Erich Keane [Thu, 16 Sep 2021 16:57:54 +0000 (09:57 -0700)]
Make multiversioning work with internal linkage

We previously made all multiversioning resolvers/ifuncs have weak
ODR linkage in IR, since we NEED to emit the whole resolver every time
we see a call, but it is not necessarily the place where all the
definitions live.

HOWEVER, when doing so, we neglected the case where the versions have
internal linkage.  This patch ensures we do this, so you don't get weird
behavior with static functions.

3 years ago[MLIR] PresbugerSet: slightly expand documentation
Arjun P [Fri, 17 Sep 2021 11:07:28 +0000 (16:37 +0530)]
[MLIR] PresbugerSet: slightly expand documentation

3 years agoFix Wdocumentation warnings. NFCI.
Simon Pilgrim [Fri, 17 Sep 2021 11:45:56 +0000 (12:45 +0100)]
Fix Wdocumentation warnings. NFCI.

Fix parameter name typos and drop returns statements from void functions

3 years ago[X86][Atom] Fix integer shuffles uops, latency and throughput
Simon Pilgrim [Fri, 17 Sep 2021 10:51:46 +0000 (11:51 +0100)]
[X86][Atom] Fix integer shuffles uops, latency and throughput

The MMX pack/unpck shuffles don't need an override - they have the same behaviour as other shuffles (Port0 only).
The SSE pslldq/psrldq shuffles don't need an override - they have the same behaviour as other shuffles (Port0 only).
The SSE pshufb shuffles use 4uops (+1 load).

Noticed the pslldq/psrldq issue while trying to improve reduction costs via the D103695 helper script, and fixed the others while reviewing. Confirmed with Intel AoM / Agner / InstLatX64.

3 years ago[CodeGen] MachineInstr::getUsedDebugRegs() - Use const-ref iterator in for-range...
Simon Pilgrim [Thu, 16 Sep 2021 17:50:20 +0000 (18:50 +0100)]
[CodeGen] MachineInstr::getUsedDebugRegs() - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[AsmPrinter] DebugLocEntry::dump() - Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Thu, 16 Sep 2021 17:48:20 +0000 (18:48 +0100)]
[AsmPrinter] DebugLocEntry::dump() - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[TableGen] Record::checkRecordAssertions() - Use const-ref iterator in for-range...
Simon Pilgrim [Thu, 16 Sep 2021 17:46:08 +0000 (18:46 +0100)]
[TableGen] Record::checkRecordAssertions() - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[TextAPI] Use const-ref iterator in for-range loop. NFCI.
Simon Pilgrim [Thu, 16 Sep 2021 17:44:53 +0000 (18:44 +0100)]
[TextAPI] Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

3 years ago[MLIR] AffineStructures: support removing a range of constraints at once
Arjun P [Thu, 16 Sep 2021 19:27:11 +0000 (00:57 +0530)]
[MLIR] AffineStructures: support removing a range of constraints at once

Reviewed By: Groverkss, grosser

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

3 years ago[MLIR] AffineStructures::removeIdRange: support specifying a range within an IdKind
Arjun P [Thu, 16 Sep 2021 19:22:20 +0000 (00:52 +0530)]
[MLIR] AffineStructures::removeIdRange: support specifying a range within an IdKind

Reviewed By: Groverkss, grosser

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

3 years ago[MLIR] Matrix: support resizing horizontally
Arjun P [Fri, 17 Sep 2021 07:44:50 +0000 (13:14 +0530)]
[MLIR] Matrix: support resizing horizontally

Reviewed By: Groverkss

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

3 years ago[SystemZ] Recognize .machine directive in parser.
Jonas Paulsson [Sun, 12 Sep 2021 15:16:35 +0000 (17:16 +0200)]
[SystemZ]  Recognize .machine directive in parser.

The .machine directive can be used in assembly files to specify the ISA for
the instructions following it.

Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D109660

3 years agoGlobalISel/Utils: Refactor integer/float constant match functions
Petar Avramovic [Fri, 17 Sep 2021 09:21:55 +0000 (11:21 +0200)]
GlobalISel/Utils: Refactor integer/float constant match functions

Rework getConstantstVRegValWithLookThrough in order to make it clear if we
are matching integer/float constant only or any constant(default).
Add helper functions that get DefVReg and APInt/APFloat from constant instr
getIConstantVRegValWithLookThrough: integer constant, only G_CONSTANT
getFConstantVRegValWithLookThrough: float constant, only G_FCONSTANT
getAnyConstantVRegValWithLookThrough: either G_CONSTANT or G_FCONSTANT

Rename getConstantVRegVal and getConstantVRegSExtVal to getIConstantVRegVal
and getIConstantVRegSExtVal. These now only match G_CONSTANT as described
in comment.

Relevant matchers now return both DefVReg and APInt/APFloat.

Replace existing uses of getConstantstVRegValWithLookThrough and
getConstantVRegVal with new helper functions. Any constant match is
only required in:
ConstantFoldBinOp: for constant argument that was bit-cast of float to int
getAArch64VectorSplat: AArch64::G_DUP operands can be any constant
amdgpu select for G_BUILD_VECTOR_TRUNC: operands can be any constant

In other places use integer only constant match.

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

3 years ago[OpenCL] Supports optional pipe types in C++ for OpenCL 2021
Justas Janickas [Wed, 1 Sep 2021 15:37:37 +0000 (16:37 +0100)]
[OpenCL] Supports optional pipe types in C++ for OpenCL 2021

Adds support for a feature macro `__opencl_c_pipes` in C++ for
OpenCL 2021 enabling a respective optional core feature from
OpenCL 3.0.

This change aims to achieve compatibility between C++ for OpenCL
2021 and OpenCL 3.0.

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

3 years ago[Test] Add simple test where IndVars fails to remove checks on negative values
Max Kazantsev [Fri, 17 Sep 2021 08:39:41 +0000 (15:39 +0700)]
[Test] Add simple test where IndVars fails to remove checks on negative values

3 years ago[DSE] Add test cases with stores to objects before they escape.
Florian Hahn [Wed, 15 Sep 2021 10:42:23 +0000 (11:42 +0100)]
[DSE] Add test cases with stores to objects before they escape.

Test cases where stores to local objects can be removed because the
object does not escape before calls that may read/write to memory.

Includes test from PR50220.

3 years agoRevert "[PowerPC][ELF] make sure local variable space does not overlap with parameter...
Chen Zheng [Fri, 17 Sep 2021 07:56:43 +0000 (07:56 +0000)]
Revert "[PowerPC][ELF] make sure local variable space does not overlap with parameter save area"

This causes mix-compile issues on PowerPC Linux.

This reverts commit 324bd467a217d89b5ab84a8ed66c0d3dc431782a.

3 years ago[Test] One more missing opportunity on IndVars check removal
Max Kazantsev [Fri, 17 Sep 2021 07:20:38 +0000 (14:20 +0700)]
[Test] One more missing opportunity on IndVars check removal

3 years agoRevert "[examples] Fix SectionMemoryManager deconstruction error with MSVC."
Lang Hames [Fri, 17 Sep 2021 07:42:25 +0000 (17:42 +1000)]
Revert "[examples] Fix SectionMemoryManager deconstruction error with MSVC."

This reverts commit 63838d88145feaeb839efff8f40ab1e98597e423, which broke tests
on some bots. See e.g. https://lab.llvm.org/buildbot#builders/109/builds/22561

3 years ago[Clang] Fix long double availability check
Qiu Chaofan [Fri, 17 Sep 2021 07:24:06 +0000 (15:24 +0800)]
[Clang] Fix long double availability check

fae0dfa changed code to check 128-bit float availability, since it
introduced a new 128-bit double type on PowerPC. However, there're other
long float types besides IEEE float128 and PPC double-double requiring
this feature.

Reviewed By: ronlieb

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

3 years ago[FuncSpec] Specialising on addresses of const global values.
Sjoerd Meijer [Fri, 17 Sep 2021 07:07:05 +0000 (08:07 +0100)]
[FuncSpec] Specialising on addresses of const global values.

This introduces an option to allow specialising on the address of global
values. This option is off by default because it is likely not that profitable
to do so and needs more investigation. Before, we were specialising on addresses
and thus this changes the default behaviour.

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

3 years ago[examples] Fix SectionMemoryManager deconstruction error with MSVC.
Lang Hames [Fri, 17 Sep 2021 06:18:19 +0000 (16:18 +1000)]
[examples] Fix SectionMemoryManager deconstruction error with MSVC.

This commit fixes an order-of-initialization issue: If the default mmapper
object is destroyed while some global SectionMemoryManager is still using it
then calls to the mapper from ~SectionMemoryManager will fail. This issue was
causing failures when running the LLVM Kaleidoscope examples on windows.

Switching to a ManagedStatic solves the initialization order issue.

Patch by Justice Adams. Thanks Justice!

Reviewed By: lhames

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

3 years agoCodeView: static_cast result of getOffset() to size_t.
Peter Collingbourne [Fri, 17 Sep 2021 06:37:39 +0000 (23:37 -0700)]
CodeView: static_cast result of getOffset() to size_t.

Silences a narrowing conversion warning on 32-bit platforms after D109923.

3 years ago[flang] Make 'this_image()' an intrinsic function
Craig Rasmussen [Fri, 17 Sep 2021 00:21:40 +0000 (17:21 -0700)]
[flang] Make 'this_image()' an intrinsic function

Added 'this_image()' to the list of functions that are evaluated as intrinsic.
Added IsCoarray functions to determine if an expression is a coarray (corank > 1).

Added save attribute to coarray variables in test file, this_image.f90.

reviewers: klausler, PeteSteinfeld

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

3 years ago[clang][scan-build] Use cc/c++ instead of gcc/g++ on OpenBSD.
Frederic Cambus [Fri, 17 Sep 2021 04:45:11 +0000 (00:45 -0400)]
[clang][scan-build] Use cc/c++ instead of gcc/g++ on OpenBSD.

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

3 years ago[NFC][MachineRegisterInfo] Fix typo in comments of getLiveInVirtReg() function
RamNalamothu [Tue, 14 Sep 2021 06:59:14 +0000 (12:29 +0530)]
[NFC][MachineRegisterInfo] Fix typo in comments of getLiveInVirtReg() function

Reviewed By: scott.linder

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

3 years ago[GlobalOpt] Do not shrink global to bool for an unfavorable AS
Christudasan Devadasan [Wed, 15 Sep 2021 10:11:07 +0000 (06:11 -0400)]
[GlobalOpt] Do not shrink global to bool for an unfavorable AS

Do not call `TryToShrinkGlobalToBoolean` for address spaces
that don't allow initializers. It inserts an initializer value
while shrinking to bool. Used the target hook introduced with
D109337 to skip this call for the restricted address spaces.

Reviewed By: tra

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

3 years ago[X86] Refactor GetSSETypeAtOffset to fix pr51813
Wang, Pengfei [Fri, 17 Sep 2021 02:20:09 +0000 (10:20 +0800)]
[X86] Refactor GetSSETypeAtOffset to fix pr51813

D105263 adds support for _Float16 type. It introduced a bug (pr51813) that generates a <4 x half> type instead the default double when passing blank structure by SSE registers.

Although I doubt it may expose a bug somewhere other than D105263, it's good to avoid return half type when no half type in arguments.

Reviewed By: LuoYuanke

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

3 years agoAdd MachO signature verification test
Nuri Amari [Fri, 17 Sep 2021 00:46:49 +0000 (17:46 -0700)]
Add MachO signature verification test

Add a test to ensure that MachO files including
a LC_CODE_SIGNATURE load command produced by lld
are signed correctly.

Reviewed By: #lld-macho, int3

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

3 years ago[gn build] Port cc8229603b67
LLVM GN Syncbot [Fri, 17 Sep 2021 00:45:09 +0000 (00:45 +0000)]
[gn build] Port cc8229603b67

3 years agoExtract LC_CODE_SIGNATURE related implementation out of LLD
Nuri Amari [Thu, 16 Sep 2021 23:00:26 +0000 (16:00 -0700)]
Extract LC_CODE_SIGNATURE related implementation out of LLD

Move the functionality in lld that handles writing of the LC_CODE_SIGNATURE load command and associated data section to a central reusable location.

This change is in preparation for another change that modifies llvm-objcopy to reproduce the LC_CODE_SIGNATURE load command and corresponding
data section to maintain the validity of signed macho object files passed through llvm-objcopy.

Reviewed By: #lld-macho, int3, oontvoo

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

3 years ago[compiler-rt][test] Ensure CMAKE_SYSROOT is added as a test cflag if provided
Leonard Chan [Fri, 17 Sep 2021 00:13:04 +0000 (17:13 -0700)]
[compiler-rt][test] Ensure CMAKE_SYSROOT is added as a test cflag if provided

When running tests like SanitizerCommon-asan-x86_64-Linux :: Linux/crypt_r.cpp,
it may attempt to use the host header crypt.h rather than a sysroot header.
This is significant in the event where struct crypt_data defined on host is
different from the sysroot used to make the sanitizer runtime libraries. This
can result in logical differences between the expected size/layout of struct
crypt_data known by sanitizers and the strict crypt_data provided by the host crypt.h.

Since tests should still use the CMAKE_SYSROOT, this ensures that CMAKE_SYSROOT
is propagated to compiler-rt tests.

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

3 years ago[ELF] Clarify --export-dynamic-symbol/--dynamic-list. NFC
Fangrui Song [Fri, 17 Sep 2021 00:13:08 +0000 (17:13 -0700)]
[ELF] Clarify --export-dynamic-symbol/--dynamic-list. NFC

3 years ago[flang] Fold COUNT()
peter klausler [Fri, 10 Sep 2021 22:55:55 +0000 (15:55 -0700)]
[flang] Fold COUNT()

Complete folding of the intrinsic reduction function COUNT() for all
cases, including partial reductions with DIM= arguments.

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

3 years ago[compiler-rt][test] Add int128 requirement to TestCases/Misc/Linux/static-link.cpp
Leonard Chan [Fri, 17 Sep 2021 00:03:32 +0000 (17:03 -0700)]
[compiler-rt][test] Add int128 requirement to TestCases/Misc/Linux/static-link.cpp

We hit some undefined symbol errors to 128-bit floating point functions when linking this test.

ld.lld: error: undefined symbol: __multf3
>>> referenced by strtof128_l.o:(round_and_return) in archive /usr/lib/x86_64-linux-gnu/libc.a
>>> referenced by strtof128_l.o:(round_and_return) in archive /usr/lib/x86_64-linux-gnu/libc.a
>>> referenced by strtof128_l.o:(round_and_return) in archive /usr/lib/x86_64-linux-gnu/libc.a
>>> referenced 4 more times
>>> did you mean: __muldf3
>>> defined in: /usr/local/google/home/leonardchan/llvm-monorepo/llvm-build-1-master-fuchsia-toolchain/lib/clang/14.0.0/lib/x86_64-unknown-linux-gnu/libclang_rt.builtins.a

Host libc expects these to be defined, and compiler-rt will only define these
for certain platforms (see definition for CRT_LDBL_128BIT). Since we likely
can't do anything about the host libc, we can at least restrict the test to
check that these functions are supported.

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

3 years ago[gn build] Port 78b083dbb725
LLVM GN Syncbot [Thu, 16 Sep 2021 23:56:09 +0000 (23:56 +0000)]
[gn build] Port 78b083dbb725

3 years ago[ORC] Add finalization & deallocation actions, SimpleExecutorMemoryManager class
Lang Hames [Tue, 14 Sep 2021 01:47:08 +0000 (11:47 +1000)]
[ORC] Add finalization & deallocation actions, SimpleExecutorMemoryManager class

Finalization and deallocation actions are a key part of the upcoming
JITLinkMemoryManager redesign: They generalize the existing finalization and
deallocate concepts (basically "copy-and-mprotect", and "munmap") to include
support for arbitrary registration and deregistration of parts of JIT linked
code. This allows us to register and deregister eh-frames, TLV sections,
language metadata, etc. using regular memory management calls with no additional
IPC/RPC overhead, which should both improve JIT performance and simplify
interactions between ORC and the ORC runtime.

The SimpleExecutorMemoryManager class provides executor-side support for memory
management operations, including finalization and deallocation actions.

This support is being added in advance of the rest of the memory manager
redesign as it will simplify the introduction of an EPC based
RuntimeDyld::MemoryManager (since eh-frame registration/deregistration will be
expressible as actions). The new RuntimeDyld::MemoryManager will in turn allow
us to remove older remote allocators that are blocking the rest of the memory
manager changes.

3 years agoUpdate LoopPredication test to fix buildbot failure.
Daniil Suchkov [Thu, 16 Sep 2021 23:36:19 +0000 (23:36 +0000)]
Update LoopPredication test to fix buildbot failure.

This patch updates tests added in 5f2b7879f16ad5023f0684febeb0a20f7d53e4a8.

3 years ago[flang] Enforce array conformance in actual arguments to ELEMENTALs
peter klausler [Thu, 9 Sep 2021 20:09:48 +0000 (13:09 -0700)]
[flang] Enforce array conformance in actual arguments to ELEMENTALs

When the shapes of actual arguments to ELEMENTAL procedures are
sufficiently well known during semantics, require them to conform.

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

3 years ago[Support] Convert BinaryStream class zoo to 64-bit offsets
Nico Weber [Thu, 16 Sep 2021 23:14:52 +0000 (19:14 -0400)]
[Support] Convert BinaryStream class zoo to 64-bit offsets

Most PDB fields on disk are 32-bit but describe the file in terms of MSF
blocks, which are 4 kiB by default.

So PDB files can be a bit larger than 4 GiB, and much larger if you create them
with a block size > 4 kiB.

This is a first (necessary, but by far not not sufficient) step towards
supporting such PDB files.  Now we don't truncate in-memory file offsets (which
are in terms of bytes, not in terms of blocks).

No effective behavior change. lld-link will still error out if it were to
produce PDBs > 4 GiB.

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

3 years ago[flang] More precise checks for NULL() operands
peter klausler [Tue, 7 Sep 2021 19:17:31 +0000 (12:17 -0700)]
[flang] More precise checks for NULL() operands

Improve checking for NULL() and NULL(MOLD=) when used as
variables and expressions outside the few contexts where
a disassociated pointer can be valid.  There were both
inappropriate errors and missing checks.

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

3 years ago[LoopPredication] Report changes correctly when attempting loop exit predication
Daniil Suchkov [Tue, 14 Sep 2021 22:52:29 +0000 (22:52 +0000)]
[LoopPredication] Report changes correctly when attempting loop exit predication

To make the IR easier to analyze, this pass makes some minor transformations.
After that, even if it doesn't decide to optimize anything, it can't report that
it changed nothing and preserved all the analyses.

Reviewed By: reames

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

3 years agoNFC. Add tests exposing missing analysis invalidation in LoopPredication.
Daniil Suchkov [Tue, 14 Sep 2021 22:30:28 +0000 (22:30 +0000)]
NFC. Add tests exposing missing analysis invalidation in LoopPredication.

3 years ago[LoopIdiomRecognize][Remarks] Track loop-strided store to/from blocks
Jon Roelofs [Thu, 16 Sep 2021 21:34:39 +0000 (14:34 -0700)]
[LoopIdiomRecognize][Remarks] Track loop-strided store to/from blocks

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

3 years ago[symbolizer] Change libcxx paths in buildscript.
Mitch Phillips [Thu, 16 Sep 2021 22:08:51 +0000 (15:08 -0700)]
[symbolizer] Change libcxx paths in buildscript.

D107799 changed the paths from lib/libcxx(abi)?.a to
lib/<triple>/libcxx(abi)?.a. The build script needs to know to pick up
the files from the triple subfolder instead.

See https://lab.llvm.org/buildbot/#/builders/37/builds/6764 for buildbot log failure.

Reviewed By: MaskRay

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

3 years agoFixing vector add pattern that incorrectly returns success.
MaheshRavishankar [Thu, 16 Sep 2021 21:48:09 +0000 (14:48 -0700)]
Fixing vector add pattern that incorrectly returns success.

The pattern is returning success even if it does no work leading to pattern application running up to the max iteration count and failing.

Reviewed By: nicolasvasilache, mravishankar

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

3 years ago[mlir][sparse] remove unused TENSOR environment
Aart Bik [Thu, 16 Sep 2021 20:30:20 +0000 (13:30 -0700)]
[mlir][sparse] remove unused TENSOR environment

Reviewed By: bixia

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

3 years ago[clang][NFC] refactor GlobalMethodPool to encapsulate its map
Richard Howell [Thu, 16 Sep 2021 21:01:30 +0000 (14:01 -0700)]
[clang][NFC] refactor GlobalMethodPool to encapsulate its map

This refactor changes the GlobalMethodPool to a class that contains
the DenseMap of methods. This is to allow for the addition of a
separate DenseSet in a follow-up diff that will handle method
de-duplication when inserting methods into the global method pool.

Changes:
  - the `GlobalMethods` pair becomes `GlobalMethodPool::Lists`
  - the `GlobalMethodPool` becomes a class containing the `DenseMap` of methods
  - pass through methods are added to maintain most of the existing code without changing `MethodPool` -> `MethodPool.Methods` everywhere

Reviewed By: dexonsmith

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

3 years ago[Bazel] Use posix definitions for FreeBSD
William Muir [Thu, 16 Sep 2021 20:53:39 +0000 (13:53 -0700)]
[Bazel] Use posix definitions for FreeBSD

Presently, definitions default to those for Linux which are not defined for FreeBSD (HAVE_LSEEK64, HAVE_MALLINFO, etc.).  Patch sets os_defines to posix definitions under FreeBSD.

Reviewed By: GMNGeoffrey

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

3 years agoRevert "[lldb] Skip TestAppleSimulatorOSType if json parsing fails"
Augusto Noronha [Thu, 16 Sep 2021 20:47:34 +0000 (17:47 -0300)]
Revert "[lldb] Skip TestAppleSimulatorOSType if json parsing fails"

This reverts commit 47dd1f642846d476e3d789f4aa941699dc0ed3fe.
After discussing with Jim Ingham, we agreed to leave the test as-is
so we can catch any CI problems instead of silently skipping the test.

3 years agoRevert "[MachCore] Report arm64 thread exception state"
Vedant Kumar [Thu, 16 Sep 2021 20:43:35 +0000 (13:43 -0700)]
Revert "[MachCore] Report arm64 thread exception state"

This reverts commit 7eb67748f9d7186419d678e807c01fc2a3811a80. It causes
TestMachCore.MachCoreTestCase to fail.

3 years ago[MachCore] Report arm64 thread exception state
Vedant Kumar [Tue, 14 Sep 2021 23:58:40 +0000 (16:58 -0700)]
[MachCore] Report arm64 thread exception state

A MachO userspace corefile may contain LC_THREAD commands which specify
thread exception state.

For arm64* only (for now), report a human-readable version of this state
as the thread stop reason, instead of 'SIGSTOP'.

As a follow-up, similar functionality can be implemented for x86 cores
by translating the trapno/err exception registers.

rdar://82898146

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

3 years ago[lldb] Refactor and rename CPlusPlusLanguage::FindAlternateFunctionManglings
Alex Langford [Tue, 14 Sep 2021 20:31:35 +0000 (13:31 -0700)]
[lldb] Refactor and rename CPlusPlusLanguage::FindAlternateFunctionManglings

I have 2 goals with this change:
1. Disambiguate between CPlusPlus::FindAlternateFunctionManglings and
   IRExecutionUnit::FindBestAlternateMangledName. These are named very
   similar things, they try to do very similar things, but their
   approaches are different. This change should make it clear that one
   is generating possible alternate manglings (through some
   heuristics-based approach) and the other is finding alternate
   manglings (through searching the SymbolFile for potential matches).
2. Change GenerateAlternateFunctionManglings from a static method in
   CPlusPlusLanguage to a virtual method in Language. This will allow us
   to remove a direct use of CPlusPlusLanguage in IRExecutionUnit,
   further pushing it to be more general. This change doesn't meet this
   goal completely but allows for it to happen later.

Though this doesn't remove IRExecutionUnit's dependency on
CPlusPlusLanguage, it does bring us closer to that goal.

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

3 years ago[AMDGPU] NFC: Fixing small spelling errors in AMDGPU header files
Jacob Lambert [Tue, 14 Sep 2021 02:14:52 +0000 (19:14 -0700)]
[AMDGPU] NFC: Fixing small spelling errors in AMDGPU header files

Nonfunctional commit fixing several minor spelling errors in llvm/lib/Target/AMDGPU header files.
Testing workflow as a new contributor.

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

3 years agoprecommit tests for D109457
Philip Reames [Thu, 16 Sep 2021 19:23:18 +0000 (12:23 -0700)]
precommit tests for D109457

3 years ago[lldb] Skip TestAppleSimulatorOSType if json parsing fails
Augusto Noronha [Mon, 6 Sep 2021 20:03:47 +0000 (17:03 -0300)]
[lldb] Skip TestAppleSimulatorOSType if json parsing fails

xcodebuild, which is invoked by the apple_simulator_test decorator, may
may return a successful status even if it was unable to run due to the
authorization agent denying it. This causes the TestAppleSimulatorOSType
to run when it shouldn't, and throw an excpection when parsing the JSON
that lists the simulators available. Wrap the json parsing in a
try/except block and if it fails, skip the ttest.

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

3 years ago[OpenMP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D109635
Fangrui Song [Thu, 16 Sep 2021 19:36:45 +0000 (12:36 -0700)]
[OpenMP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D109635

3 years ago[MemProf] Don't instrument stack accesses unless requested
Teresa Johnson [Thu, 16 Sep 2021 05:06:07 +0000 (22:06 -0700)]
[MemProf] Don't instrument stack accesses unless requested

Skip stack accesses unless requested, as the memory profiler runtime
does not currently look at or report accesses for these addresses.

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

3 years agoautogen a SCEV test for ease of update
Philip Reames [Thu, 16 Sep 2021 19:13:33 +0000 (12:13 -0700)]
autogen a SCEV test for ease of update

3 years ago[IR] Return AAMDNodes from Instruction::getMetadata() (NFC)
Nikita Popov [Wed, 15 Sep 2021 21:01:01 +0000 (23:01 +0200)]
[IR] Return AAMDNodes from Instruction::getMetadata() (NFC)

getMetadata() currently uses a weird API where it populates a
structure passed to it, and optionally merges into it. Instead,
we can return the AAMDNodes and provide a separate merge() API.
This makes usages more compact.

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

3 years agoTemporarily revert "[LLD] Remove global state in lld/COFF" and "[lld] Add test to
Amy Huang [Thu, 16 Sep 2021 18:54:57 +0000 (11:54 -0700)]
Temporarily revert "[LLD] Remove global state in lld/COFF" and "[lld] Add test to
check for timer output"

Seems to be causing a number of asan test failures.

This reverts commit b4fa71eed34d967195514fe9b0a5211fca2bc5bc
and e03c7e367adb8f228332e3c2ef8f45484597b719.

3 years ago[fuzzer][fuchsia] Close exception channel before exiting.
Aaron Green [Thu, 16 Sep 2021 18:52:23 +0000 (11:52 -0700)]
[fuzzer][fuchsia] Close exception channel before exiting.

On Fuchsia, killing or exiting a process that has a thread listening to its own process's debugger exception channel can hang. Zircon may kill all the threads, send a synthetic exceptions to debugger, and wait for the debugger to have received them. This means the thread listening to the debug exception channel may be killed even as Zircon is waiting for that thread to drain the exception channel, and the process can become stuck in a half-dead state.

This situation is "weird" as it only arises when a process is trying to debug itself. Unfortunately, this is exactly the scenario for libFuzzer on Fuchsia: FuzzerUtilFuchsia spawns a crash-handling thread that acts like a debugger in order to be able to rewrite the crashed threads stack and resume them into libFuzzer's usual POSIX signal handlers. In practice, approximately 25% of fuzzers appear to hang on exit, after generating output and artifacts. These processes hang around until the platform is torn done, which is typically a ClusterFuzz VM. Thus, real-world impact has been somewhat mitigated. The issue should still be resolved for local users, though.

This change improves the behavior of exit() in libFuzzer by adding an atexit handler which closes an event shared with the crash handling thread. This signals to the crash handler that it should close the exception channel and be joined before the process actually exits.

Reviewed By: charco

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

3 years ago[mlir][tosa] Relax ranked constraint on quantization builder
Rob Suderman [Thu, 16 Sep 2021 18:43:41 +0000 (11:43 -0700)]
[mlir][tosa] Relax ranked constraint on quantization builder

TosaOp defintion had an artificial constraint that the input/output types
needed to be ranked to invoke the quantization builder. This is correct as an
unranked tensor could still be quantized.

Reviewed By: NatashaKnk

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

3 years ago[lld] Add test to check for timer output
Amy Huang [Wed, 15 Sep 2021 22:14:47 +0000 (15:14 -0700)]
[lld] Add test to check for timer output

This test checks that timers are working and printing as expected.

I also seem to have changed the order of the timers in my globals refactoring
patch, so I fixed it here.

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

3 years ago[CUDA] Pass ExecConfig through BuildCallToMemberFunction
Artem Belevich [Thu, 26 Aug 2021 19:38:33 +0000 (12:38 -0700)]
[CUDA] Pass ExecConfig through BuildCallToMemberFunction

Otherwise, we fail to compile calls to CUDA kernels that are static members.

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

3 years ago[AIX][ZOS] Disable LIT tests on AIX and z/OS due to lack of Objective-C support
Jake Egan [Thu, 16 Sep 2021 18:03:36 +0000 (14:03 -0400)]
[AIX][ZOS] Disable LIT tests on AIX and z/OS due to lack of Objective-C support

AIX and z/OS lack Objective-C support, so mark these tests as unsupported for AIX and z/OS.

Reviewed By: jsji

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

3 years ago[RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are...
Craig Topper [Thu, 16 Sep 2021 17:37:55 +0000 (10:37 -0700)]
[RISCV] Select (srl (sext_inreg X, i32), uimm5) to SRAIW if only lower 32 bits are used.

SimplifyDemandedBits can turn srl into sra if the bits being shifted
in aren't demanded. This patch can recover the original sra in some cases.

I've renamed the tablegen class for detecting W users since the "overflowing operator"
term I originally borrowed from Operator.h does not include srl.

Reviewed By: luismarques

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

3 years ago[LLD] Remove global state in lld/COFF
Amy Huang [Fri, 3 Sep 2021 22:28:29 +0000 (15:28 -0700)]
[LLD] Remove global state in lld/COFF

This patch removes globals from the lldCOFF library, by moving globals
into a context class (COFFLinkingContext) and passing it around wherever
it's needed.

See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for
context about removing globals from LLD.

I also haven't moved the `driver` or `config` variables yet.

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

3 years ago[lldb] Remove SBExecutionContext::reset (NFC)
Jonas Devlieghere [Thu, 16 Sep 2021 17:27:07 +0000 (10:27 -0700)]
[lldb] Remove SBExecutionContext::reset (NFC)

This is a protected function that's not implemented.

3 years ago[AMDGPU] Inline non-kernel functions using extern lds
Vang Thao [Tue, 14 Sep 2021 17:49:08 +0000 (10:49 -0700)]
[AMDGPU] Inline non-kernel functions using extern lds

In https://reviews.llvm.org/D100481, forceful inline of all non-kernel
functions using lds was disabled since AMDGPULowerModuleLDS pass now handles
static lds. However that pass does not handle extern lds so non-kernel
functions using extern lds must sill be inline.

Reviewed By: hsmhsm, arsenm

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

3 years ago[SimplifyCFG] Add bonus when seeing vector ops to branch fold to common dest
Arthur Eubanks [Mon, 30 Aug 2021 19:14:57 +0000 (12:14 -0700)]
[SimplifyCFG] Add bonus when seeing vector ops to branch fold to common dest

This makes some tests in vector-reductions-logical.ll more stable when
applying D108837.

The cost of branching is higher when vector ops are involved due to
potential SLP transformations.

Reviewed By: spatel

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

3 years agodocs: correct SPHNIX document reference
Saleem Abdulrasool [Thu, 16 Sep 2021 17:42:51 +0000 (17:42 +0000)]
docs: correct SPHNIX document reference

The trailing `>` was missing, which resulted in the reference not being
processed properly.

3 years ago[InstCombine] Added llvm.powi optimizations
Dávid Bolvanský [Thu, 16 Sep 2021 17:18:47 +0000 (19:18 +0200)]
[InstCombine] Added llvm.powi optimizations

If power is even:
powi(-x, p) -> powi(x, p)
powi(fabs(x), p) -> powi(x, p)
powi(copysign(x, y), p) -> powi(x, p)

3 years ago[NFC] Added tests for llvm.powi optimizations
Dávid Bolvanský [Thu, 16 Sep 2021 15:59:38 +0000 (17:59 +0200)]
[NFC] Added tests for llvm.powi optimizations

3 years ago[llvm-profgen] Use context-sensitive byte size cost for preinliner decisions by default
Wenlei He [Thu, 16 Sep 2021 15:33:47 +0000 (08:33 -0700)]
[llvm-profgen] Use context-sensitive byte size cost for preinliner decisions by default

Turn on `use-context-cost-for-preinliner` to use context-sensitive byte size cost for preinliner decisions by default.

This is a more accurate proxy of inline cost than profile size. We tested on our large workload that it delivers measureable CPU improvement.

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

3 years agoSupport Unicode 14 identifiers
Corentin Jabot [Thu, 16 Sep 2021 17:20:35 +0000 (13:20 -0400)]
Support Unicode 14 identifiers

This update the UAX tables to support new Unicode 14 identifiers.

3 years ago[OpenMP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D109635
Fangrui Song [Thu, 16 Sep 2021 17:19:35 +0000 (10:19 -0700)]
[OpenMP] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off build after D109635

3 years agoRemoving some spurious whitespace; NFC
Aaron Ballman [Thu, 16 Sep 2021 16:45:42 +0000 (12:45 -0400)]
Removing some spurious whitespace; NFC

3 years ago[mlir][sparse] add more asserts to sparse support lib
Aart Bik [Wed, 15 Sep 2021 23:08:49 +0000 (16:08 -0700)]
[mlir][sparse] add more asserts to sparse support lib

We are having issues running the integration test of the sparse compiler
on AArch64 (crashing in the lib). This revision adds more assertions.

Reviewed By: jsetoain

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

3 years ago[FuncSpec] Add force flag to test case to trigger the transform. NFC.
Sjoerd Meijer [Thu, 16 Sep 2021 16:34:47 +0000 (17:34 +0100)]
[FuncSpec] Add force flag to test case to trigger the transform. NFC.

3 years ago[mlir][Linalg] Cleanup doc and improve logging and readability in ComprehensiveBuffer...
Nicolas Vasilache [Thu, 16 Sep 2021 16:35:13 +0000 (16:35 +0000)]
[mlir][Linalg] Cleanup doc and improve logging and readability in ComprehensiveBufferize.cpp - NFC

3 years ago[OpenMP] Support construct trait set for Clang
cchen [Thu, 16 Sep 2021 16:28:31 +0000 (11:28 -0500)]
[OpenMP] Support construct trait set for Clang

This patch supports construct trait set selector by using the existed
declare variant infrastructure inside `OMPContext` and simd selector is
currently not supported. The goal of this patch is to pass the declare variant
test inside sollve test suite.

Reviewed By: jdoerfert

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

3 years ago[LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout...
Alfonso Gregory [Thu, 16 Sep 2021 16:27:53 +0000 (18:27 +0200)]
[LLVM][CMake][NFC] Resolve FIXME: Rename LLVM_CMAKE_PATH to LLVM_CMAKE_DIR throughout the project

This way, we do not need to set LLVM_CMAKE_PATH to LLVM_CMAKE_DIR when (NOT LLVM_CONFIG_FOUND)

Reviewed By: #libc, ldionne

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

3 years ago[libcxx][libcxxabi] CMAKE_REQUIRED_FLAGS is a string, not a list
Nehal J Wani [Thu, 16 Sep 2021 16:23:53 +0000 (18:23 +0200)]
[libcxx][libcxxabi] CMAKE_REQUIRED_FLAGS is a string, not a list

When `libcxx` or `libcxxabi` is built with `-DLLVM_USE_SANITIZER=MemoryWithOrigins`
**and** `-DLIBCXX[ABI]_USE_COMPILER_RT=ON`, all of the `LIBCXX[ABI]_SUPPORTS_*_FLAG`
checks fail, since the value of `CMAKE_REQUIRED_FLAGS` is not set correctly.

Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=51774

Reviewed By: #libc, #libc_abi, compnerd, ldionne

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

3 years ago[test] Fix test failure in Clang :: Lexer/char-escapes-delimited.c
Matthew Voss [Wed, 15 Sep 2021 21:09:20 +0000 (14:09 -0700)]
[test] Fix test failure in Clang :: Lexer/char-escapes-delimited.c

Specify the C and C++ standards explicitly for this test. This avoids
failures for drivers that default to older standards.

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

3 years agoAdd a new frontend flag `-fswift-async-fp={auto|always|never}`
Arnold Schwaighofer [Wed, 8 Sep 2021 14:26:08 +0000 (07:26 -0700)]
Add a new frontend flag `-fswift-async-fp={auto|always|never}`

Summary:
Introduce a new frontend flag `-fswift-async-fp={auto|always|never}`
that controls how code generation sets the Swift extended async frame
info bit. There are three possibilities:

* `auto`: which determines how to set the bit based on deployment target, either
statically or dynamically via `swift_async_extendedFramePointerFlags`.
* `always`: default, always set the bit statically, regardless of deployment
target.
* `never`: never set the bit, regardless of deployment target.

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

3 years ago[llvm] Use drop_begin (NFC)
Kazu Hirata [Thu, 16 Sep 2021 15:46:26 +0000 (08:46 -0700)]
[llvm] Use drop_begin (NFC)

3 years agoFix warning on `llvm-else-after-return`. NFC.
Michael Liao [Thu, 16 Sep 2021 01:22:43 +0000 (21:22 -0400)]
Fix warning on `llvm-else-after-return`. NFC.