platform/upstream/llvm.git
2 years ago[OpenMP] Try to Infer target triples using the offloading architecture
Joseph Huber [Thu, 5 May 2022 22:09:55 +0000 (18:09 -0400)]
[OpenMP] Try to Infer target triples using the offloading architecture

Currently we require the `-fopenmp-targets=` option to specify the
triple to use for the offloading toolchains, and the `-Xopenmp-target=`
option to specify architectures to a specific toolchain. The changes
made in D124721 allowed us to use `--offload-arch=` to specify multiple
target architectures. However, this can become combersome with many
different architectures. This patch introduces functinality that
attempts to deduce the target triple and architectures from the
offloading action. Currently we will deduce known GPU architectures when
only `-fopenmp` is specified.

This required a bit of a hack to cache the deduced architectures,
without this we would've just thrown an error when we tried to look up
the architecture again when generating the job. Normally we require the
user to manually specify the toolchain arguments, but here they would
confict unless we overrode them.

Depends on: D124721

Reviewed By: saiislam

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

2 years ago[OpenMP] Allow compiling multiple target architectures with OpenMP
Joseph Huber [Sat, 30 Apr 2022 22:46:58 +0000 (18:46 -0400)]
[OpenMP] Allow compiling multiple target architectures with OpenMP

This patch adds support for OpenMP to use the `--offload-arch` and
`--no-offload-arch` options. Traditionally, OpenMP has only supported
compiling for a single architecture via the `-Xopenmp-target` option.
Now we can pass in a bound architecture and use that if given, otherwise
we default to the value of the `-march` option as before.

Note that this only applies the basic support, the OpenMP target runtime
does not yet know how to choose between multiple architectures.
Additionally other parts of the offloading toolchain (e.g. LTO) require
the `-march` option, these should be worked out later.

Reviewed By: tra

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

2 years ago[mlir] Remove special case parsing/printing of `func` operations
River Riddle [Thu, 21 Apr 2022 04:39:22 +0000 (21:39 -0700)]
[mlir] Remove special case parsing/printing of `func` operations

This was leftover from when the standard dialect was destroyed, and
when FuncOp moved to the func dialect. Now that these transitions
have settled a bit we can drop these.

Most updates were handled using a simple regex: replace `^( *)func` with `$1func.func`

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

2 years ago[InstCombine] canonicalize fneg after shuffle
Sanjay Patel [Fri, 6 May 2022 19:48:41 +0000 (15:48 -0400)]
[InstCombine] canonicalize fneg after shuffle

For the unary shuffle pattern, this is opposite to what we try
to do with binops, but it seems better to keep it consistent
with the motivating binary shuffle pattern. On that, it is
clearly better on the usual no-extra uses case.

There is a chance that this will pull an fneg away from some
other binop and cause a regression in codegen, but that should
be invertible in the backend. The transform is birectional:
https://alive2.llvm.org/ce/z/kKaKCU
https://alive2.llvm.org/ce/z/3Desfw

Fixes #45631

2 years ago[InstCombine] add tests for shuffle with fneg operand(s); NFC
Sanjay Patel [Fri, 6 May 2022 19:23:48 +0000 (15:23 -0400)]
[InstCombine] add tests for shuffle with fneg operand(s); NFC

issue #45631

2 years agoRevert "Automatically generates several X86/sse tests cases. NFC"
Nico Weber [Fri, 6 May 2022 20:24:51 +0000 (16:24 -0400)]
Revert "Automatically generates several X86/sse tests cases. NFC"

This reverts commit 324d696c154aad42b2580d2f225a677c04fe0ab4.
Broke check-llvm on Windows, see e.g.
https://lab.llvm.org/buildbot/#/builders/216/builds/4005 and
comment on https://reviews.llvm.org/rG324d696c154aad42b2580d2f225a677c04fe0ab4

