platform/upstream/llvm.git
22 months ago[Bitcode] Remove auto-detection for typed pointers
Nikita Popov [Tue, 13 Dec 2022 10:58:06 +0000 (11:58 +0100)]
[Bitcode] Remove auto-detection for typed pointers

Always read bitcode according to the -opaque-pointers mode. Do not
perform auto-detection to implicitly switch to typed pointers.

This is a step towards removing typed pointer support, and also
eliminates the class of problems where linking may fail if a typed
pointer module is loaded before an opaque pointer module. (The
latest place where this was encountered is D139924, but this has
previously been fixed in other places doing bitcode linking as well.)

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

22 months ago[CodeGenCUDASPIRV] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 12:35:09 +0000 (13:35 +0100)]
[CodeGenCUDASPIRV] Convert tests to opaque pointers (NFC)

22 months ago[Flang] Remove some incorrect UNSUPPORTED clauses
Paul Robinson [Tue, 13 Dec 2022 16:53:07 +0000 (08:53 -0800)]
[Flang] Remove some incorrect UNSUPPORTED clauses

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

22 months ago[OpenMP] Add a missing dllexport for the new function __kmpc_fork_call_if
Martin Storsjö [Wed, 14 Dec 2022 08:19:11 +0000 (10:19 +0200)]
[OpenMP] Add a missing dllexport for the new function __kmpc_fork_call_if

This new function was added in b72f1ec9fbb14cd7d2f5112d2c52ef5cdd1aa94a,
but wasn't exported from the DLL on Windows.

This fixes the parallel/omp_parallel_if.c OpenMP testcase on
Windows.

22 months ago[OpenMP] Fix detecting warning options for GCC
Martin Storsjö [Tue, 13 Dec 2022 09:39:27 +0000 (11:39 +0200)]
[OpenMP] Fix detecting warning options for GCC

If testing for a warning option like -Wno-<foo> with GCC, GCC won't
print any diagnostic at all, leading to the options being accepted
incorrectly. However later, if compiling a file that actually prints
another warning, GCC will also print warnings about these -Wno-<foo>
options being unrecognized.

This avoids warning spam like this, for every OpenMP source file that
produces build warnings with GCC:

    cc1plus: warning: unrecognized command line option ‘-Wno-int-to-void-pointer-cast’
    cc1plus: warning: unrecognized command line option ‘-Wno-return-type-c-linkage’
    cc1plus: warning: unrecognized command line option ‘-Wno-covered-switch-default’
    cc1plus: warning: unrecognized command line option ‘-Wno-enum-constexpr-conversion’

This matches how such warning options are detected and added in
llvm/cmake/modules/HandleLLVMOptions.cmake, e.g. like this:

    check_cxx_compiler_flag("-Wclass-memaccess" CXX_SUPPORTS_CLASS_MEMACCESS_FLAG)
    append_if(CXX_SUPPORTS_CLASS_MEMACCESS_FLAG "-Wno-class-memaccess" CMAKE_CXX_FLAGS)

This also matches how LLDB warning options were restructured for
GCC compatibility in e546bbfda0ab91cf78c096d8c035851cc7c3b9f3.

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

22 months agoAArch64: use CAS instead of LDXR/STXR if available
Tim Northover [Mon, 20 Sep 2021 13:19:14 +0000 (14:19 +0100)]
AArch64: use CAS instead of LDXR/STXR if available

This covers 128-bit loads, and atomicrmw operations without a single native
instruction. Using CAS saves has a better chance of succeeding with high
contention on some systems.

22 months ago[mlir][gpu] Add `uniform` flag to gpu reduction ops
Ivan Butygin [Sun, 27 Nov 2022 14:19:56 +0000 (15:19 +0100)]
[mlir][gpu] Add `uniform` flag to gpu reduction ops

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

22 months agoRevert "[lld-macho][test][nfc] Update stabs.s to use touch -d instead of -t"
Nico Weber [Wed, 14 Dec 2022 12:14:29 +0000 (07:14 -0500)]
Revert "[lld-macho][test][nfc] Update stabs.s to use touch -d instead of -t"

This reverts commit 3c9f479a5e47d5f3de07ccac365589dd928bfd20.
Breaks tests on macOS, see e.g. https://reviews.llvm.org/D139980#3993989

22 months ago[WebAssembly][NFC] Add ComplexPattern for loads
Luke Lau [Wed, 14 Dec 2022 12:10:03 +0000 (12:10 +0000)]
[WebAssembly][NFC] Add ComplexPattern for loads

This refactors out the offset and address operand pattern matching into
a ComplexPattern, so that one pattern fragment can match the dynamic and
static (offset) addresses in all possible positions.

Split out from D139530, which also contained an improvement to global
address folding.

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

22 months ago[X86] Don't fold scalar_to_vector(i64 C) -> vzext_movl(scalar_to_vector(i32 C))
Simon Pilgrim [Wed, 14 Dec 2022 12:10:59 +0000 (12:10 +0000)]
[X86] Don't fold scalar_to_vector(i64 C) -> vzext_movl(scalar_to_vector(i32 C))

Fixes constant-folding infinite loop reported by @uabelho on rG5ca77541446d

