platform/upstream/llvm.git
19 months ago[clang-tidy][NFC] Simply match processing in misc-use-anonymous-namespace
Carlos Galvez [Mon, 12 Dec 2022 13:36:29 +0000 (13:36 +0000)]
[clang-tidy][NFC] Simply match processing in misc-use-anonymous-namespace

No need for the templated function "processMatch", since
we can infer the type with llvm:isa.

19 months ago[include-cleaner] Include the reference type when printing the SymbolReference.
Haojian Wu [Mon, 12 Dec 2022 12:47:46 +0000 (13:47 +0100)]
[include-cleaner] Include the reference type when printing the SymbolReference.

This information is useful when printing the reference for debugging
purposes.

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

19 months ago[Clang] Convert CXX tests to opaque pointers (NFC)
Nikita Popov [Mon, 12 Dec 2022 13:49:32 +0000 (14:49 +0100)]
[Clang] Convert CXX tests to opaque pointers (NFC)

19 months agoRevert "[Clang][NFC] Prevent lit tests from matching substrings in current path"
Nikita Popov [Mon, 12 Dec 2022 13:43:14 +0000 (14:43 +0100)]
Revert "[Clang][NFC] Prevent lit tests from matching substrings in current path"

This reverts commit bb48aa20e761e26226c6f909a07246781d68ba41.

Using placeholders inside CHECK-LABEL is not legal.

19 months ago[flang] Match alternative names for crtend in fastmath test
Tom Eccles [Mon, 12 Dec 2022 13:31:06 +0000 (13:31 +0000)]
[flang] Match alternative names for crtend in fastmath test

The fastmath test checks that crtfastmath.o is added between crtbeginS.o
and crtendS.o. On some systems, crtend is called crtend.o - match these
too.

Related to https://reviews.llvm.org/D138675

19 months ago[mlir][bufferize] Fix typo in EmptyTensorElimination
Matthias Springer [Mon, 12 Dec 2022 13:16:41 +0000 (14:16 +0100)]
[mlir][bufferize] Fix typo in EmptyTensorElimination

The structure of the code has changed a while ago and the code was not updated properly.

There is no test case for this because we do currently not have an op
that could trigger this bug.

Reviewed By: nicolasvasilache

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

19 months ago[mlir][bufferize] Implement BufferizableOpInterface for tensor.empty
Matthias Springer [Mon, 12 Dec 2022 13:16:28 +0000 (14:16 +0100)]
[mlir][bufferize] Implement BufferizableOpInterface for tensor.empty

The op is not bufferizable but should be analyzable (for `EliminateEmptyTensors`, which uses the bufferization infrastructure).

Also improve debugging functionality and error messages.

Also adds a missing pass to the sparse pipeline. (tensor.empty should be replaced with bufferization.alloc_tensor, but it sometimes used to work without depending on how the tensor.empty is used. Now we always fail explicitly.)

19 months ago[Alignment][NFC] Use Align in MCSymbol::setCommon
Guillaume Chatelet [Mon, 12 Dec 2022 09:44:12 +0000 (09:44 +0000)]
[Alignment][NFC] Use Align in MCSymbol::setCommon

This patch supersedes D138705.

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

19 months ago[flang] Perform polymorphic pointer association with runtime call
Valentin Clement [Mon, 12 Dec 2022 13:04:17 +0000 (14:04 +0100)]
[flang] Perform polymorphic pointer association with runtime call

pointer association to a polymorphic pointer needs to potentially
update the element size in the descriptor. Update the pointer association
to polymoprhic pointer with a runtime call to PointerAssociate.

Reviewed By: jeanPerier

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

19 months ago[PowerPC][GISel] add the missing verify option - NFC
Chen Zheng [Mon, 12 Dec 2022 12:59:27 +0000 (12:59 +0000)]
[PowerPC][GISel] add the missing verify option - NFC

19 months ago[PowerPC][GISel] support 32 bit load/store
Chen Zheng [Sun, 9 Oct 2022 08:45:59 +0000 (08:45 +0000)]
[PowerPC][GISel] support 32 bit load/store

Reviewed By: arsenm

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

19 months ago[mlir] make DiagnosedSilenceableError(LogicalResult) ctor private
Alex Zinenko [Wed, 2 Nov 2022 15:22:43 +0000 (15:22 +0000)]
[mlir] make DiagnosedSilenceableError(LogicalResult) ctor private

Now we have more convenient functions to construct silenceable errors
while emitting diagnostics, and the constructor is ambiguous as it
doesn't tell whether the logical error is silencebale or definite.

Reviewed By: nicolasvasilache

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

19 months ago[clangd] Fix a typo "Features.h" => "Feature.h" in IWYU pragma.
Haojian Wu [Mon, 12 Dec 2022 12:40:36 +0000 (13:40 +0100)]
[clangd] Fix a typo "Features.h" => "Feature.h" in IWYU pragma.

19 months ago[PowerPC][GISel] support 64 bit load/store
Chen Zheng [Sun, 9 Oct 2022 03:31:00 +0000 (03:31 +0000)]
[PowerPC][GISel] support 64 bit load/store

Reviewed By: arsenm

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

