platform/upstream/llvm.git
2 years ago[InstCombine] add tests for min/max intrinsics with offset operand; NFC
Sanjay Patel [Fri, 17 Sep 2021 18:47:49 +0000 (14:47 -0400)]
[InstCombine] add tests for min/max intrinsics with offset operand; NFC

2 years ago[mlir][sparse] add a sparse quantized_matmul example to integration test
Aart Bik [Thu, 16 Sep 2021 23:43:03 +0000 (16:43 -0700)]
[mlir][sparse] add a sparse quantized_matmul example to integration test

Note that this revision adds a very tiny bit of constant folding in the
sparse compiler lattice construction. Although I am generally trying to
avoid such canonicalizations (and rely on other passes to fix this instead),
the benefits of avoiding a very expensive disjunction lattice construction
justify having this special code (at least for now).

Reviewed By: bixia

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

2 years ago[mlir][sparse] add dce test for all sparse tensor ops
Aart Bik [Fri, 17 Sep 2021 18:55:45 +0000 (11:55 -0700)]
[mlir][sparse] add dce test for all sparse tensor ops

Reviewed By: ThomasRaoux

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

2 years ago[NFC] Precommit tests for D109954
Dávid Bolvanský [Fri, 17 Sep 2021 19:58:57 +0000 (21:58 +0200)]
[NFC] Precommit tests for D109954

2 years ago[DFSan] Add force_zero_label abilist option to DFSan. This can be used as a work...
Andrew Browne [Wed, 15 Sep 2021 18:50:07 +0000 (11:50 -0700)]
[DFSan] Add force_zero_label abilist option to DFSan. This can be used as a work-around for overtainting.

Reviewed By: morehouse

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

2 years ago[nfc] [lldb] Remove unused DIEPointerSet, DeclToDIEMap and m_decl_to_die
Jan Kratochvil [Fri, 17 Sep 2021 19:51:36 +0000 (21:51 +0200)]
[nfc] [lldb] Remove unused DIEPointerSet, DeclToDIEMap and m_decl_to_die

In whole GIT history this map has been always only written but never read.

2 years ago[compiler-rt] Implement __clear_cache() on OpenBSD/riscv64
Jeremie Courreges-Anglas [Fri, 17 Sep 2021 19:15:46 +0000 (15:15 -0400)]
[compiler-rt] Implement __clear_cache() on OpenBSD/riscv64

2 years ago[flang] Fix build
peter klausler [Fri, 17 Sep 2021 19:39:38 +0000 (12:39 -0700)]
[flang] Fix build

An unused variable declaration from a recent change is eliciting
a fatal warning; remove it.

2 years ago[llvm-reduce] Add reduce operands pass
Samuel [Fri, 17 Sep 2021 19:18:03 +0000 (12:18 -0700)]
[llvm-reduce] Add reduce operands pass

Add reduction to set operands to default values

Reviewed By: aeubanks

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

2 years ago[CSSPGO] Tweakes to lower pseudo probe runtime overhead
Hongtao Yu [Fri, 17 Sep 2021 16:21:39 +0000 (09:21 -0700)]
[CSSPGO] Tweakes to lower pseudo probe runtime overhead

A couple tweaks to

1. allow more thinlto importing by excluding probe intrinsics from IR size in module summary

2. Allow general default attributes (nofree nosync nounwind) for pseudo probe intrinsic. Without those attributes, pseudo probes will be basically treated as unknown calls which will in turn block their containing functions from annotated with those attributes.

Reviewed By: wenlei

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

2 years ago[clang][darwin] Add support for --emit-static-lib
Keith Smiley [Wed, 8 Sep 2021 20:49:16 +0000 (13:49 -0700)]
[clang][darwin] Add support for --emit-static-lib

This uses darwin's default libtool since llvm-ar isn't normally
available.

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

2 years ago[MLIR][Affine] Simplify nested modulo operations when able
Krzysztof Drewniak [Thu, 16 Sep 2021 21:25:20 +0000 (21:25 +0000)]
[MLIR][Affine] Simplify nested modulo operations when able

It is the case that, for all positive a and b such that b divides a
(e mod (a * b)) mod b = e mod b. For example, ((d0 mod 35) mod 5) can
be simplified to (d0 mod 5), but ((d0 mod 35) mod 4) cannot be simplified
further (x = 36 is a counterexample).

This change enables more complex simplifications. For example,
((d0 * 72 + d1) mod 144) mod 9 can now simplify to (d0 * 72 + d1) mod 9
and thus to d1 mod 9. Expressions with chained modulus operators are
reasonably common in tensor applications, and this change _should_
improve code generation for such expressions.

Reviewed By: nicolasvasilache

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

2 years ago[mlir] Prevent crash in DropUnitDim pattern due to tensor with encoding
thomasraoux [Fri, 17 Sep 2021 17:56:21 +0000 (10:56 -0700)]
[mlir] Prevent crash in DropUnitDim pattern due to tensor with encoding

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

