platform/upstream/llvm.git
21 months ago[lldb] Get rid of __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS
serge-sans-paille [Thu, 29 Sep 2022 19:48:38 +0000 (21:48 +0200)]
[lldb] Get rid of __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS

C++11 made the use of these macro obsolete, see https://sourceware.org/bugzilla/show_bug.cgi?id=15366

As a side effect this prevents https://github.com/swig/swig/issues/2193.

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

21 months ago[mlir][Linalg] Reland Add ReduceOp to Linalg structured ops.
Adrian Kuegel [Fri, 30 Sep 2022 06:36:32 +0000 (08:36 +0200)]
[mlir][Linalg] Reland Add ReduceOp to Linalg structured ops.

This op will allow to model (variadic) reductions with this special op
instead of using GenericOp.

This reverts commit 535fd753ef8dcfe5c73219ea7173e015a74e4f59.
Additional fix: implement a getLibraryName method.

21 months ago[mlir][Bazel] Port 11069cbcb47845074d526490fff8daff8afda11d
Adrian Kuegel [Fri, 30 Sep 2022 06:33:10 +0000 (08:33 +0200)]
[mlir][Bazel] Port 11069cbcb47845074d526490fff8daff8afda11d

21 months ago[sanitizer] Fix symbolizer build script
Vitaly Buka [Fri, 30 Sep 2022 06:32:16 +0000 (23:32 -0700)]
[sanitizer] Fix symbolizer build script

21 months ago[clang][Interp] Handle enums
Timm Bäder [Fri, 16 Sep 2022 07:17:52 +0000 (09:17 +0200)]
[clang][Interp] Handle enums

Handle DeclRefExprs of enum types. They are otherwise handled like
integers.

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

21 months ago[clang] [test] Use --implicit-check-not in config-file3 tests
Michał Górny [Fri, 30 Sep 2022 05:59:41 +0000 (07:59 +0200)]
[clang] [test] Use --implicit-check-not in config-file3 tests

Thanks to Fangrui Song for the suggestion.

21 months ago[Doc] Fix typo. NFC
Phoebe Wang [Fri, 30 Sep 2022 06:00:42 +0000 (14:00 +0800)]
[Doc] Fix typo. NFC

Fixes #56429

21 months agoRevert "[CMake] Use libcxx targets for in-tree sanitizer C++ ABI"
Petr Hosek [Fri, 30 Sep 2022 05:52:49 +0000 (05:52 +0000)]
Revert "[CMake] Use libcxx targets for in-tree sanitizer C++ ABI"

This reverts commit 7dbdffefb768062f28599c256b5e013ee26ff04e since
it appears to have broken several ASan tests.

21 months agoFix spelling in Co-authored-by documentation
Kristof Beyls [Fri, 30 Sep 2022 05:42:06 +0000 (07:42 +0200)]
Fix spelling in Co-authored-by documentation

21 months ago[ELF] Reset verdefIndex for Defined preempting SharedSymbol
Fangrui Song [Fri, 30 Sep 2022 04:26:53 +0000 (21:26 -0700)]
[ELF] Reset verdefIndex for Defined preempting SharedSymbol

to avoid spurious "attempt to reassign symbol '...'" warning after
7a58dd1046a8052619d173b769f32f2df3aafbe8

21 months ago[JITLink] Update external symbol scopes to reflect scopes of resolved defs.
Lang Hames [Fri, 30 Sep 2022 02:16:19 +0000 (19:16 -0700)]
[JITLink] Update external symbol scopes to reflect scopes of resolved defs.

This is a counterpart to ffe2dda29f3, and does for scope what that commit did
for linkage.

Making the scope of external definitions visible to JITLink plugins will
allow us to distinguish hidden weak defs (which do not need to be tracked by
default) from default-scoped weak defs (which need to be updated to point at
a single chosen definition at runtime).

21 months ago[SelectionDAG] Add helper function to check whether a SDValue is neutral element...
Yeting Kuo [Wed, 14 Sep 2022 08:29:53 +0000 (16:29 +0800)]
[SelectionDAG] Add helper function to check whether a SDValue is neutral element. NFC.

Using this helper makes work about neutral elements more easier. Although I only
find one case now, I think it will have more chance to be used since so many
combine works are related to neutral elements.

Reviewed By: RKSimon

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

21 months ago[mlir][spirv] Handle dynamic/static cases differntly for kernel capability
Nirvedh Meshram [Thu, 29 Sep 2022 18:14:18 +0000 (11:14 -0700)]
[mlir][spirv] Handle dynamic/static cases differntly for kernel capability

Reviewed By: antiagainst

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

21 months ago[gn build] Port 91c96a806cae
LLVM GN Syncbot [Fri, 30 Sep 2022 01:33:02 +0000 (01:33 +0000)]
[gn build] Port 91c96a806cae

21 months ago[CMake] Use correct include flag for MSVC
Petr Hosek [Thu, 29 Sep 2022 08:48:03 +0000 (08:48 +0000)]
[CMake] Use correct include flag for MSVC

When building using the MSVC driver, we need to use /imsvc rather than
-isystem for system headers.

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

21 months ago[CMake] Use libcxx targets for in-tree sanitizer C++ ABI
Petr Hosek [Thu, 29 Sep 2022 07:53:06 +0000 (07:53 +0000)]
[CMake] Use libcxx targets for in-tree sanitizer C++ ABI

When in-tree libcxx is selected as the sanitizer C++ ABI, use libcxx
targets rather than libcxxabi and libunwind, since those may not be
available on all platforms (Windows for example).

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

