platform/upstream/llvm.git
19 months agoRevert "[OpenMP] Clang Support for taskwait nowait clause"
Chi Chun Chen [Fri, 9 Dec 2022 17:06:45 +0000 (11:06 -0600)]
Revert "[OpenMP] Clang Support for taskwait nowait clause"

This reverts commit 100dfe7a8ad3789a98df623482b88d9a3a02e176.

19 months ago[NFC][scudo] Fix warnings in tests after D139430
Vitaly Buka [Fri, 9 Dec 2022 16:59:03 +0000 (08:59 -0800)]
[NFC][scudo] Fix warnings in tests after D139430

19 months ago[mlir][arith] Update addui_extended naming in canon tests. NFC.
Jakub Kuderski [Fri, 9 Dec 2022 16:55:25 +0000 (11:55 -0500)]
[mlir][arith] Update addui_extended naming in canon tests. NFC.

Update some arith canonicalization tests to follow the new naming
convention for `arith.addui_extened`. I missed this in the original
patch that did the renaming: D139569.

19 months agoSema: diagnose PMFs passed through registers to inline assembly
Saleem Abdulrasool [Fri, 9 Dec 2022 16:58:15 +0000 (16:58 +0000)]
Sema: diagnose PMFs passed through registers to inline assembly

The itanium ABI represents the PMF as a pair of pointers.  As such the
structure cannot be passed through a single register.  Diagnose such
cases in the frontend rather than trying to generate IR to perform this
operation.

Fixes: 59033

Differential Revision: https://reviews.llvm.org/D13851
Reviewed By: aaron.ballman

19 months agoAMDGPU: Check if operand RC contains register used when printing
Petar Avramovic [Fri, 9 Dec 2022 16:55:31 +0000 (17:55 +0100)]
AMDGPU: Check if operand RC contains register used when printing

Disassembler can successfully decode sgpr register when only vgpr
registers are valid for the operand (e.g. VReg_* and VISrc_* operands).
In InstPrinter, detect when operand register class does not contain
register that is being printed. Does not result in an error.
Intended use is for disassembler tests.

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

19 months agoAMDGPU: Precommit wmma tests for D139646
Petar Avramovic [Fri, 9 Dec 2022 16:45:37 +0000 (17:45 +0100)]
AMDGPU: Precommit wmma tests for D139646

19 months ago[gn build] Port 1d1de7467c32
LLVM GN Syncbot [Fri, 9 Dec 2022 16:40:46 +0000 (16:40 +0000)]
[gn build] Port 1d1de7467c32

19 months agoFix compile error in unittests after 1d1de7467c32d52926ca56b9167a2c65c451ecfa
OCHyams [Fri, 9 Dec 2022 16:37:48 +0000 (16:37 +0000)]
Fix compile error in unittests after 1d1de7467c32d52926ca56b9167a2c65c451ecfa

Build-bot failure: https://lab.llvm.org/buildbot/#/builders/139/builds/32477

commit 1d1de7467c32d52926ca56b9167a2c65c451ecfa (HEAD -> main, origin/main)
Author: OCHyams <orlando.hyams@sony.com>
Date:   Fri Dec 9 15:43:56 2022 +0000

19 months ago[STLExtras] Convert deref_or_none and zip_longest to std::optional
Krzysztof Parzyszek [Fri, 9 Dec 2022 02:08:32 +0000 (20:08 -0600)]
[STLExtras] Convert deref_or_none and zip_longest to std::optional

19 months ago[RISCV] Consolidate a bit of common logic for forming reductions
Philip Reames [Fri, 9 Dec 2022 16:17:44 +0000 (08:17 -0800)]
[RISCV] Consolidate a bit of common logic for forming reductions

There's several patches in flght which change this code, better to only have one copy.

The VP case is left seperate for the moment as the result value type differs.

19 months ago[Assignment Tracking][Analysis] Add analysis pass
OCHyams [Fri, 9 Dec 2022 15:43:56 +0000 (15:43 +0000)]
[Assignment Tracking][Analysis] Add analysis pass

The Assignment Tracking debug-info feature is outlined in this RFC:

https://discourse.llvm.org/t/
rfc-assignment-tracking-a-better-way-of-specifying-variable-locations-in-ir

Add initial revision of assignment tracking analysis pass
---------------------------------------------------------
This patch squashes five individually reviewed patches into one:

    #1 https://reviews.llvm.org/D136320
    #2 https://reviews.llvm.org/D136321
    #3 https://reviews.llvm.org/D136325
    #4 https://reviews.llvm.org/D136331
    #5 https://reviews.llvm.org/D136335

Patch #1 introduces 2 new files: AssignmentTrackingAnalysis.h and .cpp. The
two subsequent patches modify those files only. Patch #4 plumbs the analysis
into SelectionDAG, and patch #5 is a collection of tests for the analysis as
a whole.

The analysis was broken up into smaller chunks for review purposes but for the
most part the tests were written using the whole analysis. It would be possible
to break up the tests for patches #1 through #3 for the purpose of landing the
patches seperately. However, most them would require an update for each
patch. In addition, patch #4 - which connects the analysis to SelectionDAG - is
required by all of the tests.

If there is build-bot trouble, we might try a different landing sequence.

Analysis problem and goal
-------------------------

Variables values can be stored in memory, or available as SSA values, or both.
Using the Assignment Tracking metadata, it's not possible to determine a
variable location just by looking at a debug intrinsic in
isolation. Instructions without any metadata can change the location of a
variable. The meaning of dbg.assign intrinsics changes depending on whether
there are linked instructions, and where they are relative to those
instructions. So we need to analyse the IR and convert the embedded information
into a form that SelectionDAG can consume to produce debug variable locations
in MIR.

