platform/upstream/llvm.git
13 months ago[clangd] Use FileManager for getCanonicalPath, NFC
Haojian Wu [Fri, 2 Jun 2023 10:12:54 +0000 (12:12 +0200)]
[clangd] Use FileManager for getCanonicalPath, NFC

get rid of the SourceManager dependency -- getCanonicalPath doesn't use
other SourceManager fields.

13 months ago[AArch64] Don't use tbl lowering if ZExt can be folded into user.
Florian Hahn [Fri, 2 Jun 2023 10:53:03 +0000 (11:53 +0100)]
[AArch64] Don't use tbl lowering if ZExt can be folded into user.

If the ZExt can be lowered to a single ZExt to the next power-of-2 and
the remaining ZExt folded into the user, don't use tbl lowering.

Fixes #62620.

Reviewed By: efriedma

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

13 months ago[GlobalIsel][X86] Update legalization of G_ADD/G_SUB
Simon Pilgrim [Fri, 2 Jun 2023 10:33:51 +0000 (11:33 +0100)]
[GlobalIsel][X86] Update legalization of G_ADD/G_SUB

Replace the legacy legalizers for G_ADD/G_SUB with a pattern that should work for the full mixture of scalar/vector types we need to support for most opcodes.

If we can decide on this as a suitable pattern we can reuse it for the other op types, but G_ADD/G_SUB are the only ones that have decent legalizer test coverage at this stage.

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

13 months ago[MLIR][Bufferization] Improve documentation of introduction and `summary`s
rikhuijzer [Fri, 2 Jun 2023 09:46:46 +0000 (11:46 +0200)]
[MLIR][Bufferization] Improve documentation of introduction and `summary`s

This patch suggests to add a sentence in the introduction which clarifies
the aim of the dialect in one sentence. I hope that I understood it correctly.