22 months ago[InstCombine] return the result of the GEP of PHI transformation early
Danila Malyutin [Wed, 14 Dec 2022 10:31:15 +0000 (13:31 +0300)]
[InstCombine] return the result of the GEP of PHI transformation early

Without this change this function could return nullptr if no further
transformation took place making InstCombine pass incorrectly report no
IR changes preventing analyses invalidation.

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

22 months ago[Linker] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 12:02:35 +0000 (13:02 +0100)]
[Linker] Convert test to opaque pointers (NFC)

To preserve test intent, remove a pointer indirection and use
a GEP instead of bitcast, so the type is still mentioned.

22 months ago[SCEV] Cache folded SExt SCEV expressions.
Florian Hahn [Wed, 14 Dec 2022 11:59:19 +0000 (11:59 +0000)]
[SCEV] Cache folded SExt SCEV expressions.

Use FoldID to cache SignExtendExprs that get folded to a different
SCEV.

Depends on D137505.

Reviewed By: mkazantsev

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

22 months ago[Linker] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 11:57:59 +0000 (12:57 +0100)]
[Linker] Convert test to opaque pointers (NFC)

To preserve test intent, drop the pointer type.

22 months agore-land [RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V
Alexey Baturo [Wed, 10 Aug 2022 05:41:26 +0000 (08:41 +0300)]
re-land [RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V

now with the fixed warning and updated lit tests
---
[RISC-V][HWASAN] Add support for HWASAN code instrumentation for RISC-V

Reviewed By: vitalybuka

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

22 months ago[Linker] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 11:48:21 +0000 (12:48 +0100)]
[Linker] Convert test to opaque pointers (NFC)

All the pointer-indirected cases are no longer relevant with
opaque pointers. To preserve at least some of the test intent,
switch to by value passing of the unnamed types. Otherwise we
wouldn't be testing anything at all.

22 months ago[mlir][tensor][bufferize] Improve bufferization of DimOp/RankOp
Matthias Springer [Wed, 14 Dec 2022 11:26:29 +0000 (12:26 +0100)]
[mlir][tensor][bufferize] Improve bufferization of DimOp/RankOp

The tensor operands do not bufferize to a memory read.

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

22 months ago[mlir][memref] Fold no-op subview(subview(x)) ops
Matthias Springer [Wed, 14 Dec 2022 11:26:41 +0000 (12:26 +0100)]
[mlir][memref] Fold no-op subview(subview(x)) ops

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

22 months ago[LTO] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 11:32:45 +0000 (12:32 +0100)]
[LTO] Convert tests to opaque pointers (NFC)

22 months ago[X86] lowerShuffleAsVTRUNC - bit shift the offset elements into place instead of...
Simon Pilgrim [Wed, 14 Dec 2022 11:41:14 +0000 (11:41 +0000)]
[X86] lowerShuffleAsVTRUNC - bit shift the offset elements into place instead of shuffle

This helps avoid issues on non-BWI targets which can end up splitting the shuffles to 2 x 256-bit bitshifts of a smaller scalar width

22 months ago[llvm-link] Convert test to opaque pointers (NFC)
Nikita Popov [Wed, 14 Dec 2022 11:29:44 +0000 (12:29 +0100)]
[llvm-link] Convert test to opaque pointers (NFC)

To preserve test intent, remove the pointer types and replace by
value types, otherwise this wouldn't be testing anything at all.

22 months agomlir/ods-gen: use bash from env in shell script
Ramkumar Ramachandra [Tue, 13 Dec 2022 16:27:50 +0000 (17:27 +0100)]
mlir/ods-gen: use bash from env in shell script

On macOS, hardcoding the path of bash leads to a failure in executing
update_core_linalg_named_ops.sh, due to an old version of bash being
present in that location.

Signed-off-by: Ramkumar Ramachandra <r@artagnon.com>
Differential Revision: https://reviews.llvm.org/D139942

22 months ago[mlir][NFC] Make test-lower-to-llvm a named pipeline
Quentin Colombet [Mon, 12 Dec 2022 13:36:39 +0000 (13:36 +0000)]
[mlir][NFC] Make test-lower-to-llvm a named pipeline

This patch changes the `test-lower-to-llvm` pass into a named pipeline.
The functionality is unchanged but thanks to this change, we don't have
to pull the dependencies of all the passes that this pass calls.
In other words, `TestLowerToLLVMPass::getDependDialects` was supposed to
transitively declare all the dialects that were used in the union of all
the invoked passes.

NFC

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

22 months agoRevert "[InstCombine] Handle logical op in simplifyRangeCheck() (PR59484)"
Nikita Popov [Wed, 14 Dec 2022 11:01:30 +0000 (12:01 +0100)]
Revert "[InstCombine] Handle logical op in simplifyRangeCheck() (PR59484)"

This reverts commit 492c471839a66e354ebe696bd3e15f7477c63613.

As pointed out by nloped, the transform in f2 is not correct: If
%shr is poison, then freeze may result in a negative value. The
transform is correct in the case where the freeze is pushed through
the operation in a way that guarantees the result is non-negative,
which is the case I had tested.