2 years ago[Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia
Petr Hosek [Tue, 16 Nov 2021 20:54:11 +0000 (12:54 -0800)]
[Driver] Pass --fix-cortex-a53-843419 automatically on Fuchsia

When targeting cortex-a53, set this linker flag rather than relying
on the toolchain users to do it in their build.

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

2 years agoFix build with shared libs: add missing CMake dep to MLIR sparse pipeline
Mehdi Amini [Fri, 6 May 2022 20:20:03 +0000 (20:20 +0000)]
Fix build with shared libs: add missing CMake dep to MLIR sparse pipeline

2 years agoApply clang-tidy fixes for bugprone-copy-constructor-init in TestPassManager.cpp...
Mehdi Amini [Fri, 6 May 2022 00:00:14 +0000 (00:00 +0000)]
Apply clang-tidy fixes for bugprone-copy-constructor-init in TestPassManager.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming in SparseTensorUtils.cpp...
Mehdi Amini [Thu, 5 May 2022 23:22:38 +0000 (23:22 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in SparseTensorUtils.cpp (NFC)

2 years agoApply clang-tidy fixes for llvm-include-order in Merger.cpp (NFC)
Mehdi Amini [Thu, 5 May 2022 23:10:19 +0000 (23:10 +0000)]
Apply clang-tidy fixes for llvm-include-order in Merger.cpp (NFC)

2 years ago[riscv] Use early return to reduce nesting for InsertVSETVLI [nfc]
Philip Reames [Fri, 6 May 2022 20:10:05 +0000 (13:10 -0700)]
[riscv] Use early return to reduce nesting for InsertVSETVLI [nfc]

2 years ago[riscv] Add early return to InsertVSETLI fixed point step [nfc]
Philip Reames [Fri, 6 May 2022 19:53:34 +0000 (12:53 -0700)]
[riscv] Add early return to InsertVSETLI fixed point step [nfc]

If the income state hasn't changed, and the step function is fixed by assumption, then the output state can't have changed.

In the current algorithm, this is a very minor win and mostly allows adding tracing output without being horrible verbose.

2 years ago[riscv] Add some minimal tracing output to InsertVSETVLI
Philip Reames [Fri, 6 May 2022 19:50:24 +0000 (12:50 -0700)]
[riscv] Add some minimal tracing output to InsertVSETVLI

Only available with -debug.  Main purpose is simplifying an upcoming change, and providing tools for debugging problems.

2 years agoRevert "[DAGCombine] Make combineShuffleOfBitcast LittleEndian specific"
David Green [Fri, 6 May 2022 20:03:22 +0000 (21:03 +0100)]
Revert "[DAGCombine] Make combineShuffleOfBitcast LittleEndian specific"

This reverts commit 891c3cf99e100e8871aff9a0747c887a5d0a8b0f as it turns
out that the error was not caused by this commit, the error caming
from D124526 instead.

2 years ago[gn build] (semi-manually) port 7e63a0d479dd
Nico Weber [Fri, 6 May 2022 19:54:29 +0000 (15:54 -0400)]
[gn build] (semi-manually) port 7e63a0d479dd

2 years agoUpdate ReleaseNotes.rst
Shivam [Fri, 6 May 2022 19:50:45 +0000 (01:20 +0530)]
Update ReleaseNotes.rst

2 years agoupdate the doc for the static analyzer checker
Shivam [Fri, 6 May 2022 19:49:46 +0000 (01:19 +0530)]
update the doc for the static analyzer checker

2 years agoAdded the brief discription about the new CSA checker.
Shivam [Fri, 6 May 2022 19:46:22 +0000 (01:16 +0530)]
Added the brief discription about the new CSA checker.

2 years ago[runtimes] Always configure libc++abi before libc++
Louis Dionne [Tue, 1 Mar 2022 14:17:57 +0000 (09:17 -0500)]
[runtimes] Always configure libc++abi before libc++

That makes it possible to reuse libc++abi targets from the libc++
configuration, which is necessary to allow major CMake simplifications.
As a fly-by fix, we also unify how compiler-rt ordering is handled so
it matches how libc++ and libc++abi are handled (compiler-rt always
ends up first).

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

2 years agoEnable the use of ThreadPoolTaskGroup in MLIR threading helper to enable nested paral...
Mehdi Amini [Fri, 6 May 2022 19:38:49 +0000 (19:38 +0000)]
Enable the use of ThreadPoolTaskGroup in MLIR threading helper to enable nested parallelism

The LLVM ThreadPool recently got the addition of the concept of
ThreadPoolTaskGroup: this is a way to "partition" the threadpool
into a group of tasks and enable nested parallelism through this
grouping at every level of nesting.
We make use of this feature in MLIR threading abstraction to fix a long
lasting TODO and enable nested parallelism.

Reviewed By: rriddle

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

2 years agoApply clang-tidy fixes for llvm-else-after-return in Merger.cpp (NFC)
Mehdi Amini [Thu, 5 May 2022 23:09:44 +0000 (23:09 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in Merger.cpp (NFC)

2 years agoApply clang-tidy fixes for llvm-prefer-isa-or-dyn-cast-in-conditionals in OpenMPDiale...
Mehdi Amini [Thu, 5 May 2022 23:02:38 +0000 (23:02 +0000)]
Apply clang-tidy fixes for llvm-prefer-isa-or-dyn-cast-in-conditionals in OpenMPDialect.cpp (NFC)

2 years ago[clang-tidy][NFC] Fix doc typo for bugprone-unchecked-optional-access
Yitzhak Mandelbaum [Fri, 6 May 2022 19:23:15 +0000 (19:23 +0000)]
[clang-tidy][NFC] Fix doc typo for bugprone-unchecked-optional-access

2 years ago[libc][NFC] add index mode to printf parser
Michael Jones [Thu, 7 Apr 2022 21:22:48 +0000 (14:22 -0700)]
[libc][NFC] add index mode to printf parser

This patch is a followup to the previous patch which implemented the
main printf parsing logic as well as sequential mode. This patch adds
index mode.

Reviewed By: sivachandra

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

2 years ago[clang-tidy] New check for safe usage of `std::optional` and like types.
Yitzhak Mandelbaum [Sun, 6 Mar 2022 19:01:46 +0000 (19:01 +0000)]
[clang-tidy] New check for safe usage of `std::optional` and like types.

This check verifies the safety of access to `std::optional` and related
types (including `absl::optional`). It is based on a corresponding Clang
Dataflow Analysis, which does most of the work. This check merely runs it and
converts its findings into diagnostics.

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

2 years ago[HLSL] add -fcgl option flag.
python3kgae [Thu, 5 May 2022 06:15:40 +0000 (23:15 -0700)]
[HLSL] add -fcgl option flag.

fcgl option will make compilation stop after clang codeGen and output the llvm ir.
It is added to check clang codeGen output for HLSL.

It will be translated into -S -emit-llvm and -disable-llvm-passes.

Reviewed By: aaron.ballman

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

2 years ago[libc] Update windows entrypoint list
Michael Jones [Thu, 5 May 2022 23:40:28 +0000 (16:40 -0700)]
[libc] Update windows entrypoint list

The entrypoint list for windows hasn't been updated in a while, this
adds all of the entrypoints that are working for windows now.

Reviewed By: sivachandra, lntue

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

2 years ago[clangd] Speed up a slow sleeping testcase.
Sam McCall [Fri, 6 May 2022 16:24:48 +0000 (18:24 +0200)]
[clangd] Speed up a slow sleeping testcase.

This testcase runs slowly due to 3.2s of sleeps = 2 + 1 + 0.2s.
After this patch it has 0.55s only.

Reduced by:
 - observed that the last test was bogus: we were sleeping until the queue was
   idle, effectively just a second copy of the first test. This avoids 1s sleep.
 - when waiting for debounce, sleep only until test passes, not for enough
   time to be safe (in practice was 2x debounce time, now 1x debounce time)
 - scaling delays down by a factor of 2 (note: factor of 10 caused bot failures)

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

2 years ago[AArch64] Fix sub with carry
Kazu Hirata [Fri, 6 May 2022 18:04:17 +0000 (11:04 -0700)]
[AArch64] Fix sub with carry

13403a70e45b2d22878ba59fc211f8dba3a8deba introduced a bug where we
generate the outgoing carry inverted, which in turn breaks the
lowering of @llvm.usub.sat.i128, returning the normal difference on
saturation and zero otherwise.

Note that AArch64 has peculiar semantics where the subtraction
instructions generate borrow inverted.  The problem is that we mix the
two forms of semantics -- the normal carry and inverted carry -- in
the area of extended precision subtractions.  Specifically, we have
three problems:

- lowerADDSUBCARRY takes the non-inverted incoming carry from a
  subtraction and feeds it to SBCS without inverting it first.

- lowerADDSUBCARRY makes available the outgoing carry from SBCS
  without inverting it.

- foldOverflowCheck folds:

  (SBC{S} l r (CMP (CSET LO carry) 1)) => (SBC{S} l r carry)

  When the incoming carry flag is set, CSET LO results in zero.  CMP
  in turn generates a borrow, *clearing* the carry flag.  Instead, we
  should fold:

  (SBC{S} l r (CMP 0 (CSET LO carry))) => (SBC{S} l r carry)

  When the incoming carry flag is set, CSET LO results in zero.  CMP
  does not generate a borrow, *setting* the carry flag.

IIUC, we should use the normal (that is, non-inverted) semantics for
carry everywhere.

This patch fixes the three problems above.

This patch does not add any new testcases because we have a plenty of
them covering the instruction in question.  In particular,
@u128_saturating_sub is identical to the testcase in the motivating
issue.

Fixes: #55253

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

2 years ago[DAGCombine] Make combineShuffleOfBitcast LittleEndian specific
David Green [Fri, 6 May 2022 17:42:44 +0000 (18:42 +0100)]
[DAGCombine] Make combineShuffleOfBitcast LittleEndian specific

Something is going wrong with the BigEndian PowerPC bot. It is hard to
tell what is wrong from here, but attempt to fix it by disabling the
combineShuffleOfBitcast combine for bigendian.

2 years ago[mlir][sparse] integration test for zero preserving math op
Aart Bik [Fri, 6 May 2022 16:47:59 +0000 (09:47 -0700)]
[mlir][sparse] integration test for zero preserving math op

Also fixes omission in lowering math ops that require lib support

Reviewed By: bixia

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

2 years ago[riscv] Add strict asserts for VSETVLI insertion algorithm to help catch bugs
Philip Reames [Thu, 5 May 2022 19:50:47 +0000 (12:50 -0700)]
[riscv] Add strict asserts for VSETVLI insertion algorithm to help catch bugs

This assertion should hold for any reasonable data flow algorithm, but is known not to in several cases today. I'd like to go ahead and land this off-by-default, so that we can collaborate on fixes and have a common definition of success.

Differential: https://reviews.llvm.org/D125035

2 years ago[AArch64] Add extra reverse costs.
David Green [Fri, 6 May 2022 17:23:36 +0000 (18:23 +0100)]
[AArch64] Add extra reverse costs.

This adds some extra costs for reverse shuffles under AArch64, filling
in the i16/f16/i8 gaps in the cost model.

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

2 years ago[InstCombine] Add tests for combining AArch64 neon min/max intrinsics.
Florian Hahn [Fri, 6 May 2022 16:59:22 +0000 (17:59 +0100)]
[InstCombine] Add tests for combining AArch64 neon min/max intrinsics.

2 years ago[libc++][NFC] Fix formatting that was incorrectly changed by D124695
Louis Dionne [Fri, 6 May 2022 16:41:07 +0000 (12:41 -0400)]
[libc++][NFC] Fix formatting that was incorrectly changed by D124695

2 years ago[SimplifyLibcalls] Tests for libcall folding of subobjects [NFC]
Martin Sebor [Fri, 6 May 2022 16:34:13 +0000 (10:34 -0600)]
[SimplifyLibcalls] Tests for libcall folding of subobjects [NFC]

Add tests exercising the future enancement of folding library function
calls with arguments involving subobjects such as elements of arrays
or struct members.

2 years ago[SelectionDAG] Improve asserts in SelectionDAG::getSelect.
Craig Topper [Fri, 6 May 2022 16:39:39 +0000 (09:39 -0700)]
[SelectionDAG] Improve asserts in SelectionDAG::getSelect.

The VT passed in must match the type of LHS and RHS.
Previously we only checked that the vectorness matched.

2 years ago[clang-tidy][NFC] Add createChecks method that also checks for LangaugeOptions
Nathan James [Fri, 6 May 2022 16:30:30 +0000 (17:30 +0100)]
[clang-tidy][NFC] Add createChecks method that also checks for LangaugeOptions

This method won't add a check if it isn't supported in the Contexts current LanguageOptions.

Reviewed By: aaron.ballman

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

2 years ago[SelectionDAG] Clear promoted bits before UREM on shift amount in PromoteIntRes_Funne...
Craig Topper [Fri, 6 May 2022 07:04:43 +0000 (00:04 -0700)]
[SelectionDAG] Clear promoted bits before UREM on shift amount in PromoteIntRes_FunnelShift.

Otherwise we have garbage in the upper bits that can affect the
results of the UREM.

Fixes PR55296.

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

2 years agoAutomatically generates several X86/sse tests cases. NFC
Amaury Séchet [Fri, 6 May 2022 15:54:31 +0000 (15:54 +0000)]
Automatically generates several X86/sse tests cases. NFC

2 years agoAutomatically generate CodeGen/X86/sse-align-*.ll test cases. NFC
Amaury Séchet [Fri, 6 May 2022 15:44:50 +0000 (15:44 +0000)]
Automatically generate CodeGen/X86/sse-align-*.ll test cases. NFC

2 years ago[flang] Fix internal error with DATA-statement style initializers
Daniil Dudkin [Fri, 6 May 2022 15:18:33 +0000 (18:18 +0300)]
[flang] Fix internal error with DATA-statement style initializers

The code below causes flang to crash with an exception.
After fixing the crash flang with an internal error "no symbol found for 'bar'"
This change fixes all the issues.

  program name
    implicit none
    integer, parameter :: bar = 1
    integer foo(bar) /bar*2/
  end program name

Reviewed By: kiranchandramohan, klausler

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

2 years ago[OpenMP] Add basic support for properly handling static libraries
Joseph Huber [Fri, 6 May 2022 13:37:08 +0000 (09:37 -0400)]
[OpenMP] Add basic support for properly handling static libraries

Currently we handle static libraries like any other object in the
linker wrapper. However, this does not preserve the sematnics that
dictate static libraries should be lazily loaded as the symbols are
needed. This allows us to ignore linking in architectures that are not
used by the main application being compiled. This patch adds the basic
support for detecting if a file came from a static library, and only
including it in the link job if it's used by other object files.

This patch only adds the basic support, to be more correct we should
check the symbols and only inclue the library if the link job contains
symbols that are needed. Ideally we could just put this on the linker
itself, but nvlink doesn't seem to support `.a` files.

Reviewed By: jdoerfert

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

2 years agoRevert "[clangd] Speed up an unfortunate timer-based test."
Sam McCall [Fri, 6 May 2022 15:18:39 +0000 (17:18 +0200)]
Revert "[clangd] Speed up an unfortunate timer-based test."

This reverts commit 076dd0a763fd803897b0f806e0e350a27d2c087c.

http://45.33.8.238/macm1/34776/step_9.txt

2 years ago[libc++][NFC] Add release note for constexpr std::string
Louis Dionne [Fri, 6 May 2022 15:18:01 +0000 (11:18 -0400)]
[libc++][NFC] Add release note for constexpr std::string

2 years ago[InstCombine] Fold icmp of select with implied condition
Nikita Popov [Fri, 6 May 2022 14:48:02 +0000 (16:48 +0200)]
[InstCombine] Fold icmp of select with implied condition

When threading the icmp over the select, check whether the
condition can be folded when taking into account the select
condition.

2 years ago[InstCombine] Add icmp of select with implied condition tests (NFC)
Nikita Popov [Fri, 6 May 2022 14:59:57 +0000 (16:59 +0200)]
[InstCombine] Add icmp of select with implied condition tests (NFC)

2 years agoFix LLDB test broken by 499d0b96cb52c828e7fc4d58825b5e8b3f9931c5
Sam McCall [Fri, 6 May 2022 15:09:02 +0000 (17:09 +0200)]
Fix LLDB test broken by 499d0b96cb52c828e7fc4d58825b5e8b3f9931c5

2 years ago[Frontend] Fix broken createInvocation test due to bad merge
Sam McCall [Fri, 6 May 2022 15:05:47 +0000 (17:05 +0200)]
[Frontend] Fix broken createInvocation test due to bad merge

2 years ago[libc++][NFC] Move swap_noexcept test to .compile.pass.cpp
Louis Dionne [Fri, 6 May 2022 15:02:17 +0000 (11:02 -0400)]
[libc++][NFC] Move swap_noexcept test to .compile.pass.cpp

2 years ago[libc++][NFC] Slight refactoring of some std::vector tests
Louis Dionne [Fri, 6 May 2022 14:49:14 +0000 (10:49 -0400)]
[libc++][NFC] Slight refactoring of some std::vector tests

2 years ago[ELF] Change (NOLOAD) type mismatch to use SHT_NOBITS instead of SHT_PROGBITS
Fangrui Song [Fri, 6 May 2022 14:49:42 +0000 (07:49 -0700)]
[ELF] Change (NOLOAD) type mismatch to use SHT_NOBITS instead of SHT_PROGBITS

Placing a non-SHT_NOBITS input section in an output section specified with
(NOLOAD) is fishy but used by some projects. D118840 changed the output type to
SHT_PROGBITS, but using the specified type seems to make more sense and improve
GNU ld compatibility: `(NOLOAD)` seems to change the output section type
regardless of input.

I think we should keep the current type mismatch warning as it does indicate an
error-prone usage.

Reviewed By: peter.smith

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

2 years ago[MC][X86] Add vcmpps disassembler tests for Issue #41491
Simon Pilgrim [Fri, 6 May 2022 14:39:05 +0000 (15:39 +0100)]
[MC][X86] Add vcmpps disassembler tests for Issue #41491

We were missing coverage for vcmpps imm, vreg, vreg, mreg {mreg} patterns

2 years ago[DAG] visitREM - merge buildOptimizedSREM into if(). NFCI.
Simon Pilgrim [Fri, 6 May 2022 14:17:00 +0000 (15:17 +0100)]
[DAG] visitREM - merge buildOptimizedSREM into if(). NFCI.

2 years ago[clangd] Eliminate direct usage of isAvailable() matcher. NFC
Sam McCall [Fri, 6 May 2022 14:34:06 +0000 (16:34 +0200)]
[clangd] Eliminate direct usage of isAvailable() matcher. NFC

This prepares to replace the implementation of EXPECT_[UN]AVAILABLE with
something more efficient.

2 years ago[clangd] Speed up an unfortunate timer-based test.
Sam McCall [Fri, 6 May 2022 14:29:10 +0000 (16:29 +0200)]
[clangd] Speed up an unfortunate timer-based test.

2 years agoFix lifetime of DiagnosticsEngine in diagtool.
Sam McCall [Fri, 6 May 2022 14:21:23 +0000 (16:21 +0200)]
Fix lifetime of DiagnosticsEngine in diagtool.

2 years ago[clang] createInvocationFromCommandLine -> createInvocation, delete former. NFC
Sam McCall [Thu, 5 May 2022 14:17:47 +0000 (16:17 +0200)]
[clang] createInvocationFromCommandLine -> createInvocation, delete former. NFC

(Followup from 40c13720a4b977d4347bbde53c52a4d0703823c2)

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

2 years ago[flang] Add one semantic check for masked array assignment
PeixinQiao [Fri, 6 May 2022 14:19:20 +0000 (22:19 +0800)]
[flang] Add one semantic check for masked array assignment

As Fortran 2018 states, in each where-assignment-stmt, the mask-expr and
the variable being defined shall be arrays of the same shape. The
previous check does not consider checking if it is an array.

Reviewed By: klausler

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

2 years ago[flang] Support external procedure passed as actual argument with implicit character...
PeixinQiao [Fri, 6 May 2022 14:14:51 +0000 (22:14 +0800)]
[flang] Support external procedure passed as actual argument with implicit character type

As Fortran 2018 15.5.2.9 point 2, the actual argument and dummy argument
have the same type and type parameters and an external function with
assumed character length may be associated with a dummy argument with
explicit character length. As Fortran 2018 15.5.2.9 point 7, if an
external procedure is used as an actual argument, it can be explicitly
declared to have the EXTERNAL attribute. This supports the external
procedure passed as actual argument with implicit character type, either
explicit character length or assumed character length.

Reviewed By: Jean Perier, klausler

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

2 years ago[clangd] Add parsing for IgnoreHeaders config option
Kadir Cetinkaya [Fri, 6 May 2022 12:32:04 +0000 (14:32 +0200)]
[clangd] Add parsing for IgnoreHeaders config option

2 years ago[flang] Fix AllocaOp/AllocMemOp type conversion
PeixinQiao [Fri, 6 May 2022 14:10:13 +0000 (22:10 +0800)]
[flang] Fix AllocaOp/AllocMemOp type conversion

For arrays without a constant interior or arrays of character with
dynamic length arrays, the data types are converted to a pointer to the
element type, so the scale size of the constant extents needs to be
counted. The previous AllocaOp conversion does not consider the arrays
of character with dynamic length arrays, and the previous AllocMemOp
conversion does not consider arrays without a constant interior. This
fixes them and refactors the code so that it can be shared. Also add
the test cases.

Reviewed By: Jean Perier

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

2 years ago[InstCombine] Fold icmp of select with non-constant operand
Nikita Popov [Fri, 6 May 2022 13:07:01 +0000 (15:07 +0200)]
[InstCombine] Fold icmp of select with non-constant operand

Try to push an icmp into a select even if the icmp operand isn't
constant - perform a generic SimplifyICmpInst instead.

This doesn't appear to impact compile-time much, and forming
logical and/or is generally profitable, as we have very good
support for them.

2 years ago[InstCombine] Add additional icmp of select tests (NFC)
Nikita Popov [Fri, 6 May 2022 13:59:01 +0000 (15:59 +0200)]
[InstCombine] Add additional icmp of select tests (NFC)

2 years ago[gn build] Port 586efd52b93f
LLVM GN Syncbot [Fri, 6 May 2022 13:54:41 +0000 (13:54 +0000)]
[gn build] Port 586efd52b93f

2 years ago[gn build] Port 37ba1b9d1ac7
LLVM GN Syncbot [Fri, 6 May 2022 13:54:40 +0000 (13:54 +0000)]
[gn build] Port 37ba1b9d1ac7

2 years agoRevert "[HWASan] Allow to linkify symbolizer output."
Nico Weber [Fri, 6 May 2022 13:52:58 +0000 (09:52 -0400)]
Revert "[HWASan] Allow to linkify symbolizer output."

This reverts commit 4af9392e13a212fe295dc33455bc591b2dc8f859.
The new test fails on several machines (including some bots),
see https://reviews.llvm.org/D124950

2 years agoRevert "[HWASan] Clean up hwasan_symbolize."
Nico Weber [Fri, 6 May 2022 13:52:32 +0000 (09:52 -0400)]
Revert "[HWASan] Clean up hwasan_symbolize."

This reverts commit 6ca1df61d29c1c46d8d6f51a1091a7651c8b1ab1.
Prerequisite for reverting 4af9392e13a212fe295dc.

2 years ago[libc++][P0943] Add stdatomic.h header.
Louis Dionne [Mon, 11 Apr 2022 14:42:45 +0000 (10:42 -0400)]
[libc++][P0943] Add stdatomic.h header.

* https://wg21.link/P0943
* https://eel.is/c++draft/stdatomic.h.syn

This is a re-application of 5d1c1a24, which was reverted in 987c7f407
because it broke the LLDB build.

Co-authored-by: Marek Kurdej <marek.kurdej@gmail.com>
Differential Revision: https://reviews.llvm.org/D97044

2 years ago[Support] Fix asan AllocatorTest after ba0d50ad7ec66
Sam McCall [Fri, 6 May 2022 13:50:33 +0000 (15:50 +0200)]
[Support] Fix asan AllocatorTest after ba0d50ad7ec66

We were counting the number of bytes allocated, but under asan there's
extra redzone bytes by default. Disable this.

2 years ago[SLP][X86] Add test coverage for Issue #51088
Simon Pilgrim [Fri, 6 May 2022 13:49:27 +0000 (14:49 +0100)]
[SLP][X86] Add test coverage for Issue #51088

2 years ago[clang][X86] Rename some intrinsics tests to use the *-builtins.c naming convention
Simon Pilgrim [Fri, 6 May 2022 13:34:39 +0000 (14:34 +0100)]
[clang][X86] Rename some intrinsics tests to use the *-builtins.c naming convention

2 years ago[compiler-rt][builtins] Fix wrong ABI of AVR __mulqi3 & __mulhi3
Ben Shi [Fri, 6 May 2022 07:21:19 +0000 (07:21 +0000)]
[compiler-rt][builtins] Fix wrong ABI of AVR __mulqi3 & __mulhi3

Reviewed By: aykevl, dylanmckay

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

2 years ago[RS4GC] Add support for 'freeze' instruction to findBaseDefiningValue
Max Kazantsev [Fri, 6 May 2022 13:42:30 +0000 (20:42 +0700)]
[RS4GC] Add support for 'freeze' instruction to findBaseDefiningValue

Because this instruction is a noop, we can simply go through it in
search of the base.

2 years ago[gn build] try to (manually) port 9ef451d1fdaa9a1 (hwasan_symbolize)
Nico Weber [Fri, 6 May 2022 12:33:16 +0000 (08:33 -0400)]
[gn build] try to (manually) port 9ef451d1fdaa9a1 (hwasan_symbolize)

needed by check-hwasan as of 4af9392e13a212

2 years ago[NFC] Fix typo in assert message
Max Kazantsev [Fri, 6 May 2022 13:31:04 +0000 (20:31 +0700)]
[NFC] Fix typo in assert message

2 years ago[clang][dataflow][NFC] Clarify guarantees on returned vector size for `runDataflowAna...
Yitzhak Mandelbaum [Fri, 6 May 2022 12:56:44 +0000 (12:56 +0000)]
[clang][dataflow][NFC] Clarify guarantees on returned vector size for `runDataflowAnalysis`.

Adjusts the comment to specify that the output vector's size matches the number of CFG blocks.

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

2 years ago[MLIR] Fix build with make
Nikita Popov [Thu, 5 May 2022 13:47:34 +0000 (15:47 +0200)]
[MLIR] Fix build with make

https://reviews.llvm.org/D124075 causes MLIR to no longer build
when using make rather than ninja, due to a tablegen-generated
header being used before it is created.

It seems that this is related to the use of LLVM_ENABLE_OBJLIB when
using add_tablgen with a non-Ninja/Xcode generator. In that case an
intermediate objlib target is generated.

This patch fixes the issue by a) declaring dependencies in
add_tablegen for mlir-pdll and b) making sure those dependencies
are added to the objlib target.

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

2 years agoFix underlining length; NFC
Aaron Ballman [Fri, 6 May 2022 12:47:19 +0000 (08:47 -0400)]
Fix underlining length; NFC

2 years ago[InstCombine] Extract icmp of select transform (NFC)
Nikita Popov [Fri, 6 May 2022 12:46:12 +0000 (14:46 +0200)]
[InstCombine] Extract icmp of select transform (NFC)

To make it either to extend to the case where the other operand
is not a constant.

2 years ago[CostModel][X86] Relax fcmp costs on SSE41 targets or later
Simon Pilgrim [Fri, 6 May 2022 12:29:40 +0000 (13:29 +0100)]
[CostModel][X86] Relax fcmp costs on SSE41 targets or later

Only pre-SSE41 targets double-pump the fp comparison ops

2 years ago[InstCombine] Fix scalable-vector bitwise select matching
Fraser Cormack [Thu, 5 May 2022 10:06:41 +0000 (11:06 +0100)]
[InstCombine] Fix scalable-vector bitwise select matching

D113035 enhanced the matching of bitwise selects from vector types. This
change unfortunately introduced crashes as it tries to cast scalable
vector types to integers.

Reviewed By: spatel

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

2 years ago[CostModel][X86] Adjust 128-bit select costs to account for slow BLENDV op
Simon Pilgrim [Fri, 6 May 2022 12:07:26 +0000 (13:07 +0100)]
[CostModel][X86] Adjust 128-bit select costs to account for slow BLENDV op

Based off the script from D103695 - Jaguar, Bulldozer, Silvermont (et al) and Haswell all have slow BLENDV ops, so adjust the worse case cost values

2 years ago[Flang][OpenMP] Initial lowering of the OpenMP worksharing loop
Kiran Chandramohan [Fri, 6 May 2022 11:45:18 +0000 (11:45 +0000)]
[Flang][OpenMP] Initial lowering of the OpenMP worksharing loop

The OpenMP worksharing loop operation in the dialect is a proper loop
operation and not a container of a loop. So we have to lower the
parse-tree OpenMP loop construct and the do-loop inside the construct
to a omp.wsloop operation and there should not be a fir.do_loop inside
it. This is achieved by skipping fir.do_loop creation and calling genFIR
for the nested evaluations in the lowering of the do construct.

Note: Handling of more clauses, parallel do, storage of loop index variable etc will come in separate patches.

Part of the upstreaming effort to move LLVM Flang from fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project to the LLVM Project.

Reviewed By: peixin

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

Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Co-authored-by: Shraiysh Vaishay <Shraiysh.Vaishay@amd.com>
2 years ago[RISCV] Add an extra vsetvli insertion test
Fraser Cormack [Fri, 6 May 2022 11:14:09 +0000 (12:14 +0100)]
[RISCV] Add an extra vsetvli insertion test

This test starts failing with the changes in D125021.

2 years ago[libc++] Implement ranges::is_partitioned
Nikolas Klauser [Wed, 4 May 2022 12:19:09 +0000 (14:19 +0200)]
[libc++] Implement ranges::is_partitioned

Reviewed By: var-const, #libc

Spies: libcxx-commits, mgorny

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

2 years ago[CostModel][X86] Adjust pre-SSE41 fp scalar select costs to account for vector ops
Simon Pilgrim [Fri, 6 May 2022 10:41:45 +0000 (11:41 +0100)]
[CostModel][X86] Adjust pre-SSE41 fp scalar select costs to account for vector ops

Based off the script from D103695, we now mainly use BLENDV or OR(AND,ANDN) to select scalar float/double ops

2 years agoGeneralize "check-all" umbrella targets, use for check-clang-tools
Sam McCall [Wed, 16 Mar 2022 18:46:28 +0000 (19:46 +0100)]
Generalize "check-all" umbrella targets, use for check-clang-tools

The mechanism behind "check-all" is recording params of add_lit_testsuite()
calls in global variables LLVM_LIT_*, and then creating an extra suite with
their union at the end.
This avoids composing the check-* targets directly, which doesn't work well.

We generalize this by allowing multiple families of variables LLVM_{name}_LIT_*:
  umbrella_lit_testsuite_begin(check-foo)
  ... test suites here will be added to LLVM_FOO_LIT_* variables ...
  umbrella_lit_testsuite_end(check-foo)
(This also moves some implementation muck out of {llvm,clang}/CMakeLists.txt

This patch also changes check-clang-tools to use be an umbrella test target,
which means the clangd and clang-pseudo tests are included in it, along with the
the other testsuites that already are (like check-clang-extra-clang-tidy).

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

2 years ago[CostModel][X86] Adjust 256-bit select costs to account for slow BLENDV op
Simon Pilgrim [Fri, 6 May 2022 10:27:37 +0000 (11:27 +0100)]
[CostModel][X86] Adjust 256-bit select costs to account for slow BLENDV op

Based off the script from D103695, on AVX1, Jaguar/Bulldozer both have low throughput for ymm select patterns (BLENDV + OR(AND,ANDN))), and even on AVX2 Haswell still struggles with BLENDV ops

2 years ago[SLP][X86] Regenerate ssat tests to remove defunct AVX1/AVX2 checks
Simon Pilgrim [Fri, 6 May 2022 10:21:44 +0000 (11:21 +0100)]
[SLP][X86] Regenerate ssat tests to remove defunct AVX1/AVX2 checks

2 years ago[pseudo] Strip directives from a token stream
Sam McCall [Wed, 6 Apr 2022 19:29:59 +0000 (21:29 +0200)]
[pseudo] Strip directives from a token stream

This includes only the taken branch of conditional sections.
The API allows for producing a stream for a particular PP branch, which
will be used later for the secondary GLR parses of not-taken branches.

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

2 years agoRevert "[analyzer] Canonicalize SymIntExpr so the RHS is positive when possible"
Balazs Benics [Fri, 6 May 2022 10:13:51 +0000 (12:13 +0200)]
Revert "[analyzer] Canonicalize SymIntExpr so the RHS is positive when possible"

It seems like multiple users are affected by a crash introduced by this
commit, thus I'm reverting it for the time being.
Read more about the found reproducers at Phabricator.

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

This reverts commit f0d6cb4a5cf5723d7ddab2c7dab74f2f62116a6d.

2 years ago[libcxx] Reject month 0 in get_date/__get_month
David Spickett [Thu, 21 Apr 2022 14:09:56 +0000 (14:09 +0000)]
[libcxx] Reject month 0 in get_date/__get_month

[libcxx] Reject month 0 in get_date/__get_month

This fixes #47663.

Months in dates should be >= 1 and <= 12.
We parse up to two digits then minus one, because
we want to store this as "months since January"
(0-11).

However we didn't check that the result of that
was not -1. For example if you had (MM/DD/YYYY)
00/21/2022.

Added tests for:
* Failing if month is 0
* Failing if month is 13
* Allowing a leading zero in month e.g. "01"

Note that libc++ and libstdc++ return different
values on parsing failure, and MSVC STL returns
end of stream instead.

Handle the first two by checking for defines, MSVC STL
expects these tests to fail for other reasons already:
https://github.com/microsoft/STL/blob/main/tests/libcxx/expected_results.txt#L372
so not handling that case here.

Reviewed By: #libc, Mordante

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

2 years ago[libc++] Mark tests that use check_assertion.h as requiring unix headers
John Brawn [Fri, 6 May 2022 09:43:06 +0000 (10:43 +0100)]
[libc++] Mark tests that use check_assertion.h as requiring unix headers

On targets without unistd.h or sys/wait.h (such as bare metal targets)
any test that uses check_assertion.h will fail, so add
REQUIRES: has-unix-headers to them and autodetect whether we have
these headers or not.

These tests currently have unsupported on windows, but that's exactly
because windows doesn't have these headers so we can remove the
specific check for windows.

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

2 years ago[DAG][PowerPC] Combine shuffle(bitcast(X), Mask) to bitcast(shuffle(X, Mask'))
David Green [Fri, 6 May 2022 09:50:31 +0000 (10:50 +0100)]
[DAG][PowerPC] Combine shuffle(bitcast(X), Mask) to bitcast(shuffle(X, Mask'))

If the mask is made up of elements that form a mask in the higher type
we can convert shuffle(bitcast into the bitcast type, simplifying the
instruction sequence. A v4i32 2,3,0,1 for example can be treated as a
1,0 v2i64 shuffle. This helps clean up some of the AArch64 concat load
combines, along with helping simplify a number of other tests.

The PowerPC combine for v16i8 splat vector loads needed some fixes to
keep it working for v16i8 vectors. This improves the handling of v2i64
shuffles to match too, hopefully improving them in general.

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

2 years ago[CostModel][X86] Add more complete float/double select cost test coverage
Simon Pilgrim [Fri, 6 May 2022 09:43:49 +0000 (10:43 +0100)]
[CostModel][X86] Add more complete float/double select cost test coverage

We were only testing basic vector types

2 years ago[mlir][bufferize] Disallow adding new bufferizable ops during bufferization
Matthias Springer [Fri, 6 May 2022 09:01:39 +0000 (18:01 +0900)]
[mlir][bufferize] Disallow adding new bufferizable ops during bufferization

Ops that are created during the bufferization were not analyzed (when run with One-Shot Bufferize), and users should instead create memref ops directly.

Futhermore, this fixes an issue where an op was erased (and put on the `erasedOps` list), but subsequently a new tensor op was created at the same memory location. This op was then not bufferized. Disallowing the creation of new tensor ops simplifies the bufferization and fixes such issues.

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

2 years ago[RISCV] Enable MachineOutliner by default under -Oz for RISCV
wangpc [Fri, 6 May 2022 09:30:49 +0000 (17:30 +0800)]
[RISCV] Enable MachineOutliner by default under -Oz for RISCV

Enable default outlining when the function has the minsize attribute.

`addr-label.ll` crashed after enabling this, so a barrier is added before
instruction selection as a workaround.

Reviewed By: luismarques

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

2 years ago[lldb] Correct hex digit regex in some tests
David Spickett [Fri, 6 May 2022 09:28:21 +0000 (09:28 +0000)]
[lldb] Correct hex digit regex in some tests

"A-f" -> "A-F"