21 months agoRevert "[MLGO] ML Regalloc Priority Advisor"
Mircea Trofin [Fri, 30 Sep 2022 01:26:40 +0000 (18:26 -0700)]
Revert "[MLGO] ML Regalloc Priority Advisor"

This reverts commit 8f4f26ba5bd04f7b335836021e5e63b4236c0305.

Buildbot failures, e.g. https://lab.llvm.org/buildbot/#/builders/6/builds/14041

21 months ago[mlir][sparse] Fixing case coverage warning
wren romano [Fri, 30 Sep 2022 00:24:01 +0000 (17:24 -0700)]
[mlir][sparse] Fixing case coverage warning

Followup to D133835 for fixing the warning on LLVM's Windows buildbot

Reviewed By: aartbik, Peiming, stella.stamenova

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

21 months ago[DAG] Simplify the select of constant combine code. NFC
Amaury Séchet [Fri, 30 Sep 2022 00:58:04 +0000 (00:58 +0000)]
[DAG] Simplify the select of constant combine code. NFC

21 months ago[DAG] select Cond, C, -1 --> or (sext (not Cond)), C when C is MVT::i1
Amaury Séchet [Sat, 6 Aug 2022 02:10:22 +0000 (02:10 +0000)]
[DAG] select Cond, C, -1 --> or (sext (not Cond)), C when C is MVT::i1

In the spirit of D130765 . Get rid of cbranches and/or cmov. Usually shorter, but sometime not, becaus eit's hard to prededict when dependency breaking xor will be introduced.

Reviewed By: RKSimon

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

21 months ago[mlir][sparse] refactoring: split translateIndices.
Peiming Liu [Thu, 29 Sep 2022 21:59:02 +0000 (21:59 +0000)]
[mlir][sparse] refactoring: split translateIndices.

TranslateIndicesArray take an array of SSA value and convert them into another array of SSA values based on reassociation. Which makes it easier to be reused by `foreach` operator (as the indices array are given as an array of SSA values).

Reviewed By: aartbik, bixia

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

21 months ago[libc][windows] rename fenv internals for windows
Michael Jones [Tue, 27 Sep 2022 23:52:21 +0000 (16:52 -0700)]
[libc][windows] rename fenv internals for windows

On windows, including math.h causes macros for "OVERFLOW" and
"UNDERFLOW" to be defined. This patch renames some variables internal to
FEnvImpl.h to avoid colliding with those.

Reviewed By: sivachandra

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

21 months ago[mlir][sparse] Allow the push_back operator to skip capacity check and reallocation.
bixia1 [Thu, 29 Sep 2022 21:50:42 +0000 (14:50 -0700)]
[mlir][sparse] Allow the push_back operator to skip capacity check and reallocation.

Add UnitAttr `inbounds` for this purpose.

Reviewed By: aartbik

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

21 months ago[IR] Don't allow DLL storage-class and local linkage
Ben Dunbobbin [Thu, 29 Sep 2022 23:21:31 +0000 (00:21 +0100)]
[IR] Don't allow DLL storage-class and local linkage

Disallow this meaningless combination. Doing so simplifies analysis
of LLVM code w.r.t t DLL storage-class, and prevents mistakes with
DLL storage class.

- Change the assembler to reject DLL storage class on symbols with
  local linkage.
- Change the bitcode reader to clear the DLL Storage class when the
  linkage is local for auto-upgrading
- Update LangRef.

There is an existing restriction on non-default visibility and local
linkage which this is modelled on.

Differential Review: https://reviews.llvm.org/D134784

21 months ago[mlir][sparse] implement singleton dimension level type
Aart Bik [Sat, 17 Sep 2022 00:55:50 +0000 (17:55 -0700)]
[mlir][sparse] implement singleton dimension level type

This is a first step towards fully implementing the new dimension
level types and properties, illustrating with a fully functional
sorted COO of any dimension. Note that the sparsification part is
pretty complete. The required parts in the runtime support library
have been kept to a minimum, to avoid huge conflicts with Wren's
ongoing refactoring. The missing parts will be filled in later.

Reviewed By: Peiming

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

21 months ago[MC] Properly disable debug-frame test on AppleSilicon Mac
Steven Wu [Thu, 29 Sep 2022 23:20:47 +0000 (16:20 -0700)]
[MC] Properly disable debug-frame test on AppleSilicon Mac

Disable debug-frame tests on AppleSilicon Mac to improve some of the fix
in PR46647.

Reviewed By: aprantl

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

21 months ago[mlir] Use `interleave` in `printOperands` (NFC)
Jeff Niu [Thu, 29 Sep 2022 20:45:44 +0000 (13:45 -0700)]
[mlir] Use `interleave` in `printOperands` (NFC)

Instead of reimplementing it.

Reviewed By: rriddle

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

21 months ago[mlir] Add `OpAsmPrinter::printOptionalLocationSpecifier`
Jeff Niu [Thu, 29 Sep 2022 21:43:08 +0000 (14:43 -0700)]
[mlir] Add `OpAsmPrinter::printOptionalLocationSpecifier`

This is the corresponding method to
`OpAsmParser::parseOptionalLocationSpecifier` that prints a location
`loc(...)` based on the op printing flags. Together, these two functions
allow propagating user-level location info outside of their usual spots.

Reviewed By: rriddle

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

21 months agoadd missing textual header to modulemap
Adrian Prantl [Thu, 29 Sep 2022 22:56:31 +0000 (15:56 -0700)]
add missing textual header to modulemap