The solution is a dataflow analysis which, aiming to maximise the memory
location coverage for variables, outputs a mapping of instruction positions to
variable location definitions.

API usage
---------

The analysis is named `AssignmentTrackingAnalysis`. It is added as a required
pass for SelectionDAGISel when assignment tracking is enabled.

The results of the analysis are exposed via `getResults` using the returned
`const FunctionVarLocs *`'s const methods:

    const VarLocInfo *single_locs_begin() const;
    const VarLocInfo *single_locs_end() const;
    const VarLocInfo *locs_begin(const Instruction *Before) const;
    const VarLocInfo *locs_end(const Instruction *Before) const;
    void print(raw_ostream &OS, const Function &Fn) const;

Debug intrinsics can be ignored after running the analysis. Instead, variable
location definitions that occur between an instruction `Inst` and its
predecessor (or block start) can be found by looping over the range:

    locs_begin(Inst), locs_end(Inst)

Similarly, variables with a memory location that is valid for their lifetime
can be iterated over using the range:

    single_locs_begin(), single_locs_end()

Further detail
--------------

For an explanation of the dataflow implementation and the integration with
SelectionDAG, please see the reviews linked at the top of this commit message.

Reviewed By: jmorse

19 months ago[InstCombine] allow more fast-math-flags to propagate in fneg-of-select fold
Sanjay Patel [Fri, 9 Dec 2022 15:58:27 +0000 (10:58 -0500)]
[InstCombine] allow more fast-math-flags to propagate in fneg-of-select fold

We were conservatively intersecting flags, but we can take the union here
because forbidden special values (nsz/nnan/ninf) are not altered by fneg.
So if they were guaranteed not present on the select or fneg, then they
are guaranteed not present on the new select. Alive2 appears to agree on
the test diffs (reduced to not include irrelevant flags like reassoc):
https://alive2.llvm.org/ce/z/ViqqrO

This prevents a potential regression if we tighten up the FMF behavior
for fabs with NAN as suggested in issue #59279.

19 months ago[gn build] Unbreak link after 9ebaf4fef4aac89
Nico Weber [Fri, 9 Dec 2022 15:55:22 +0000 (10:55 -0500)]
[gn build] Unbreak link after 9ebaf4fef4aac89

9ebaf4fef4aac89 removed one of two redundant deps in CMake, but it removed the
one dep in the GN build. Since the CMake build still has the dep, so should the
GN build. (Things don't link without it.)

19 months ago[mlir][Linalg] Apply fixes to TileReductionUsingForeachThreadOp
Nicolas Vasilache [Fri, 9 Dec 2022 12:02:28 +0000 (04:02 -0800)]
[mlir][Linalg] Apply fixes to TileReductionUsingForeachThreadOp

In the process, numerous insertion point issues were found and fixed.
RAII on insertion points is now used more dilligently.

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

19 months agoRevert "[mlir] FunctionOpInterface: make get/setFunctionType interface methods"
David Spickett [Fri, 9 Dec 2022 15:21:28 +0000 (15:21 +0000)]
Revert "[mlir] FunctionOpInterface: make get/setFunctionType interface methods"
and "[mlir] Fix examples build"

This reverts commit fbc253fe81da4e1d6bfa2519e01e03f21d8c40a8 and
96cf183bccd7d1c3083f169a89a6af1f263b3aae.

Which I missed in the first revert in f3379feabe38fd3711b13ffcf6de4aab03b7ccdc.

19 months ago[MLIR/S90x] Convert tests to check 'target=...'
Paul Robinson [Fri, 9 Dec 2022 15:24:16 +0000 (07:24 -0800)]
[MLIR/S90x] Convert tests to check 'target=...'

Part of the project to eliminate special handling for triples in lit
expressions.

19 months ago[AArch64][NFC] Move hasFeature fields initiations to the declaration
Daniel Kiss [Fri, 9 Dec 2022 15:23:10 +0000 (16:23 +0100)]
[AArch64][NFC] Move hasFeature fields initiations to the declaration

hasFeature fields need to be initialised to false. Easy to miss as missed for hasPAuth and hasFlagM.
Maybe the code less error prone like this.

Reviewed By: chill

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

19 months ago[BasicAA] Handle phi with itself as incoming value
Nikita Popov [Fri, 9 Dec 2022 15:17:45 +0000 (16:17 +0100)]
[BasicAA] Handle phi with itself as incoming value

We can skip such incoming values. This was already done by
PhiValues if present, but we can also do this without the
additional analysis.

19 months ago[BasicAA] Add test for phi that contains itself (NFC)
Nikita Popov [Fri, 9 Dec 2022 15:14:07 +0000 (16:14 +0100)]
[BasicAA] Add test for phi that contains itself (NFC)

This currently produces a better result with PhiValues.

19 months ago[flang] Handle correctly polymorphic descriptor for IO input
Valentin Clement [Fri, 9 Dec 2022 14:59:59 +0000 (15:59 +0100)]
[flang] Handle correctly polymorphic descriptor for IO input

Polymorphic entities are already emboxed. Just update
the code to use `BaseBoxType` instead of `BoxType`.

Reviewed By: jeanPerier

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

19 months ago[BasicAA] Convert test to opaque pointers (NFC)
Nikita Popov [Fri, 9 Dec 2022 15:05:31 +0000 (16:05 +0100)]
[BasicAA] Convert test to opaque pointers (NFC)

19 months ago[IPSCCP] Move the IPSCCP run function under the IPO directory.
Alexandros Lamprineas [Fri, 9 Dec 2022 11:05:03 +0000 (11:05 +0000)]
[IPSCCP] Move the IPSCCP run function under the IPO directory.

Reland 42c2dc401742266da3e0251b6c1ca491f4779963 which was reverted
in cb03b1bd99313a728d47060b909a73e7f5991231. The fix for the link
errors was to reintroduce one of the two occurences of 'Scalar'
under the LINK_COMPONENTS.

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

19 months ago[TableGen] Add a !listremove() bang operator
Simon Pilgrim [Fri, 9 Dec 2022 15:03:11 +0000 (15:03 +0000)]
[TableGen] Add a !listremove() bang operator

This patch proposes to add a !listremove() bang operator to allow us to prune list entries by removing any entries from the first list arg that are also contained in the second list arg.

The particular use case I have in mind is for improved analysis of x86 scheduler models for which I'm hoping to start using the CodeGenProcModel 'Unsupported' features lists, which lists the ISA features a particular model DOESN'T support - with such a diverse and growing list of x86 ISAs, I don't want to have to update all these lists with every ISA change to every model - so I'm intending to keep a single central list of all x86 features, and then have the each model "remove" the features that it supports via a !listremove() - leaving just the unsupported ones.

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

19 months agoRevert "[mlir] FunctionOpInterface: arg and result attrs dispatch to interface"
David Spickett [Fri, 9 Dec 2022 14:49:44 +0000 (14:49 +0000)]
Revert "[mlir] FunctionOpInterface: arg and result attrs dispatch to interface"
and "[flang] Fix flang after MLIR update"

This reverts commit dd74e6b6f4fb7a4685086a4895c1934e043f875b and
1897b67ae86470ad54f6baea6f220933d8053b5b due to ongoing test failures on flang
bots e.g. https://lab.llvm.org/buildbot/#/builders/179/builds/5050

19 months ago[BasicAA] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 9 Dec 2022 14:49:15 +0000 (15:49 +0100)]
[BasicAA] Convert some tests to opaque pointers (NFC)