2 years ago[clang] [ARM] Don't set the strict alignment flag for armv7 on Windows
Martin Storsjö [Thu, 16 Sep 2021 10:31:31 +0000 (13:31 +0300)]
[clang] [ARM] Don't set the strict alignment flag for armv7 on Windows

Windows on armv7 is as alignment tolerant as Linux.

The alignment considerations in the Windows on ARM ABI are documented
at https://docs.microsoft.com/en-us/cpp/build/overview-of-arm-abi-conventions?view=msvc-160#alignment.

The document doesn't explicitly say in which state the OS configures
the SCTLR.A register (and it's not accessible from user space to
inspect), but in practice, unaligned loads/stores do work and seem
to be as fast as aligned loads and stores. (Unaligned strd also does
seem to work, contrary to Linux, but significantly slower, as they're
handled by the kernel - exactly as the document describes.)

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

2 years ago[flang] Enforce specification function rules on callee, not call
peter klausler [Thu, 16 Sep 2021 00:25:15 +0000 (17:25 -0700)]
[flang] Enforce specification function rules on callee, not call

A function can't be a specification function if it has a dummy procedure
argument, even if it's optional and unused.  So don't check the reference
for actual procedure arguments, but rather the characteristics of the
function.

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

2 years ago[flang] Enforce fixed form rules about END continuation
peter klausler [Wed, 15 Sep 2021 22:46:43 +0000 (15:46 -0700)]
[flang] Enforce fixed form rules about END continuation

From subclause 6.3.3.5: a program unit END statement cannot be
continued in fixed form, and other statements cannot have initial
lines that look like program unit END statements.  I think this
is to avoid violating assumptions that are important to legacy
compilers' statement classification routines.

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

2 years agoAdd information about C99 to the C status page.
Aaron Ballman [Fri, 17 Sep 2021 17:48:33 +0000 (13:48 -0400)]
Add information about C99 to the C status page.

2 years ago[Dexter] Mutually exclusive argument group for --builder and --binary
Tozer [Fri, 10 Sep 2021 12:02:59 +0000 (13:02 +0100)]
[Dexter] Mutually exclusive argument group for --builder and --binary

Dexter currently accepts two possible arguments to determine the binary
used for testing; either --builder <builder> (and optionally
compiler/linker flags) to build the binary, or --binary <binary> to use
the provided binary directly. If both are passed, then --binary
overrides --builder; if neither are passed, then an error is raised.
This patch instead puts these arguments into a required mutually
exclusive argument group, so that an error is automatically raised by
argparse if both or neither are given.

As an additional change, the --cflags and --ldflags will now raise a
warning if they are passed without the --builder flag, as they are
meaningless if Dexter is using a pre-built binary.

Reviewed By: Orlando

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

2 years ago[SLP][NFC]Add a test for reorder of alt shuffle operands.
Alexey Bataev [Fri, 17 Sep 2021 17:30:35 +0000 (10:30 -0700)]
[SLP][NFC]Add a test for reorder of alt shuffle operands.

2 years ago[flang] Validate SIZE(x,DIM=n) dimension for assumed-size array x
peter klausler [Mon, 13 Sep 2021 20:45:30 +0000 (13:45 -0700)]
[flang] Validate SIZE(x,DIM=n) dimension for assumed-size array x

Catch invalid attempts to extract the unknowable extent of the last
dimension of an assumed-size array dummy argument, and clean up
problems with assumed-rank arguments in similar circumstances
exposed by testing the fix.

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

2 years ago[flang] Upgrade warning to error in case of PURE procedure
peter klausler [Tue, 14 Sep 2021 19:44:57 +0000 (12:44 -0700)]
[flang] Upgrade warning to error in case of PURE procedure

A procedure actual argument to a PURE procedure should be required
to have an explicit interface.  Implicit-interface actual arguments
to non-PURE procedures remain a warning.

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

2 years ago[mlir][linalg] Extend drop unit dim pattern to all cases of reduction
thomasraoux [Fri, 17 Sep 2021 17:09:57 +0000 (10:09 -0700)]
[mlir][linalg] Extend drop unit dim pattern to all cases of reduction

Even with all parallel loops reading the output value is still allowed so we
don't have to handle reduction loops differently.

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

2 years ago[mlir] Linalg hoisting should ignore uses outside the loop
thomasraoux [Fri, 17 Sep 2021 17:06:57 +0000 (10:06 -0700)]
[mlir] Linalg hoisting should ignore uses outside the loop

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

2 years ago[mlir] Fix potential crash in hoistRedundantVectorTransfers
thomasraoux [Thu, 16 Sep 2021 14:37:30 +0000 (07:37 -0700)]
[mlir] Fix potential crash in hoistRedundantVectorTransfers

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

2 years ago [lld-macho] Ignore local personality symbols if non-local with the same name...
Vy Nguyen [Wed, 15 Sep 2021 19:49:56 +0000 (15:49 -0400)]
[lld-macho] Ignore local personality symbols if non-local with the same name exisst,  to avoid "too many personalities" error.

    Sometimes people intentionally re-define a dylib personlity symbol as a local defined symbol as a workaround to a ld -r bug.
    As a result, we could see "too many personalities" to encode. This patch tries to handle this case by ignoring the local symbols entirely.

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