21 months agoInclude <cmath> in FileUtilities.cpp for std:abs(double)
Rahul Joshi [Thu, 29 Sep 2022 22:33:49 +0000 (15:33 -0700)]
Include <cmath> in FileUtilities.cpp for std:abs(double)

21 months ago[mlir][sparse] Improve sparse_tensor::detail::readCOOValue template
wren romano [Thu, 29 Sep 2022 20:13:48 +0000 (13:13 -0700)]
[mlir][sparse] Improve sparse_tensor::detail::readCOOValue template

This is a followup to the refactoring of D133462, D133830, D133831, and D133833.

Depends On D133833

Reviewed By: aartbik

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

21 months ago[gn build] Port 8f4f26ba5bd0
LLVM GN Syncbot [Thu, 29 Sep 2022 22:13:14 +0000 (22:13 +0000)]
[gn build] Port 8f4f26ba5bd0

21 months ago[mlir][sparse] optimizing permutation validity check in toMLIRSparseTensor
wren romano [Thu, 29 Sep 2022 20:35:17 +0000 (13:35 -0700)]
[mlir][sparse] optimizing permutation validity check in toMLIRSparseTensor

The previous sorting-based check was O(n*log n). The new implementation is O(n).

This is a followup to the refactoring of D133462, D133830, D133831, and D133833.

Depends On D133833

Reviewed By: aartbik

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

21 months ago[libc][Obvious] Enable some of the recently added functions on aarch64.
Siva Chandra [Thu, 29 Sep 2022 21:41:46 +0000 (14:41 -0700)]
[libc][Obvious] Enable some of the recently added functions on aarch64.

21 months ago[mlir][sparse] Move the implementation of sparse_tensor.push_back to the buffer rewriter.
bixia1 [Thu, 29 Sep 2022 21:09:04 +0000 (14:09 -0700)]
[mlir][sparse] Move the implementation of sparse_tensor.push_back to the buffer rewriter.

Reviewed By: aartbik, Peiming

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

21 months ago[mlir][sparse] Adding isSorted bit to SparseTensorCOO
wren romano [Thu, 29 Sep 2022 20:39:30 +0000 (13:39 -0700)]
[mlir][sparse] Adding isSorted bit to SparseTensorCOO

This is a followup to the refactoring of D133462, D133830, D133831, and D133833.

Depends On D133833

Reviewed By: aartbik

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

21 months ago[mlir][sparse] Cleaning up SparseTensorFile::readMMEHeader
wren romano [Thu, 29 Sep 2022 20:31:14 +0000 (13:31 -0700)]
[mlir][sparse] Cleaning up SparseTensorFile::readMMEHeader

This is a followup to the refactoring of D133462, D133830, D133831, and D133833.

Depends On D133833

Reviewed By: aartbik

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

21 months ago[MLGO] ML Regalloc Priority Advisor
Eric Wang [Fri, 9 Sep 2022 19:20:27 +0000 (14:20 -0500)]
[MLGO] ML Regalloc Priority Advisor

The bulk of the implementation is common between 'release' mode (==AOT-ed
model) and 'development' mode (for training), the main difference is
that in development mode, we may also log features (for training logs),
inject scoring information and then produce the log file.

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

21 months ago[AArch64][GlobalISel] Implement another combine for shufflevector->AArch64 G_EXT.
Amara Emerson [Thu, 29 Sep 2022 16:22:25 +0000 (17:22 +0100)]
[AArch64][GlobalISel] Implement another combine for shufflevector->AArch64 G_EXT.

This is a port of an existing optimization in AArch64 ISelLowering, handling
a case when the same input vector can be used for both ext inputs.

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

21 months ago[mlir][sparse] Factoring out SparseTensorFile::canReadAs predicate
wren romano [Thu, 29 Sep 2022 20:09:24 +0000 (13:09 -0700)]
[mlir][sparse] Factoring out SparseTensorFile::canReadAs predicate

This is a followup to the refactoring of D133462, D133830, D133831, and D133833.

Depends On D133833

Reviewed By: aartbik

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

21 months ago[mlir][sparse] refactoring SparseTensorUtils: (4 of 4) documentation
wren romano [Thu, 29 Sep 2022 20:04:28 +0000 (13:04 -0700)]
[mlir][sparse] refactoring SparseTensorUtils: (4 of 4) documentation

Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* D133462: Part 1: split one file into several
* D133830: Part 2: Reorder chunks within files
* D133831: Part 3: General code cleanup
* (this): Part 4: Update documentation

This part updates existing documentation, adds new documentation, and reflows the test for some existing documentation.

Depends On D133831

Reviewed By: aartbik

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

21 months ago[mlir][sparse] refactoring SparseTensorUtils: (3 of 4) code-cleanup
wren romano [Thu, 29 Sep 2022 19:55:32 +0000 (12:55 -0700)]
[mlir][sparse] refactoring SparseTensorUtils: (3 of 4) code-cleanup

Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* D133462: Part 1: split one file into several
* D133830: Part 2: Reorder chunks within files
* (this): Part 3: General code cleanup
* D133833: Part 4: Update documentation