19 months ago[libc++] Refactor char_traits
Nikolas Klauser [Wed, 7 Dec 2022 17:31:14 +0000 (18:31 +0100)]
[libc++] Refactor char_traits

This allows us to reuse workarounds for compilers that don't provide the builtins or constexpr support.

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

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

19 months ago[flang] Embox derived-type when passed to element procedure as passed object
Valentin Clement [Fri, 9 Dec 2022 14:37:25 +0000 (15:37 +0100)]
[flang] Embox derived-type when passed to element procedure as passed object

In elemental procedure lowering the passed object is always emboxed. The current code
was not correctly dealing with scalar derived-type used as passed object.

Reviewed By: jeanPerier, PeteSteinfeld

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

19 months ago[GVN] Regenerate test checks (NFC)
Nikita Popov [Fri, 9 Dec 2022 14:30:40 +0000 (15:30 +0100)]
[GVN] Regenerate test checks (NFC)

19 months ago[openmp][mlir] Lower parallel if to new fork_call_if function.
David Truby [Tue, 22 Nov 2022 13:32:47 +0000 (13:32 +0000)]
[openmp][mlir] Lower parallel if to new fork_call_if function.

This patch adds a new runtime function `fork_call_if` and uses that
to lower parallel if statements when going through OpenMPIRBuilder.

This fixes an issue where the OpenMPIRBuilder passes all arguments to
fork_call as a struct but this struct is not filled corretly in the
non-if branch by handling the fork inside the runtime.

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

19 months ago[mlir][linalg] Fold duplicate and unused inputs in linalg.generic
Matthias Springer [Fri, 9 Dec 2022 14:17:30 +0000 (15:17 +0100)]
[mlir][linalg] Fold duplicate and unused inputs in linalg.generic

If an input bbArg is not used, its corresponding input operand is removed. If there are duplicate input operands or input operands that are also used as output operands, the duplicate input operands are removed. Output operands are never modified.

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

19 months ago[MemoryBuiltins] Avoid comparing against Type::getInt8PtrTy(0)
Alex Richardson [Fri, 9 Dec 2022 13:42:47 +0000 (13:42 +0000)]
[MemoryBuiltins] Avoid comparing against Type::getInt8PtrTy(0)

This does not make sense with opaque pointers, and also caused issues for
CHERI/Morello where hardcoding address-space zero prevented optimization.

Downstream change: https://git.morello-project.org/morello/llvm-project/-/merge_requests/180
Co-authored-by: Silviu Baranga <silviu.baranga@arm.com>
Reviewed By: lebedev.ri

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

19 months ago[clang] Try to unbreak test/C/drs/dr324.c on Windows
Nico Weber [Fri, 9 Dec 2022 13:56:02 +0000 (08:56 -0500)]
[clang] Try to unbreak test/C/drs/dr324.c on Windows

The test uses

    #pragma GCC dependency "oops\..\dr0xx.c"

to test preprocessor "tokenization obscurities". However, that
pragma also emits a warning if the refered file is newer than the
current file -- and d694e2490af8 edited dr0xx.c, causing this warning
to fire.

As workaround, touch this file, so that it's newer than dr0xx.c again.

19 months ago[Serialization] Add -ftime-trace block for reading loaded modules.
Sam McCall [Fri, 9 Dec 2022 13:30:04 +0000 (14:30 +0100)]
[Serialization] Add -ftime-trace block for reading loaded modules.

The existing ReadAST block only describes the top-level PCM file being
loaded, when in practice most of the time taken is dealing with other
PCM files which are loaded in turn.