19 months ago[Test] Regenerate checks in turn-to-invariant.ll
Max Kazantsev [Mon, 12 Dec 2022 12:16:09 +0000 (19:16 +0700)]
[Test] Regenerate checks in turn-to-invariant.ll

Due to changes in update script, it now has 'define' prefix in every check,
which is distracting.

19 months ago[clangd] Remove a gest-internal header, NFC
Haojian Wu [Mon, 12 Dec 2022 12:14:24 +0000 (13:14 +0100)]
[clangd] Remove a gest-internal header, NFC

gmock-more-matchers.h is a private header, we should use gmock.h which
is already included in the test.

19 months ago[llvm-exegesis][X86] Add memory pipe counters to SLM model
Simon Pilgrim [Mon, 12 Dec 2022 11:28:22 +0000 (11:28 +0000)]
[llvm-exegesis][X86] Add memory pipe counters to SLM model

There might not be any exposed alu pipe counters for us to measure - but the sum of load/store uop counters seems to give a really good approximation to memory controller usage - even for more complex instructions like cmpxchg

19 months ago[Test] Add some IndVars test with swapped true/false branches
Max Kazantsev [Mon, 12 Dec 2022 12:05:33 +0000 (19:05 +0700)]
[Test] Add some IndVars test with swapped true/false branches

Just to make sure our transforms work correctly with them.

19 months ago[mlir] Fix -Wstrict-prototypes warning
Tom Eccles [Mon, 5 Dec 2022 12:07:51 +0000 (12:07 +0000)]
[mlir] Fix -Wstrict-prototypes warning

These warnings prevent compilation using clang and
-DLLVM_ENABLE_WERROR=On.

Differential revision: https://reviews.llvm.org/D139322

19 months ago[NFC] Removal of complex deinterleaving i64 test cases
Nicholas Guy [Mon, 12 Dec 2022 12:02:00 +0000 (12:02 +0000)]
[NFC] Removal of complex deinterleaving i64 test cases

The tests in question are not particularly useful for testing complex
deinterleaving, especially due to i64 complex adds not being supported in mve.
The tests are being removed as they are hitting an unrelated pre-existing
condition regarding register spilling.

19 months ago[ARM][CodeGen] Add integer support for complex deinterleaving
Nicholas Guy [Thu, 8 Dec 2022 13:56:38 +0000 (13:56 +0000)]
[ARM][CodeGen] Add integer support for complex deinterleaving

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

19 months ago[AArch64][SVE][Fixed length] Fix div miscompile
Peter Waller [Thu, 8 Dec 2022 11:09:20 +0000 (11:09 +0000)]
[AArch64][SVE][Fixed length] Fix div miscompile

The prior code worked before SVE DIV was enabled 128 bit vectors.
With 128 bit vectors, when run on a 256 bit machine, it would split and
do a signed unpack, but this resulted in one full vector and one empty
vector with a half-sized predicate. The effect was that only half the
elements were treated correctly.

The fix is to bisect the vector, sign extend, do the division, truncate
and then concat.

Fixes #59357.

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

19 months ago[UpdateTestChecks] Match define for labels
Sebastian Neubauer [Mon, 12 Dec 2022 11:28:45 +0000 (12:28 +0100)]
[UpdateTestChecks] Match define for labels

Previously, the label also matched function calls with the function
name, which caused tests to fail because the label matched on the wrong
line.
Add the `define` prefix, so only function defines are matched.

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

19 months ago[flang] match alternate names for crtbegin in fastmath test
Tom Eccles [Mon, 12 Dec 2022 11:28:21 +0000 (11:28 +0000)]
[flang] match alternate names for crtbegin in fastmath test

The fastmath test checks that crtfastmath.o is added between crtbeginS.o
and crtend.o. On some systems the first file is instead called
crtbegin.o - match these too.

Related to https://reviews.llvm.org/D138675

19 months ago[Clang][NFC] Prevent lit tests from matching substrings in current path
Sameer Sahasrabuddhe [Mon, 12 Dec 2022 11:01:43 +0000 (16:31 +0530)]
[Clang][NFC] Prevent lit tests from matching substrings in current path

19 months ago[IndVars][NFC] Separate creation of condition and replacement in foldExit
Max Kazantsev [Mon, 12 Dec 2022 10:48:42 +0000 (17:48 +0700)]
[IndVars][NFC] Separate creation of condition and replacement in foldExit

It is a preparatory step for further improvements.

19 months ago[sanitizers][windows] Correctly override functions with backward jmps
Markus Böck [Mon, 12 Dec 2022 10:45:31 +0000 (11:45 +0100)]
[sanitizers][windows] Correctly override functions with backward jmps