22 months ago[X86] lowerShuffleAsVTRUNC - improve detection of cheap/free vector concatenation
Simon Pilgrim [Tue, 13 Dec 2022 17:48:39 +0000 (17:48 +0000)]
[X86] lowerShuffleAsVTRUNC - improve detection of cheap/free vector concatenation

Handle the case where the lo/hi subvectors are a split load.

22 months ago[AArch64][SVE][ISel] Combine dup of load to replicating load
Peter Waller [Thu, 8 Dec 2022 12:00:35 +0000 (12:00 +0000)]
[AArch64][SVE][ISel] Combine dup of load to replicating load

(dup (load) z_or_x_passthrough) => (replicating load)

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

22 months ago[bazel] add some more deps to libc BUILD files
Krasimir Georgiev [Wed, 14 Dec 2022 10:25:54 +0000 (10:25 +0000)]
[bazel] add some more deps to libc BUILD files

22 months ago[llvm-readobj] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 10:24:52 +0000 (10:24 +0000)]
[llvm-readobj] llvm::Optional => std::optional

Temporarily add expectedToStdOptional to llvm/Support/Error.h for migration.

22 months ago[ExecutionEngine] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 10:18:07 +0000 (10:18 +0000)]
[ExecutionEngine] llvm::Optional => std::optional

22 months ago[bazel] Add __support_common dep
Krasimir Georgiev [Wed, 14 Dec 2022 10:16:17 +0000 (10:16 +0000)]
[bazel] Add __support_common dep

22 months ago[FileCheck] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 10:07:47 +0000 (10:07 +0000)]
[FileCheck] llvm::Optional => std::optional

22 months ago[include-cleaner] Print the line number of removal #includes.
Haojian Wu [Wed, 14 Dec 2022 09:45:56 +0000 (10:45 +0100)]
[include-cleaner] Print the line number of removal #includes.

I found that this information is helpful when using this tool.

Reviewed By: kadircet

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

22 months ago[mlir][llvm] Add inbounds attriubte to the gep op.
Tobias Gysi [Wed, 14 Dec 2022 09:44:11 +0000 (10:44 +0100)]
[mlir][llvm] Add inbounds attriubte to the gep op.

The revision adds an inbounds attribute to the LLVM dialect
GEP operation. It extends the builders and the import and export
to support the optional inbounds attribute.

As all builders set inbounds to false by default, existing lowerings
from higher-level dialects to LLVM dialect are not affected by the
change. Canonicalization/folding remains untouched since it currently
does not implement any simplifications in case of undefined behavior
(the handling of undefined behavior is deferred to LLVM).

Reviewed By: ftynse

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

22 months ago[clangd] Correct the local variable names to match the code style, NFC
Haojian Wu [Tue, 13 Dec 2022 12:38:36 +0000 (13:38 +0100)]
[clangd] Correct the local variable names to match the code style, NFC

22 months ago[mlir][llvm] Fix bug in the LLVM IR constant import.
Tobias Gysi [Wed, 14 Dec 2022 09:27:01 +0000 (10:27 +0100)]
[mlir][llvm] Fix bug in the LLVM IR constant import.

The recently introduced iterative constant import
(https://reviews.llvm.org/D137559) fails for programs that
subsequently import constant expressions with duplicate
subexpressions. The reason is a broken duplicate check
in getConstantsToConvert. The revision fixes the bug and
adds a test case that imports two constant expressions
with duplicates.

Reviewed By: ftynse

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

22 months ago[AArch64][SVE] Add hadd and rhadd support
David Green [Wed, 14 Dec 2022 09:24:54 +0000 (09:24 +0000)]
[AArch64][SVE] Add hadd and rhadd support

This adds basic HADD and RHADD support for SVE, by marking the AVGFLOOR
and AVGCEIL as custom and converting those to HADD_PRED/RHADD_PRED
AArch64 nodes. Both the existing intrinsics and the _PRED nodes are then
lowered to the _ZPmZ instructions.

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

22 months agoRevert "Implement CWG2631"
Krasimir Georgiev [Wed, 14 Dec 2022 08:41:51 +0000 (08:41 +0000)]
Revert "Implement CWG2631"

This reverts commit f1f1b60c7ba607e9ffe3bc012161d43ef95ac773.

Temporary revert, possibly triggers a new assertion failure on
QualType::getCommonPtr.
We're working on a reproducer, to follow-up on
https://reviews.llvm.org/D136554.

22 months ago[clang][analyzer] No new nodes when bug is detected in StdLibraryFunctionsChecker.
Balázs Kéri [Wed, 14 Dec 2022 08:25:06 +0000 (09:25 +0100)]
[clang][analyzer] No new nodes when bug is detected in StdLibraryFunctionsChecker.

The checker applies constraints in a sequence and adds new nodes for these states.
If a constraint violation is found this sequence should be stopped with a sink
(error) node. Instead the `generateErrorNode` did add a new error node as a new
branch that is parallel to the other node sequence, the other branch was not
stopped and analysis was continuing on that invalid branch.
To add an error node after any previous node a new version of `generateErrorNode`
is needed, this function is added here and used by `StdLibraryFunctionsChecker`.
The added test executes a situation where the checker adds a number of
constraints before it finds a constraint violation.

Reviewed By: NoQ

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

22 months ago[RISCV] Add Syntacore SCR1 CPU model
Dmitrii Petrov [Wed, 14 Dec 2022 08:12:23 +0000 (11:12 +0300)]
[RISCV] Add Syntacore SCR1 CPU model

SCR1 is available at https://github.com/syntacore/scr1

'syntacore-scr1-base' corresponds to SCR1_CFG_RV32IC_BASE,
'syntacore-scr1-max' corresponds to SCR1_CFG_RV32IMC_MAX.

SCR1_CFG_RV32EC_MIN is RV32EC, which is currently unsupported.

Reviewed By: craig.topper

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

22 months ago[Bitcode] Use std::nullopt_t instead of NoneType (NFC)
Kazu Hirata [Wed, 14 Dec 2022 08:39:45 +0000 (00:39 -0800)]
[Bitcode] Use std::nullopt_t instead of NoneType (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

22 months ago[llvm-pdbutil] Update #includes (NFC)
Kazu Hirata [Wed, 14 Dec 2022 08:32:06 +0000 (00:32 -0800)]
[llvm-pdbutil] Update #includes (NFC)

The header file uses std::optional, but it's realying a transitive
inclusion of <optional>.  Meanwhile, it no longer uses llvm::Optional.

22 months ago[libunwind] Use .irp directives. NFC
Fangrui Song [Wed, 14 Dec 2022 08:24:22 +0000 (08:24 +0000)]
[libunwind] Use .irp directives. NFC

The repeated instructions make the file long and difficult to read.
Simplify them with .irp directives.

Skip PowerPC since AIX assembler doesn't support .irp

Reviewed By: #libunwind, compnerd

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

22 months ago[tools] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 08:01:04 +0000 (08:01 +0000)]
[tools] llvm::Optional => std::optional

22 months ago[Analysis] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 07:32:24 +0000 (07:32 +0000)]
[Analysis] llvm::Optional => std::optional