For the `summary` fields, I have scrolled through the Bufferization page
(<https://mlir.llvm.org/docs/Bufferization>) and added missing summaries
or standardized existing ones to make the summaries easier to read.

Reviewed By: springerm

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

13 months ago[GlobalIsel][X86] Legalize G_BSWAP III
Thorsten Schütt [Fri, 2 Jun 2023 09:18:38 +0000 (11:18 +0200)]
[GlobalIsel][X86] Legalize G_BSWAP III

Reviewed By: RKSimon

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

13 months ago[ValueTracking] Replace Query with SimplifyQuery (NFC)
Nikita Popov [Fri, 2 Jun 2023 09:05:55 +0000 (11:05 +0200)]
[ValueTracking] Replace Query with SimplifyQuery (NFC)

These implement essentially the same thing, so normalize
ValueTracking to use SimplifyQuery. In the future we can directly
expose the SimplifyQuery-based APIs.

13 months ago[LoongArch] Use Subtarget consistently during LoongArchISelLowering init. NFC
Weining Lu [Fri, 2 Jun 2023 08:20:32 +0000 (16:20 +0800)]
[LoongArch] Use Subtarget consistently during LoongArchISelLowering init. NFC

13 months ago[AArch64] Add additional zext/mull tests.
Florian Hahn [Fri, 2 Jun 2023 08:16:30 +0000 (09:16 +0100)]
[AArch64] Add additional zext/mull tests.

Extra test coverage for D150482.

13 months ago[MI] Don't use std::function for all_uses/all_defs iterators (NFC)
Nikita Popov [Fri, 2 Jun 2023 07:17:48 +0000 (09:17 +0200)]
[MI] Don't use std::function for all_uses/all_defs iterators (NFC)

This mitigates the compile-time regression from D151424. The use
of std::function is not necessary here, as we're passing in a
static function.

13 months agoFix isKnownNeverInfOrNaN() call in AMDGPU after ORE removal 97b5cc214aee48e30391bfcd2...
Haojian Wu [Fri, 2 Jun 2023 07:32:46 +0000 (09:32 +0200)]
Fix isKnownNeverInfOrNaN() call in AMDGPU after ORE removal 97b5cc214aee48e30391bfcd2cde4252163d7406

13 months ago[X86] Add schedule module for SapphireRapids
Haohai Wen [Fri, 2 Jun 2023 07:10:24 +0000 (15:10 +0800)]
[X86] Add schedule module for SapphireRapids

The X86SchedSapphireRapids.td file is automatically generated by
schedtool (D130897). Most of instruction's scheduling information
is from SapphireRapids tpt/lat data provided by intel doc. Some data
is from measured ADL-P data in uops.info. The rest instruction's
scheduling information is from skylake server schedule model in order
to get a relative complete model.

Reviewed By: LuoYuanke

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

13 months ago[SimplifyLibCalls] Fix isKnownNeverInfinity() call after ORE removal
Nikita Popov [Fri, 2 Jun 2023 07:20:57 +0000 (09:20 +0200)]
[SimplifyLibCalls] Fix isKnownNeverInfinity() call after ORE removal

Missed this in 97b5cc214aee48e30391bfcd2cde4252163d7406.

13 months ago[ValueTracking] Remove ORE argument (NFC-ish)
Nikita Popov [Fri, 26 May 2023 13:14:31 +0000 (15:14 +0200)]
[ValueTracking] Remove ORE argument (NFC-ish)

The ORE argument threaded through ValueTracking is used only in a
single, untested place. It is also essentially never passed: The
only places that do so have been added very recently as part of the
KnownFPClass migration, which is vanishingly unlikely to hit this
code path. Remove this effectively dead argument.

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

13 months ago[cuda, NVPTX] Signed char and (unsigned)long builtins of ldg and ldu
Jakub Chlanda [Thu, 1 Jun 2023 10:41:06 +0000 (12:41 +0200)]
[cuda, NVPTX] Signed char and (unsigned)long builtins of ldg and ldu

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

13 months agoRevert "[clang][Diagnostics] Split source ranges into line ranges before..."
Timm Bäder [Fri, 2 Jun 2023 07:02:04 +0000 (09:02 +0200)]
Revert "[clang][Diagnostics] Split source ranges into line ranges before..."

This reverts commit fc1262bd58ac54ad0a0bfa9750254b81c742bbb5.

This causes build bot failures because of a parser test case:
https://lab.llvm.org/buildbot/#/builders/139/builds/41961

13 months ago[clang][Diagnostics] Split source ranges into line ranges before...
Timm Bäder [Tue, 23 May 2023 14:33:59 +0000 (16:33 +0200)]
[clang][Diagnostics] Split source ranges into line ranges before...

... emitting them.

This makes later code easier to understand, since we emit the code
snippets line by line anyway.
It also fixes the weird underlinig of multi-line source ranges.

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

13 months ago[mlir][IR][NFC] Move CastOpInterface helpers to mlir/Interfaces
Matthias Springer [Fri, 2 Jun 2023 06:32:01 +0000 (08:32 +0200)]
[mlir][IR][NFC] Move CastOpInterface helpers to mlir/Interfaces

These helpers should not be part of the IR build unit.

The interface is now implemented on `builtin.unrealized_conversion_cast` with an external model.

Also rename the CastOpInterfaces Bazel target name to CastInterfaces to be consistent with the CMake target name.

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

13 months ago[clang][Interp][NFC] Print Function name in unreachable type failures
Timm Bäder [Fri, 19 May 2023 07:30:24 +0000 (09:30 +0200)]
[clang][Interp][NFC] Print Function name in unreachable type failures

and pass Record* pointers around as const.

13 months ago[clang][Interp][NFC] Add FunctionPointer.h header comment
Timm Bäder [Fri, 19 May 2023 06:57:52 +0000 (08:57 +0200)]
[clang][Interp][NFC] Add FunctionPointer.h header comment

13 months ago[RISCV] Modify a tablegen multiclass for a future patch. NFC
Craig Topper [Fri, 2 Jun 2023 05:38:00 +0000 (22:38 -0700)]
[RISCV] Modify a tablegen multiclass for a future patch. NFC

Split the vop_type parameter to VPatBinaryVL_VF into vop1_type
and vop2_type. This will allows to be used for vfwadd.wf in
a future patch.

13 months ago[AMDGPU] WQM: Allow insertion of exact mode transition as terminator
Carl Ritson [Fri, 2 Jun 2023 01:34:37 +0000 (10:34 +0900)]
[AMDGPU] WQM: Allow insertion of exact mode transition as terminator

Allow WQM pass to insert transitions to exact mode among block
terminators, instead of forcing them to occur before terminators.

This should not yield any functional change, but allows block
splitting of control flow, such as that in D145329.

Reviewed By: arsenm

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

13 months agoFix TableGen emitter: hasValue() has been renamed has_value()
Mehdi Amini [Fri, 2 Jun 2023 03:54:32 +0000 (20:54 -0700)]
Fix TableGen emitter: hasValue() has been renamed has_value()

This codepath isn't exercised in-tree right now unfortunately, this only
happens when a dialect does not use the default entry points for types
parsing AND is extensible: both of these aren't the default settings and
the combination of them isn't common.

Fix #63058

13 months ago[RISCV][NFC] Use common prefix to simplify test.
Jianjian GUAN [Thu, 1 Jun 2023 09:32:25 +0000 (17:32 +0800)]
[RISCV][NFC] Use common prefix to simplify test.

Reviewed By: frasercrmck

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

13 months ago[lldb] Take StringRef names in GetChildAtNamePath (NFC)
Dave Lee [Sun, 28 May 2023 23:03:42 +0000 (16:03 -0700)]
[lldb] Take StringRef names in GetChildAtNamePath (NFC)

Following D151810, this changes `GetChildAtNamePath` to take a path of `StringRef`
values instead of `ConstString`.

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

13 months ago[lldb] Take StringRef name in GetIndexOfChildWithName (NFC)
Dave Lee [Sun, 28 May 2023 22:52:06 +0000 (15:52 -0700)]
[lldb] Take StringRef name in GetIndexOfChildWithName (NFC)

As with D151615, which changed `GetIndexOfChildMemberWithName` to take a `StringRef`
instead of a `ConstString`, this change does the same for `GetIndexOfChildWithName`.

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

13 months ago[libc++] Refactor the mandatory header inclusion tests to .gen.py
Louis Dionne [Wed, 31 May 2023 16:43:14 +0000 (09:43 -0700)]
[libc++] Refactor the mandatory header inclusion tests to .gen.py

This allows removing a bunch of boilerplate from the test suite and
reducing the amount of manual stuff contributors have to do when they
add a new public header.

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

13 months ago[libc++] Make sure we use POSIX paths in header_information.py
Louis Dionne [Thu, 1 Jun 2023 18:18:53 +0000 (11:18 -0700)]
[libc++] Make sure we use POSIX paths in header_information.py

Otherwise, the various lists of headers have different content based
on whether they are run on Windows or other platforms, which makes it
really difficult to write .gen.py tests correctly.

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

13 months ago[FuzzMutate] Handle BB without predecessor, avoid insertion after `musttail call...
Henry Yu [Fri, 2 Jun 2023 02:51:41 +0000 (19:51 -0700)]
[FuzzMutate] Handle BB without predecessor, avoid insertion after `musttail call`, avoid sinking token type

FuzzMutate didn't consider some corner cases and leads to mutation failure when mutating some modules.
This patch fixes 3 bugs:

- Add null check when encountering basic blocks without predecessor to avoid segmentation fault
- Avoid insertion after `musttail call` instruction
- Avoid sinking token type

Unit tests are also added.

Reviewed By: Peter

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

13 months ago[X86][MC] Use MCInstrDesc to access CondCode operand
Amir Ayupov [Fri, 2 Jun 2023 01:59:27 +0000 (18:59 -0700)]
[X86][MC] Use MCInstrDesc to access CondCode operand

BOLT may add an extra MCOperand as annotation, making the number of operands in
MCInst different from MCInstrDesc information. A recent change broke our use as
the last operand is no longer a cond code.

Partially revert 287dd0142c08caad5b32628f3842dfd5d5c59d03 to rely on MCInstrDesc
to access CondCode operand.

Reviewed By: skan

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

13 months agoRestrict the test from 22667e3220de5ead353a2148265d841644b63824
Jim Ingham [Fri, 2 Jun 2023 01:42:06 +0000 (18:42 -0700)]
Restrict the test from 22667e3220de5ead353a2148265d841644b63824

I fixed some long-standing failures in SBTarget::FindGlobalVariables
but the fix is in the the accelerator table lookups.  I fixed it in
the DWARF mappable tables but not everyone uses those, so I had to
restrict the test to systems I know did.

13 months ago[lldb/crashlog] Add test for non-symbolicated report crash
Med Ismail Bennani [Fri, 2 Jun 2023 00:50:55 +0000 (17:50 -0700)]
[lldb/crashlog] Add test for non-symbolicated report crash

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[lldb/crashlog] Run python formatter (nfc)
Med Ismail Bennani [Fri, 2 Jun 2023 00:13:16 +0000 (17:13 -0700)]
[lldb/crashlog] Run python formatter (nfc)

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[lldb/crashlog] Create interactive crashlog with no binary
Med Ismail Bennani [Fri, 2 Jun 2023 00:10:39 +0000 (17:10 -0700)]
[lldb/crashlog] Create interactive crashlog with no binary

This patch changes the way we load a crash report into a scripted
process by creating a empty target.

To do so, it parses the architecture information from the report (for
both the legacy and json format) and uses that to create a target that
doesn't have any executable, like what we do when attaching to a process.

For the legacy format, we mostly rely on the `Code Type` line, since the
architure is an optional field on the `Binary Images` sections.

However for the json format, we first try to get the architecture while
parsing the image dictionary if we couldn't find it, we try to infer it
using the "flavor" key when parsing the frame's registers.

If the architecture is still not set after parsing the report, we raise
an exception.

rdar://107850263

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

Differential

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[lldb/crashlog] Fix crash when loading non-symbolicated report
Med Ismail Bennani [Wed, 31 May 2023 22:29:24 +0000 (15:29 -0700)]
[lldb/crashlog] Fix crash when loading non-symbolicated report

This patch should address the crashes when parsing a the crash report
frame dictionary.

If the crash report is not symbolicated, the `symbolLocation` key will
be missing. In that case, we should just use the `imageOffset`.

rdar://109836386

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[mlir][sparse] enhance sparse reduction support
Aart Bik [Thu, 1 Jun 2023 20:34:39 +0000 (13:34 -0700)]
[mlir][sparse] enhance sparse reduction support

Formerly, we accepted and/prod reductions as a standard
reduction but these change the semantics after sparsification
by not looking at implicit zeros. Therefore, we only accept
standard reductions that are insensitive to implicit vs.
explicit zeros, and leave the more complex reductions to
the sparse_tensor.reduce custom reduction implementation.

Reviewed By: Peiming

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

13 months agoFix regex & startsWith name lookup in SBTarget::FindGlobalVariables
Jim Ingham [Thu, 1 Jun 2023 23:12:52 +0000 (16:12 -0700)]
Fix regex & startsWith name lookup in SBTarget::FindGlobalVariables

There were two bugs here.

eMatchTypeStartsWith searched for "symbol_name" by adding ".*" to the
end of the symbol name and treating that as a regex, which isn't
actually a regex for "starts with". The ".*" is in fact a no-op.  When
we finally get to comparing the name, we compare against whatever form
of the name was in the accelerator table. But for C++ that might be
the mangled name. We should also try demangled names here, since most
users are going the see demangled not mangled names.  I fixed these
two bugs and added a bunch of tests for FindGlobalVariables.

This change is in the DWARF parser code, so there may be a similar bug
in PDB, but the test for this was already skipped for Windows, so I
don't know about this.

You might theoretically need to do this Mangled comparison in

DWARFMappedHash::MemoryTable::FindByName

except when we have names we always chop them before looking them up
so I couldn't see any code paths that fail without that change. So I
didn't add that to this patch.

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

13 months ago[RISCV][GlobalISel] Remove unused variable 'Index' (NFC)
Jie Fu [Thu, 1 Jun 2023 23:10:24 +0000 (07:10 +0800)]
[RISCV][GlobalISel] Remove unused variable 'Index' (NFC)

/data/llvm-project/llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp:272:12: error: variable 'Index' set but not used [-Werror,-Wunused-but-set-variable]
  unsigned Index = 0;
           ^
1 error generated.

13 months ago[RISCV][GlobalISel] Add lowerCall for calling convention
Nitin John Raj [Thu, 1 Jun 2023 22:35:06 +0000 (15:35 -0700)]
[RISCV][GlobalISel] Add lowerCall for calling convention

This patch implements minimal support for lowering function calls to callees with arguments and/or return values according to the RISC-V calling convention. Integer, pointer and aggregate types are supported.

Feedback is very much appreciated.

Reviewed By: arsenm

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

13 months ago[lld][COFF] Retry failed paths to take advantage of winsysroot search paths
Arthur Eubanks [Wed, 31 May 2023 15:52:21 +0000 (08:52 -0700)]
[lld][COFF] Retry failed paths to take advantage of winsysroot search paths

With /winsysroot and without /machine, we don't know which paths to add to the search paths.

We do autodetect machine type and add winsysroot search paths in SymbolTable::addFile(), but that happens after all input files are opened. So in the loop where we read files, if we fail to open a file we can retry with the winsysroot search path potentially added by reading a previous file. This will fail if we try to open something in the winsysroot before reading a file that can give us the architecture, but shrug.

Fixes #54409

Reviewed By: rnk

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

13 months agoAMDGPU: Refine undef handling for llvm.amdgcn.class intrinsic
Matt Arsenault [Wed, 24 May 2023 14:56:09 +0000 (15:56 +0100)]
AMDGPU: Refine undef handling for llvm.amdgcn.class intrinsic

This barely matters since 99% are converted to the generic intrinsic now,
and the only real difference is the target intrinsic supports a variable
test mask. Start propagating poison. Prefer folding to a defined result (false)
for an undef test mask. Propagate undef for the first operand.

13 months ago[RISCV] Separate slideup/down pseudoinstructions from FMA instructions earlier in...
Craig Topper [Thu, 1 Jun 2023 22:25:40 +0000 (15:25 -0700)]
[RISCV] Separate slideup/down pseudoinstructions from FMA instructions earlier in the class hierarchy.

Remove RISCVMaskedPseudo from vslideup/down. I hadn't intended to
include them. I missed that they used the same classes as FMA.
They weren't tested and I don't have a use case yet.

This is also needed as I attempt refactor the classes to improve
D151850.

13 months ago[RISCV] Move vslideup/down tablegen classes together. NFC
Craig Topper [Thu, 1 Jun 2023 21:25:07 +0000 (14:25 -0700)]
[RISCV] Move vslideup/down tablegen classes together. NFC

13 months agoReland "[mlir][Vector] Extend xfer drop unit dim patterns"
Diego Caballero [Thu, 1 Jun 2023 21:47:48 +0000 (21:47 +0000)]
Reland "[mlir][Vector] Extend xfer drop unit dim patterns"

This reverts commit 76d71f3792b2b1864992446f7b1028b026dccd11.

13 months ago[mlir][Vector] Prevent vector-to-scalar xfer patterns from triggering on sub-vectors
Diego Caballero [Thu, 1 Jun 2023 21:45:39 +0000 (21:45 +0000)]
[mlir][Vector] Prevent vector-to-scalar xfer patterns from triggering on sub-vectors

Patterns that convert extract(transfer_read) into a scalar load where
incorrectly triggering for cases where a sub-vector instead of a scalar
was extracted.

Reviewed By: nicolasvasilache, hanchung, awarzynski

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

13 months ago[mlir][Vector] Add support for 0-D 'vector.shape_cast' lowering
Diego Caballero [Thu, 1 Jun 2023 21:45:11 +0000 (21:45 +0000)]
[mlir][Vector] Add support for 0-D 'vector.shape_cast' lowering

This PR adds support for shape casting from and to 0-D vectors.

Reviewed By: nicolasvasilache, hanchung, awarzynski

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

13 months ago[mlir][Vector] Disable 'vector.extract' folding for unsupported 0-D vectors
Diego Caballero [Thu, 1 Jun 2023 21:44:41 +0000 (21:44 +0000)]
[mlir][Vector] Disable 'vector.extract' folding for unsupported 0-D vectors

The `vector.extract` folding patterns do not support 0-D vectors
(actually, 0-D vector support couldn't even be implemented as a folding
pattern as it would require replacing `vector.extract` with a
`vector.extractelement` op). This patch is bailing out folding when 0-D
vectors are found.

Reviewed By: nicolasvasilache, hanchung

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

13 months ago[gn build] Port d51a84b4059c
LLVM GN Syncbot [Thu, 1 Jun 2023 22:11:58 +0000 (22:11 +0000)]
[gn build] Port d51a84b4059c

13 months ago[libc++][PSTL] Implement std::stable_sort
Nikolas Klauser [Thu, 1 Jun 2023 22:05:11 +0000 (15:05 -0700)]
[libc++][PSTL] Implement std::stable_sort

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

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

13 months ago[libc] Add strtoint32 and strtoint64 tests
Michael Jones [Thu, 1 Jun 2023 21:01:04 +0000 (14:01 -0700)]
[libc] Add strtoint32 and strtoint64 tests

There were regressions in the testing framework due to none of the
functioning buildbots having a 32 bit long. This allowed the 32 bit
version of the strtointeger function to go untested. This patch adds
tests for strtoint32 and strtoint64, which are internal testing
functions that use constant integer sizes. It also fixes the tests to
properly handle these situations.

Reviewed By: sivachandra

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

13 months ago[GlobalISel] Delete code in GIMatcher complaining about unreachable rules.
Amara Emerson [Thu, 1 Jun 2023 21:10:52 +0000 (14:10 -0700)]
[GlobalISel] Delete code in GIMatcher complaining about unreachable rules.

Fixes #62897

13 months ago[TargetLowering][ARM][AArch64] Remove usage of NoSignedWrap/NoUnsignedWrap from AVGFL...
Craig Topper [Thu, 1 Jun 2023 21:18:08 +0000 (14:18 -0700)]
[TargetLowering][ARM][AArch64] Remove usage of NoSignedWrap/NoUnsignedWrap from AVGFLOOR/CEIL transform.

Use computeOverflowForUnsignedAdd and computeOverflowForSignedAdd
instead. Unfortunately, this recomputes some known bits and sign bits
we may have already computed, but was the easiest fix without a lot
of restructuring.

This recovers the regressions from D151472.

Reviewed By: RKSimon

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

13 months ago[Sanitizers][Darwin][ASanABI] Fix architecture config for ASan Abi
Blue Gaston [Wed, 31 May 2023 22:23:06 +0000 (15:23 -0700)]
[Sanitizers][Darwin][ASanABI] Fix architecture config for ASan Abi

Moved setting supported architecture to parent cmake configuration files
so they can be read by both lib and test CMakeList.txt.

Fixed issue with check-asan-abi that did not filter for current host architecture
which caused x86_64 bots to run Arm64 tests.

Added x86_64 as a supported arch to the test cmake file.

rdar://110017569

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

13 months ago[RISCV] Rename VPseudoBinaryTailPolicy to VPseudoTernaryMaskPolicy. NFC
Craig Topper [Thu, 1 Jun 2023 21:00:44 +0000 (14:00 -0700)]
[RISCV] Rename VPseudoBinaryTailPolicy to VPseudoTernaryMaskPolicy. NFC

13 months ago[FuzzMutate] Avoid calling function with metadata/token parameter/return type for...
Henry Yu [Thu, 1 Jun 2023 20:56:20 +0000 (13:56 -0700)]
[FuzzMutate] Avoid calling function with metadata/token parameter/return type for `InsertFunctionStrategy`

When there is a function with metadata/token parameter/return type, `InsertFunctionStrategy` will crash.

This patch fixes the problem by falling back to create function declaration when the sampled function contains metadata/token parameter/return type.

Reviewed By: Peter

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

13 months ago[flang] CUDA Fortran - part 5/5: statement semantics
Peter Klausler [Sat, 6 May 2023 22:03:39 +0000 (15:03 -0700)]
[flang] CUDA Fortran - part 5/5: statement semantics

Canonicalize !$CUF KERNEL DO loop nests, similar to OpenACC/OpenMP
canonicalization.  Check statements and expressions in device contexts
for usage that isn't supported.  Add more tests, and include some
tweaks to standard modules needed to build CUDA Fortran modules.

Depends on https://reviews.llvm.org/D150159,
https://reviews.llvm.org/D150161, https://reviews.llvm.org/D150162, &
https://reviews.llvm.org/D150163.

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

13 months ago[libc++] Extract ccache stats after the bootstrapping build
Louis Dionne [Thu, 1 Jun 2023 20:16:19 +0000 (13:16 -0700)]
[libc++] Extract ccache stats after the bootstrapping build

13 months agoAllow configuring InlinerThreshold in C bindings for the new pass manager
Dmitry Dolgov [Thu, 1 Jun 2023 15:56:00 +0000 (08:56 -0700)]
Allow configuring InlinerThreshold in C bindings for the new pass manager

C bindings for the new pass manager seem to allow to set any option from LLVMPassBuilderOptions, except InlinerThreshold. Allow to configure it as well.

Reviewed By: aeubanks

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

13 months ago[flang] Fix character initialization after continuation
Leandro Lupori [Wed, 31 May 2023 22:11:51 +0000 (22:11 +0000)]
[flang] Fix character initialization after continuation

The insertion of a space on a line continuation right before
a character literal was confusing TokenSequence::ToLowerCase(),
that was unable to identify the character literal as such,
causing it to be converted to lower case.

Fix this by skipping spaces in the beginning and end of each
token, before testing for token type.

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

Reviewed By: klausler

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

13 months ago[flang][hlfir] Separate -emit-fir and -emit-hlfir for bbc
Tom Eccles [Mon, 22 May 2023 14:53:08 +0000 (14:53 +0000)]
[flang][hlfir] Separate -emit-fir and -emit-hlfir for bbc

In review for https://reviews.llvm.org/D146278, @vzakhari asked to
separate -emit-fir and -emit-hlfir. This will allow FIR to be easily
outputted after the HLFIR passes have been run.

The new semantics are as follows:

| Action      | -hlfir? | Result                          |
| =========== | ======= | =============================== |
| -emit-hlfir | N       | Outputs HLFIR                   |
| -emit-hlfir | Y       | Outputs HLFIR                   |
| -emit-fir   | N       | Outputs FIR, using old lowering |
| -emit-fir   | Y       | Outputs FIR, lowering via HLFIR |

This is tested in flang/test/HLFIR/hlfir-flags.f90

Depends on: D151088

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

13 months ago[flang][hlfir] Separate -emit-fir and -emit-hlfir for flang-new
Tom Eccles [Mon, 22 May 2023 12:55:10 +0000 (12:55 +0000)]
[flang][hlfir] Separate -emit-fir and -emit-hlfir for flang-new

In review for https://reviews.llvm.org/D146278, @vzakhari asked to
separate -emit-fir and -emit-hlfir. This will allow FIR to be easily
outputted after the HLFIR passes have been run.

The new semantics are as follows:

| Action      | -flang-experimental-hlfir? | Result |
| =========== | ========================== | =============================== |
| -emit-hlfir | N                          | Outputs HLFIR                   |
| -emit-hlfir | Y                          | Outputs HLFIR                   |
| -emit-fir   | N                          | Outputs FIR, using old lowering |
| -emit-fir   | Y                          | Outputs FIR, lowering via HLFIR |

A patch for bbc will follow.

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

13 months ago[BOLT][DWARF] Fix handling of GCed CU function
Alexander Yermolovich [Thu, 1 Jun 2023 19:06:47 +0000 (12:06 -0700)]
[BOLT][DWARF] Fix handling of GCed CU function

A CU can have only one function so CU will have low_pc/high_pc. If this funciton
is GCed by LLD low_pc will become 0x0, and BOLT can't map this to output. We
kind of were getting away with it in monolithic DWARF, but with split DWARF
there is only skeleton CU, so we end up with rnglist with header and array, but
no body. This caused LLDB to report an error.

Reviewed By: maksfb

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

13 months ago[SDAG] Preserve unpredictable metadata, teach X86CmovConversion to respect this metadata
Dávid Bolvanský [Thu, 1 Jun 2023 18:56:12 +0000 (20:56 +0200)]
[SDAG] Preserve unpredictable metadata, teach X86CmovConversion to respect this metadata

Sometimes an developer would like to have more control over cmov vs branch. We have unpredictable metadata in LLVM IR, but currently it is ignored by X86 backend. Propagate this metadata and avoid cmov->branch conversion in X86CmovConversion for cmov with this metadata.

Example:

```
int MaxIndex(int n, int *a) {
    int t = 0;
    for (int i = 1; i < n; i++) {
        // cmov is converted to branch by X86CmovConversion
        if (a[i] > a[t]) t = i;
    }
    return t;
}

int MaxIndex2(int n, int *a) {
    int t = 0;
    for (int i = 1; i < n; i++) {
        // cmov is preserved
        if (__builtin_unpredictable(a[i] > a[t])) t = i;
    }
    return t;
}
```

Reviewed By: nikic

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

13 months ago[Fuchsia] Reland: Add llvm-debuginfod to toolchain
Daniel Thornburgh [Tue, 30 May 2023 21:20:46 +0000 (14:20 -0700)]
[Fuchsia] Reland: Add llvm-debuginfod to toolchain

13 months ago[MLIR][doc] Improve/fix the doc on mlir.vector.transfer_read (NFC)
Mehdi Amini [Wed, 31 May 2023 20:28:44 +0000 (13:28 -0700)]
[MLIR][doc] Improve/fix the doc on mlir.vector.transfer_read (NFC)

This doc was written 4 years ago, some refresh in the example was
overdue I suspect.

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

13 months agoFixing broken test in D140524 "Flang implementation for COMPILER_VERSION and COMPILER...
Hussain Kadhem [Thu, 1 Jun 2023 17:20:15 +0000 (13:20 -0400)]
Fixing broken test in D140524 "Flang implementation for COMPILER_VERSION and COMPILER_OPTIONS intrinsics".

13 months ago[FLANG] Change loop versioning to use shift instead of divide
Mats Petersson [Thu, 1 Jun 2023 10:39:26 +0000 (11:39 +0100)]
[FLANG] Change loop versioning to use shift instead of divide

Despite me being convinced that the use of divide didn't produce any
divide instructions, it does in fact add more instructions than using
a plain shift operation.

This patch simply changes the divide to a shift right, with an
assert to check that the "divisor" is a power of two.

Reviewed By: kiranchandramohan, tblah

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

13 months ago[clang][docs] document __attribute__((cleanup())) GNU C extension
Nick Desaulniers [Thu, 1 Jun 2023 18:18:03 +0000 (11:18 -0700)]
[clang][docs] document __attribute__((cleanup())) GNU C extension

Provide an example of how to use this extension and more importantly,
document that cleanup functions are run in reverse nested order.

Reviewed By: erichkeane

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

13 months ago[CodeGen] Make use of MachineInstr::all_defs and all_uses. NFCI.
Jay Foad [Wed, 24 May 2023 13:57:23 +0000 (14:57 +0100)]
[CodeGen] Make use of MachineInstr::all_defs and all_uses. NFCI.

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

13 months ago[tsan] Invoke malloc/free hooks on darwin
Jin Xin Ng [Thu, 1 Jun 2023 03:59:01 +0000 (03:59 +0000)]
[tsan] Invoke malloc/free hooks on darwin

Matches behaviour from tsan_interceptors_posix. This is covered by sanitizer_common/TestCases/malloc_hook.cpp (which is currently failing on darwin)
I've tested it on an arm-based Mac & also compiled to x86_64 on it.

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

13 months ago[LV] Split off invariance check from isUniform (NFCI).
Florian Hahn [Thu, 1 Jun 2023 18:09:11 +0000 (19:09 +0100)]
[LV] Split off invariance check from isUniform (NFCI).

After 572cfa3fde5433, isUniform now checks VF based uniformity instead of
just invariance as before.

As follow-up cleanup suggested in D148841, separate the invariance check
out and update callers that currently check only for invariance.

This also moves the implementation of isUniform from LoopAccessAnalysis
to LoopVectorizationLegality, as LoopAccesAnalysis doesn't use the more
general isUniform.

13 months ago[libc++] Add a few more mising HIDE_FROM_ABI macros
Louis Dionne [Thu, 1 Jun 2023 18:07:40 +0000 (11:07 -0700)]
[libc++] Add a few more mising HIDE_FROM_ABI macros

13 months ago[mlir][gpu][sparse] fix broken type in cusparseCreateCsr
Kun Wu [Thu, 1 Jun 2023 18:00:21 +0000 (18:00 +0000)]
[mlir][gpu][sparse] fix broken type in cusparseCreateCsr

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

13 months ago[ARM] Emit code alignment after .arm and .thumb directives
Antonio Abbatangelo [Thu, 1 Jun 2023 18:05:38 +0000 (11:05 -0700)]
[ARM] Emit code alignment after .arm and .thumb directives

Emit a 4-byte alignment after the .arm directive and a 2-byte alignment
after the .thumb directive. The new behavior matches GNU assembler.

Fixes #53386

Reviewed By: MaskRay

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

13 months ago[mlir][sparse][gpu] fixing broken literal names in cuda runner macros
Kun Wu [Thu, 1 Jun 2023 17:46:08 +0000 (17:46 +0000)]
[mlir][sparse][gpu] fixing broken literal names in cuda runner macros

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

13 months ago[clang] Use `FileEntryRef` in modular header search (part 1/2)
Jan Svoboda [Wed, 31 May 2023 06:26:24 +0000 (23:26 -0700)]
[clang] Use `FileEntryRef` in modular header search (part 1/2)

This patch removes some deprecated uses of `{File,Directory}Entry::getName()`. No functional change indended.

Depends on D151853.

Reviewed By: benlangmuir

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

13 months ago[gn build] Port 217709cbae34
LLVM GN Syncbot [Thu, 1 Jun 2023 17:26:03 +0000 (17:26 +0000)]
[gn build] Port 217709cbae34

13 months agoPrevent some spurious error messages in the debugserver logs.
Jim Ingham [Thu, 1 Jun 2023 17:21:23 +0000 (10:21 -0700)]
Prevent some spurious error messages in the debugserver logs.

DNBGetDeploymentInfo was calling GetPlatformString w/o checking that
the load command it was processing actually provided a platform string.
That caused a bunch of worrisome looking error messages in the debugserver
log output.

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

13 months agoAdd EXC_SYSCALL to the set of ignorable mach exceptions.
Jim Ingham [Wed, 31 May 2023 21:43:00 +0000 (14:43 -0700)]
Add EXC_SYSCALL to the set of ignorable mach exceptions.
Add some more tests of what exceptions we accept and don't accept.

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

13 months agoRevert "[Fuchsia] Add llvm-debuginfod to toolchain"
Haowei Wu [Thu, 1 Jun 2023 17:20:17 +0000 (10:20 -0700)]
Revert "[Fuchsia] Add llvm-debuginfod to toolchain"

This reverts commit 731f9ac6e53611dabb51c52bfc8011c2aab7790b.

13 months ago[mlir][sparse][gpu] add result type to spmv and spmm gpu libgen path
Kun Wu [Fri, 26 May 2023 21:46:22 +0000 (21:46 +0000)]
[mlir][sparse][gpu] add result type to spmv and spmm gpu libgen path

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

13 months agoremove Demangle/StringView.h
Nick Desaulniers [Thu, 1 Jun 2023 17:09:43 +0000 (10:09 -0700)]
remove Demangle/StringView.h

Now that we've converted libcxxabi and llvm Demangle to use
std::string_view, this code no longer has any users. Bye bye!

Reviewed By: #libc_abi, phosek, MaskRay

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

13 months ago[clang] NFCI: Split `HeaderSearch::findAllModulesForHeader()`
Jan Svoboda [Wed, 31 May 2023 05:58:49 +0000 (22:58 -0700)]
[clang] NFCI: Split `HeaderSearch::findAllModulesForHeader()`

This mimics the `ModuleMap` API and enables D151854, where the `AllowCreation = true` function needs `FileEntryRef` but `AllowCreation = false` functions is happy with plain `FileEntry`. No functional change intended.

Reviewed By: benlangmuir

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

13 months ago[clang] NFCI: Use `FileEntryRef` in `ModuleMapCallbacks`
Jan Svoboda [Wed, 31 May 2023 17:35:59 +0000 (10:35 -0700)]
[clang] NFCI: Use `FileEntryRef` in `ModuleMapCallbacks`

This patch removes path hackery from `ModuleMapCallbacks` by adopting `FileEntryRef`. No functional change intended.

Reviewed By: benlangmuir

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

13 months ago[lldb][NFCI] Remove use of ConstString from UnixSignals::SignalCode
Alex Langford [Thu, 25 May 2023 23:22:13 +0000 (16:22 -0700)]
[lldb][NFCI] Remove use of ConstString from UnixSignals::SignalCode

On llvm.org and all downstream forks that I'm aware of, SignalCodes are
always created from C string literals. They are never compared to
anything so they take up space in the ConstString StringPool for no
tangible benefit.

I've changed the type here to `const llvm::StringLiteral` instead of
using a `StringRef` or a `const char *` to express intent -- These
strings come from constant data whose lifetime is directly tied to that
of the running process (and are thus safe to store).

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

13 months agoRevert "[ARM] Allow D-reg copies to use VMOVD with fpregs64"
David Green [Thu, 1 Jun 2023 16:49:25 +0000 (17:49 +0100)]
Revert "[ARM] Allow D-reg copies to use VMOVD with fpregs64"

This reverts commit 0a762ec1b09d96734a3462f8792a5574d089b24d.

Some CPUs enable fp64 by default (such as cortex-m7). When specifying a
single-precision fpu with them like -mfpu=fpv5-sp-d16, the fp64 feature will
be disabled, but fpreg64 will not. We need to disable them both correctly under
clang in order for the backend to be able to use the reliably. In the meantime
this reverts 0a762ec1b09d96734 until that issue is fixed.

13 months ago[Lex] Only warn on defining or undefining language-defined builtins
John Brawn [Thu, 1 Jun 2023 10:09:40 +0000 (11:09 +0100)]
[Lex] Only warn on defining or undefining language-defined builtins

D144654 made it so that we warn on any defining or undefining of
builtin macros. However the C and C++ standards only forbid the
defining or undefining of macros defined in the language standard
itself, but clang defines more macros than those and warning on those
may not be helpful.

Resolve this by only warning if the builtin macro name is the name of
a macro defined by the language. This is done in a way that removes
some of the existing checks, as those were made redundant by
restricting the warning in this way.

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

13 months agoFlang implementation for COMPILER_VERSION and COMPILER_OPTIONS intrinsics
Hussain Kadhem [Thu, 1 Jun 2023 16:31:51 +0000 (12:31 -0400)]
Flang implementation for COMPILER_VERSION and COMPILER_OPTIONS intrinsics

This revision implements the Fortran intrinsic procedures COMPILER_VERSION and COMPILER_OPTIONS from the iso_fortran_env module.
To be able to set the COMPILER_OPTIONS string according to the original compiler driver invocation, a string is passed to the frontend driver using the environment variable FLANG_COMPILER_OPTIONS_STRING, for lack of a better mechanism.

Fixes #59233

Reviewed By: awarzynski

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

13 months ago[clang][Darwin] Error out when missing requested libarclite library
Keith Smiley [Thu, 1 Jun 2023 01:55:17 +0000 (18:55 -0700)]
[clang][Darwin] Error out when missing requested libarclite library

Starting with the SDKs provided with Xcode 14.3, this library no longer
exists. Before this change this results in an opaque linker error in the
case that your deployment target is low enough that this library is
added. This produces a more useful error message in that case.

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

13 months ago[MachineInstr] Implement new operand accessors all_defs and all_uses
Jay Foad [Wed, 24 May 2023 13:19:33 +0000 (14:19 +0100)]
[MachineInstr] Implement new operand accessors all_defs and all_uses

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

13 months ago[ThinLTO] Restructure promotion / internalization decisions (NFC)
Teresa Johnson [Thu, 1 Jun 2023 15:57:35 +0000 (08:57 -0700)]
[ThinLTO] Restructure promotion / internalization decisions (NFC)

Restructures the combined index based promotion and internalization
decision code so that it is a bit easier to follow. This is in
preparation for a bugfix to this code that will modify one part of the
logic.

13 months ago[NFC][libc++][tests] Move directories under stringstream
Piotr Fusik [Thu, 1 Jun 2023 15:58:36 +0000 (08:58 -0700)]
[NFC][libc++][tests] Move directories under stringstream

Reviewed By: #libc, philnik

Spies: libcxx-commits

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

13 months ago[gn build] Port ee6ec2c5f1a5
LLVM GN Syncbot [Thu, 1 Jun 2023 15:52:25 +0000 (15:52 +0000)]
[gn build] Port ee6ec2c5f1a5

13 months ago[libc++][PSTL] Implement std::reduce and std::transform_reduce
Nikolas Klauser [Thu, 1 Jun 2023 15:51:35 +0000 (08:51 -0700)]
[libc++][PSTL] Implement std::reduce and std::transform_reduce

Reviewed By: ldionne, #libc

Spies: libcxx-commits, miyuki

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

13 months ago[IPSCCP] Decouple queries for function analysis results.
Alexandros Lamprineas [Thu, 1 Jun 2023 14:09:08 +0000 (15:09 +0100)]
[IPSCCP] Decouple queries for function analysis results.

The SCCPSolver is using a structure (AnalysisResultsForFn) where it keeps
pointers to various analyses needed by the IPSCCP pass. These analyses are
requested all at the same time, which can become problematic in some cases.
For example one could be retrieved via getCachedAnalysis() prior to the
actual execution of the analysis. In more detail:

The IPSCCP pass uses a DomTreeUpdater to preserve the PostDominatorTree
in case the PostDominatorTreeAnalysis had run before IPSCCP. Starting with
commit 1b1232047e83b the IPSCCP pass may use BlockFrequencyAnalysis for
some functions in the module. As a result, the PostDominatorTreeAnalysis
may not run until the BlockFrequencyAnalysis has run, since the latter
analysis depends on the former. Currently, we setup the DomTreeUpdater
using getCachedAnalysis to retrieve a PostDominatorTree. This happens
before BlockFrequencyAnalysis has run, therefore the cached analysis can
become invalid by the time we use it.

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

13 months ago[DAGCombiner] Do not fold fadd (fmul x, y), (fmul x, y) -> fma x, y, (fmul x, y)
Jay Foad [Thu, 1 Jun 2023 14:21:09 +0000 (15:21 +0100)]
[DAGCombiner] Do not fold fadd (fmul x, y), (fmul x, y) -> fma x, y, (fmul x, y)

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

13 months ago[OpenCL] Add CLK_UNORM_INT_101010_2 channel type
Sven van Haastregt [Thu, 1 Jun 2023 15:21:54 +0000 (16:21 +0100)]
[OpenCL] Add CLK_UNORM_INT_101010_2 channel type

This new channel data type was added in OpenCL C 3.0.

13 months ago[libc++][NFC] Use TEST_HAS_NO_FILESYSTEM_LIBRARY in the test suite
Louis Dionne [Wed, 31 May 2023 18:40:01 +0000 (11:40 -0700)]
[libc++][NFC] Use TEST_HAS_NO_FILESYSTEM_LIBRARY in the test suite

This replaces some uses of internal libc++ macros with the equivalent
macro from "test_macros.h".

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

13 months ago[libc++] Use .gen.py tests to generate _LIBCPP_VERSION tests
Louis Dionne [Wed, 31 May 2023 17:07:54 +0000 (10:07 -0700)]
[libc++] Use .gen.py tests to generate _LIBCPP_VERSION tests

This removes the need for contributors to do some manual steps
when adding a new public header.

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

13 months ago[LV] Bail out on loop-variant steps when rewriting SCEV exprs.
Florian Hahn [Thu, 1 Jun 2023 15:14:02 +0000 (16:14 +0100)]
[LV] Bail out on loop-variant steps when rewriting SCEV exprs.

If the step is not loop-invariant, we cannot create a modified AddRec,
as the start needs to be loop-invariant. Mark those cases as
CannotAnalyze and bail out, to fix a crash.

13 months ago[NFC][TargetTransformInfo] Make getInliningThreholdMultiplier and getInlinerVectorBon...
Juan Manuel MARTINEZ CAAMAÑO [Thu, 1 Jun 2023 14:54:49 +0000 (16:54 +0200)]
[NFC][TargetTransformInfo] Make getInliningThreholdMultiplier and getInlinerVectorBonusPercent const

Reviewed By: jlebar

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