To reproduce: Download and run the latest Firefox ASAN build (https://firefox-ci-tc.services.mozilla.com/api/index/v1/task/gecko.v2.mozilla-central.latest.firefox.win64-asan-opt/artifacts/public/build/target.zip) on Windows 11 (version 10.0.22621 Build 22621); it will crash on launch. Note that this doesn't seem to crash on another Windows 11 VM I've tried, so I'm not sure how reproducible it is across machines, but it reproduces on my machine every time.

The problem seems to be that when overriding the memset function in OverrideFunctionWithRedirectJump(), the relative_offset is stored as a uptr. Per the Intel x64 instruction set reference (https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf - warning: large PDF), on page 646 the jmp instruction (specifically the near jump flavors that start with E9, which are the ones the OverrideFunctionWithRedirectJump() considers) treats the offset as a signed displacement. This causes an incorrect value to be stored for REAL(memset) which points to uninitialized memory, and a crash the next time that gets called.

The fix is to simply treat that offset as signed. I have also added a test case.

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

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

19 months agoFix mismatch in kate !bang operator list
Simon Pilgrim [Mon, 12 Dec 2022 10:42:51 +0000 (10:42 +0000)]
Fix mismatch in kate !bang operator list

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

19 months agosanmd: improve precision of UAR analysis
Dmitry Vyukov [Sun, 11 Dec 2022 09:37:46 +0000 (10:37 +0100)]
sanmd: improve precision of UAR analysis

Only mark functions that have address-taken locals
as requiring UAR checking.

On a large internal app this reduces number of marked functions
from 78441 to 66618. Mostly small, trivial getter/setter-type
functions are unmarked, but also some amount of larger
number-crunching-type functions are unmarked as well.

Reviewed By: melver

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

19 months ago[IndVars][NFC] Separate invariant condition creation and cond replacement
Max Kazantsev [Mon, 12 Dec 2022 10:01:03 +0000 (17:01 +0700)]
[IndVars][NFC] Separate invariant condition creation and cond replacement

This separation is a preparatory step for further improvements in this code.
Also simplifies this function's API.

19 months ago[mlir][Transform] NFC - Return omitted loop construct in transform.tile_reduction_xxx ops
Nicolas Vasilache [Mon, 12 Dec 2022 10:13:54 +0000 (02:13 -0800)]
[mlir][Transform] NFC - Return omitted loop construct in transform.tile_reduction_xxx ops

19 months agoRevert "[AAPointerInfo] track multiple constant offsets for each use"
Sameer Sahasrabuddhe [Mon, 12 Dec 2022 08:20:52 +0000 (13:50 +0530)]
Revert "[AAPointerInfo] track multiple constant offsets for each use"

Assertion fired in openmp-offload-amdgpu-runtime:
https://lab.llvm.org/buildbot/#/builders/193/builds/23177

This reverts commit c2a0baad1fbb21fe111fef83ec93c2d7923b9b0c.

19 months ago[MLIR] Vectorize tensor.extract on n-D tensor (n >= 2)
Andrzej Warzynski [Wed, 19 Oct 2022 17:04:31 +0000 (17:04 +0000)]
[MLIR] Vectorize tensor.extract on n-D tensor (n >= 2)

This patch implements the vectorization of tensor.extract for arbitrary
tensors. It basically extends https://reviews.llvm.org/D133786 by adding
support for n-D tensors (n >= 2). This is implemented by essentially
flattening the indices.

When benchmarking the vectorized code, we have observed that it is
slower than the scalar code. That's most likely due to sub-optimal (and,
in general slow) gather loads. More work is needed to identify an
implementation and/or a representation that would lead to better code.
In the meantime, the vectorization of n-D tensors (where n >= 2) has to
be explicitly enabled. This can be done either via:
  * transfer dialect's `vectorize_nd_extract` attribute,
  * dedicated bool argument in the `vectorize` method from
    "Vectorization.cpp".
The second option was added to control the new functionality through
means other than the transfer dialect.

Related discussion: https://github.com/iree-org/iree/issues/9198

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

19 months ago[IndVars][NFC] Remove redundant param in optimizeLoopExitWithUnknownExitCount
Max Kazantsev [Mon, 12 Dec 2022 08:21:33 +0000 (15:21 +0700)]
[IndVars][NFC] Remove redundant param in optimizeLoopExitWithUnknownExitCount

There was a crippled version of this transform for Inverted predicate, so the same
query was done twice. Advanced version of this transform wasn't implemented for
inverted condition. Thus, the code was hard to read. The only real purpose of the
Inverted param was to make a simple isKnownPredicateAt query.

Instead if this, use evaluatePredicateAt to solve the task for both inverted and
non-inverted predicate. This slightly changes the order of queries, but effectively
it should save some time by avoiding duplicating queries, and simplifies the code a lot.

I also could not find any evidence that we ever eliminate anything with Inverted = true,
but conservatively preserved the current behavior. Maybe we can remove it and save
some compile time.

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