22 months ago[Attributor][FIX] Avoid memory leakage through InstExclusionSet
Johannes Doerfert [Wed, 14 Dec 2022 06:57:55 +0000 (22:57 -0800)]
[Attributor][FIX] Avoid memory leakage through InstExclusionSet

22 months ago[OpenMP][FIX] Restrict more unsound assmptions about threading
Johannes Doerfert [Wed, 14 Dec 2022 06:00:15 +0000 (22:00 -0800)]
[OpenMP][FIX] Restrict more unsound assmptions about threading

Even if all loads and stores are in `nosync` functions we cannot
guarantee there is no synchronization going on between them. As such, we
cannot use CFG reasoning. We could check the entire module, or, what
happens now to minimize test churn, is to check if all accesses are in
the same function that is `nosync`. A follow up will undo some of the
regressions where possible.

Similarly, reachability cannot be used to exclude an access if the
access is not known to be executed by the same thread as the given
instruction.

The OpenMP-opt test was added for the latter problem.

22 months ago[gn] Port 5f68c4111ab9c79b902723df3986dd1033813c01
Fangrui Song [Wed, 14 Dec 2022 06:48:20 +0000 (06:48 +0000)]
[gn] Port 5f68c4111ab9c79b902723df3986dd1033813c01

22 months ago[clang] Remove uses of ::testing::Matcher<const Optional<T> &>
Fangrui Song [Wed, 14 Dec 2022 06:42:34 +0000 (06:42 +0000)]
[clang] Remove uses of ::testing::Matcher<const Optional<T> &>

Change a few functions (getCheckTraversalKind, some clang/Tooling/ API, etc)
from llvm::Optional to std::optional.

22 months ago[Testing/Support] llvm::Optional => std::optional
Fangrui Song [Wed, 14 Dec 2022 06:35:39 +0000 (06:35 +0000)]
[Testing/Support] llvm::Optional => std::optional

SupportHelpers.h supports both for now to ease migration.

22 months ago[libc] Implement a high-precision floating point class.
Tue Ly [Wed, 7 Dec 2022 16:53:18 +0000 (11:53 -0500)]
[libc] Implement a high-precision floating point class.

Implement a high-precision floating point class using UInt<> as its
mantissa.  This will be used in accurate pass for double precision math
functions.

Reviewed By: sivachandra

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

22 months ago[NFC] Cleanup: Replace BB->getInstList().erase() with I->eraseFromParent().
Vasileios Porpodas [Wed, 14 Dec 2022 04:24:16 +0000 (20:24 -0800)]
[NFC] Cleanup: Replace BB->getInstList().erase() with I->eraseFromParent().

This is part of a series of patches that aim at making BasicBlock::getInstList() private.

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

22 months ago[OpenMP][NFC] Remove more unused code, eliminate warning
Johannes Doerfert [Wed, 14 Dec 2022 04:53:08 +0000 (20:53 -0800)]
[OpenMP][NFC] Remove more unused code, eliminate warning

22 months ago[FuzzMutate] InstModStrategy: switch nsw/nuw/inbount instead of repeated setting it
Peter Rong [Mon, 12 Dec 2022 23:35:54 +0000 (15:35 -0800)]
[FuzzMutate] InstModStrategy: switch nsw/nuw/inbount instead of repeated setting it

Reviewed By: arsenm

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