Because this work isn't strictly recursive (first all the modules are
discovered, then processsed in several flat loops), we can't have a neat
recursive structure like processing of source files. Instead, slap a
timer on the largest of these boxes: reading the AST block for modules.
In practice this shows where most of the time goes, and in particular
which modules are most expensive.

19 months ago[mlir][bufferize] Improve analysis of external functions
Matthias Springer [Fri, 9 Dec 2022 13:30:08 +0000 (14:30 +0100)]
[mlir][bufferize] Improve analysis of external functions

External functions have no body, so they cannot be analyzed. Assume conservatively that each tensor bbArg may be aliasing with each tensor result. Furthermore, assume that each function arg is read and written-to after bufferization. This default behavior can be controlled with `bufferization.access` (similar to `bufferization.memory_layout`) in test cases.

Also fix a bug in the dialect attribute verifier, which did not run for region argument attributes.

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

19 months agoRevert "[lld-macho] Fix bug in reading cpuSubType field."
Nico Weber [Fri, 9 Dec 2022 13:32:10 +0000 (08:32 -0500)]
Revert "[lld-macho] Fix bug in reading cpuSubType field."

This reverts commit e54cfa48d2d56e025fee9e239f8ba4fdec5520c8.
Test fails at least on macOS: https://reviews.llvm.org/D139572#3984162

19 months agoRevert "Mark test lld/test/MachO/fat-arch.s updated in e54cfa4 to require aarch64."
Nico Weber [Fri, 9 Dec 2022 13:32:01 +0000 (08:32 -0500)]
Revert "Mark test lld/test/MachO/fat-arch.s updated in e54cfa4 to require aarch64."

This reverts commit 9c381c430e413b2c2b7a15e43f4db3f4b7a7e138.
Prerequisite for reverting e54cfa48d2d56e025fee9e239f8ba4fdec5520c8.

19 months ago[TBAA] Avoid duplicate set lookup (NFC)
Nikita Popov [Fri, 9 Dec 2022 13:29:51 +0000 (14:29 +0100)]
[TBAA] Avoid duplicate set lookup (NFC)

19 months ago[mlir][llvm] Improve LLVM IR import error handling.
Tobias Gysi [Fri, 9 Dec 2022 12:40:18 +0000 (14:40 +0200)]
[mlir][llvm] Improve LLVM IR import error handling.

Instead of exiting in the middle of the import handle errors more
gracefully by printing an error message and returning failure. The
revision handles and tests the import of unsupported instructions,
values, constants, and intrinsics.

Depends on D139404

Reviewed By: ftynse

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

19 months ago[analyzer][solver] Introduce reasoning for not equal to operator
Manas [Fri, 9 Dec 2022 12:30:57 +0000 (13:30 +0100)]
[analyzer][solver] Introduce reasoning for not equal to operator

With this patch, the solver can infer results for not equal (!=) operator
over Ranges as well. This also fixes the issue of comparison between
different types, by first converting the RangeSets to the resulting type,
which then can be used for comparisons.

Patch by Manas.

Reviewed By: steakhal

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

19 months ago[SLP][NFC]prepare isUndefVector function to be used for differently
Alexey Bataev [Thu, 8 Dec 2022 21:32:25 +0000 (13:32 -0800)]
[SLP][NFC]prepare isUndefVector function to be used for differently
sized vectors as shuffle masks, NFC.

Use use-mask instead of actual mask to speed up the process and make it
possible to use for the cases where the mask is used for vector
resizing.

19 months ago[include-cleaner] Filter out references that not spelled in the main file.
Haojian Wu [Sat, 26 Nov 2022 00:02:25 +0000 (01:02 +0100)]
[include-cleaner] Filter out references that not spelled in the main file.

A HTML report of gtest after this patch:
https://gist.githubusercontent.com/hokein/73eee6f65a803e5702d8388c187524a6/raw/cf05a503519703a2fb87840bb0b270fe11a7a9fd/RecordTest.html

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

19 months ago[MemoryBuiltins] Remove unused TLI parameters (NFC)
Nikita Popov [Fri, 9 Dec 2022 11:57:40 +0000 (12:57 +0100)]
[MemoryBuiltins] Remove unused TLI parameters (NFC)

19 months ago[MemoryBuiltins] Remove CallocLike (NFC)
Nikita Popov [Fri, 9 Dec 2022 11:45:00 +0000 (12:45 +0100)]
[MemoryBuiltins] Remove CallocLike (NFC)

All functions of this kind already use allocator attributes. This
also highlights that isMallocOrCallocLikeFn() doesn't really do
what the name says (notably, it does not check for allocator
attributes). The places it is used in are also very dubious, so
we'll want to remove it.

19 months ago[SLP][X86] slp-fma-loss.ll - add various targets with different FMA abilities
Simon Pilgrim [Fri, 9 Dec 2022 11:45:59 +0000 (11:45 +0000)]
[SLP][X86] slp-fma-loss.ll - add various targets with different FMA abilities

Add targets with FMA3, FMA4 and no-FMA support

Should help with D132872 testing

19 months ago[MemoryBuiltins] Remove AlignedAllocLike (NFC)
Nikita Popov [Fri, 9 Dec 2022 11:35:43 +0000 (12:35 +0100)]
[MemoryBuiltins] Remove AlignedAllocLike (NFC)

All functions that formerly had this AllocType now use allocator
attributes, so drop it.

19 months ago[clangd] NFC. Add a newline at the end of the file
Ilya Biryukov [Wed, 7 Dec 2022 16:14:27 +0000 (17:14 +0100)]
[clangd] NFC. Add a newline at the end of the file

19 months ago[include-cleaner] Fix walkUsed only report a single macro ref.
Haojian Wu [Fri, 9 Dec 2022 11:10:13 +0000 (12:10 +0100)]
[include-cleaner] Fix walkUsed only report a single macro ref.