This part performs some general code cleanup including:
* making more things `const`, especially for the targets of pointers
* using preincrement wherever possible ([[ https://llvm.org/docs/CodingStandards.html#prefer-preincrement | per LLVM style guide ]])
* adding messages to most `assert` statments.
* moving argument casting from the core function/method definitions to the CPP wrappers

Depends On D133830

Reviewed By: aartbik

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

21 months ago[mlir][sparse] refactoring SparseTensorUtils: (2 of 4) reordering
wren romano [Thu, 29 Sep 2022 18:55:51 +0000 (11:55 -0700)]
[mlir][sparse] refactoring SparseTensorUtils: (2 of 4) reordering

Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* D133462: Part 1: split one file into several
* (this): Part 2: Reorder chunks within files
* D133831: Part 3: General code cleanup
* D133833: Part 4: Update documentation

This part moves chunks of code within files, but again aims to make no other changes. Many of these movements are part of a stylistic shift to reorder the components of class definitions as follows: data members, ctors/factories, getters, other public methods, private methods.

Depends On D133462

Reviewed By: aartbik

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

21 months ago[mlir][sparse] refactoring SparseTensorUtils: (1 of 4) file-splitting
wren romano [Thu, 29 Sep 2022 18:40:40 +0000 (11:40 -0700)]
[mlir][sparse] refactoring SparseTensorUtils: (1 of 4) file-splitting

Previously, the SparseTensorUtils.cpp library contained a C++ core implementation, but hid it in an anonymous namespace and only exposed a C-API for accessing it. Now we are factoring out that C++ core into a standalone C++ library so that it can be used directly by downstream clients (per request of one such client). This refactoring has been decomposed into a stack of differentials in order to simplify the code review process, however the full stack of changes should be considered together.

* (this): Part 1: split one file into several
* D133830: Part 2: Reorder chunks within files
* D133831: Part 3: General code cleanup
* D133833: Part 4: Update documentation

This part aims to make no changes other than the 1:N file splitting, and things which are forced to accompany that change.

Reviewed By: aartbik

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

21 months ago[NFC] Use %clang_cc1
Xiang Li [Thu, 29 Sep 2022 21:26:01 +0000 (14:26 -0700)]
[NFC] Use %clang_cc1

21 months ago[NFC] Move cc1 test out of Driver test
Xiang Li [Thu, 29 Sep 2022 21:19:12 +0000 (14:19 -0700)]
[NFC] Move cc1 test out of Driver test

21 months ago[HLSL] add ceil library function
Joshua Batista [Thu, 29 Sep 2022 20:43:24 +0000 (13:43 -0700)]
[HLSL] add ceil library function

This change exposes the ceil library function for HLSL,
excluding long, int, and long long doubles.
Ceil is supported for all scalar, vector, and matrix types.

Long and long long double support is missing in this patch because those types
don't exist in HLSL. Int is missing because the ceil function only works on floating type arguments.

The full documentation of the HLSL ceil function is available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-ceil

Reviewed By: python3kgae

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

21 months ago[RISCV] Minor code motion in InsertVSETVLI [nfc]
Philip Reames [Thu, 29 Sep 2022 21:01:14 +0000 (14:01 -0700)]
[RISCV] Minor code motion in InsertVSETVLI [nfc]

21 months ago[scudo][Fuchsia] Increase MaxNumCachedHint
Alex Brachet [Thu, 29 Sep 2022 20:57:10 +0000 (20:57 +0000)]
[scudo][Fuchsia] Increase MaxNumCachedHint

This brings the value closer to other platforms and allows
for future improvements, see D133897.

21 months ago[libc] Add GNU extension functions sched_getaffinity and sched_setaffinity.
Siva Chandra Reddy [Thu, 29 Sep 2022 07:57:52 +0000 (07:57 +0000)]
[libc] Add GNU extension functions sched_getaffinity and sched_setaffinity.

Reviewed By: michaelrj

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

21 months ago[HIP] stop forcing the lang std in the driver
Siu Chi Chan [Tue, 13 Sep 2022 17:42:43 +0000 (13:42 -0400)]
[HIP] stop forcing the lang std in the driver

D103221 changed HIP's default to C++14, removing the driver logic to
force it into a different std.

Change-Id: I9f5220a7456687039b0bd3b3574f3124d3cc7665

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

Change-Id: I40513f2ebe93ee53ea95c8bb3cc704487d970263

21 months ago[Clang][NFC] Fix broken link in release notes
Roy Jacobson [Thu, 29 Sep 2022 20:16:17 +0000 (23:16 +0300)]
[Clang][NFC] Fix broken link in release notes

21 months ago[Clang] P1169R4: static operator()
Roy Jacobson [Thu, 29 Sep 2022 15:45:03 +0000 (18:45 +0300)]
[Clang] P1169R4: static operator()

Implements 'P1169R4: static operator()' from C++2b.

Reviewed By: #clang-language-wg, aaron.ballman

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

21 months ago[SCEVExpander] Move LCSSA fixup to ::expand.
Florian Hahn [Thu, 29 Sep 2022 19:49:55 +0000 (20:49 +0100)]
[SCEVExpander] Move LCSSA fixup to ::expand.

Move LCSSA fixup from ::expandCodeForImpl to ::expand(). This has
the advantage that we directly preserve LCSSA nodes here instead of
relying on doing so in rememberInstruction. It also ensures that we
 don't add the non-LCSSA-safe value to InsertedExpressions.

Alternative to D132704.

Fixes #57000.

Reviewed By: efriedma

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

21 months ago[X86] Avoid miscompile in combineOr (X86ISelLowering.cpp)
Bjorn Pettersson [Thu, 29 Sep 2022 16:22:56 +0000 (18:22 +0200)]
[X86] Avoid miscompile in combineOr (X86ISelLowering.cpp)

In combineOr (X86ISelLowering.cpp) there is a DAG combine that rewrite
a "(0 - SetCC) | C" pattern into something simpler given that a LEA
can be used. Another requirement is that C has some specific value,
for example 1 or 7. When checking those requirements the code used a
32-bit unsigned variable to store the value of C. So for a 64-bit OR
this could miscompile in case any of the 32 most significant bits in
C were non zero.

This patch adds fixes the bug by using a large enough type for the
C value.

The faulty code seem to have been introduced by commit 9bceb8981d32fe
(D131358).

Reviewed By: RKSimon

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

21 months ago[X86] Pre-commit test case showing bug in combineOr (X86ISelLowering.cpp)
Bjorn Pettersson [Thu, 29 Sep 2022 16:14:15 +0000 (18:14 +0200)]
[X86] Pre-commit test case showing bug in combineOr (X86ISelLowering.cpp)

In combineOr (X86ISelLowering.cpp) there is a DAG combine that rewrite
a "(0 - SetCC) | C" pattern into something simpler given that a LEA
can be used. Another requirement is that C has some specific value,
for example 1 or 7. When doing that check it is using a 32-bit
unsigned variable to store the value of C. So for a 64-bit OR this
could miscompile in case any of the 32 most significant bits in C
are set.

This patch adds a test case to show this miscompile bug.

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

21 months ago[Driver][test] Restore %clang -cc1 in test/Driver
Fangrui Song [Thu, 29 Sep 2022 19:21:57 +0000 (12:21 -0700)]
[Driver][test] Restore %clang -cc1 in test/Driver

This partially reverts commit 1609a5d7715c06ff52c13af8b20ee64811a8ec7b (the
test/Driver part). We want to discourage %clang_cc1 and clang -cc1 in
test/Driver. The clang -cc1 uses in hlsl/offload/etc are not good examples.

21 months ago[mlir][sparse] fix build breakage due to Arith name change
Aart Bik [Thu, 29 Sep 2022 19:09:09 +0000 (12:09 -0700)]
[mlir][sparse] fix build breakage due to Arith name change

Reviewed By: Peiming

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

21 months ago[libc++] Include skipped headers in the --trace-includes output
Louis Dionne [Wed, 28 Sep 2022 20:07:43 +0000 (16:07 -0400)]
[libc++] Include skipped headers in the --trace-includes output

By default, Clang does not include headers that are skipped due to
the include guard optimization in the --trace-includes output, which
breaks the use case that we were trying to use it for.

However, Clang does support the -fshow-skipped-includes flag, which
does exactly what we need and will result in an accurate include
graph.

As a fly-by fix, make sure that our includes don't differ between
-fexceptions and -fno-exceptions.

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

21 months ago[clang] [test] Use %clang_cc1 substitution consistently
Michał Górny [Thu, 29 Sep 2022 18:58:47 +0000 (20:58 +0200)]
[clang] [test] Use %clang_cc1 substitution consistently

Use the `%clang_cc1` substitution consistently across the test suite,
replacing inline `%clang -cc1` invocations, except for one Preprocessor
test where this is causing breakage.  This is necessary to ensure that
additional parameters passed via `%clang` do not interfere with `-cc1`
that must always be passed as the first command-line argument.

Remove the additional substitution blocking `%clang_cc1` use in Driver
tests.  It has been added in 2013 and was supposed to prevent tests
calling `clang -cc1` from being added to Driver.  The state of the test
suite proves that it did not succeed at all.

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

21 months ago[llvm] [lit] Move %clang_dxc substitution from clang/test
Michał Górny [Thu, 29 Sep 2022 18:58:43 +0000 (20:58 +0200)]
[llvm] [lit] Move %clang_dxc substitution from clang/test

Move the `%clang_dxc` substitution from local definition in clang/test
to lit's `llvm/config.py` module where all other driver definitions
are found.  This improves consistency and makes it easier to control
global clang options.

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

21 months ago[clang] [Driver] More flexible rules for loading default configs
Michał Górny [Thu, 29 Sep 2022 18:58:35 +0000 (20:58 +0200)]
[clang] [Driver] More flexible rules for loading default configs

Change the default config file loading logic to be more flexible
and more readable at the same time.  The new algorithm focuses on four
locations, in order:

1. <triple>-<mode>.cfg using real driver mode
2. <triple>-<mode>.cfg using executable suffix
3. <triple>.cfg + <mode>.cfg using real driver mode
4. <triple>.cfg + <mode>.cfg using executable suffix

This is meant to preserve reasonable level of compatibility with
the existing use, while introducing more flexibility and making the code
simpler.  Notably:

1. In this layout, the actual target triple is normally respected,
   and e.g. in `-m32` build the `x86_64-*` configs will never be used.

2. Both real driver mode (preferable) and executable suffix are
   supported.  This permits correctly handling calls with explicit
   `--driver-mode=` while at the same time preserving compatibility
   with the existing code.

3. The first two locations provide users with the ability to override
   configuration per specific target+mode combinaton, while the next two
   make it possible to independently specify per-target and per-mode
   configuration.

4. All config file locations are applicable independently of whether
   clang is started via a prefixed executable, or bare `clang`.

5. If the target is not explicitly specified and the executable prefix
   does not name a valid triple, it is used instead of the actual target
   triple for backwards compatibility.

This is particularly meant to address Gentoo's use case for
configuration files: to configure the default runtimes (i.e. `-rtlib=`,
`-stdlib=`) and `--gcc-install-dir=` for all the relevant drivers,
as well as to make it more convenient for users to override `-W` flags
to test compatibility with future versions of Clang easier.

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

21 months ago[mlir][sparse] Add rewrite rule for the sort operator.
bixia1 [Wed, 28 Sep 2022 19:59:00 +0000 (12:59 -0700)]
[mlir][sparse] Add rewrite rule for the sort operator.

Add sparse-buffer-rewrite pass to rewrite sparse primitives on buffers to MLIR
implementation.

Add sparse rewrite rule for the sort operator.

Add FileCheck test and integration test.

Reviewed By: aartbik

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

21 months ago[clang][deps] NFC: Expose more flexible version of `Worker::computeDependencies()`
Jan Svoboda [Thu, 29 Sep 2022 18:00:42 +0000 (11:00 -0700)]
[clang][deps] NFC: Expose more flexible version of `Worker::computeDependencies()`

This patch adds new member function to `DependencyScanningWorker` that allows clients to pass custom `DiagnosticConsumer`, and returns `bool`.

This provides more flexibility compared to the existing version that automatically stringifies diagnostics and returns them in `llvm::Error`.

Reviewed By: benlangmuir

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

21 months ago[libclang] Split-out parts of `Index.h`
Jan Svoboda [Thu, 29 Sep 2022 17:58:27 +0000 (10:58 -0700)]
[libclang] Split-out parts of `Index.h`

The `Index.h` header defines some functions and data structures that are useful for other (non-indexing) APIs. This patch extracts those into separate headers.

Reviewed By: akyrtzi, benlangmuir

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

21 months ago[Clang][NFC] Add missing feature macros to lexer test
Roy Jacobson [Thu, 29 Sep 2022 18:16:29 +0000 (21:16 +0300)]
[Clang][NFC] Add missing feature macros to lexer test

21 months agoWhen there are variable errors, display an error in VS Code's local variables view.
Greg Clayton [Wed, 21 Sep 2022 03:58:08 +0000 (20:58 -0700)]
When there are variable errors, display an error in VS Code's local variables view.

After recent diffs that enable variable errors that stop variables from being correctly displayed when debugging, allow users to see these errors in the LOCALS variables in the VS Code UI. We do this by detecting when no variables are available and when there is an error to be displayed, and we add a single variable named "<error>" whose value is a string error that the user can read. This allows the user to be aware of the reason variables are not available and fix the issue. Previously if someone enabled "-gline-tables-only" or was debugging with DWARF in .o files or with .dwo files and those separate object files were missing or they were out of date, the user would see nothing in the variables view. Communicating these errors to the user is essential to a good debugging experience.

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

21 months ago[NFC] Add header documentation to the SBError::GetCString() to clarify ownwership...
Greg Clayton [Thu, 29 Sep 2022 00:33:12 +0000 (17:33 -0700)]
[NFC] Add header documentation to the SBError::GetCString() to clarify ownwership of the returned string.

Title says it all!

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

21 months ago[AArch64] Lower multiplication by a constant (NFC)
zhongyunde [Thu, 29 Sep 2022 17:35:18 +0000 (01:35 +0800)]
[AArch64] Lower multiplication by a constant (NFC)

Refactor according https://reviews.llvm.org/D134706#inline-1298952
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D134848

21 months ago[DX] [ObjectYAML] Support DX shader feature flags
Chris Bieneman [Tue, 20 Sep 2022 21:30:59 +0000 (16:30 -0500)]
[DX] [ObjectYAML] Support DX shader feature flags

DXContainers contain a feature flag part, which stores a bitfield used
to denote what underlying hardware features the shader requires. This
change adds feature flags to the DXContainer YAML tooling to enable
testing generating feature flags during HLSL code generation.

Depends on D133980

Reviewed By: lhames

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

21 months ago[AArch64] Lower multiplication by a constant int to shl+sub+shl
zhongyunde [Thu, 29 Sep 2022 17:30:31 +0000 (01:30 +0800)]
[AArch64] Lower multiplication by a constant int to shl+sub+shl

Decompose the const 14 can be separated from D132322
Change the costmodel to lower a = b * C where C = 2^n - 2^m to
        lsl     w8, w0, n
        sub     w0, w8, w0, lsl m
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D134706

21 months agoRevert "[mlir][Linalg] Add ReduceOp to Linalg structured ops."
Stella Stamenova [Thu, 29 Sep 2022 17:23:54 +0000 (10:23 -0700)]
Revert "[mlir][Linalg] Add ReduceOp to Linalg structured ops."

This reverts commit d02233f0da17c73f2070b5d59c80547102fa12a3.

This commit the Windows mlir buildbot: https://lab.llvm.org/buildbot/#/builders/13/builds/26413

21 months ago[libc] add clock_gettime
Michael Jones [Fri, 23 Sep 2022 21:00:52 +0000 (14:00 -0700)]
[libc] add clock_gettime

Add the clock_gettime syscall wrapper and tests.

Reviewed By: sivachandra

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

21 months ago[gn build] Port 63accaf46f09
LLVM GN Syncbot [Thu, 29 Sep 2022 17:15:28 +0000 (17:15 +0000)]
[gn build] Port 63accaf46f09

21 months ago[NFC] Refactor DXContainer to support more parts
Chris Bieneman [Wed, 28 Sep 2022 18:30:44 +0000 (13:30 -0500)]
[NFC] Refactor DXContainer to support more parts

This patch refactors some of the DXContainer Object and YAML code to
make it easier to add more part parsing.

DXContainer has a whole bunch of constant values, so I've added a
DXContainerConstants.def file which will grow with constant
definitions, but starts with just part identifiers. I've also added a
utility to parse the part magic string into an enum, and converted the
code to use that utility and the enum instead of the part literal
string.

Reviewed By: lhames

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

21 months agoRevert "[DirectX backend] Support global ctor for DXILBitcodeWriter."
Chris Bieneman [Thu, 29 Sep 2022 16:57:47 +0000 (11:57 -0500)]
Revert "[DirectX backend] Support global ctor for DXILBitcodeWriter."

This reverts commit 26129766df701d462ed9a6a9a68a88b3564a70bd.

The reverted commit broke in-tree unit tests for the DirectX backend.

21 months ago[AMDGPU][MC][GFX11] Disable non-null src0 for s_waitcnt_*cnt
Dmitry Preobrazhensky [Thu, 29 Sep 2022 16:54:00 +0000 (19:54 +0300)]
[AMDGPU][MC][GFX11] Disable non-null src0 for s_waitcnt_*cnt

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

21 months ago[CGSCC][DevirtWrapper] Properly handle invalidating analyses for invalidated SCCs
Arthur Eubanks [Thu, 29 Sep 2022 16:54:10 +0000 (09:54 -0700)]
[CGSCC][DevirtWrapper] Properly handle invalidating analyses for invalidated SCCs

f77342693 handled the adaptor and pass manager but missed the devirt wrapper.

21 months ago[mlir][scf] Simplify the logic for `replaceLoopWithNewYields` for perfectly nested...
Mahesh Ravishankar [Mon, 26 Sep 2022 22:09:31 +0000 (22:09 +0000)]
[mlir][scf] Simplify the logic for `replaceLoopWithNewYields` for perfectly nested loops.

Based on discussion in https://reviews.llvm.org/D134411, instead of
first modifying the inner most loop first followed by modifying the
outer loops from inside out, this patch restructures the logic to
start the modification from the outer most loop.

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

21 months ago[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI
luxufan [Mon, 12 Sep 2022 01:02:09 +0000 (01:02 +0000)]
[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI

For noop store of the form of LoadI and StoreI,
An invariant should be kept is that the memory state of the related
MemoryLoc before LoadI is the same as before StoreI.
For this example:
```
define void @pr49927(i32* %q, i32* %p) {
  %v = load i32, i32* %p, align 4
  store i32 %v, i32* %q, align 4
  store i32 %v, i32* %p, align 4
  ret void
}
```
Here the definition of the store's destination is different with the
definition of the load's destination, which it seems that the
invariant mentioned above is broken. But the definition of the
store's destination would write a value that is LoadI, actually, the
invariant is still kept. So we can safely ignore it.

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

Reviewed By: nikic

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

21 months ago[ARM] Add an option for disabling omitting DLS.
David Green [Thu, 29 Sep 2022 16:42:45 +0000 (17:42 +0100)]
[ARM] Add an option for disabling omitting DLS.

Useful for testing, this option disables when `DLS lr, lr` gets removed.

21 months ago[flang] Add atomic_fetch_or to the list of intrinsics
Katherine Rasmussen [Fri, 2 Sep 2022 00:01:52 +0000 (17:01 -0700)]
[flang] Add atomic_fetch_or to the list of intrinsics

Add the atomic subroutine, atomic_fetch_or, to the list of
intrinsic subroutines. Add new enumerators to deal with the rank
of the atom dummy argument, and the kind of atomic_int_kind. Use
check for a coindexed-object for the fourth dummy argument. Move
atomic_int_kind and atomic_logical_kind definitions from
iso_fortran_env module to the __fortran_builtins module to allow
for access to those values when analyzing `atomic_fetch_or`
calls in flang/lib/Evaluate/intrinsics.cpp.

Reviewed By: jeanPerier

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

21 months ago[AArch64][GlobalISel] Update shuffle->ext test before patch.
Amara Emerson [Thu, 29 Sep 2022 16:20:02 +0000 (17:20 +0100)]
[AArch64][GlobalISel] Update shuffle->ext test before patch.

21 months ago[mlir][Affine] Move/expose hasNoInterveningEffect
Maksim Levental [Thu, 29 Sep 2022 16:08:36 +0000 (11:08 -0500)]
[mlir][Affine] Move/expose hasNoInterveningEffect

Expose [[ https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Affine/Utils/Utils.cpp#L661 | Dialect/Affine/Utils/Utils.cpp#hasNoInterveningEffect ]] for downstream use (particular use case is a lazy implementation of [[ https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Affine/Utils/Utils.cpp#L845 | forwardStoreToLoad ]] in CIRCT). This exposes hasNoInterveningEffect and instantiates for the necessary types.

Reviewed By: bondhugula

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

21 months ago[InstSimplify][PhaseOrdering] add tests for vector select of min/max; NFC
Sanjay Patel [Wed, 28 Sep 2022 16:13:34 +0000 (12:13 -0400)]
[InstSimplify][PhaseOrdering] add tests for vector select of min/max; NFC

The phase ordering test is the almost unoptimized IR for the example
in issue #42100; it was passed through -mem2reg to reduce obvious
excessive load/store and other noise.

D134879

21 months ago[ModuleInliner] Add a cost-benefit-based priority
Kazu Hirata [Thu, 29 Sep 2022 16:00:38 +0000 (09:00 -0700)]
[ModuleInliner] Add a cost-benefit-based priority

This patch teaches the module inliner a traversal order designed for
the instrumentation FDO (+ThinLTO) scenario.

The new traversal order prioritizes call sites in the following order:

1. Those call sites that are expected to reduce the caller size

2. Those call sites that have gone through the cost-benefit analaysis

3. The remaining call sites

With this fairly simple traversal order, a large internel benchmark
yields performance comparable to the bottom-up inliner -- both in
terms of the execution performance and .text* sizes.

Big thanks goes to Liqiang Tao for the module inliner infrastructure.

I still have hacks outside this patch to prevent excessively long
compilation or .text* size explosion.  I'm trying to come up with
acceptable solutions in near future.

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

21 months ago[lld][COFF][LTO] Don't disable verifier in assert builds
Arthur Eubanks [Wed, 28 Sep 2022 22:57:19 +0000 (15:57 -0700)]
[lld][COFF][LTO] Don't disable verifier in assert builds

We should catch more issues this way.

This previously the behavior and was dropped in cde5e5b600b06.

Reviewed By: hans

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

21 months ago[flang][mlir][arith] Fix flang build after dialect renaming
Jakub Kuderski [Thu, 29 Sep 2022 15:55:17 +0000 (11:55 -0400)]
[flang][mlir][arith] Fix flang build after dialect renaming

Tested with `ninja check-flang`

21 months ago[NFC][libc++][test] Enables variant test.
Mark de Wever [Wed, 28 Sep 2022 17:58:05 +0000 (19:58 +0200)]
[NFC][libc++][test] Enables variant test.

Noticed this while working on D133326. Let's see whehter all compilers
now support this feature.

Reviewed By: #libc, philnik, ldionne

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

21 months ago[mlir][arith] Change dialect name from Arithmetic to Arith
Jakub Kuderski [Thu, 29 Sep 2022 15:14:47 +0000 (11:14 -0400)]
[mlir][arith] Change dialect name from Arithmetic to Arith

Suggested by @lattner in https://discourse.llvm.org/t/rfc-define-precise-arith-semantics/65507/22.

Tested with:
`ninja check-mlir check-mlir-integration check-mlir-mlir-spirv-cpu-runner check-mlir-mlir-vulkan-runner check-mlir-examples`

and `bazel build --config=generic_clang @llvm-project//mlir:all`.

Reviewed By: lattner, Mogball, rriddle, jpienaar, mehdi_amini

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

21 months ago[DSE][NFC] Update noop-stores.ll using update_test_checks.py
luxufan [Sun, 25 Sep 2022 14:56:19 +0000 (14:56 +0000)]
[DSE][NFC] Update noop-stores.ll using update_test_checks.py

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

21 months ago[ValueTracking] Fix CannotBeOrderedLessThanZero() for fdiv (PR58046)
Nikita Popov [Thu, 29 Sep 2022 13:51:05 +0000 (15:51 +0200)]
[ValueTracking] Fix CannotBeOrderedLessThanZero() for fdiv (PR58046)

When checking the RHS of fdiv, we should set the SignBitOnly flag,
because a negative zero can become -Inf, which is ordered less
than zero.

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

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

21 months ago[Debugify][OriginalDIMode] Update script to handle large JSON reports
Nikola Tesic [Wed, 28 Sep 2022 10:34:32 +0000 (12:34 +0200)]
[Debugify][OriginalDIMode] Update script to handle large JSON reports

This patch updates llvm/utils/llvm-original-di-preservation.py to create more
compact HTML verify-debuginfo-preserve reports by:
- removing duplicated debug info bugs,
- introducing -compress option to create highly compressed report.
Additionally, this patch makes script able to process very large JSON inputs.
That is done by reading & analyzing JSON report in chunks.

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

21 months ago[Debugify][OriginalDIMode] Make HTML reporting infrastructure more resilient
Nikola Tesic [Wed, 28 Sep 2022 10:32:46 +0000 (12:32 +0200)]
[Debugify][OriginalDIMode] Make HTML reporting infrastructure more resilient

Debugify in OriginalDebugInfo mode (verify-each-debuginfo-preserve), when used
in parallel builds of large projects, can produce incorrect report. More
precisely, simultaneous writes to JSON report file, could form incorrect JSON
objects, which describe found Debug Info bugs.
This patch uses the lock/unlock mechanism to protect JSON report file and also
makes script llvm/utils/llvm-original-di-preservation.py resilient to corrupted
lines in the report file. So, it ensures the creation of HTML report.

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

21 months ago[RISCV] Adjust vector immediate store materialization cost
Philip Reames [Thu, 29 Sep 2022 14:31:03 +0000 (07:31 -0700)]
[RISCV] Adjust vector immediate store materialization cost

This change updates the costs to make constant pool loads match their actual cost, and adds the broadcast special case to avoid too many regressions. We really need more information about the constants being rematerialized, but this is an incremental improvement.

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

21 months ago[libc++] Add missing return 0;'s to main() functions in tests
Louis Dionne [Thu, 29 Sep 2022 14:34:52 +0000 (10:34 -0400)]
[libc++] Add missing return 0;'s to main() functions in tests

21 months ago[mlir][Linalg] Add ReduceOp to Linalg structured ops.
Adrian Kuegel [Wed, 28 Sep 2022 11:49:13 +0000 (13:49 +0200)]
[mlir][Linalg] Add ReduceOp to Linalg structured ops.

This will allow to model (variadic) reductions with this special op instead of
using GenericOp.

RFC: https://discourse.llvm.org/t/rfc-primitive-ops-add-mapop-reductionop-transposeop-broadcastop-to-linalg/64184

21 months ago[mlir] fix formatting in markdown
Alex Zinenko [Thu, 29 Sep 2022 14:09:40 +0000 (14:09 +0000)]
[mlir] fix formatting in markdown

21 months ago[libc][NFC] Move alignment utils to utils.h
Guillaume Chatelet [Thu, 29 Sep 2022 13:51:20 +0000 (13:51 +0000)]
[libc][NFC] Move alignment utils to utils.h

21 months ago[LSR][NFC] Add missing constness
eopXD [Thu, 29 Sep 2022 13:30:32 +0000 (06:30 -0700)]
[LSR][NFC] Add missing constness