22 months ago[mlir][math] Added arith::FastMathAttr support for math::FPowI.
Slava Zakharin [Tue, 13 Dec 2022 17:51:40 +0000 (09:51 -0800)]
[mlir][math] Added arith::FastMathAttr support for math::FPowI.

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

22 months ago[Attributor] Introduce AA[Intra/Inter]Reachability
Johannes Doerfert [Mon, 12 Dec 2022 23:17:27 +0000 (15:17 -0800)]
[Attributor] Introduce AA[Intra/Inter]Reachability

We had two AAs for reachability but it was very cumbersome to extend
them. We also had some fallback to use LLVM-core mechanisms and cache
the result. The new design shares the query code and interface nicely
between AAIntraFnReachability and AAInterFnReachability.

As part of the rewrite we also added the ExclusionSet to the queries.

22 months ago[OpenMP][FIX] Remove accidental and somewhat random change
Johannes Doerfert [Wed, 14 Dec 2022 03:36:45 +0000 (19:36 -0800)]
[OpenMP][FIX] Remove accidental and somewhat random change

22 months ago[NFC] [C++20] [Modules] Add more lambda tests
Chuanqi Xu [Wed, 14 Dec 2022 03:28:06 +0000 (11:28 +0800)]
[NFC] [C++20] [Modules] Add more lambda tests

Add more lambda tests in modules. This is useful when we started to work
on https://github.com/llvm/llvm-project/issues/57222.

22 months agoWarn about unsupported ibmlongdouble
Tulio Magno Quites Machado Filho [Wed, 14 Dec 2022 02:59:20 +0000 (10:59 +0800)]
Warn about unsupported ibmlongdouble

When -mabi=ieeelongdouble is enabled by default, libc++ does not support
-mabi=ibmlongdouble.

Reviewed By: qiucf

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

22 months ago[OpenMP][FIX] Remove unsound reasoning about written to values
Johannes Doerfert [Tue, 13 Dec 2022 22:35:50 +0000 (14:35 -0800)]
[OpenMP][FIX] Remove unsound reasoning about written to values

Even if a value is for sure written we need to visit the call sites as
they might end up inside the function that reads and writes the value.
In a follow up we can introduce correct reasoning to avoid the backwards
traversal in this case and instead check if any call site between the
write and the read might reach a potential write we want to exclude.

22 months ago[NFC] Rerun update test checks on Attributor and OpenMP-Opt tests
Johannes Doerfert [Tue, 13 Dec 2022 19:11:55 +0000 (11:11 -0800)]
[NFC] Rerun update test checks on Attributor and OpenMP-Opt tests

22 months ago[OpenMP][NFCI] Remove effectively dead code in clang and the runtime
Johannes Doerfert [Tue, 13 Dec 2022 18:11:18 +0000 (10:11 -0800)]
[OpenMP][NFCI] Remove effectively dead code in clang and the runtime

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

22 months ago[mlir][Vector] Use llvm::zip to avoid assertion failed.
jacquesguan [Mon, 12 Dec 2022 08:58:04 +0000 (16:58 +0800)]
[mlir][Vector] Use llvm::zip to avoid assertion failed.

This patch fixes the issue https://github.com/llvm/llvm-project/issues/59455.
We could omit the un-changed dimensions in offsets and sizes, so llvm::zip_equal would fail in this case.

Reviewed By: Mogball

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

22 months ago[mlir][Python] Add a simple PyOpOperand iterator for PyValue uses.
Mike Urbach [Wed, 7 Dec 2022 02:30:56 +0000 (19:30 -0700)]
[mlir][Python] Add a simple PyOpOperand iterator for PyValue uses.

This adds a simple PyOpOperand based on MlirOpOperand, which can has
properties for the owner op and operation number.

This also adds a PyOpOperandIterator that defines methods for __iter__
and __next__ so PyOpOperands can be iterated over using the the
MlirOpOperand C API.

Finally, a uses psuedo-container is added to PyValue so the uses can
generically be iterated.

Depends on D139596

Reviewed By: stellaraccident, jdd

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

22 months ago[OpenMP][Test] Make the output error message consistent with the comment
gonglingqin [Wed, 14 Dec 2022 01:54:26 +0000 (09:54 +0800)]
[OpenMP][Test] Make the output error message consistent with the comment

Modify the error message output of affinity/kmp-affinity.c and
affinity/omp-places.c.

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

22 months ago[openmp][amdgpu] Let fine grain and kernarg pools differ
Jon Chesterfield [Wed, 14 Dec 2022 02:02:58 +0000 (02:02 +0000)]
[openmp][amdgpu] Let fine grain and kernarg pools differ

22 months ago[VP][RISCV] Add vp.ctpop and RISC-V support.
Yeting Kuo [Tue, 13 Dec 2022 09:41:46 +0000 (17:41 +0800)]
[VP][RISCV] Add vp.ctpop and RISC-V support.

The patch also adds expandVPCTPOP in TargetLowering to expand VP_CTPOP nodes.

Reviewed By: craig.topper

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

22 months ago[mlir][tosa] Fix padding for tosa.conv2d and tosa.depthwise_conv2d decomposition
Rob Suderman [Wed, 14 Dec 2022 01:19:04 +0000 (17:19 -0800)]
[mlir][tosa] Fix padding for tosa.conv2d and tosa.depthwise_conv2d decomposition