19 months ago[Assignment Tracking][13/*] Account for assignment tracking in SROA
OCHyams [Mon, 12 Dec 2022 09:18:59 +0000 (09:18 +0000)]
[Assignment Tracking][13/*] Account for assignment tracking in SROA

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

Split dbg.assign intrinsics into fragments similarly to what SROA already does
for dbg.declares, except that there's many more intrinsics to split. The
function migrateDebugInfo generates new dbg.assigns intrinsic for each part of
a split store.

Reviewed By: jmorse

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

19 months agoFix 5bb06c7cce6bdcffb3ced29fa733c0dbb1b63c41 build on windows.
Andrew Browne [Mon, 12 Dec 2022 09:22:05 +0000 (01:22 -0800)]
Fix 5bb06c7cce6bdcffb3ced29fa733c0dbb1b63c41 build on windows.

```
C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\lib\Transforms\Instrumentation\DataFlowSanitizer.cpp(1062,37): error: call to constructor of 'llvm::APInt' is ambiguous
                                    llvm::APInt(32, dbgloc.getLine(), false));
                                    ^           ~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\include\llvm/ADT/APInt.h(108,3): note: candidate constructor
  APInt(unsigned numBits, uint64_t val, bool isSigned = false)
  ^
C:\b\slave\clang-x64-windows-msvc\llvm-project\llvm\include\llvm/ADT/APInt.h(134,3): note: candidate constructor
  APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
  ^
1 error generated.
```

19 months ago[LoongArch] Test CodeGen/LoongArch/intrinsic-la32.c with -O2. NFC.
gonglingqin [Mon, 12 Dec 2022 09:13:52 +0000 (17:13 +0800)]
[LoongArch] Test CodeGen/LoongArch/intrinsic-la32.c with -O2. NFC.

To avoid excessive redundancy in test cases, use -O2 instead of -O0
for testing.

19 months ago[mlir] fixes to transform::SequenceOp
Alex Zinenko [Tue, 6 Dec 2022 14:17:33 +0000 (15:17 +0100)]
[mlir] fixes to transform::SequenceOp

Harden the verifier to check that the block argument type matches the
operand type, when present. This was overlooked when transform dialect
types were introduced.

Fix the builders to preserve the insertion point before creating the
block, otherwise the insertion point is updated to be within the block
by `createBlock` and never reset to be after the sequence op itself,
leading all following operations to be created in the unexpected to
the caller place.

Reviewed By: chelini, springerm

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

19 months ago[ProfileData] llvm::Optional => std::optional
Fangrui Song [Mon, 12 Dec 2022 09:11:55 +0000 (09:11 +0000)]
[ProfileData] llvm::Optional => std::optional

19 months ago[include-cleaner] Add a unique_ptr-style member expr test in WalkASTTest.
Haojian Wu [Mon, 12 Dec 2022 08:52:06 +0000 (09:52 +0100)]
[include-cleaner] Add a unique_ptr-style member expr test in WalkASTTest.

This is a test I missed to mention in https://reviews.llvm.org/D139087.

Reviewed By: VitaNuo

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

19 months ago[Transforms/Vectorize] llvm::Optional => std::optional
Fangrui Song [Mon, 12 Dec 2022 08:56:35 +0000 (08:56 +0000)]
[Transforms/Vectorize] llvm::Optional => std::optional

19 months ago[Assignment Tracking Analysis] Add target triple to test
OCHyams [Mon, 12 Dec 2022 08:39:14 +0000 (08:39 +0000)]
[Assignment Tracking Analysis] Add target triple to test

Build-bot failure: https://lab.llvm.org/buildbot/#/builders/214/builds/4756
Original commit: 1d1de7467c32d52926ca56b9167a2c65c451ecfa
Work-around commit: 34a3259fab86aaa1a20224e08849775f3593e6a3

19 months ago[BasicAA] Remove support for PhiValues analysis
Nikita Popov [Fri, 9 Dec 2022 14:29:35 +0000 (15:29 +0100)]
[BasicAA] Remove support for PhiValues analysis

BasicAA currently has an optional dependency on the PhiValues
analysis. However, at least with our current pipeline setup, we
never actually make use of it. It's possible that this used to work
with the legacy pass manager, but I'm not sure of that either.

Given that this analysis has not actually been in use for a long
time, and nobody noticed or complained, I think we should drop
support for it and focus on one code path. It is worth noting that
analysis quality for the non-PhiValues case has significantly
improved in the meantime.

If we really wanted to make use of PhiValues, the right way would
probably be to pass it in via AAQI in places we want to use it,
rather than using an optional pass manager dependency (which are
an unpredictable PITA and should really only ever be used for
analyses that are only preserved and not used).

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

19 months ago[gn build] Port 800533283524
LLVM GN Syncbot [Mon, 12 Dec 2022 08:36:01 +0000 (08:36 +0000)]
[gn build] Port 800533283524

19 months ago[DAGCombine] Fold Splat(bitcast(buildvector(x,..))) to splat(x)
David Green [Mon, 12 Dec 2022 08:35:43 +0000 (08:35 +0000)]
[DAGCombine] Fold Splat(bitcast(buildvector(x,..))) to splat(x)

This adds a fold which teaches the backend to fold
splat(bitcast(buildvector(x,..))) or
splat(bitcast(scalar_to_vector(x))) to a single splat.

This only handles lane 0 splats, which are only valid under LE, and
needs to be a little careful with the types it creates for the new
buildvector.

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

19 months ago[AA] Remove CFL AA passes
Nikita Popov [Fri, 9 Dec 2022 10:57:50 +0000 (11:57 +0100)]
[AA] Remove CFL AA passes

The CFL Steens/Anders alias analysis passes are not enabled by
default, and to the best of my knowledge have no pathway towards
ever being enabled by default. The last significant interest in
these passes seems to date back to 2016. Given the little
maintenance these have seen in recent times, I also have very
little confidence in the correctness of these passes. I don't
think we should keep these in-tree.

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

19 months ago[lldb] Modify TestThreadJump to work around a change in clang's debug_line generation
Pavel Labath [Mon, 12 Dec 2022 08:27:48 +0000 (09:27 +0100)]
[lldb] Modify TestThreadJump to work around a change in clang's debug_line generation

After D133376, jumping to the return line in the otherfn function became
ambiguous because it has two line entries associated with it. Work
around that problem by changing the function. Filed PR59458 to track
possible improvements in jump target disambiguation.

19 months ago[mlir] Clean up typos in FileCheck directives in various tests.
Benjamin Chetioui [Mon, 12 Dec 2022 08:27:29 +0000 (09:27 +0100)]
[mlir] Clean up typos in FileCheck directives in various tests.

Reviewed By: tpopp

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

19 months agoTransforms/Utils: llvm::Optional => std::optional
Fangrui Song [Mon, 12 Dec 2022 08:29:05 +0000 (08:29 +0000)]
Transforms/Utils: llvm::Optional => std::optional

19 months ago[mlir][affine] Fix crash in AffineApplyOp canonicalization
Matthias Springer [Mon, 12 Dec 2022 08:06:41 +0000 (09:06 +0100)]
[mlir][affine] Fix crash in AffineApplyOp canonicalization

This test case used to crash with a failed assertion:
```
AffineExpr.cpp:659 in AffineExpr simplifyMul(AffineExpr, AffineExpr): lhs.isSymbolicOrConstant() || rhs.isSymbolicOrConstant()
```

This was caused by combining two affine maps, which created a multiplication of two non-symbols.

19 months ago[AAPointerInfo] track multiple constant offsets for each use
Sameer Sahasrabuddhe [Mon, 12 Dec 2022 08:06:45 +0000 (13:36 +0530)]
[AAPointerInfo] track multiple constant offsets for each use

An expression of the form `gep(base, select(pred, const1, const2))` can result
in a set of offsets instead of just one. PointerInfo can now track these sets
instead of conservatively modeling them as Unknown. In general, AAPointerInfo
now uses AAPotentialConstantValues to examine the operands of the GEP.

Reviewed By: jdoerfert

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

19 months ago[DFSan] Add callback that allows to track which function tainted data reaches.
Andrew Browne [Sat, 10 Dec 2022 01:47:54 +0000 (17:47 -0800)]
[DFSan] Add callback that allows to track which function tainted data reaches.

Authored-by: Christopher Liebchen <liebchen@google.com>
Co-authored-by: Andrew Browne <browneee@google.com>
Reviewed By: browneee

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

19 months ago[DAGCombiner] Scalarize extend/truncate for splat vector.
jacquesguan [Mon, 11 Apr 2022 03:15:15 +0000 (03:15 +0000)]
[DAGCombiner] Scalarize extend/truncate for splat vector.

This revision scalarizes extend/truncate for splat vector.

Reviewed By: RKSimon

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

19 months ago[mlir] Add LLDB visualizers for MLIR constructs
River Riddle [Thu, 8 Dec 2022 04:09:28 +0000 (20:09 -0800)]
[mlir] Add LLDB visualizers for MLIR constructs

This commit adds a significant amount of visualizers attempting
to cover the majority of our visualization needs. It covers:

* Operations/OperationName/Ops/OpInterfaces
* Attributes/Types/Attr|TypeInterfaces/NamedAttribute
* Blocks/Regions
* Various range types (e.g. ValueRange/TypeRange)
* Values/BlockArguments/OpResults

This does require an NFC change to interfaces to rename
the concept field to avoid clash with the base class. It
also requires exposing a few method to the debugger
to help resolve information that is non-trivial to reconstruct.
These methods are re-exported using a debug_Blah naming
scheme to avoid messing with hot methods.

Note that this makes use of the new callback feature in lldb-16
(currently trunk) that allows for providing visualizers based on
a dynamic callback, instead of just the typename. It requires
a very new lldb, but allows for providing good default visualization
for all attributes/operations/types out of the box.

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

19 months ago[mlir:Bytecode] Add shared_ptr<SourceMgr> overloads to allow safe mmap of data
River Riddle [Mon, 5 Dec 2022 21:29:15 +0000 (13:29 -0800)]
[mlir:Bytecode] Add shared_ptr<SourceMgr> overloads to allow safe mmap of data

The bytecode reader currently has no mechanism that allows for directly referencing
data from the input buffer safely. This commit adds shared_ptr<SourceMgr> overloads
that provide an explicit and safe way of extending the lifetime of the input. The usage of
these new overloads is adopted in all of our tooling, and is implicitly used in the filename
only parser methods.

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

19 months ago[BOLT] Fix broken unittests
Amir Ayupov [Mon, 12 Dec 2022 06:34:40 +0000 (22:34 -0800)]
[BOLT] Fix broken unittests

19 months ago[BOLT][NFC] Use std::optional in ShrinkWrapping
Amir Ayupov [Sun, 11 Dec 2022 20:43:26 +0000 (12:43 -0800)]
[BOLT][NFC] Use std::optional in ShrinkWrapping

19 months ago[BOLT][NFC] Use std::optional for readDWARFExpressionTargetReg
Amir Ayupov [Sun, 11 Dec 2022 20:41:57 +0000 (12:41 -0800)]
[BOLT][NFC] Use std::optional for readDWARFExpressionTargetReg

19 months ago[BOLT][NFC] Use std::optional in DWARFRewriter
Amir Ayupov [Sun, 11 Dec 2022 20:40:06 +0000 (12:40 -0800)]
[BOLT][NFC] Use std::optional in DWARFRewriter

19 months ago[BOLT][NFC] Use std::optional in has*NameRegex
Amir Ayupov [Sun, 11 Dec 2022 20:33:47 +0000 (12:33 -0800)]
[BOLT][NFC] Use std::optional in has*NameRegex

19 months ago[BOLT][NFC] Use std::optional in RI
Amir Ayupov [Sun, 11 Dec 2022 20:28:08 +0000 (12:28 -0800)]
[BOLT][NFC] Use std::optional in RI

19 months ago[BOLT][NFC] Use std::optional for getLTOCommonName
Amir Ayupov [Sun, 11 Dec 2022 20:14:15 +0000 (12:14 -0800)]
[BOLT][NFC] Use std::optional for getLTOCommonName

19 months ago[BOLT][NFC] Use std::optional in BC
Amir Ayupov [Sun, 11 Dec 2022 20:02:21 +0000 (12:02 -0800)]
[BOLT][NFC] Use std::optional in BC

19 months ago[BOLT][NFC] Use std::optional in DataAggregator
Amir Ayupov [Sun, 11 Dec 2022 19:57:30 +0000 (11:57 -0800)]
[BOLT][NFC] Use std::optional in DataAggregator

19 months ago[BOLT][NFC] Use std::optional in BAT
Amir Ayupov [Sun, 11 Dec 2022 19:51:08 +0000 (11:51 -0800)]
[BOLT][NFC] Use std::optional in BAT

19 months ago[RISCV] Enable the Machine Late Cleanup pass.
Craig Topper [Mon, 12 Dec 2022 04:44:24 +0000 (20:44 -0800)]
[RISCV] Enable the Machine Late Cleanup pass.

Believe the bug has been fixed with D139169

Reviewed By: asb

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

19 months agoRevert "[OpenMP] Add `abort` to `FATAL_MESSAGE`"
Shilei Tian [Mon, 12 Dec 2022 03:46:56 +0000 (22:46 -0500)]
Revert "[OpenMP] Add `abort` to `FATAL_MESSAGE`"

This reverts commit ac65b3c7a2ad67ce17d31dc14867dc83650f751e.

19 months ago[OpenMP] Add `abort` to `FATAL_MESSAGE`
Shilei Tian [Mon, 12 Dec 2022 03:41:22 +0000 (22:41 -0500)]
[OpenMP] Add `abort` to `FATAL_MESSAGE`

19 months ago[CSKY][NFC] Fix check-all error due to change of expected output
Zi Xuan Wu (Zeson) [Mon, 12 Dec 2022 03:23:17 +0000 (11:23 +0800)]
[CSKY][NFC] Fix check-all error due to change of expected output

- Remove unnecessary symbol offset check in MC cases.
- Change other expected output in CodeGen cases.

19 months ago[NFC] Update comment for TRUNC followed by a masked store
Xiang1 Zhang [Mon, 12 Dec 2022 03:24:41 +0000 (11:24 +0800)]
[NFC] Update comment for TRUNC followed by a masked store

19 months ago[NFC][Clang] Add missing test cases for segment load
Zakk Chen [Tue, 17 May 2022 03:09:22 +0000 (20:09 -0700)]
[NFC][Clang] Add missing test cases for segment load

This patch fixed the missing test cases from: 010f329803c84e43ec15ffaff7b6e26b032cbcc6

Reviewed By: kito-cheng, craig.topper

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

19 months ago[VP][RISCV] Add vp.bitreverse and RISC-V support.
Yeting Kuo [Fri, 9 Dec 2022 08:20:04 +0000 (16:20 +0800)]
[VP][RISCV] Add vp.bitreverse and RISC-V support.

The patch also added function expandVPBITREVERSE to expand ISD::VP_BITREVERSE nodes.

Reviewed By: craig.topper

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

19 months ago[RISCV][NFC] Define variables for vector VT list of different LMUL
wangpc [Mon, 12 Dec 2022 02:44:45 +0000 (10:44 +0800)]
[RISCV][NFC] Define variables for vector VT list of different LMUL

This reduces several lines of code and these variables can be used
by followed patches.

Reviewed By: craig.topper

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

19 months ago[DAG] Stop combine for masked compressstore
Xiang1 Zhang [Thu, 8 Dec 2022 09:24:20 +0000 (17:24 +0800)]
[DAG] Stop combine for masked compressstore

Reviewed By: WangPengfei

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

19 months ago[StackProtector] Rewrite dominator tree update handling
Roman Lebedev [Mon, 12 Dec 2022 01:46:57 +0000 (04:46 +0300)]
[StackProtector] Rewrite dominator tree update handling

19 months ago[AArch64][NFC] Change order of instructions in isAssociativeAndCommutative
KAWASHIMA Takahiro [Thu, 8 Dec 2022 05:15:21 +0000 (14:15 +0900)]
[AArch64][NFC] Change order of instructions in isAssociativeAndCommutative

Before this change, the order of instructions in `case` labels was
inconsistent. It is alphabetical order for FP instructions but another
order for integer instructions. This commit changes the order to
1) instruction set (base/FP/SIMD), 2) mnemonic, 3) element type.
I believe this change makes it consistent, improves understandability,
and makes it easy to add/remove a group of instructions.

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

19 months ago[AArch64][NFC] Add tests for D134260
KAWASHIMA Takahiro [Thu, 8 Dec 2022 05:15:20 +0000 (14:15 +0900)]
[AArch64][NFC] Add tests for D134260

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

19 months agoEnhance stack protector
Xiang1 Zhang [Fri, 9 Dec 2022 11:16:00 +0000 (19:16 +0800)]
Enhance stack protector

Reviewed By: LuoYuanke

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

19 months ago[gn build] Port 443b46e6d313
LLVM GN Syncbot [Sun, 11 Dec 2022 23:58:49 +0000 (23:58 +0000)]
[gn build] Port 443b46e6d313

19 months ago[analyzer] Fix assertion in getAPSIntType
einvbri [Sat, 10 Dec 2022 01:18:03 +0000 (19:18 -0600)]
[analyzer] Fix assertion in getAPSIntType

getAPSIntType crashes when analzying a simple case that uses a fixed
point type. getAPSIntType needs to handle fixed point types differently
to get sign information. LIT and Unittests were added since there were
 none previously added.

   clang: <root>/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h:155:
      clang::ento::APSIntType clang::ento::BasicValueFactory::getAPSIntType(clang::QualType) const:
      Assertion `T->isIntegralOrEnumerationType() || Loc::isLocType(T)' failed.

    Program received signal SIGABRT, Aborted.
    0x00007ffff66e2387 in raise () from /lib64/libc.so.6
    (gdb) bt
        at <root>/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h:155
        at <root>/clang/include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h:172
          LHS=0x108965a0, op=clang::BO_Shr, RHS=..., resultTy=...) at
          <root>/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:213
          (this=0x1088e460, state=..., op=clang::BO_Shr, lhs=..., rhs=..., resultTy=...)
          at <root>/clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:681

Reviewed By: steakhal

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

19 months ago[openmp] Fix a doc comment issue found by -Wdocumentation
Dmitri Gribenko [Sun, 11 Dec 2022 23:14:01 +0000 (00:14 +0100)]
[openmp] Fix a doc comment issue found by -Wdocumentation

19 months ago[openmp] Fix a doc comment issue found by -Wdocumentation
Dmitri Gribenko [Sun, 11 Dec 2022 20:39:21 +0000 (21:39 +0100)]
[openmp] Fix a doc comment issue found by -Wdocumentation

19 months ago[libc] Fix wrappergen_test.cpp on runtimes build
Joseph Huber [Mon, 5 Dec 2022 18:44:54 +0000 (12:44 -0600)]
[libc] Fix wrappergen_test.cpp on runtimes build

The `tools` directory depends on `llvm_gtest` which is not immediately
availible with a runtimes build. This patch builds the `llvm_gtest`
target if it isn't present. Additionally, we use the CMake binary
directory to find the tool binary, which is different when using a
runtimes build. Using the LLVM binary directory should match both build
conditions.

Reviewed By: lntue

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

19 months ago[OpenMP][libomptarget] Add utility class for reference counting
Kevin Sala [Sun, 11 Dec 2022 15:51:05 +0000 (16:51 +0100)]
[OpenMP][libomptarget] Add utility class for reference counting

The AMDGPU NextGen plugin will use this class for counting the references of some device resources.

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

19 months agoNFC. Refactor/update some affine fusion pass code for readability
Uday Bondhugula [Sun, 11 Dec 2022 19:12:48 +0000 (00:42 +0530)]
NFC. Refactor/update some affine fusion pass code for readability

NFC. Refactor some affine fusion pass code for readability. Some of its
methods are too long. This is the first among some NFC changes before new
features/related updates are posted. Add missing code comments at a couple of
places.

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

19 months ago[CMake] Warn when the version is older than 3.20.0.
Mark de Wever [Wed, 9 Nov 2022 17:08:54 +0000 (18:08 +0100)]
[CMake] Warn when the version is older than 3.20.0.

This is a preparation to require CMake 3.20.0 after LLVM 16 has been
released.

This change has been discussed on discourse
https://discourse.llvm.org/t/rfc-upgrading-llvms-minimum-required-cmake-version/66193

Reviewed By: #libc_vendors, MaskRay, ChuanqiXu, to268, thieta, stellaraccident, ldionne, #libc, #libc_abi, phosek

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

19 months agoRevert rG6a0bbb84cef28ed642a730e55c52447b8c870647 "[X86] RDRAND is a Goldmont feature...
Simon Pilgrim [Sun, 11 Dec 2022 18:19:13 +0000 (18:19 +0000)]
Revert rG6a0bbb84cef28ed642a730e55c52447b8c870647 "[X86] RDRAND is a Goldmont feature, not Silvermont"

RDRAND is a Silvermont feature - confirmed with CPUID

19 months ago[X86] AMD Zen 3 sched model: FMA ops have inverse throughput of 0.5
Roman Lebedev [Sun, 11 Dec 2022 17:56:01 +0000 (20:56 +0300)]
[X86] AMD Zen 3 sched model: FMA ops have inverse throughput of 0.5

Now that exegesis produces meaningful snippets to measure throughtput
for instructions with tied operands:
https://github.com/llvm/llvm-project/commit/2ffe225d113031cc211d20d8d2cb82eeaa1a34a2
the measurements clearly show these instructions to have
more optimistic throughtput.

There's still some noise in the reports, especially around instructions
with memory operands. I'm not sure if we measure those correctly.

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

19 months agoUse poison instead of undef where its used as a placeholder [NFC]
Manuel Brito [Sun, 11 Dec 2022 17:17:34 +0000 (17:17 +0000)]
Use poison instead of undef where its used as a placeholder [NFC]

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

19 months ago[VPlan] Summarize recipes used to model inductions (NFC).
Florian Hahn [Sun, 11 Dec 2022 16:28:42 +0000 (16:28 +0000)]
[VPlan] Summarize recipes used to model inductions (NFC).

Document recipes used to model inductions after introducing
VPDerivedIVRecipe in 0c5df7cd2f81c.

Reviewed By: Ayal

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

19 months ago[Clang] Use poison instead of undef where its used as placeholder [NFC]
Manuel Brito [Sun, 11 Dec 2022 16:16:31 +0000 (16:16 +0000)]
[Clang] Use poison instead of undef where its used as placeholder [NFC]

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

19 months ago[MCA][X86] Add test coverage for PFI instructions
Simon Pilgrim [Sun, 11 Dec 2022 15:57:47 +0000 (15:57 +0000)]
[MCA][X86] Add test coverage for PFI instructions

19 months ago[MCA][X86] Add test coverage for ERI instructions
Simon Pilgrim [Sun, 11 Dec 2022 15:52:38 +0000 (15:52 +0000)]
[MCA][X86] Add test coverage for ERI instructions

19 months ago[MCA][X86] Add missing knotw test
Simon Pilgrim [Sun, 11 Dec 2022 15:35:58 +0000 (15:35 +0000)]
[MCA][X86] Add missing knotw test

19 months ago[MCA][X86] Add missing test coverage for DQ instructions
Simon Pilgrim [Sun, 11 Dec 2022 15:34:34 +0000 (15:34 +0000)]
[MCA][X86] Add missing test coverage for DQ instructions

19 months ago[InstCombine] try to forward-propagate some FMF to select
Sanjay Patel [Sun, 11 Dec 2022 13:50:42 +0000 (08:50 -0500)]
[InstCombine] try to forward-propagate some FMF to select

This is intended to mitigate potential regressions that
would result from restricting this fold for NANs as
discussed in issue #59279.

Ideally, we could do this more generally because we have
known problems seeing/generating FMF on a select, but there
are likely many corner cases that need to verified.

For example, I thought this propagation would be valid
without looking at the condition value and for 'nsz' too,
but according to Alive2, it is not:
https://alive2.llvm.org/ce/z/AnG6As

19 months ago[test][NFC] Guard one test case against LLVM checkouts at interesting paths
WANG Xuerui [Sun, 11 Dec 2022 13:31:11 +0000 (16:31 +0300)]
[test][NFC] Guard one test case against LLVM checkouts at interesting paths

Previously only the "store" string was being checked for not appearing
twice, but unfortunately the check also looked at the ModuleID and
source_filename lines, so the test case would fail if the LLVM
checkout's absolute path contained the substring "store".

Fix this spurious test failure by tweaking the invocation so the full
path no longer shows up in the output.

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

19 months ago[X86] RDRAND is a Goldmont feature, not Silvermont
Simon Pilgrim [Sun, 11 Dec 2022 12:28:22 +0000 (12:28 +0000)]
[X86] RDRAND is a Goldmont feature, not Silvermont

19 months ago[X86] Fix missing HasPRFCHW predicate
Simon Pilgrim [Sun, 11 Dec 2022 11:06:10 +0000 (11:06 +0000)]
[X86] Fix missing HasPRFCHW predicate

This was declared in FeaturePRFCHW but never defined.

Noticed while preparing to add Unsupported features handling to X86 scheduler models.

19 months ago[X86] Fix missing HasX86_64 predicate
Simon Pilgrim [Sun, 11 Dec 2022 10:27:03 +0000 (10:27 +0000)]
[X86] Fix missing HasX86_64 predicate

This was declared in FeatureX86_64 but never defined (we use the *64BitMode predicates for instruction defs - but now we need it for scheduler model defs).

Noticed while preparing to add Unsupported features handling to X86 scheduler models.