platform/upstream/llvm.git
20 months ago[libc] Skip setjmp tests under sanitizers.
Siva Chandra Reddy [Tue, 1 Nov 2022 23:13:57 +0000 (23:13 +0000)]
[libc] Skip setjmp tests under sanitizers.

20 months ago[AArch64][GlobalISel] Add a simple cross-regclass copy optimization post-selection.
Amara Emerson [Tue, 25 Oct 2022 03:51:24 +0000 (20:51 -0700)]
[AArch64][GlobalISel] Add a simple cross-regclass copy optimization post-selection.

This does some trivial cross-regclass folding, where we can either do some extra
constraining to eliminate the copy or modify uses to use a smaller regclass.

There are minor code size improvements on average.

Program                                       size.__text
                                              before         after           diff
tramp3d-v4/tramp3d-v4                         366000.00      366012.00       0.0%
mafft/pairlocalalign                          248196.00      248188.00      -0.0%
7zip/7zip-benchmark                           568612.00      568592.00      -0.0%
kimwitu++/kc                                  434704.00      434676.00      -0.0%
Bullet/bullet                                 456128.00      456096.00      -0.0%
sqlite3/sqlite3                               284136.00      284100.00      -0.0%
ClamAV/clamscan                               381492.00      381396.00      -0.0%
SPASS/SPASS                                   412052.00      411944.00      -0.0%
lencod/lencod                                 428060.00      427912.00      -0.0%
consumer-typeset/consumer-typeset             413148.00      411116.00      -0.5%
                           Geomean difference                               -0.1%

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

20 months ago[libc] Add x86_64 implementation of setjmp and longjmp.
Siva Chandra Reddy [Tue, 1 Nov 2022 06:18:12 +0000 (06:18 +0000)]
[libc] Add x86_64 implementation of setjmp and longjmp.

Reviewed By: michaelrj

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

20 months ago[mlir][sparse] Add rewriting rule for the convert operator.
bixia1 [Mon, 31 Oct 2022 04:55:25 +0000 (21:55 -0700)]
[mlir][sparse] Add rewriting rule for the convert operator.

Reviewed By: aartbik

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

20 months agoHonor LLVM_LIBDIR_SUFFIX
serge-sans-paille [Sun, 30 Oct 2022 17:25:04 +0000 (18:25 +0100)]
Honor LLVM_LIBDIR_SUFFIX

Some distribution install libraries under lib64. LLVM supports this
through LLVM_LIBDIR_SUFFIX, have bolt do the same.

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

20 months ago[mlir][TOSA]Add optional attributes to TOSA custom op
Eric Kunze [Tue, 1 Nov 2022 22:09:56 +0000 (15:09 -0700)]
[mlir][TOSA]Add optional attributes to TOSA custom op

The implementation_attrs attr allows passing of backend specific
attributes to TOSA custom ops.

Also adds a config option to avoid namespace collisions on the
identifier.

Reviewed By: rsuderman

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

20 months ago[llvm-c] Harmonize usage of unwrap (NFC)
Aaron Puchert [Tue, 1 Nov 2022 21:26:40 +0000 (22:26 +0100)]
[llvm-c] Harmonize usage of unwrap (NFC)

Some places were using unwrap<T>(x) = cast<T>(unwrap(x)), even though
the unwrapped value already had type T. Removing the template argument
makes it clear that no cast is intended.

Other places were using cast<T>(unwrap(x)), we replace that with the
shorthand unwrap<T>(x) for consistency.

20 months agoAdd tests which need right Insert Point for merged load
bipmis [Tue, 1 Nov 2022 21:49:44 +0000 (21:49 +0000)]
Add tests which need right Insert Point for merged load

20 months ago[mlir][Linalg] Drop usage of tileWithLinalgTilingOptions in the structured.tile transform
Nicolas Vasilache [Thu, 14 Jul 2022 15:55:03 +0000 (08:55 -0700)]
[mlir][Linalg] Drop usage of tileWithLinalgTilingOptions in the structured.tile transform

This is on a path to deprecation.
Context: https://discourse.llvm.org/t/psa-retire-tileandfuselinalgops-method/63850

As the interface-based transformation is more generic, some additional folding of AffineMin/MaxOp and some extra canonicalizations are needed.
This can be further evolved.

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

20 months agoPatch up attributes on a newly enabled test
Paul Robinson [Tue, 1 Nov 2022 21:14:13 +0000 (14:14 -0700)]
Patch up attributes on a newly enabled test

20 months ago[lldb] Document QSetDetachOnError packet
Felipe de Azevedo Piovezan [Fri, 28 Oct 2022 15:39:17 +0000 (11:39 -0400)]
[lldb] Document QSetDetachOnError packet

The packet was introduced in 106d02866d4d54b09c08e6a12915dba58e709294.

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

20 months agoFix release note indentation; NFC
Aaron Ballman [Tue, 1 Nov 2022 20:54:08 +0000 (16:54 -0400)]
Fix release note indentation; NFC

20 months ago[flang] Add atomic_or to list of intrinsics
Katherine Rasmussen [Mon, 31 Oct 2022 17:53:04 +0000 (10:53 -0700)]
[flang] Add atomic_or to list of intrinsics

Add the atomic subroutine, atomic_or, to the list of
intrinsic subroutines, add its last dummy argument to a check
for a coindexed-object, and update test.

Reviewed By: PeteSteinfeld

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

20 months ago[lit][REQUIRES] Fix some tests with incorrect REQUIRES clauses
Paul Robinson [Mon, 24 Oct 2022 15:34:30 +0000 (08:34 -0700)]
[lit][REQUIRES] Fix some tests with incorrect REQUIRES clauses

These weren't running anywhere because of bad specifications.
One test has bit-rotted and had to be XFAILed, the rest are okay.

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