The fix 962343a979d51cea9363167e9121c446abbdfdbc was reverted during a
rebase of a later patch. Added a test.

19 months ago[NFC] Finish cleaning up StringRef usage in OptTable::ParseOneArg
serge-sans-paille [Thu, 8 Dec 2022 14:29:05 +0000 (15:29 +0100)]
[NFC] Finish cleaning up StringRef usage in OptTable::ParseOneArg

This is a followup to https://reviews.llvm.org/D139274

19 months ago[mlir][llvm] Modernize LLVM instruction and global import (NFC).
Tobias Gysi [Fri, 9 Dec 2022 10:31:53 +0000 (11:31 +0100)]
[mlir][llvm] Modernize LLVM instruction and global import (NFC).

Modernize the import of LLVMIR instructions and global variables.
Use longer variable names, factor out code used to import call or
invoke instructions, use the CPP builders for importing branch
instructions, etc. The revision is a preparation for a follow up
revision that moves the import code to implement improved error
handling.

Reviewed By: ftynse

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

19 months ago[SimplifyCFG] Prohibit hoisting of llvm.deoptimize calls
Dmitry Makogon [Tue, 6 Dec 2022 16:18:48 +0000 (23:18 +0700)]
[SimplifyCFG] Prohibit hoisting of llvm.deoptimize calls

This prohibits hoisiting identical llvm.deoptimize calls
from 'then' and 'else' blocks of a conditional branch.
This fixes a crash that happened because we didn't hoist
the return instructions together with the llvm.deoptimize calls,
so the verifier would crash.

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

19 months ago[Test] Reduce deopt bundle in test with hoisted llvm.deoptimize call
Dmitry Makogon [Fri, 9 Dec 2022 10:36:03 +0000 (17:36 +0700)]
[Test] Reduce deopt bundle in test with hoisted llvm.deoptimize call

19 months ago[X86] Regenerate fastcc-byval.ll with visible stack math
Simon Pilgrim [Fri, 9 Dec 2022 10:40:49 +0000 (10:40 +0000)]
[X86] Regenerate fastcc-byval.ll with visible stack math

Allows us to truly see the diff in D138899

19 months ago[X86] Regenerate fastcc-byval.ll
Simon Pilgrim [Fri, 9 Dec 2022 10:37:03 +0000 (10:37 +0000)]
[X86] Regenerate fastcc-byval.ll

Allows us to truly see the diff in D138899

19 months ago[AArch64] Lower READCYCLECOUNTER using MRS CNTVCT_EL0
Salvatore Dipietro [Fri, 9 Dec 2022 10:36:16 +0000 (10:36 +0000)]
[AArch64] Lower READCYCLECOUNTER using MRS CNTVCT_EL0

As suggested in D12425 it would be better for the readcyclecounter
function on ARM architecture to use the CNTVCT_EL0 register
(Counter-timer Virtual Count register) instead of the PMCCNTR_EL0
(Performance Monitors Cycle Count Register) because the PMCCNTR_EL0 is a
PMU register which, depending on the configuration, it might always
return zeroes and it doesn't guaranteed to always be increased.

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

19 months ago[MemoryBuiltins] Drop ReallocLike type (NFC)
Nikita Popov [Fri, 9 Dec 2022 10:35:20 +0000 (11:35 +0100)]
[MemoryBuiltins] Drop ReallocLike type (NFC)

All realloc style functions have been migrated to use allocator
attributes, so we no longer need to check for this.

19 months ago[MemoryBuiltins] Remove some hardcoded builtins
Nikita Popov [Fri, 9 Dec 2022 10:28:11 +0000 (11:28 +0100)]
[MemoryBuiltins] Remove some hardcoded builtins

For all of these we already infer the new memory attributes, so
they don't need to be explicitly listed.

19 months agoAdapt lldb to use StringRef for option storage
serge-sans-paille [Fri, 9 Dec 2022 10:20:37 +0000 (11:20 +0100)]
Adapt lldb to use StringRef for option storage

As a consequence to 138942c833b3baa12d19216797efca6d4dd010d2
This fixes lldb build https://lab.llvm.org/buildbot/#/builders/83/builds/26991

19 months ago[Alignment] Use Align in MCStreamer::emitCommonSymbol
Guillaume Chatelet [Thu, 8 Dec 2022 09:53:35 +0000 (09:53 +0000)]
[Alignment] Use Align in MCStreamer::emitCommonSymbol

Next patch after D139548 and D139439. Same expectations, the change seems safe with as far as llvm goes, we cannot check downstream implementations.

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

19 months ago[IndVars] Use symbolic max block exit count to handle the last iter
Max Kazantsev [Fri, 9 Dec 2022 10:05:33 +0000 (17:05 +0700)]
[IndVars] Use symbolic max block exit count to handle the last iter

Old logic: when loop symbolic max exit count matched *exact* block exit count,
assume that all subsequent blocks will do 1 iteration less.

New logic: when loop symbolic max exit count matched *symbolic max* block exit count,
assume that all subsequent blocks will do 1 iteration less.

The new logic is still legal and is more permissive in situations when exact
block exit count is not known.

Differential Revision: https://reviews.llvm.org/D139692
Reviewed By: nikic

19 months ago[Docs] Update PatFrag definition in documentation
Luke Lau [Fri, 9 Dec 2022 09:55:35 +0000 (09:55 +0000)]
[Docs] Update PatFrag definition in documentation

The old definition for store was outdated.

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