2 years ago[NFC] clang-format -i /openmp/libomptarget/deviceRTLs/interface.h
Shilei Tian [Fri, 17 Sep 2021 16:54:40 +0000 (12:54 -0400)]
[NFC] clang-format -i /openmp/libomptarget/deviceRTLs/interface.h

2 years ago[flang] Correct overflow detection in folding of real->integer conversions
peter klausler [Tue, 14 Sep 2021 18:39:48 +0000 (11:39 -0700)]
[flang] Correct overflow detection in folding of real->integer conversions

INT, NINT, FLOOR, and CEILING were failing to report overflow as an
error while folding operations with constant operands.

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

2 years ago[OpenMP] NFC: add type casts to silence gcc warnings
AndreyChurbanov [Fri, 17 Sep 2021 16:49:40 +0000 (19:49 +0300)]
[OpenMP] NFC: add type casts to silence gcc warnings

2 years ago[OpenMP] libomp: Update third-party sources of ittnotify client code.
AndreyChurbanov [Fri, 17 Sep 2021 16:38:34 +0000 (19:38 +0300)]
[OpenMP] libomp: Update third-party sources of ittnotify client code.

The third-party ittnotify sources updated from https://github.com/intel/ittapi.
Changes applied:
- llvm license aded to all files; initial BSD license saved in LICENSE.txt;
- clang-formatted;
- renamed *.c to *.cpp, similar to what we did with all our sources;
- added #include "kmp_config.h" with definition of INTEL_ITTNOTIFY_PREFIX macro
  into ittnotify_static.cpp.

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

2 years ago[flang] Catch errors with intrinsic array inquiry functions
peter klausler [Sat, 11 Sep 2021 00:35:47 +0000 (17:35 -0700)]
[flang] Catch errors with intrinsic array inquiry functions

The intrinsic inquiry functions SIZE and UBOUND -- but not LBOUND --
require a DIM= argument if their first argument is an assumed-size
array.  The intrinsic SHAPE must not be used with an assumed-size
array.

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

2 years ago[llvm] Use drop_begin (NFC)
Kazu Hirata [Fri, 17 Sep 2021 16:16:39 +0000 (09:16 -0700)]
[llvm] Use drop_begin (NFC)

2 years ago[X86] Improve `matchBinaryShuffle()`'s `BLEND` lowering with per-element all-zero...
Roman Lebedev [Fri, 17 Sep 2021 16:07:01 +0000 (19:07 +0300)]
[X86] Improve `matchBinaryShuffle()`'s `BLEND` lowering with per-element all-zero/all-ones knowledge

We can use `OR` instead of `BLEND` if either the element we are not picking is zero (or masked away);
or the element we are picking overwhelms (e.g. it's all-ones) whatever the element we are not picking:
https://alive2.llvm.org/ce/z/RKejao

Reviewed By: RKSimon

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

2 years ago[gn build] (semi-manually) port 750d5fc65c92
Nico Weber [Fri, 17 Sep 2021 16:01:55 +0000 (12:01 -0400)]
[gn build] (semi-manually) port 750d5fc65c92

2 years ago[flang] Accept SIZE(assumed-rank, DIM=n)
peter klausler [Mon, 13 Sep 2021 17:41:27 +0000 (10:41 -0700)]
[flang] Accept SIZE(assumed-rank, DIM=n)

Silence a bogus error message about an out-of-range DIM= argument
when the argument is assumed-rank.  (More generally, don't pretend
to be able to discern a shape of known rank for an assumed-rank
object.)

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

2 years ago[InstCombine] allow splat vectors for narrowing masked fold
Sanjay Patel [Fri, 17 Sep 2021 14:54:59 +0000 (10:54 -0400)]
[InstCombine] allow splat vectors for narrowing masked fold

Mostly cosmetic diffs, but the use of m_APInt matches splat constants.

2 years ago[InstCombine] add vector tests for 'and' folds; NFC
Sanjay Patel [Fri, 17 Sep 2021 13:45:56 +0000 (09:45 -0400)]
[InstCombine] add vector tests for 'and' folds; NFC

2 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

2 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

2 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

2 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

2 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

2 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

2 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.

2 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

2 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.

2 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.

2 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.

2 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.

2 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.

2 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

2 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

2 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.

2 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.

2 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.

2 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.

2 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.

2 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

2 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

2 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

2 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

2 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

2 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

2 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

2 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.

2 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.

2 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

2 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

2 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

2 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

2 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

2 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.

2 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

2 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

2 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

2 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

2 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

2 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

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

2 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

2 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

2 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

2 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

2 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

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

2 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.

2 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.

2 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

2 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

2 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

2 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

2 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.

2 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

2 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

2 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

2 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

2 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

2 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

2 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.

2 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.

2 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