20 months ago[Sanitizers] Modified __aarch64__ to use the 64 bit version of the allocator.
Kirill Stoimenov [Mon, 31 Oct 2022 23:29:39 +0000 (23:29 +0000)]
[Sanitizers] Modified __aarch64__ to use the 64 bit version of the allocator.

This change will switch SizeClassAllocator32 to SizeClassAllocator64 on ARM. This might potentially affect ARM platforms with 39-bit address space. This addresses [[ https://github.com/google/sanitizers/issues/703  | issues/703  ]], but unlike [[ https://reviews.llvm.org/D60243 | D60243 ]] it defaults to 64 bit allocator.

Reviewed By: vitalybuka, MaskRay

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

20 months ago[InstCombine] use logical-or matcher to avoid crash
Sanjay Patel [Tue, 1 Nov 2022 20:26:20 +0000 (16:26 -0400)]
[InstCombine] use logical-or matcher to avoid crash

This should prevent crashing for the example in issue #58552
by not matching a select-of-vectors-with-scalar-condition.

A similar change is likely needed for the related fold to
properly fix that kind of bug.

The test that shows a regression seems unlikely to occur
in real code.

This also picks up an optimization in the case where a real
(bitwise) logic op is used. We could already convert some
similar select ops to real logic via impliesPoison(), so
we don't see more diffs on commuted tests. Using commutative
matchers (when safe) might also handle one of the TODO tests.

20 months ago[InstCombine] add tests for logical-and / logical-or folds; NFC
Sanjay Patel [Tue, 1 Nov 2022 19:14:47 +0000 (15:14 -0400)]
[InstCombine] add tests for logical-and / logical-or folds; NFC

20 months ago[flang] Handle pointer assignment with polymorphic entities
Valentin Clement [Tue, 1 Nov 2022 20:46:07 +0000 (21:46 +0100)]
[flang] Handle pointer assignment with polymorphic entities

This patch forces pointer and allocatable polymorphic entities to be
tracked as descriptor. It also enables the pointer assignment between
polymorphic entities. Pointer association between a non-polymorphic
pointer and a polyrmophic target might require some more work as
per 10.2.2.3 point 1.

Reviewed By: PeteSteinfeld

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

20 months agoAddress post commit review feedback from D137046
Philip Reames [Tue, 1 Nov 2022 20:34:59 +0000 (13:34 -0700)]
Address post commit review feedback from D137046

It was pointed out the verifier rejects inttoptr and ptrtoint casts with inputs and outputs whose scalability doesn't match.  As such, checking the input type separately from the type of the cast itself is redundant.

20 months ago[CodeView][clang] Add flag to disable emitting command line into CodeView
Arthur Eubanks [Fri, 21 Oct 2022 18:05:04 +0000 (11:05 -0700)]
[CodeView][clang] Add flag to disable emitting command line into CodeView

In https://reviews.llvm.org/D80833, there were concerns about
determinism emitting the commandline into CodeView. We're actually
hitting these when running clang-cl on Linux (cross compiling) versus on
Windows (e.g. -fmessage-length being inferred on terminals).

Add -g[no-]codeview-command-line to enable/disable this feature.
It's still on by default to preserve the current state of clang.

Reviewed By: thakis, rnk

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

20 months ago[GlobalOpt] Don't remove inalloca from varargs functions
Arthur Eubanks [Tue, 1 Nov 2022 18:37:10 +0000 (11:37 -0700)]
[GlobalOpt] Don't remove inalloca from varargs functions

Varargs and inalloca have a weird interaction where varargs are actually
passed via the inalloca alloca. Removing inalloca breaks the varargs
because they're still not passed as separate arguments.

Fixes #58718

Reviewed By: rnk

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

20 months ago[libc++] Improves modular build.
Mark de Wever [Tue, 25 Oct 2022 19:56:01 +0000 (21:56 +0200)]
[libc++] Improves modular build.

Makes sure headers having a xxx_result as return type export the proper
header. Without exporting these modularized headers are not self
contained.

This is related to D136045.

Reviewed By: #libc, ldionne

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

20 months ago[libc++][doc] Updates implementation status.
Mark de Wever [Sat, 29 Oct 2022 10:15:37 +0000 (12:15 +0200)]
[libc++][doc] Updates implementation status.

Claim some tasks for formatting and mark some parts as complete, which
was missed in the commits completing the task.

Reviewed By: #libc, ldionne

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

20 months ago[libc++][format] Fixes default string alignment.
Mark de Wever [Sat, 29 Oct 2022 10:50:26 +0000 (12:50 +0200)]
[libc++][format] Fixes default string alignment.

Fixes https://llvm.org/PR58315

Reviewed By: #libc, ldionne

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

20 months ago[libc++] Validates valid weekday indexed range.
Mark de Wever [Sat, 29 Oct 2022 10:27:54 +0000 (12:27 +0200)]
[libc++] Validates valid weekday indexed range.

No code changes, but only increased the range in the tests.

Completes:
- LWG3273. Specify weekday_indexed to range of [0, 7]

Reviewed By: #libc, ldionne

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

20 months ago[Concepts] Correctly handle failure when checking concepts recursively
Erich Keane [Mon, 31 Oct 2022 15:43:08 +0000 (08:43 -0700)]
[Concepts] Correctly handle failure when checking concepts recursively

Based on discussion on the core reflector, it was made clear that a
concept that depends on itself should be a hard error, not a constraint
failure. This patch implements a stack of constraint-checks-in-progress
to make sure we quit, rather than hitting stack-exhaustion.

Note that we DO need to be careful to make sure we still check
constraints properly that are caused by a previous constraint, but not
derived from (such as when a check causes us to check special member
function generation), so we cannot use the existing logic to see if this
is being instantiated.

This fixes https://github.com/llvm/llvm-project/issues/44304 and
https://github.com/llvm/llvm-project/issues/50891.

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

20 months ago[PatternMatch] don't match a scalar select of bool vectors as a logical-and or logical-or
Sanjay Patel [Tue, 1 Nov 2022 18:35:56 +0000 (14:35 -0400)]
[PatternMatch] don't match a scalar select of bool vectors as a logical-and or logical-or

Most folds based on these matchers already check to make sure the
condition type is the same as the select type, and it seems unlikely
that a fold would want to handle a scalar-select-of-vectors pattern
(there are no regression tests for it).

This is a preliminary step for fixing #issue 58552. The fold(s)
responsible for that crash (D101807, D101375) don't use the matchers
yet, but they probably should.

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

20 months ago[Concepts] Improve diagnostics on a missing 'auto' keyword.
Erich Keane [Tue, 1 Nov 2022 18:37:35 +0000 (11:37 -0700)]
[Concepts] Improve diagnostics on a missing 'auto' keyword.

As reported in https://github.com/llvm/llvm-project/issues/49192,
we did a pretty poor job diagnosing cases where someone forgot 'auto', a
nd is probably in the middle of a variable declaration.  This patch
makes us properly diagnose in cases where the next token is a reference,
or CVR qualifier.

20 months ago[clang][Lex] Header map search case insensitivity
Troy Johnson [Tue, 1 Nov 2022 18:06:30 +0000 (11:06 -0700)]
[clang][Lex] Header map search case insensitivity

Correct D135801 to be case insensitive.

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

20 months ago[X86] Add SchedWriteVecExtend scheduler per-width wrapper
Simon Pilgrim [Tue, 1 Nov 2022 18:18:53 +0000 (18:18 +0000)]
[X86] Add SchedWriteVecExtend scheduler per-width wrapper

Replaces hard coded uses of WriteShuffleX/WriteVPMOV256 for VPMOVSX/VPMOVZX vector extension instructions

20 months ago[asan] Add missing __asan_set_shadow_0x() calls.
Roy Sundahl [Tue, 1 Nov 2022 17:49:25 +0000 (10:49 -0700)]
[asan] Add missing __asan_set_shadow_0x() calls.

Add new calls introduced in https://reviews.llvm.org/D136197 to weak_symbols.txt.

Reviewed By: vitalybuka

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

20 months ago[mlir][sparse] replace magic constant with symbol
Aart Bik [Tue, 1 Nov 2022 17:34:13 +0000 (10:34 -0700)]
[mlir][sparse] replace magic constant with symbol

Reviewed By: Peiming

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

20 months agoSystemZ: Register null target streamer
Matt Arsenault [Sat, 29 Oct 2022 19:35:27 +0000 (12:35 -0700)]
SystemZ: Register null target streamer

Fixes at least one null dereference.

20 months agoXCore: Register null MCTargetStreamer
Matt Arsenault [Sat, 29 Oct 2022 19:55:57 +0000 (12:55 -0700)]
XCore: Register null MCTargetStreamer

Fixes null dereference when printing globals

20 months ago[SCEVExpander] Forget SCEV when replacing congruent phi.
Florian Hahn [Tue, 1 Nov 2022 17:47:47 +0000 (17:47 +0000)]
[SCEVExpander] Forget SCEV when replacing congruent phi.

Otherwise there may be stale values left over in the cache, causing a
SCEV verification failure.

Fixes #58702.

20 months ago[AArch64] SME2 remove comma from the regression tests
Caroline Concatto [Tue, 1 Nov 2022 17:02:08 +0000 (17:02 +0000)]
[AArch64] SME2 remove comma from the regression tests

This patch replaces:
 CHECK, INST by CHECK-INST
 the comma(,) by dash line(-) in the binary encoding

The mistake was introduced when we had to use pintVectoList and the test's
automated update was not checking that a comma should not replace these
parts of the test.

20 months ago[flang] Improve warning message
Peter Klausler [Wed, 12 Oct 2022 17:24:23 +0000 (10:24 -0700)]
[flang] Improve warning message

When a floating-point exception occurs while folding an exponentiation
operation with a host library at compilation time, the warning message
should not say that it was an "intrinsic function".

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

20 months ago[mlir][math][spirv] Add `math.roundeven` lowering to SPIR-V
Jakub Kuderski [Tue, 1 Nov 2022 16:51:08 +0000 (12:51 -0400)]
[mlir][math][spirv] Add `math.roundeven` lowering to SPIR-V

This has two lowering path, one for each extended instructions set:
-  to OpenGL's `RoundEven`,
-  to OpenCL's `rint`.

Implement those two ops and add minimal tests.

Reviewed By: antiagainst

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

20 months ago[RISCV][docs] Add some wording around vendor extensions
Philip Reames [Tue, 1 Nov 2022 16:33:32 +0000 (09:33 -0700)]
[RISCV][docs] Add some wording around vendor extensions

This adds an initial bit of policy around inclusion of vendor extensions. My intention here is to leave all of the actual decision making to a case by case decision on the regular sync calls, but to spell out some of the pieces we've discussed and (I think) have general agreement on.

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

20 months agoAllow scalable vectors in ComputeNumSignBits and isKnownNonNull
Philip Reames [Tue, 1 Nov 2022 16:22:24 +0000 (09:22 -0700)]
Allow scalable vectors in ComputeNumSignBits and isKnownNonNull

This is a follow up to D136470 which extends the same scheme used there to ComputeNumSignBits and isKnownNonNull. As a reminder, for scalable vectors we track a single bit which is implicitly broadcast to all lanes. We do not know how many lanes there are statically, and thus have to be conservative along paths which require exact sizes.

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

20 months ago[lldb] Don't crash when printing static enum members with bool as underlying type
Arthur Eubanks [Sun, 30 Oct 2022 19:42:40 +0000 (12:42 -0700)]
[lldb] Don't crash when printing static enum members with bool as underlying type

Undoes a lot of the code added in D135169 to piggyback off of the enum logic in `TypeSystemClang::SetIntegerInitializerForVariable()`.

Fixes #58383.

Reviewed By: DavidSpickett

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

20 months ago[SCCP] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 1 Nov 2022 16:05:47 +0000 (17:05 +0100)]
[SCCP] Convert tests to opaque pointers (NFC)

Conversion was performed using
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34
plus manual (but uninteresting) fixup.

20 months ago[mlir][OpenMP] Add aligned clause definition to simd construct
Dominik Adamski [Thu, 20 Oct 2022 09:29:57 +0000 (04:29 -0500)]
[mlir][OpenMP] Add aligned clause definition to simd construct

simd aligned construct is represented as pair of variable which needs
to be aligned and corresponding alignment value.

Added parser, printer and verifier of aligned clause. MLIR tests were
updated to test correctness of MLIR definition of aligned clause.

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

Reviewed By: kiranchandramohan

20 months ago[PatternMatch] add unittests for logical-and/or; NFC
Sanjay Patel [Tue, 1 Nov 2022 16:04:04 +0000 (12:04 -0400)]
[PatternMatch] add unittests for logical-and/or; NFC

20 months agoRevert "[ValueLattice] Fix getCompare() for undef values"
Nikita Popov [Tue, 1 Nov 2022 16:03:40 +0000 (17:03 +0100)]
Revert "[ValueLattice] Fix getCompare() for undef values"

This reverts commit 6de41e6d7652b74a5aa2bd78b0597cc53a8c3c2a.

Missed a unit test affected by this change, revert for now.

20 months ago[SCCP] Regenerate test checks (NFC)
Nikita Popov [Tue, 1 Nov 2022 16:00:17 +0000 (17:00 +0100)]
[SCCP] Regenerate test checks (NFC)

20 months agoRevert "[OpenMP] [OMPT] [2/8] Implemented a connector for communication of OMPT callb...
Dhruva Chakrabarti [Tue, 1 Nov 2022 15:59:58 +0000 (08:59 -0700)]
Revert "[OpenMP] [OMPT] [2/8] Implemented a connector for communication of OMPT callbacks between libraries."

This reverts commit f94c2679cb1db92ce4103487bf0247eca6e4d722.

20 months agoImplement support for AArch64ISD::MOVI in computeKnownBits
Adrian Tong [Mon, 31 Oct 2022 17:22:17 +0000 (17:22 +0000)]
Implement support for AArch64ISD::MOVI in computeKnownBits

This helps simplify a USHR+ORR into USRA on AArch64

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

20 months agoAdd formatting support for VSCode logpoints message
Jeffrey Tan [Tue, 25 Oct 2022 16:42:34 +0000 (09:42 -0700)]
Add formatting support for VSCode logpoints message

https://reviews.llvm.org/D127702 adds the initial logpoints support in
lldb-vscode. This patch further improves it by:
1. Adding a newline at the end of each log message
2. Support most of the format specifiers like \t, \n, \x etc..

The implementation is borrowed from FormatEntity::ParseInternal(). Future
patch should merge these two implementations.

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

20 months ago[ValueLattice] Fix getCompare() for undef values
Nikita Popov [Tue, 1 Nov 2022 15:39:20 +0000 (16:39 +0100)]
[ValueLattice] Fix getCompare() for undef values

Resolve the TODO about incorrect getCompare() behavior. This can
be made more precise (e.g. by materializing the undef value and
performing constant folding on it), but for now just return an
unknown result.

20 months ago[Hexagon] Use HVX predicates when mapping HVX intrinsics in isel
Krzysztof Parzyszek [Tue, 1 Nov 2022 15:29:21 +0000 (08:29 -0700)]
[Hexagon] Use HVX predicates when mapping HVX intrinsics in isel

In llvm/lib/Target/Hexagon/HexagonDepMapAsm2Intrin.td we use "HasV66" for
HVX v66 intrinsics. We should be using "UseHVXV66" instead, since HVX has
its own versioning.

20 months agoPrecommit test cases for D137108 (Support for AArch64ISD::MOVI in computeKnownBits)
Adrian Tong [Tue, 1 Nov 2022 15:22:45 +0000 (15:22 +0000)]
Precommit test cases for D137108 (Support for AArch64ISD::MOVI in computeKnownBits)

20 months ago[mlir][gpu] Relax MMA load/store to allow vector memref
Lei Zhang [Tue, 1 Nov 2022 15:33:42 +0000 (11:33 -0400)]
[mlir][gpu] Relax MMA load/store to allow vector memref

This is useful for converting to SPIR-V, where we'd like to have
memref of vector element types.

Reviewed By: ThomasRaoux, bondhugula

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

20 months ago[X86] Fix broadcastm intrinsics comment
Simon Pilgrim [Tue, 1 Nov 2022 15:34:32 +0000 (15:34 +0000)]
[X86] Fix broadcastm intrinsics comment

These broadcast from mask predicate registers, and don't load from memory

Noticed while reviewing D137163

20 months ago[AA] Add missing const qualifier (NFC)
Nikita Popov [Tue, 1 Nov 2022 15:17:05 +0000 (16:17 +0100)]
[AA] Add missing const qualifier (NFC)

20 months ago[clang][Sema] Fix a clang crash with btf_type_tag
Yonghong Song [Wed, 26 Oct 2022 23:15:02 +0000 (16:15 -0700)]
[clang][Sema] Fix a clang crash with btf_type_tag

For the following program,
  $ cat t.c
  struct t {
   int (__attribute__((btf_type_tag("rcu"))) *f)();
   int a;
  };
  int foo(struct t *arg) {
    return arg->a;
  }
Compiling with 'clang -g -O2 -S t.c' will cause a failure like below:
  clang: /home/yhs/work/llvm-project/clang/lib/Sema/SemaType.cpp:6391: void {anonymous}::DeclaratorLocFiller::VisitParenTypeLoc(clang::ParenTypeLoc):
         Assertion `Chunk.Kind == DeclaratorChunk::Paren' failed.
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  ......
  #5 0x00007f89e4280ea5 abort (/lib64/libc.so.6+0x21ea5)
  #6 0x00007f89e4280d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
  #7 0x00007f89e42a6456 (/lib64/libc.so.6+0x47456)
  #8 0x00000000045c2596 GetTypeSourceInfoForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
  #9 0x00000000045ccfa5 GetFullTypeForDeclarator((anonymous namespace)::TypeProcessingState&, clang::QualType, clang::TypeSourceInfo*) SemaType.cpp:0:0
  ......

The reason of the failure is due to the mismatch of TypeLoc and D.getTypeObject().Kind. For example,
the TypeLoc is
  BTFTagAttributedType 0x88614e0 'int  btf_type_tag(rcu)()' sugar
  |-ParenType 0x8861480 'int ()' sugar
  | `-FunctionNoProtoType 0x8861450 'int ()' cdecl
  |   `-BuiltinType 0x87fd500 'int'
while corresponding D.getTypeObject().Kind points to DeclaratorChunk::Paren, and
this will cause later assertion.

To fix the issue, similar to AttributedTypeLoc, let us skip BTFTagAttributedTypeLoc in
GetTypeSourceInfoForDeclarator().

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

20 months ago[InstCombine] add helper function for select-of-bools folds; NFC
Sanjay Patel [Tue, 1 Nov 2022 15:04:10 +0000 (11:04 -0400)]
[InstCombine] add helper function for select-of-bools folds; NFC

This set of folds keeps growing, and it contains
bugs like issue #58552, so make it easier to
spot those via backtrace.

20 months ago[ARM] Tests for various NEON vector compares. NFC
David Green [Tue, 1 Nov 2022 15:00:56 +0000 (15:00 +0000)]
[ARM] Tests for various NEON vector compares. NFC

20 months ago[ARM] Specify Triple in DebugInfo Tests
Archibald Elliott [Tue, 1 Nov 2022 14:52:37 +0000 (14:52 +0000)]
[ARM] Specify Triple in DebugInfo Tests

When the host's target triple ends in `-windows-msvc`, `%llc_dwarf`
contains an explicit `-windows-gnu` triple which ensures that dwarf will
be used. This is useful in target-independent tests, where no triple is
specified, and no target-specific features are used. However, this is
not compatible with target-dependent tests (such as those in
llvm/test/DebugInfo/ARM), as the command-line triple will override the
triple in the LLVM IR program, causing test issues on windows.

This change switches these tests to use an explicit triple, so the tests
test what was expected, and there is no flakiness on windows.

Fixes #58053

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

20 months agoUpdate a stale comment; NFC
Aaron Ballman [Tue, 1 Nov 2022 14:46:20 +0000 (10:46 -0400)]
Update a stale comment; NFC

This function doesn't return anything these days.

20 months ago[ConstraintElimination] Fix nested GEP check.
Florian Hahn [Tue, 1 Nov 2022 14:43:42 +0000 (14:43 +0000)]
[ConstraintElimination] Fix nested GEP check.

At the moment, the implementation requires that the outer GEP has a
single index, the inner GEP can have an arbitrary indices, because the
general `decompose` helper is used.

20 months ago[AArch64][SVE2] Add the SVE2.1 while predicate-as-counter instructions
David Sherwood [Wed, 26 Oct 2022 08:50:17 +0000 (08:50 +0000)]
[AArch64][SVE2] Add the SVE2.1 while predicate-as-counter instructions

This patch adds the assembly/disassembly for the following
predicate-as-counter instructions:

whilelt: While incrementing signed scalar less than scalar
whilele: While incrementing signed scalar less than or equal to scalar
whilegt: While incrementing signed scalar greater than scalar
whilege: While incrementing signed scalar greater than or equal to scalar
whilelo: While incrementing unsigned scalar lower than scalar
whilels: While incrementing unsigned scalar lower or same as scalar
whilehs: While decrementing unsigned scalar higher or same as scalar
whilehi: While decrementing unsigned scalar higher than scalar

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

20 months ago[ConstraintElimination] Add tests for nested GEPs with multiple indices.
Florian Hahn [Tue, 1 Nov 2022 14:17:38 +0000 (14:17 +0000)]
[ConstraintElimination] Add tests for nested GEPs with multiple indices.

20 months ago[gn build] port 6e6704b0dc2c
Nico Weber [Tue, 1 Nov 2022 14:07:13 +0000 (10:07 -0400)]
[gn build] port 6e6704b0dc2c

20 months ago[InstCombine] add test for mul with shl; NFC
Sanjay Patel [Tue, 1 Nov 2022 12:24:13 +0000 (08:24 -0400)]
[InstCombine] add test for mul with shl; NFC

20 months ago[AArch64][SVE2] Add the SVE2.1 cntp instruction
David Sherwood [Tue, 25 Oct 2022 15:56:40 +0000 (15:56 +0000)]
[AArch64][SVE2] Add the SVE2.1 cntp instruction

This patch adds the assembly/disassembly for the following instructions:

cntp : Set scalar to count from predicate-as-counter

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

20 months ago[AArch64]SME2 Outer Product and Accumulate instructions
Caroline Concatto [Thu, 27 Oct 2022 14:49:36 +0000 (15:49 +0100)]
[AArch64]SME2 Outer Product and Accumulate instructions

This patch adds the assembly/disassembly for the following instructions:
  BMOPA: Bitwise exclusive NOR population count outer product and accumulate.
  BMOPS: Bitwise exclusive NOR population count outer product and subtract.

  SMOPA (2-way): Signed integer sum of outer products and accumulate.
  SMOPS (2-way): Signed integer sum of outer products and subtract.

  UMOPA (2-way): Unsigned integer sum of outer products and accumulate.
  UMOPS (2-way): Signed integer sum of outer products and accumulate.
The reference can be found here:

https://developer.arm.com/documentation/ddi0602/2022-09

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

20 months ago[LoongArch] Remove useless empty pattern fields in some Pseudo instructions. NFC
wanglei [Tue, 1 Nov 2022 12:44:54 +0000 (20:44 +0800)]
[LoongArch] Remove useless empty pattern fields in some Pseudo instructions. NFC

20 months ago[sanitizer] Fix build error with current LoongArch Clang
Youling Tang [Tue, 1 Nov 2022 12:48:45 +0000 (20:48 +0800)]
[sanitizer] Fix build error with current LoongArch Clang

Fix the following build failures:
```
In file included from /home/loongson/llvm-work/llvm-project/compiler-rt/lib/sanitizer_common/sanit>
llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_loongarch64.inc:27:23: error>
  register u64 a7 asm("a7") = nr;
                      ^
llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_syscall_linux_loongarch64.inc:28:23: error>
  register u64 a0 asm("a0");                      ^
```

The non-prefix `$` syntax in inline assembly is not supported in clang
yet (it is supported by gcc), add prefix `$` to solve the problem.

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

20 months ago[asan][test] Fix build errors in loongarch64
Youling Tang [Tue, 1 Nov 2022 12:19:33 +0000 (20:19 +0800)]
[asan][test] Fix build errors in loongarch64

- Add get_bits_for_arch for loongarch64 detection, fix the following error,
```
$ make check-asan
-- sanitizer_common tests on "Linux" will run against "asan"
CMake Error at test/asan/CMakeLists.txt:22 (message):
  Unknown target architecture: loongarch64
Call Stack (most recent call first):
  test/asan/CMakeLists.txt:49 (get_bits_for_arch)
```

- Do not use __builtin_longjmp, fix the following error,
```
llvm-project/compiler-rt/lib/asan/tests/asan_test.cpp:635:3: error: __builtin_longjmp is not supported for the current target
  __builtin_longjmp((void**)buf, 1);
```

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

20 months ago[builtins][LoongArch] Port __clear_cache to LoongArch Linux
Youling Tang [Tue, 1 Nov 2022 12:14:06 +0000 (20:14 +0800)]
[builtins][LoongArch] Port __clear_cache to LoongArch Linux

There are two failures in the current builtins,
Failed Tests (2):
  Builtins-loongarch64-linux :: clear_cache_test.c
  Builtins-loongarch64-linux :: enable_execute_stack_test.c

It is caused by __clear_cache not being implemented and triggering `abort`.

"__clear_cache" is implemented in the same way as "clear_cache" in gcc (
in gcc/config/loongarch/loongarch.md)

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

20 months ago[compiler-rt][builtins] Support builtins for LoongArch
Youling Tang [Tue, 1 Nov 2022 12:08:06 +0000 (20:08 +0800)]
[compiler-rt][builtins] Support builtins for LoongArch

Initial builtins for LoongArch.
Add loongarch64 to ALL_CRT_SUPPORTED_ARCH list.
Support fe_getround and fe_raise_inexact in builtins.

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

20 months ago[X86] combineConcatVectorOps - fold 512-bit concat(GF2P8AFFINEQB(x,y,c),GF2P8AFFINEQB...
Simon Pilgrim [Tue, 1 Nov 2022 12:06:34 +0000 (12:06 +0000)]
[X86] combineConcatVectorOps - fold 512-bit concat(GF2P8AFFINEQB(x,y,c),GF2P8AFFINEQB(z,w,c)) -> GF2P8AFFINEQB(concat(x,z),concat(y,w),c)

Now that D137036 has landed, we just need AVX512F support to generate 512-bit GF2P8AFFINEQB ops

20 months ago[GlobalISel] Compute debug location when merging stores more accurately
Anton Sidorenko [Fri, 28 Oct 2022 09:19:04 +0000 (12:19 +0300)]
[GlobalISel] Compute debug location when merging stores more accurately

Originaly the loop did almost nothing as the calculated location was
overwritten on the next iteration.

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

20 months ago[AMDGPU] Fix RP tracker's live registers after processing a memory clause.
Valery Pykhtin [Mon, 31 Oct 2022 13:12:35 +0000 (14:12 +0100)]
[AMDGPU] Fix RP tracker's live registers after processing a memory clause.

It's incorrect to reuse live registers left from the first instruction in a clause after the clause as they don't contain in-clause defs.

Reviewed By: arsenm

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

20 months ago[GlobalISel] Precommit test for D136937
Anton Sidorenko [Mon, 31 Oct 2022 10:13:12 +0000 (13:13 +0300)]
[GlobalISel] Precommit test for D136937

20 months ago[AArch64][SVE2] Add the SVE2.1 contiguous stores to multiple consecutive vectors
David Sherwood [Thu, 20 Oct 2022 12:27:16 +0000 (12:27 +0000)]
[AArch64][SVE2] Add the SVE2.1 contiguous stores to multiple consecutive vectors

This patch adds the assembly/disassembly for the following instructions:

st1*   : Contiguous store of bytes to multiple consecutive vectors -
 (scalar + scalar) and (scalar + immediate)
stnt1* : Contiguous store non-temporal of bytes to multiple consecutive
 vectors - (scalar + scalar) and (scalar + immediate)

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

20 months ago[AArch64][SVE2] Add the SVE2.1 contiguous load to multiple consecutive vector
David Sherwood [Wed, 19 Oct 2022 14:27:12 +0000 (14:27 +0000)]
[AArch64][SVE2] Add the SVE2.1 contiguous load to multiple consecutive vector

This patch adds the assembly/disassembly for the following instructions:

ld1*   : Contiguous load of bytes to multiple consecutive vectors -
         (scalar + scalar) and (scalar + immediate)
ldnt1* : Contiguous load non-temporal of bytes to multiple consecutive
         vectors - (scalar + scalar) and (scalar + immediate)

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

20 months ago[JITLink] Revert template typename change after 2a3b257a935a (NFC)
Stefan Gränitz [Tue, 1 Nov 2022 09:13:43 +0000 (10:13 +0100)]
[JITLink] Revert template typename change after 2a3b257a935a (NFC)

As pointed out in the review https://reviews.llvm.org/D135523#C3696894NL515

20 months ago[LLDB][LoongArch] Add LoongArch ArchSpec and subtype detection
Tiezhu Yang [Tue, 1 Nov 2022 04:56:55 +0000 (12:56 +0800)]
[LLDB][LoongArch] Add LoongArch ArchSpec and subtype detection

Define LoongArch architecture subtypes, add the LoongArch ArchSpec bits,
and inspect the ELF header to detect the right subtype based on ELF class.

Here is a simple test:

```
[loongson@linux ~]$ cat hello.c

int main()
{
printf("Hello, World!\n");
return 0;
}
[loongson@linux ~]$ clang hello.c -g -o hello
```

Without this patch:

```
[loongson@linux ~]$ llvm-project/llvm/build/bin/lldb hello
(lldb) target create "hello"
error: '/home/loongson/hello' doesn't contain any 'host' platform architectures: unknown
```

With this patch:

```
[loongson@linux ~]$ llvm-project/llvm/build/bin/lldb hello
(lldb) target create "hello"
Current executable set to '/home/loongson/hello' (loongarch64).
(lldb) run
Process 735167 launched: '/home/loongson/hello' (loongarch64)
Hello, World!
Process 735167 exited with status = 0 (0x00000000)
(lldb) quit
[loongson@linux ~]$ llvm-project/llvm/build/bin/llvm-lit llvm-project/lldb/test/Shell/ObjectFile/ELF/loongarch-arch.yaml
llvm-lit: /home/loongson/llvm-project/llvm/utils/lit/lit/llvm/config.py:456: note: using clang: /home/loongson/llvm-project/llvm/build/bin/clang
-- Testing: 1 tests, 1 workers --
PASS: lldb-shell :: ObjectFile/ELF/loongarch-arch.yaml (1 of 1)

Testing Time: 0.09s
  Passed: 1
```

Reviewed By: SixWeining, xen0n, DavidSpickett

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

20 months ago[IR] Take operand bundles into account for call argument readonly/writeonly
Nikita Popov [Thu, 27 Oct 2022 10:45:08 +0000 (12:45 +0200)]
[IR] Take operand bundles into account for call argument readonly/writeonly

We currently only take operand bundle effects into account when
querying the function-level memory attributes. However, I believe
that we also need to do the same for parameter attributes. For
example, a call with deopt bundle to a function with readnone
parameter attribute cannot treat that parameter as readnone,
because the deopt bundle may read it.

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

20 months agoAMDGPU: Add testcase from issue 58639
Matt Arsenault [Tue, 1 Nov 2022 07:40:46 +0000 (00:40 -0700)]
AMDGPU: Add testcase from issue 58639

This was fixed in bf789b1957efd2482e1dbd164d91a6612a450fe3

20 months ago[VP][RISCV] Add vp.rint and RISC-V support.
Yeting Kuo [Mon, 24 Oct 2022 15:40:48 +0000 (23:40 +0800)]
[VP][RISCV] Add vp.rint and RISC-V support.

FRINT uses dynamic rounding mode instead of static rounding mode. The patch
rename VFCVT_X_F_VL to VFCVT_RM_X_F_VL for static rounding mode uses and added
new ISDNode VFCVT_X_F_VL directly selected to PseudoVFCVT_X_F_V.

Reviewed By: craig.topper

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

20 months agoAMDGPU/GlobalISel: Add missing run line for gfx7 packed operations
Matt Arsenault [Sat, 29 Oct 2022 18:32:04 +0000 (11:32 -0700)]
AMDGPU/GlobalISel: Add missing run line for gfx7 packed operations

We were only testing targets with legal 16-bit operations.

20 months agoAtomicExpand: Use InstSimplifyFolder
Matt Arsenault [Tue, 20 Sep 2022 22:17:25 +0000 (18:17 -0400)]
AtomicExpand: Use InstSimplifyFolder

Automatically cleanup operations if we know the atomic has higher
alignment.

20 months ago[lit] Add pyproject.toml and fix build w/ modern setuptools backend
Michał Górny [Fri, 28 Oct 2022 20:13:35 +0000 (22:13 +0200)]
[lit] Add pyproject.toml and fix build w/ modern setuptools backend

Add a `pyproject.toml` file that provides build system information
for PEP 517-compliant builders.  While all the commonly used builders
provide fallback to running `setup.py` for backwards compatibility, this
ensures the best forward compatibility.  It also provides a reliable way
of specifying the minimum required setuptools version.  Effectively, it
will make it possible to remove `setup.py` in favor of purely
declarative configuration in the future, or even switch to a different
build system.

Update `setup.py` to explicitly add the current directory to `sys.path`
for importing `lit`.  This is necessary, as the modern setuptools
backend does not guarantee that the current directory is present there.

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

20 months ago[MLIR] Fix bug in the method constructing semi affine expression from flattened form
Arnab Dutta [Mon, 31 Oct 2022 11:49:51 +0000 (17:19 +0530)]
[MLIR] Fix bug in the method constructing semi affine expression from flattened form

Set proper offset to the second element of the index pair, so that
we do not have same index values for more than one local expression.

Reviewed By: springerm

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

20 months ago[lldb][Test] Fix TestFrameFormatNameWithArgs.test on Windows/Linux
Michael Buch [Tue, 1 Nov 2022 05:56:15 +0000 (22:56 -0700)]
[lldb][Test] Fix TestFrameFormatNameWithArgs.test on Windows/Linux

* Windows doesn't support setting these breakpoints by basename
* On Linux std::function arguments aren't formatted as such

20 months ago[IR][Instruction] Annotate more methods with LLVM_READONLY
Alexander Shaposhnikov [Tue, 1 Nov 2022 05:55:28 +0000 (05:55 +0000)]
[IR][Instruction] Annotate more methods with LLVM_READONLY

This diff annotates more methods of the class Instruction with
LLVM_READONLY (similarly to isAssociative/isCommutative).

Test plan: ninja check-all

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

20 months ago[SLP] Extend reordering data of tree entry to support PHI nodes
skc7 [Wed, 26 Oct 2022 04:33:13 +0000 (04:33 +0000)]
[SLP] Extend reordering data of tree entry to support PHI nodes

Reviewed By: ABataev

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

20 months agoRevert "[compiler-rt] Switch from llvm-config to find_package(LLVM)"
Michał Górny [Tue, 1 Nov 2022 04:49:24 +0000 (05:49 +0100)]
Revert "[compiler-rt] Switch from llvm-config to find_package(LLVM)"

This reverts commit 37acf9bdd4686397a6d37000e8d3fe35f456a860.  It broke
a buildbot.

20 months ago[AAPointerInfo] refactor how offsets and Access objects are tracked
Sameer Sahasrabuddhe [Tue, 1 Nov 2022 04:26:58 +0000 (09:56 +0530)]
[AAPointerInfo] refactor how offsets and Access objects are tracked

AAPointerInfo now maintains a list of all Access objects that it owns, along
with the following maps:

- OffsetBins: OffsetAndSize -> { Access }
- InstTupleMap: RemoteI x LocalI -> Access

A RemoteI is any instruction that accesses memory. RemoteI is different from
LocalI if and only if LocalI is a call; then RemoteI is some instruction in the
callgraph starting from LocalI.

Motivation: When AAPointerInfo recomputes the offset for an instruction, it sets
the value to Unknown if the new offset is not the same as the old offset. The
instruction must now be moved from its current bin to the bin corresponding to
the new offset. This happens for example, when:

- A PHINode has operands that result in different offsets.
- The same remote inst is reachable from the same local inst via different paths
  in the callgraph:

```
               A (local inst)
               |
               B
              / \
             C1  C2
              \ /
               D (remote inst)

```
This fixes a bug where a store is incorrectly eliminated in a lit test.

Reviewed By: jdoerfert

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

20 months agollvm-reduce: Write bitcode temporary files for bitcode inputs
Matt Arsenault [Sat, 29 Oct 2022 01:50:19 +0000 (18:50 -0700)]
llvm-reduce: Write bitcode temporary files for bitcode inputs

Most tools accept .ll or .bc inputs interchangably, but some don't.
Default to writing temporary files that match the input. This
will also aid reducing deserialization bugs.

20 months agollvm-reduce: Drop guessing output format based on file extension
Matt Arsenault [Sat, 29 Oct 2022 01:24:21 +0000 (18:24 -0700)]
llvm-reduce: Drop guessing output format based on file extension

20 months agollvm-reduce: Support emitting bitcode for final result
Matt Arsenault [Wed, 26 Oct 2022 20:05:46 +0000 (13:05 -0700)]
llvm-reduce: Support emitting bitcode for final result

Previously, this unconditionally emitted text IR. I ran
into a bug that manifested in broken disassembly, so the
desired output was the bitcode format. If the input format
was binary bitcode, the requested output file ends in .bc,
or an explicit -output-bitcode option was used, emit bitcode.

20 months ago[compiler-rt] Switch from llvm-config to find_package(LLVM)
Michał Górny [Sat, 29 Oct 2022 17:03:37 +0000 (19:03 +0200)]
[compiler-rt] Switch from llvm-config to find_package(LLVM)

Replace the use of the deprecated `llvm-config` tool with LLVM's CMake
files for detecting LLVM in standalone builds.

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

20 months agoFix missing C++ mode comment
Matt Arsenault [Sat, 29 Oct 2022 00:17:00 +0000 (17:17 -0700)]
Fix missing C++ mode comment

20 months agollvm-reduce: Report file opening errors
Matt Arsenault [Mon, 24 Oct 2022 16:08:54 +0000 (09:08 -0700)]
llvm-reduce: Report file opening errors

This was also trying to write the bitcode to the failed file
on failure, which asserts. Also, consistently use
ToolOutputFile, instead of one path manually removing
the temp file.

20 months agoAtomicExpand: Don't create unused instructions for some atomicrmw
Matt Arsenault [Thu, 29 Sep 2022 20:21:49 +0000 (16:21 -0400)]
AtomicExpand: Don't create unused instructions for some atomicrmw

This wasn't used by every atomicrmw expansion.

20 months agoHexagon: Register null TargetStreamer
Matt Arsenault [Sat, 29 Oct 2022 19:34:03 +0000 (12:34 -0700)]
Hexagon: Register null TargetStreamer

Unlike just about every target, I don't
see an obvious null dereference this fixes.