19 months ago[AsmParser] Check that addrspace fits within 24 bits
Luke Lau [Fri, 9 Dec 2022 09:52:31 +0000 (09:52 +0000)]
[AsmParser] Check that addrspace fits within 24 bits

Address spaces equal or larger than 1 << 24 don't fit and produce an
assertion during debug builds, or worse in release. This causes an error
to be reported during parsing instead.

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

19 months ago[Clang] improve grammar in warn_utf8_symbol_homoglyph diagnostic
Corentin Jabot [Fri, 9 Dec 2022 09:42:43 +0000 (10:42 +0100)]
[Clang] improve grammar in warn_utf8_symbol_homoglyph diagnostic

19 months ago[NFC] Rename variables in optimizeLoopExits
Max Kazantsev [Fri, 9 Dec 2022 09:14:19 +0000 (16:14 +0700)]
[NFC] Rename variables in optimizeLoopExits

19 months ago[GISel] Rework trunc/shl combine in a generic trunc/shift combine
Pierre van Houtryve [Mon, 24 Oct 2022 08:48:57 +0000 (08:48 +0000)]
[GISel] Rework trunc/shl combine in a generic trunc/shift combine

This combine only handled left shifts, but now it can handle right shifts as well. It handles right shifts conservatively and only truncates them to the size returned by TLI.

AMDGPU benefits from always lowering shifts to 32 bits for instance, but AArch64 would rather keep them at 64 bits.

Reviewed By: arsenm

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

19 months agoRevert D139098 "[Alignment] Use Align for ObjectFile::getSectionAlignment"
Guillaume Chatelet [Fri, 9 Dec 2022 09:44:01 +0000 (09:44 +0000)]
Revert D139098 "[Alignment] Use Align for ObjectFile::getSectionAlignment"

This breaks lld.

This reverts commit 10c47465e2505ddfee4e62a2ab2e535abea3ec56.

19 months agoRecommit of 8ae18303f97d5dcfaecc90b4d87effb2011ed82e - part 2
serge-sans-paille [Sun, 4 Dec 2022 08:33:14 +0000 (09:33 +0100)]
Recommit of 8ae18303f97d5dcfaecc90b4d87effb2011ed82e - part 2

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

19 months ago[PtrAuth] Use default attributes for some ptrauth intrinsics
Nikita Popov [Mon, 7 Nov 2022 16:22:14 +0000 (17:22 +0100)]
[PtrAuth] Use default attributes for some ptrauth intrinsics

This uses the default intrinsic attributes (nofree, nosync,
nocallback, willreturn) for a subset of the ptrauth intrinsics.
Notably, this does not use them for auth and resign, because these
intrinsics are specified to trap and as such are not willreturn.
As far as I understood, the remaining intrinsics may not trap
(or can only trap in cases where behavior is undefined).

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

19 months ago[mlir] Support llvm.readonly attribute on llvm pointers
Guray Ozen [Thu, 8 Dec 2022 16:59:22 +0000 (17:59 +0100)]
[mlir] Support llvm.readonly attribute on llvm pointers

The attribute is translated into LLVM's function attribute 'readonly'. The attribute can be only used for pointers.

Reviewed By: nicolasvasilache

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

19 months ago[Alignment] Use Align for ObjectFile::getSectionAlignment
Guillaume Chatelet [Thu, 1 Dec 2022 12:34:21 +0000 (12:34 +0000)]
[Alignment] Use Align for ObjectFile::getSectionAlignment

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

19 months ago[BOLT] Fix blocks layout reverse iterators
Vladislav Khmelevsky [Thu, 8 Dec 2022 10:06:39 +0000 (14:06 +0400)]
[BOLT] Fix blocks layout reverse iterators

Use container's reverse iterators, fix iterators types.

Reviewed By: Amir

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

19 months agoImplement CWG2631
Corentin Jabot [Sun, 23 Oct 2022 15:32:58 +0000 (17:32 +0200)]
Implement CWG2631

Implement https://cplusplus.github.io/CWG/issues/2631.html.

Immediate calls in default arguments and defaults members
are not evaluated.

Instead, we evaluate them when constructing a
`CXXDefaultArgExpr`/`BuildCXXDefaultInitExpr`.

The immediate calls are executed by doing a
transform on the initializing expression.

Note that lambdas are not considering subexpressions so
we do not need to transform them.

As a result of this patch, unused default member
initializers are not considered odr-used, and
errors about members binding to local variables
in an outer scope only surface at the point
where a constructor is defined.

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

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

19 months ago[Precommit][RISCV] Test for unsupported extensions in llvm-objdump
Elena Lepilkina [Wed, 7 Dec 2022 06:42:24 +0000 (09:42 +0300)]
[Precommit][RISCV] Test for unsupported extensions in llvm-objdump

Precommit for https://reviews.llvm.org/D139553

19 months agoRevert "Recommit of 8ae18303f97d5dcfaecc90b4d87effb2011ed82e - part 2"
serge-sans-paille [Fri, 9 Dec 2022 09:15:41 +0000 (10:15 +0100)]
Revert "Recommit of 8ae18303f97d5dcfaecc90b4d87effb2011ed82e - part 2"

This reverts commit 4faf00006cf989f3ae212912994022c0486a2dc4.

19 months ago[flang] Lower intrinsics to HLFIR part 1
Jean Perier [Fri, 9 Dec 2022 09:09:35 +0000 (10:09 +0100)]
[flang] Lower intrinsics to HLFIR part 1

This patch adds support for lowering intrinsics that have no dynamic
optionality aspects to handle and that requires argument to be lowered
to value, addr, or box.