Decomposition did not take padding into account when decomposing into fully
connected operation.

Reviewed By: NatashaKnk

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

22 months ago[flang] Fix a warning
Kazu Hirata [Wed, 14 Dec 2022 01:36:56 +0000 (17:36 -0800)]
[flang] Fix a warning

This patch fixes:

  flang/lib/Lower/PFTBuilder.cpp:1042:6: error: function 'dumpScope'
  is not needed and will not be emitted
  [-Werror,-Wunneeded-internal-declaration]

22 months ago[IPO] Fix a warning
Kazu Hirata [Wed, 14 Dec 2022 01:25:00 +0000 (17:25 -0800)]
[IPO] Fix a warning

This patch fixes:

  llvm/lib/Transforms/IPO/AttributorAttributes.cpp:1028:21: error:
  unused function 'operator<<' [-Werror,-Wunused-function]

22 months ago[ubsan][test] Be more specific than "error:" with implicit-check-not
Roy Sundahl [Fri, 2 Dec 2022 21:13:19 +0000 (13:13 -0800)]
[ubsan][test] Be more specific than "error:" with implicit-check-not

The string "error:" is too general and reports false positive from system
messages that can occur on stderr when using network devices for testing.
The string "runtime error:" is sufficiently unique for these connection
errors to pass through w/o a false positive.

rdar://100564373

Reviewed By: thetruestblue

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

22 months ago[lld-macho][test][nfc] Update stabs.s to use touch -d instead of -t
Pengxuan Zheng [Tue, 13 Dec 2022 20:35:11 +0000 (12:35 -0800)]
[lld-macho][test][nfc] Update stabs.s to use touch -d instead of -t

The test currently uses `touch -t` (e.g., `env TZ=UTC touch -t
"197001010000.16"`) to set file timestamps. However, this does not seem to set
the time zone correctly in a singularity container. While this is probably a
bug/limitation of the singularity container, but we can instead use `touch
-d` (e.g., `touch -d "1970-01-01 00:00:16 UTC"`) to achieve the same result
without relying on a fix from singularity. Thoughts?

Reviewed By: int3, #lld-macho

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

22 months ago[CMake] Setting the LLVM_TARGET_TRIPLE macro based on the LLVM_DEFAULT_TARGET_TRIPLE
Nicole Rabjohn [Wed, 14 Dec 2022 00:54:52 +0000 (19:54 -0500)]
[CMake] Setting the LLVM_TARGET_TRIPLE macro based on the LLVM_DEFAULT_TARGET_TRIPLE

After D137870, LLVM_TARGET_TRIPLE is no longer defined on the runtime
path into compiler-rt. This patch creates a common block of code to set
LLVM_TARGET_TRIPLE equal to the default for both the llvm- and runtime-
paths.

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

22 months agoRevert "Reland "[compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests""
Haowei Wu [Wed, 14 Dec 2022 00:38:12 +0000 (16:38 -0800)]
Revert "Reland "[compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests""

This reverts commit 255c3e3dcb06299aa2365f70817322a8a381c351, which
breaks Msan-x86_64-Test.

22 months ago[NFC] [DirectX backend] copy dxil-dis as exe file on windows
Xiang Li [Sat, 10 Dec 2022 04:34:27 +0000 (20:34 -0800)]
[NFC] [DirectX backend] copy dxil-dis as exe file on windows

Without .exe in the name on windows, the test not work.

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

22 months ago[LSAN][NFC] Eliminated GetThreadRegistryLocked from the LSAN interface to avoid the...
Kirill Stoimenov [Tue, 13 Dec 2022 23:03:48 +0000 (23:03 +0000)]
[LSAN][NFC] Eliminated GetThreadRegistryLocked from the LSAN interface to avoid the need to implement it in HWASAN.

Reviewed By: vitalybuka

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

22 months ago[mlir] Fix a warning
Kazu Hirata [Tue, 13 Dec 2022 23:44:30 +0000 (15:44 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp:52:42:
  error: 'None' is deprecated: Use std::nullopt
  instead. [-Werror,-Wdeprecated-declarations]

22 months ago[flang] Fix build failure
V Donaldson [Tue, 13 Dec 2022 22:55:46 +0000 (14:55 -0800)]
[flang] Fix build failure

22 months ago[X86] Don't zero out %eax if both %al and %ah are used
Bill Wendling [Tue, 13 Dec 2022 23:06:29 +0000 (15:06 -0800)]
[X86] Don't zero out %eax if both %al and %ah are used

The iterator over super and sub registers doesn't include both 8-bit
registers in its list. So if both registers are used and only one of
them is live on return, then we need to make sure that the other 8-bit
register is also marked as live and not zeroed out.

Reviewed By: nickdesaulniers

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

22 months ago[SPARC] Add GNU syntax extensions of WRPR instruction
Koakuma [Tue, 13 Dec 2022 22:58:54 +0000 (17:58 -0500)]
[SPARC] Add GNU syntax extensions of WRPR instruction

Add two GNU extension forms of wrpr:

wrpr %reg, %rd -> wrpr %reg, %g0, %rd
wrpr  imm, %rd -> wrpr  %g0, imm, %rd

Note: since the semantics of wrpr %rs1, %rs2/imm, %rd is %rd <- (%rs1 xor %rs2/imm),
in case (1) it technically doesn't matter whether the %g0 is placed as the first or
second operand, however, I'm placing it as the second operand to match the encoding
of GNU as.

This fixes the wrpr instruction part of bug #40792

Reviewed By: arsenm

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

22 months ago[llvm][Object] set SF_Hidden flag for MachO files
Cyndy Ishida [Tue, 13 Dec 2022 20:39:11 +0000 (12:39 -0800)]
[llvm][Object] set SF_Hidden flag for MachO files

Reviewed By: pete, ributzka

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

22 months agoSkip TestEarlyProcessLaunch.py w/ system debugserver
Jason Molenda [Tue, 13 Dec 2022 22:50:52 +0000 (14:50 -0800)]
Skip TestEarlyProcessLaunch.py w/ system debugserver

This test depends on having a new packet supported by debugserver;
skip it until we have a system debugserver installed on the CI bots
with this change.

22 months ago[NFC][X86][Codegen] Fix test coverage for AVX512 i1 mask replication
Roman Lebedev [Tue, 13 Dec 2022 20:53:08 +0000 (23:53 +0300)]
[NFC][X86][Codegen] Fix test coverage for AVX512 i1 mask replication

At least some of the seemingly-bad codegen was because we really need to
consume the replicated i1 mask by the mask-consuming instruction
if we want faithful codegen for the replication shuffle.

But some of the odd codegen is still there.

22 months agoDon't try to look up a name containing a dependent type.
Richard Smith [Tue, 13 Dec 2022 22:41:12 +0000 (14:41 -0800)]
Don't try to look up a name containing a dependent type.

Template instantiation can create names that are still dependent, such
as `operator T`. Don't assume that they can be looked up immediately,
and instead defer lookup for such names until we know what `T` is.

22 months ago[NFC] Cleanup: Remove uses of BasicBlock::getInstList().
Vasileios Porpodas [Tue, 13 Dec 2022 21:47:25 +0000 (13:47 -0800)]
[NFC] Cleanup: Remove uses of BasicBlock::getInstList().

This is part of a series of patches that aim at making Function::getInstList() private.

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

22 months ago[SPARC] Mark the %g0 register as constant & use it to materialize zeros
Koakuma [Tue, 13 Dec 2022 22:25:42 +0000 (17:25 -0500)]
[SPARC] Mark the %g0 register as constant & use it to materialize zeros

Materialize zeros by copying from %g0, which is now marked as constant.

This makes it possible for some common operations (like integer negation) to be
performed in fewer instructions.

This continues @arichardson's patch at D132561.

Reviewed By: arsenm

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

22 months ago[mlir][tensor][linalg] Enhance pack op propagation across generic ops.
Hanhan Wang [Wed, 7 Dec 2022 23:47:06 +0000 (15:47 -0800)]
[mlir][tensor][linalg] Enhance pack op propagation across generic ops.

Considering the case that generic + pack (with outer_dim_perms), the
truth is that it is equipvelent to generic + pack + transpose. There are
two steps to bubble up the pack op accross the generic op.

Step 1. swap generic + pack -> pack + generic.

In this step, we can bind the packing information to dimensions of
iteration domain. With the information, we can pack the operands with
corresponding data tile sizes; the packed inner dimensions will be
appended to the indexing_maps. Note that the outer dimensions of
indexing maps are not changed at all.

Step 2. Fold the transpose into generic op.

The step two is just updating the indexing map, so we do not have to
handle outer_dim_perms anymore.

There could be step 3 to extract the transpose op out (i.e., generic ->
transpose + generic), then we can fold the transpose into the pack op.
This step is not done in the revision.

Co-authored-by: Lorenzo Chelini <l.chelini@icloud.com>
Reviewed By: chelini

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

22 months ago[ValueTracking] peek through extends in haveNoCommonBitsSet (2nd try)
Sanjay Patel [Tue, 13 Dec 2022 21:34:35 +0000 (16:34 -0500)]
[ValueTracking] peek through extends in haveNoCommonBitsSet (2nd try)

The 1st try was not clean because a portion of the code diff
made it into the pre-commit patch to add tests. This should
be the same end result without the muddied code diff.

Original commit message:

In cases with matching extends, this allows changing an 'add'
into an 'or' and narrowing the 'or' which then simplifies to
a constant.

In cases with opposite extends, we just convert to an 'or'
currently, but that could be reduced too.

https://alive2.llvm.org/ce/z/fTHzdb

22 months ago[lld-macho][test] Add test case for section ordering
Keith Smiley [Tue, 13 Dec 2022 18:57:24 +0000 (10:57 -0800)]
[lld-macho][test] Add test case for section ordering

This covers the special section ordering handling. This chooses to fake the sections vs creating them organically which is probably a bit easier to maintain.

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

22 months ago[llvm][tests] Don't run -O2 on instcombine test [NFC]
Nuno Lopes [Tue, 13 Dec 2022 21:45:12 +0000 (21:45 +0000)]
[llvm][tests] Don't run -O2 on instcombine test [NFC]

22 months ago[HWASAN][NFC] Added implementation for the most of the allocator related functions...
Kirill Stoimenov [Tue, 13 Dec 2022 20:38:32 +0000 (20:38 +0000)]
[HWASAN][NFC] Added implementation for the most of the allocator related functions from the LSAN interface.

Reviewed By: vitalybuka

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

22 months ago[mlir][sparse] Make some integration tests run with vectorization.
bixia1 [Tue, 13 Dec 2022 19:38:32 +0000 (11:38 -0800)]
[mlir][sparse] Make some integration tests run with vectorization.

Reviewed By: Peiming

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

22 months ago[lld-macho] Fix __objc_stubs ordering
Keith Smiley [Tue, 13 Dec 2022 04:46:51 +0000 (20:46 -0800)]
[lld-macho] Fix __objc_stubs ordering

In the case of large binaries previously you could end up getting
relocation failures. This mirrors ld64's ordering of these sections. I'm
not sure this solves all cases but it should help in some.

Fixes https://github.com/llvm/llvm-project/issues/58298

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

22 months ago[InstCombine] add tests for add-of-extends; NFC (2nd try)
Sanjay Patel [Tue, 13 Dec 2022 21:18:52 +0000 (16:18 -0500)]
[InstCombine] add tests for add-of-extends; NFC (2nd try)

The 1st attempt ( c8cba0bc4a8c9f ) accidentally picked up a code diff.

22 months agoRevert "[InstCombine] add tests for add-of-extends; NFC"
Sanjay Patel [Tue, 13 Dec 2022 21:11:33 +0000 (16:11 -0500)]
Revert "[InstCombine] add tests for add-of-extends; NFC"

This reverts commit c8cba0bc4a8c9f4f3f10e17f601ed924dfb82bef.
An unintended code change snuck into this (was supposed to just add tests).

22 months agoRevert "[ValueTracking] peek through extends in haveNoCommonBitsSet"
Sanjay Patel [Tue, 13 Dec 2022 21:09:50 +0000 (16:09 -0500)]
Revert "[ValueTracking] peek through extends in haveNoCommonBitsSet"

This reverts commit 7520d187cf0dedcf5085f71bc1a5472c75cc8dbb.

The pre-commit patch that was supposed to NFC add tests for this
patch picked up some code that should not be here. I'll clean up
and re-commit.

22 months ago[flang] Submodules
V Donaldson [Mon, 12 Dec 2022 22:20:06 +0000 (14:20 -0800)]
[flang] Submodules

A submodule is a program unit that may contain the implementions of procedures
declared in an ancestor module or submodule.

Processing for the equivalence groups and variables declared in a submodule
scope is similar to existing processing for the equivalence groups and
variables in module and procedure scopes. However, module and procedure scopes
are tied directly to code in the Pre-FIR Tree (PFT), whereas processing for a
submodule must have access to an ancestor module scope that is guaranteed
to be present in a .mod file, but is not guaranteed to be in the PFT. This
difference is accommodated by tying processing directly to a front end scope.
Function scopes that can be processed on the fly are done that way; the
resulting variable information is never stored. Module and submodule scopes
whose symbol information may be needed during lowering of any number of module
procedures are instead cached on first use, and reused as needed.

These changes are a direct extension of current code. All module and submodule
variables in scope are processed, whether referenced or not. A possible
alternative would be to instead process symbols only when first used. While
this could ultimately be beneficial, such an approach must account for the
presence of equivalence groups. That information is not currently available
for on-the-fly variable processing.

Some additional changes are needed to include submodules in places where
modules must be considered, and to include separate module procedures in
places where other subprogram variants are considered. There is also a fix
for a bug involving the use of variables in an equivalence group in a
namelist group, which also involves scope processing code.

22 months ago[ValueTracking] peek through extends in haveNoCommonBitsSet
Sanjay Patel [Tue, 13 Dec 2022 20:16:47 +0000 (15:16 -0500)]
[ValueTracking] peek through extends in haveNoCommonBitsSet

In cases with matching extends, this allows changing an 'add'
into an 'or' and narrowing the 'or' which then simplifies to
a constant.

In cases with opposite extends, we just convert to an 'or'
currently, but that could be reduced too.

https://alive2.llvm.org/ce/z/fTHzdb

22 months ago[InstCombine] add tests for add-of-extends; NFC
Sanjay Patel [Tue, 13 Dec 2022 18:47:33 +0000 (13:47 -0500)]
[InstCombine] add tests for add-of-extends; NFC

22 months ago[libc] add scanf int conversions
Michael Jones [Mon, 7 Nov 2022 17:47:58 +0000 (09:47 -0800)]
[libc] add scanf int conversions

This patch adds the integer conversions %d/i/u/o/x/X to scanf as well as
unit tests to check their correctness.

Reviewed By: sivachandra

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

22 months ago[libc] fix scanf error handling
Michael Jones [Fri, 18 Nov 2022 22:19:30 +0000 (14:19 -0800)]
[libc] fix scanf error handling

Scanf is supposed to return EOF when it fails to make any conversions
and there is an input failure. Previously it would return EOF on a
matching failure, which may be an input failure but can also be a
parsing error.

Reviewed By: sivachandra

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