It uses the current intrinsic lowering framework that can be re-used in
HLFIR to start with. HLFIR operations for charater/transformational
intrinsics will be added as needed from an optimization point of view.
The current approach will still create temporary variables for their
value directly in lowering.

Later patch will still need to add:
- support for dynamically optional arguments
- inquires
- "moving" the in memory computation of character and transformational
intrinsics to hlfir.expr. This is not needed from a semantic point of
view, but will help optimizing and will probably be required inside
hlfir.elemental returning characters so that the returned element
type is an hlfir.expr and match the result type of later hlfir.apply.

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

19 months agoRecommit of 8ae18303f97d5dcfaecc90b4d87effb2011ed82e - part 2
serge-sans-paille [Thu, 8 Dec 2022 21:04:39 +0000 (22:04 +0100)]
Recommit of 8ae18303f97d5dcfaecc90b4d87effb2011ed82e - part 2

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

19 months ago[AArch64] Extending lowering of 'zext <Y x i8> %x to <Y x i8X>' to use tbl instructions
Nilanjana Basu [Mon, 28 Nov 2022 03:45:34 +0000 (09:15 +0530)]
[AArch64] Extending lowering of 'zext <Y x i8> %x to <Y x i8X>' to use tbl instructions

Adding support for ZExt lowering for destination types beyond the existing support for (8|16) x i32

Patch for lowering zext instructions to 'tbl' for (8|16)xi8 -> (8|16)xi32 conversions in https://reviews.llvm.org/D120571 is extended to support zext to 'tbl' lowering for Y x i8 to Y x i8X where X > 2 and X < 8, that is, any number of vector elements & any destination element type whose size is a multiple of 8 and lies between 16 & 64 is allowed for this transformation.

Related microbenchmarks are in https://reviews.llvm.org/D136274 & https://reviews.llvm.org/D138059

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

19 months ago[AArch64] Unit test for zext lowering for different types of vectors
Nilanjana Basu [Fri, 2 Dec 2022 18:45:57 +0000 (00:15 +0530)]
[AArch64] Unit test for zext lowering for different types of vectors

These are unit tests for code generated for zext lowering of vectors.
There are tests for different types of vectors, as well as cases where multiple 'zext' instructions of same type occur back-to-back.
Testing of Global-ISel path is added.
This will help in comparing changes in zext lowering in https://reviews.llvm.org/D136722.

Reviewed By: fhahn

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

19 months ago[flang] Generate iteration shape from passed object
Valentin Clement [Fri, 9 Dec 2022 08:18:14 +0000 (09:18 +0100)]
[flang] Generate iteration shape from passed object

When call an elemental subroutine with a monomorphic or polymorphic
passed object, the iteration shape could not be computed. Use the
passed object to infer the implicit iteration shape so the loop
can be constructed.

Reviewed By: PeteSteinfeld

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

19 months ago[LangRef] Fix typo (NFC)
Nikita Popov [Fri, 9 Dec 2022 07:47:00 +0000 (08:47 +0100)]
[LangRef] Fix typo (NFC)

19 months ago[clang] Don't including None.h (NFC)
Kazu Hirata [Fri, 9 Dec 2022 07:36:50 +0000 (23:36 -0800)]
[clang] Don't including None.h (NFC)

These source files no longer use None, so they do not need to include
None.h.

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

19 months ago[llvm] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Fri, 9 Dec 2022 07:21:59 +0000 (23:21 -0800)]
[llvm] Use std::nullopt instead of None in comments (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

19 months agoMark test lld/test/MachO/fat-arch.s updated in e54cfa4 to require aarch64.
Douglas Yung [Fri, 9 Dec 2022 06:41:45 +0000 (22:41 -0800)]
Mark test lld/test/MachO/fat-arch.s updated in e54cfa4 to require aarch64.

19 months ago[clang] Use std::nullopt instead of None in comments (NFC)
Kazu Hirata [Fri, 9 Dec 2022 06:43:11 +0000 (22:43 -0800)]
[clang] Use std::nullopt instead of None in comments (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

19 months ago[AARCH64][CostModel] Modified the cost of mask vector load/store
liqinweng [Fri, 9 Dec 2022 04:45:42 +0000 (12:45 +0800)]
[AARCH64][CostModel] Modified the cost of mask vector load/store

Reviewed By: david-arm

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

19 months ago[mlir] Fix examples build
Jeff Niu [Fri, 9 Dec 2022 05:32:26 +0000 (21:32 -0800)]
[mlir] Fix examples build

Missing two extra parameters.

19 months ago[AAPointerInfo] rearrange code in preparation for further changes
Sameer Sahasrabuddhe [Fri, 9 Dec 2022 05:28:28 +0000 (10:58 +0530)]
[AAPointerInfo] rearrange code in preparation for further changes

AAPointerInfoFloating::updateImpl
  Move the member function definition out of its class before modifying it.

translateAndAddState
  Split the function definition into two along the FromCallee boolean argument.

handleAccess
  This should only be called when Size is not known. In other cases, replaced
  with a direct call to addAccess.

Reviewed By: jdoerfert

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

19 months ago[mlir][ods] Add I8 and I16 cases to BitEnumAttr
Jeff Niu [Thu, 8 Dec 2022 19:51:36 +0000 (11:51 -0800)]
[mlir][ods] Add I8 and I16 cases to BitEnumAttr

Reviewed By: rriddle

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

19 months agoRevert "Reland "[pgo] Avoid introducing relocations by using private alias""
Paul Kirth [Fri, 9 Dec 2022 04:28:43 +0000 (04:28 +0000)]
Revert "Reland "[pgo] Avoid introducing relocations by using private alias""

This reverts commit e89e8dcfad364d23515de25ac87d26dfe25badbb.

Some configurations still have references to discarded sections. I'm
reverting until these can be addressed.

19 months ago[libTooling] Add flag to getRangeForEdit to ignore macro expansions
Eric Li [Thu, 8 Dec 2022 22:01:53 +0000 (17:01 -0500)]
[libTooling] Add flag to getRangeForEdit to ignore macro expansions

This commit resolves the FIXME around the behavior of
`Lexer::makeFileCharRange` that `getRangeForEdit` inherits around
source locations in macro expansions.

We add a flag to `getRangeForEdit` that allows a caller to disable the
behavior, and instead uses the spelling location instead, with checks
to ensure that the source locations are not within a macro definition.

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

19 months ago[InstCombine] Add tests for udiv with shl-mul; NFC
Chenbing Zheng [Fri, 9 Dec 2022 03:18:31 +0000 (11:18 +0800)]
[InstCombine] Add tests for udiv with shl-mul; NFC

19 months ago[lld-macho] Fix bug in reading cpuSubType field.
Vy Nguyen [Wed, 7 Dec 2022 20:54:48 +0000 (15:54 -0500)]
[lld-macho] Fix bug in reading cpuSubType field.

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

19 months ago[Bazel] Set HAVE_DLADDR in config.h
NAKAMURA Takumi [Fri, 9 Dec 2022 02:41:14 +0000 (11:41 +0900)]
[Bazel] Set HAVE_DLADDR in config.h

Corresponding to CMake change in llvmorg-16-init-13673-g138d53895734

19 months agoImprove error handling for invalid breakpoint `-t` and `-x` options.
Jordan Rupprecht [Fri, 9 Dec 2022 01:53:54 +0000 (17:53 -0800)]
Improve error handling for invalid breakpoint `-t` and `-x` options.

Breakpoint option `-t` checks that `option_arg` is empty by checking `option_arg[0] == '\0'`. This is unnecessary: the next two checks for comparing against "current" and calling `getAsInteger` already gracefully handle an empty StringRef. If the `option_arg` string is empty, this crashes (or triggers an assertion failure with asserts enabled). Also, this sets the thread id to `LLDB_INVALID_THREAD_ID` if the thread id is invalid -- it should just not set the thread id.

Likewise of `-x` which checks `option_arg[0] == '\n'` unnecessarily.

I believe both of these bugs are unreachable via normal LLDB usage, and are only accessible via the fuzzer -- most likely some other CLI parsing is trimming whitespace and rejecting empty inputs. Still, it doesn't hurt to simplify this bit.

19 months agoReland "[pgo] Avoid introducing relocations by using private alias"
Paul Kirth [Fri, 9 Dec 2022 00:28:37 +0000 (00:28 +0000)]
Reland "[pgo] Avoid introducing relocations by using private alias"

In many cases, we can use an alias to avoid a symbolic relocations,
instead of using the public, interposable symbol. When the instrumented
function is in a COMDAT, we can use a hidden alias, and still avoid
references to discarded sections.

This version makes the new runtime test a Linux only test.

Reviewed By: phosek

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

19 months ago[LoongArch] Remove GlobalISel from the LINK_COMPONENTS list. NFC
Weining Lu [Fri, 9 Dec 2022 01:11:10 +0000 (09:11 +0800)]
[LoongArch] Remove GlobalISel from the LINK_COMPONENTS list. NFC

LoongArch doesn't use GlobalISel for now.

19 months ago[NFC] Fix leak handling breakpoint names.
Jordan Rupprecht [Fri, 9 Dec 2022 01:14:38 +0000 (17:14 -0800)]
[NFC] Fix leak handling breakpoint names.

The breakpoint list is a list of raw pointers. When breakpoints are removed, the memory is not deleted. Switch to unique pointers. I did some minor cleanup while making this change.

Found by the LLDB command interpreter fuzzer. The input is `br m G`.

19 months ago[gn build] Port 3b7af2796b3d
LLVM GN Syncbot [Fri, 9 Dec 2022 01:06:43 +0000 (01:06 +0000)]
[gn build] Port 3b7af2796b3d

19 months agoRevert "Revert "[-Wunsafe-buffer-usage] Initial commit - Transition away from raw...
Artem Dergachev [Fri, 9 Dec 2022 00:40:33 +0000 (16:40 -0800)]
Revert "Revert "[-Wunsafe-buffer-usage] Initial commit - Transition away from raw buffers.""

This reverts commit bc0617795f8bdcd5deab3e48b120107cc2833cdc.

Be more careful with #includes to avoid linker errors on some buildbots.

19 months ago[NFC] Fix leak in command options configuration.
Jordan Rupprecht [Fri, 9 Dec 2022 00:37:43 +0000 (16:37 -0800)]
[NFC] Fix leak in command options configuration.

`m_options.Append(new OptionPermissions())` leaks because the pointer passed in is not owned. Use a class member to ensure lifetime, which is the common pattern used for this API.

Found by the LLDB command interpreter fuzzer. The fuzz input is running `ap $` twice.

19 months ago[ModuleUtils][KCFI] Set !kcfi_type metadata for sanitizer constructors
Sami Tolvanen [Fri, 9 Dec 2022 00:06:36 +0000 (00:06 +0000)]
[ModuleUtils][KCFI] Set !kcfi_type metadata for sanitizer constructors

Set KCFI type metadata for the sanitizer constructors to prevent
runtime failures when these functions are indirectly called in
instrumented code. This fixes a compatibility issue with KASAN and
-fsanitize=kcfi in the Linux kernel.

Link: https://github.com/ClangBuiltLinux/linux/issues/1742
Reviewed By: nickdesaulniers, MaskRay

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