platform/upstream/llvm.git
20 months ago[AArch64][SME]: Add precursory tests for D138309
Hassnaa Hamdi [Fri, 18 Nov 2022 16:50:27 +0000 (16:50 +0000)]
[AArch64][SME]: Add precursory tests for D138309

Add testing files:
 - int-reduce.ll
 - fp-reduce.ll

20 months agoRevert "[clang-fuzzer] Use new pass manager for optimizing IR"
Arthur Eubanks [Thu, 24 Nov 2022 16:56:53 +0000 (08:56 -0800)]
Revert "[clang-fuzzer] Use new pass manager for optimizing IR"

This reverts commit a46a746cfa08a72f9e9188451ed5cac2f77d5237.

Breaks bots, e.g. https://lab.llvm.org/buildbot#builders/121/builds/25511.

20 months ago[llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport
Michał Górny [Sun, 30 Oct 2022 06:37:15 +0000 (07:37 +0100)]
[llvm] [cmake] Set EXCLUDE_FROM_ALL on gtest and TestingSupport

Exclude building googletest and LLVMTestingSupport libraries from
the `all` target.  If unittests are being built, these libraries will
be built as a dependency anyway.  If they are not being built, building
them makes little sense as they are not installed or used otherwise.

This will also make standalone builds of other projects easier, as it
makes it possible to include these directories without having to cover
them with additional conditions to prevent them from being built
unconditionally.

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

20 months ago[libc++][AIX] Add AIX buildbot owners
David Tenty [Wed, 23 Nov 2022 16:10:30 +0000 (11:10 -0500)]
[libc++][AIX] Add AIX buildbot owners

This adds the AIX (i.e. Power) buildbot owners in the format established
by https://reviews.llvm.org/D138445

Reviewed By: ldionne

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

20 months ago[lldb][NFC] Change FindDefinitionTypeForDWARFDeclContext() to take DWARFDIE
Arthur Eubanks [Wed, 23 Nov 2022 22:29:40 +0000 (14:29 -0800)]
[lldb][NFC] Change FindDefinitionTypeForDWARFDeclContext() to take DWARFDIE

This simplifies an upcoming patch.

Reviewed By: labath

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

20 months ago[clang-fuzzer] Use new pass manager for optimizing IR
Arthur Eubanks [Thu, 24 Nov 2022 00:59:28 +0000 (16:59 -0800)]
[clang-fuzzer] Use new pass manager for optimizing IR

20 months ago[X86] combineScalarAndWithMaskSetcc - optionally peek through (oneuse) any_extend...
Simon Pilgrim [Thu, 24 Nov 2022 16:26:29 +0000 (16:26 +0000)]
[X86] combineScalarAndWithMaskSetcc - optionally peek through (oneuse) any_extend node

Extend pass to handle: (and (any_extend (bitcast (vXi1 (concat_vectors (vYi1 setcc), undef,)))), C)

Fixes several regressions identified in D127115

20 months ago[AArch64] Add support for v8.9-A/v9.4-A Debug and PMU extensions
Lucas Prates [Wed, 16 Nov 2022 16:56:54 +0000 (16:56 +0000)]
[AArch64] Add support for v8.9-A/v9.4-A Debug and PMU extensions

This adds support for the 2022 Debug and PMU extensions that are part of
the v8.9-A and v9.4-A architecture versions. This includes:

* New archtecture extension for the v9.4-A Instrumentation Extension
  (FEAT_ITE), including 'trcit' instruction and system registers
* New system registers for:
  * 2022 Debug features (FEAT_Debugv8p9)
  * 2022 Performance Monitors Extension features (FEAT_PMUv3p9)
  * PMU Snapshot extension (FEAT_PMUv3_SS)
  * PMU Fixed-function instruction counter (FEAT_PMUv3_ICNTR)
  * System Performance Monitors Extension (FEAT_SPMU)
  * Synchornous-exception-based event profiling (FEAT_SEBEP)
  * Fine Grained Traps Extension (FEAT_FGT2)
  * SPE Data Source filtering (FEAT_SPE_FDS)

More information on the new extensions can be found on:
* https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/arm-a-profile-architecture-2022
* https://developer.arm.com/downloads/-/exploration-tools

Changes by Son Tuan Vu, Sam Elliott and me.

Reviewed By: tmatheson

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

20 months agoRevert "[Debugify] Accumulate the number of variables in debugify metadata"
Anton Sidorenko [Thu, 24 Nov 2022 16:08:32 +0000 (19:08 +0300)]
Revert "[Debugify] Accumulate the number of variables in debugify metadata"

This brokes some builds
This reverts commit a1bbe8a4e2e50e7100dc17d9ddd1bfc3bfe44977.

20 months ago[Alignment][NFC] Use Align in MCStreamer::emitValueToAlignment
Guillaume Chatelet [Thu, 24 Nov 2022 15:23:06 +0000 (15:23 +0000)]
[Alignment][NFC] Use Align in MCStreamer::emitValueToAlignment

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

20 months ago[Alignment][NFC] Use Align for MCStreamer::emitXCOFFLocalCommonSymbol
Guillaume Chatelet [Thu, 24 Nov 2022 14:45:37 +0000 (14:45 +0000)]
[Alignment][NFC] Use Align for MCStreamer::emitXCOFFLocalCommonSymbol

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

20 months ago[Debugify] Accumulate the number of variables in debugify metadata
Anton Sidorenko [Fri, 28 Oct 2022 13:47:44 +0000 (16:47 +0300)]
[Debugify] Accumulate the number of variables in debugify metadata

When a module contains more than one function, we should update debugify metadata
by increasing the number of variables in the function rather than overwritting it.

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

20 months ago[flang] Lowering LOC intrinsic
Kelvin Li [Tue, 15 Nov 2022 19:46:25 +0000 (14:46 -0500)]
[flang] Lowering LOC intrinsic

This patch is to implement the lowering of the LOC intrinsic.

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

20 months ago[flang][test] Adjust Driver/pass-plugin-not-found.f90 error message
Rainer Orth [Thu, 24 Nov 2022 15:20:33 +0000 (16:20 +0100)]
[flang][test] Adjust Driver/pass-plugin-not-found.f90 error message

The `Driver/pass-plugin-not-found.f90` test `FAIL`s on Solaris since part
of the error message differs from what the test expects: Solaris has

  error: unable to load plugin 'X.Y': 'Could not load library 'X.Y':
ld.so.1: flang-new: X.Y: open failed: No such file or directory'

while the test expects

  error: unable to load plugin 'X.Y': 'Could not load library 'X.Y': X.Y:
cannot open shared object file: No such file or directory'

The last part is emitted by the system `dlerror` and is thus unportable.
Hopefully the error text itself is the same everywhere.

The following patch adjusts the expected message accordingly.

Tested on `x86_64-pc-linux-gnu` and `amd64-pc-solaris2.11`.

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

20 months ago[Debugify] Precommit test for D136949
Anton Sidorenko [Mon, 21 Nov 2022 10:49:46 +0000 (13:49 +0300)]
[Debugify] Precommit test for D136949

20 months ago[InstCombine] reduce code duplication in foldBitcastExtElt(); NFC
Sanjay Patel [Thu, 24 Nov 2022 14:27:06 +0000 (09:27 -0500)]
[InstCombine] reduce code duplication in foldBitcastExtElt(); NFC

20 months ago[InstCombine] add tests for trunc+insertelt; NFC
Sanjay Patel [Tue, 22 Nov 2022 19:14:27 +0000 (14:14 -0500)]
[InstCombine] add tests for trunc+insertelt; NFC

20 months ago[OpenMP][OMPIRBuilder] Mirgrate getName from clang to OMPIRBuilder
Jan Sjodin [Wed, 9 Nov 2022 16:59:30 +0000 (11:59 -0500)]
[OpenMP][OMPIRBuilder] Mirgrate getName from clang to OMPIRBuilder

This change moves the getName function from clang and moves the separator class
members from CGOpenMPRuntime into OMPIRBuilder. Also enusre all the getters
in the config class are const.

Reviewed By: jdoerfert

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

20 months ago[Alignment][NFC] Use Align in MCStreamer::emitCodeAlignment
Guillaume Chatelet [Thu, 24 Nov 2022 14:27:38 +0000 (14:27 +0000)]
[Alignment][NFC] Use Align in MCStreamer::emitCodeAlignment

This patch makes code less readable but it will clean itself after all functions are converted.

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

20 months ago[include-cleaner] Show details for #include directives (used/unused)
Sam McCall [Thu, 24 Nov 2022 11:34:08 +0000 (12:34 +0100)]
[include-cleaner] Show details for #include directives (used/unused)

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

20 months ago[Alignment][NFC] Use Align in MCStreamer::emitBundleAlignMode
Guillaume Chatelet [Thu, 24 Nov 2022 13:43:11 +0000 (13:43 +0000)]
[Alignment][NFC] Use Align in MCStreamer::emitBundleAlignMode

Summary:

Reviewers: courbet

Subscribers:

20 months ago[SelectOpt] Don't treat LogicalAnd/LogicalOr as selects
David Green [Thu, 24 Nov 2022 14:29:57 +0000 (14:29 +0000)]
[SelectOpt] Don't treat LogicalAnd/LogicalOr as selects

A `select i1 %c, i1 true, i1 %d` is just an or and a `select i1 %c, i1 %d, i1 false`
is just an and. There are better treated as such in the logic of SelectOpt, allowing
the backend to optimize them to and/or directly.

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

20 months ago[include-cleaner] Make Symbol (and Macro) hashable.
Sam McCall [Thu, 24 Nov 2022 11:29:50 +0000 (12:29 +0100)]
[include-cleaner] Make Symbol (and Macro) hashable.

For now, we decided not to add operator< or handle other variants.
(If we do so in future we may want to extract a base class).

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

20 months ago[Format] Don't crash on mismatched brackets
Sam McCall [Thu, 24 Nov 2022 14:13:42 +0000 (15:13 +0100)]
[Format] Don't crash on mismatched brackets

20 months ago[X86] Replace InstRW instregex single matches with instrs entries
Simon Pilgrim [Thu, 24 Nov 2022 14:08:19 +0000 (14:08 +0000)]
[X86] Replace InstRW instregex single matches with instrs entries

This reduces diffs between znver1/znver2 and should marginally speed up tlbgen build time (Issue #35303)

Found by adding a temp check inside InstRegexOp::apply inside single matches

20 months agoFix MSVC "signed/unsigned mismatch" warning. NFC.
Simon Pilgrim [Thu, 24 Nov 2022 13:58:34 +0000 (13:58 +0000)]
Fix MSVC "signed/unsigned mismatch" warning. NFC.

20 months agoFix remaining build errors introduced in D90568 - 15e76eed0c7.
Nathan James [Thu, 24 Nov 2022 14:01:08 +0000 (14:01 +0000)]
Fix remaining build errors introduced in D90568 - 15e76eed0c7.

A few cases were missed in 0923628d26d

20 months ago[include-cleaner] Record macro references in #ifdef clause.
Viktoriia Bakalova [Thu, 24 Nov 2022 13:40:49 +0000 (14:40 +0100)]
[include-cleaner] Record macro references in #ifdef clause.

Records macro references in #ifdef clauses as ambiguous.

Reviewed By: hokein

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

20 months agoFix build error introduced in D90568 - 15e76eed0c7
Nathan James [Thu, 24 Nov 2022 13:42:53 +0000 (13:42 +0000)]
Fix build error introduced in D90568 - 15e76eed0c7

20 months agoRevert "[libcxxabi] Always use thread_local for cxa_exception_storage"
Louis Dionne [Thu, 24 Nov 2022 13:32:10 +0000 (08:32 -0500)]
Revert "[libcxxabi] Always use thread_local for cxa_exception_storage"

This reverts commit 8271aa5335668a1dc62168a4e90b4554bd3a0ca7 since it
broke some downstream builds. See https://reviews.llvm.org/D138461 for
details.

20 months ago[libc++] Keep char_traits<T> for arbitrary T around until LLVM 18
Louis Dionne [Wed, 23 Nov 2022 19:06:14 +0000 (14:06 -0500)]
[libc++] Keep char_traits<T> for arbitrary T around until LLVM 18

This is in response to failures seen after landing D138307.

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

20 months ago[reland][Alignment][NFC] Use the Align type in MCSection
Guillaume Chatelet [Thu, 24 Nov 2022 13:19:00 +0000 (13:19 +0000)]
[reland][Alignment][NFC] Use the Align type in MCSection

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

20 months ago[libc++] Remove P1908 from the status page
Nikolas Klauser [Wed, 16 Nov 2022 13:38:58 +0000 (14:38 +0100)]
[libc++] Remove P1908 from the status page

The paper doesn't include anything affecting the library. AFAICT there isn't even anything to do for the compiler, since it just reserved the std attribute namespace.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

20 months ago[clang] Add [is|set]Nested methods to NamespaceDecl
Nathan James [Thu, 24 Nov 2022 12:44:33 +0000 (12:44 +0000)]
[clang] Add [is|set]Nested methods to NamespaceDecl

Adds support for NamespaceDecl to inform if its part of a nested namespace.
This flag only corresponds to the inner namespaces in a nested namespace declaration.
In this example:
namespace <X>::<Y>::<Z> {}
Only <Y> and <Z> will be classified as nested.

This flag isn't meant for assisting in building the AST, more for static analysis and refactorings.

Reviewed By: aaron.ballman

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

20 months agoRevert D138653 [Alignment][NFC] Use the Align type in MCSection"
Guillaume Chatelet [Thu, 24 Nov 2022 12:42:30 +0000 (12:42 +0000)]
Revert D138653 [Alignment][NFC] Use the Align type in MCSection"

This breaks the bolt project.
This reverts commit 409f0dc4a420db1c6b259d5ae965a070c169d930.

20 months ago[Alignment][NFC] Use the Align type in MCSection
Guillaume Chatelet [Thu, 24 Nov 2022 11:46:33 +0000 (11:46 +0000)]
[Alignment][NFC] Use the Align type in MCSection

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

20 months ago[SCEV] Add printout of symbolic max backedge-taken and block exit count
Max Kazantsev [Thu, 24 Nov 2022 12:28:30 +0000 (19:28 +0700)]
[SCEV] Add printout of symbolic max backedge-taken and block exit count

We do compute it and use in optimizations, but never print it out. We need
to do it in order to be able to track improvements in its computation.

20 months ago[SCEV][NFC] Call getConstantMaxBackedgeTakenCount once in printout
Max Kazantsev [Thu, 24 Nov 2022 11:48:30 +0000 (18:48 +0700)]
[SCEV][NFC] Call getConstantMaxBackedgeTakenCount once in printout

20 months ago[SCEV] Rename max backedge-taken count -> constant max backedge taken-count in printout
Max Kazantsev [Thu, 24 Nov 2022 11:42:16 +0000 (18:42 +0700)]
[SCEV] Rename max backedge-taken count -> constant max backedge taken-count in printout

This is a preparatory step for introducing symbolic max backedge-taken count.

20 months ago[flang][NFC] move genCallOpAndResult into new ConvertCall.cpp file
Jean Perier [Thu, 24 Nov 2022 11:37:13 +0000 (12:37 +0100)]
[flang][NFC] move genCallOpAndResult into new ConvertCall.cpp file

Move genCallOpAndResult from ConvertExpr.cpp into a new file so that
it can be shared with lowering to FIR and HLFIR during the transition.
After the transition, call lowering to HLFIR will be implemented in
this new file.

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

20 months ago[AMDGPU][AsmParser] Refine parsing instruction operands.
Ivan Kosarev [Thu, 24 Nov 2022 10:50:00 +0000 (10:50 +0000)]
[AMDGPU][AsmParser] Refine parsing instruction operands.

Eliminates the need for working around optional and token operands being
mistakenly parsed as expressions.

Reviewed By: dp

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

20 months ago[AMDGPU][CodeGen] Support raw format TFE buffer loads other than byte, short and...
Ivan Kosarev [Thu, 17 Nov 2022 15:38:48 +0000 (15:38 +0000)]
[AMDGPU][CodeGen] Support raw format TFE buffer loads other than byte, short and d16 ones.

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

20 months ago[X86] combine-and.ll - add AVX2/AVX512 test coverage
Simon Pilgrim [Thu, 24 Nov 2022 10:38:05 +0000 (10:38 +0000)]
[X86] combine-and.ll - add AVX2/AVX512 test coverage

20 months ago[SCEV][NFC] Rename MaxNotTaken -> ConstantMaxNotTaken
Max Kazantsev [Thu, 24 Nov 2022 10:18:29 +0000 (17:18 +0700)]
[SCEV][NFC] Rename MaxNotTaken -> ConstantMaxNotTaken

We are going to introduce SymbolicMaxNotTaken, avoid mixing
things up.

Differential Revision: https://reviews.llvm.org/D138568
Reviewed By: lebedev.ri

20 months ago[lldb] Fix PathMappingListTest for the Optional interface change
Pavel Labath [Thu, 24 Nov 2022 10:10:26 +0000 (11:10 +0100)]
[lldb] Fix PathMappingListTest for the Optional interface change

20 months ago[include-cleaner] Remove an unused local variable, NFC.
Haojian Wu [Thu, 24 Nov 2022 10:05:34 +0000 (11:05 +0100)]
[include-cleaner] Remove an unused local variable, NFC.

20 months ago[Debugify] Strip llvm.mir.debugify metadata
Anton Sidorenko [Mon, 21 Nov 2022 12:26:27 +0000 (15:26 +0300)]
[Debugify] Strip llvm.mir.debugify metadata

We don't strip llvm.mir.debugify metadata in `llvm::stripDebugifyMetadata`. This
may lead to incorrect number of lines and variables in the metadata when we run
debugify twice, e.g. -run-pass=mir-debugify,...,mir-strip-debug,...,mir-debugify.

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

20 months ago[Debugify] Add precommit test for D138417
Anton Sidorenko [Mon, 21 Nov 2022 12:27:05 +0000 (15:27 +0300)]
[Debugify] Add precommit test for D138417

Check that we erase `llvm.debugify` metadata, but forget to erase `llvm.mir.debugify`.

20 months ago[SCEV] Fix wrong initialization of MaxNotTaken
Max Kazantsev [Wed, 23 Nov 2022 08:13:40 +0000 (15:13 +0700)]
[SCEV] Fix wrong initialization of MaxNotTaken

I'm not sure why, but since this code was introduced back in 2019, this
variable used wrong value to initialize. Somehow it just worked, but
needs to be fixed.

Differential Revision: https://reviews.llvm.org/D138549
Reviewed By: fhahn

20 months ago[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass [NFC]
Manuel Brito [Thu, 24 Nov 2022 08:42:05 +0000 (08:42 +0000)]
[CodeGen] Use poison instead of undef as placeholder in AtomicExpandPass [NFC]

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

20 months ago[NFC] Replaced BB->getInstList().front() with BB->front()
Vasileios Porpodas [Wed, 23 Nov 2022 22:54:37 +0000 (14:54 -0800)]
[NFC] Replaced BB->getInstList().front() with BB->front()

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

20 months ago[LTO] Move cl::opt inside llvm:: after D53294
Fangrui Song [Thu, 24 Nov 2022 07:22:26 +0000 (23:22 -0800)]
[LTO] Move cl::opt inside llvm:: after D53294

20 months ago[MC] Move AsmMacroMaxNestingDepth inside llvm:: after D72680
Fangrui Song [Thu, 24 Nov 2022 07:13:55 +0000 (23:13 -0800)]
[MC] Move AsmMacroMaxNestingDepth inside llvm:: after D72680

20 months ago[CSSPGO] Move cl::opt inside llvm:: after D100528 and D108342
Fangrui Song [Thu, 24 Nov 2022 07:08:49 +0000 (23:08 -0800)]
[CSSPGO] Move cl::opt inside llvm:: after D100528 and D108342

20 months ago[LoopVectorize] Internalize some cl::opt
Fangrui Song [Thu, 24 Nov 2022 07:03:02 +0000 (23:03 -0800)]
[LoopVectorize] Internalize some cl::opt

20 months agoStandardInstrumentations: Internalize some cl::opt
Fangrui Song [Thu, 24 Nov 2022 06:58:14 +0000 (22:58 -0800)]
StandardInstrumentations: Internalize some cl::opt

20 months agoAST: Internalize functions after D111283
Fangrui Song [Thu, 24 Nov 2022 06:53:23 +0000 (22:53 -0800)]
AST: Internalize functions after D111283

20 months ago[NFC] Replaced BB->getInstList().{erase(),pop_front(),pop_back()} with eraseFromParent().
Vasileios Porpodas [Wed, 23 Nov 2022 22:53:00 +0000 (14:53 -0800)]
[NFC] Replaced BB->getInstList().{erase(),pop_front(),pop_back()} with eraseFromParent().

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

20 months agotsan: intercept epoll_pwait2
Dmitry Vyukov [Wed, 23 Nov 2022 15:20:29 +0000 (16:20 +0100)]
tsan: intercept epoll_pwait2

It's a new syscall similar to epoll_pwait.
Add a similar interceptor for it and add synchronization
annotations in epoll_wait* syscall wrappers.
Testing this is problematic b/c it's not present in glibc
and the syscall itself may not be supported by the kernel.

Reviewed By: melver

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

20 months agoHost: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreads
Fangrui Song [Thu, 24 Nov 2022 05:09:44 +0000 (21:09 -0800)]
Host: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreads

Windows computeHostNumPhysicalCores is defined by Threading.cpp. Leave it
unchanged.

20 months agoRevert "Host: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreads"
Fangrui Song [Thu, 24 Nov 2022 04:12:16 +0000 (20:12 -0800)]
Revert "Host: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreads"

This reverts commit 9969ceb36b440eaafa17c486f29a69c7a7da3b3b.

On Windows:

lld-link: error: undefined symbol: int __cdecl computeHostNumPhysicalCores(void)
>>> referenced by LLVMSupport.lib(Support.Host.obj):(int __cdecl llvm::sys::getHostNumPhysicalCores(void))

20 months ago[MLGO] Fix InlineAdvisor and ModelUnderTrainingRunner after hasValue removal
Aiden Grossman [Thu, 24 Nov 2022 03:36:13 +0000 (03:36 +0000)]
[MLGO] Fix InlineAdvisor and ModelUnderTrainingRunner after hasValue removal

Recentlyin 4b6b248, llvm::Optional's hasValue method was removed as
described in
https://discourse.llvm.org/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor
This breaks InlineAdvisor and ModelUnderTrainingRunner. This patch fixes
them by changing the method to has_value, which hasValue was evaluating
to before.

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

20 months ago[RISCV] Lower unmasked zero-stride vector load to (scalar load + splat)
wangpc [Thu, 24 Nov 2022 03:08:59 +0000 (11:08 +0800)]
[RISCV] Lower unmasked zero-stride vector load to (scalar load + splat)

So we have the opportunity to fold splat into .vx instruction as what
D101138 has done. If failed, we can select zero-stride vector load
again.

Reviewed By: reames

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

20 months ago[RISCV] Precommit test for D138101
wangpc [Thu, 24 Nov 2022 02:36:06 +0000 (10:36 +0800)]
[RISCV] Precommit test for D138101

Add a test that splat can't be folded.

Reviewed By: pcwang-thead

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

20 months agoRevert "[mlir][linalg] Add a new pattern to handle folding unit reduction dims."
Hanhan Wang [Thu, 24 Nov 2022 03:04:21 +0000 (19:04 -0800)]
Revert "[mlir][linalg] Add a new pattern to handle folding unit reduction dims."

This reverts commit 6eee66d12ab33f35a37a1514342b51ae93d175e8.

It breaks builds, see https://lab.llvm.org/buildbot/#/builders/61/builds/35742

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

20 months ago[LoongArch] Diagnose the behavior of reading and writing registers that do not confor...
gonglingqin [Thu, 24 Nov 2022 02:15:18 +0000 (10:15 +0800)]
[LoongArch] Diagnose the behavior of reading and writing registers that do not conform to the hardware register size

When reading or writing a register that does not conform to the size of a
hardware register, an error message is generated instead of a compiler crash.

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

20 months ago[X86][AMX] Fix typo of the headerfile.
Luo, Yuanke [Wed, 23 Nov 2022 08:44:54 +0000 (16:44 +0800)]
[X86][AMX] Fix typo of the headerfile.

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

20 months ago[flang] Harmonize standalone gtest support with other projects
Michał Górny [Wed, 23 Nov 2022 15:07:03 +0000 (16:07 +0100)]
[flang] Harmonize standalone gtest support with other projects

Use the CMake rules of unittest libraries via `add_subdirectory()`
when using standalone builds, similarly to how e.g. Clang does that.
Besides making things more consistent, I hope this also unblocks D137035
and effectively we'll be able to simplify things further and have LLVM
semi-automatically include gtest support for us in the future.

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

20 months ago[Object] Internalize readBBAddrMapImpl
Fangrui Song [Thu, 24 Nov 2022 01:46:59 +0000 (17:46 -0800)]
[Object] Internalize readBBAddrMapImpl

20 months agoHost: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreads
Fangrui Song [Thu, 24 Nov 2022 01:44:04 +0000 (17:44 -0800)]
Host: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreads

20 months agoModuleSummaryAnalysis: Internalize some cl::opt
Fangrui Song [Thu, 24 Nov 2022 01:33:34 +0000 (17:33 -0800)]
ModuleSummaryAnalysis: Internalize some cl::opt

20 months ago[NFC] Use BB->size() instead of BB->getInstList().size().
Vasileios Porpodas [Wed, 23 Nov 2022 22:30:18 +0000 (14:30 -0800)]
[NFC] Use BB->size() instead of BB->getInstList().size().

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

20 months agoRISCVISAInfo: Internalize struct FindByName
Fangrui Song [Thu, 24 Nov 2022 01:22:49 +0000 (17:22 -0800)]
RISCVISAInfo: Internalize struct FindByName

20 months ago[InstSimplify] Add precommit test for D138542; NFC
chenglin.bi [Thu, 24 Nov 2022 01:04:33 +0000 (09:04 +0800)]
[InstSimplify] Add precommit test for D138542; NFC

20 months ago[ADT] Deprecate Optional::getPointer
Kazu Hirata [Thu, 24 Nov 2022 00:50:34 +0000 (16:50 -0800)]
[ADT] Deprecate Optional::getPointer

This patch deprecates Optional::getPointer.  Note that I've converted
all known occurrences of X.getPointer() to &*X on Nov 21, 2022 in
commit 1f914944b6c9a5e4229ceb9f06140fdf178c5ea0.

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

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

20 months ago[ADT] Deprecate llvm::NoneType
Kazu Hirata [Thu, 24 Nov 2022 00:33:10 +0000 (16:33 -0800)]
[ADT] Deprecate llvm::NoneType

I've migrated all known uses of NoneType to std::nullopt_t.  This
patch deprecates NoneType.

I'm using "typedef" instead of "using" because somehow
"[[deprecated]]" and "using" do not seem to get along.

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

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

20 months ago[mlir][sparse] Add expand_symmetry attribute to the new operator.
bixia1 [Tue, 22 Nov 2022 22:52:47 +0000 (14:52 -0800)]
[mlir][sparse] Add expand_symmetry attribute to the new operator.

The attribute tells the operator to handle symmetric structures for 2D tensors.
By default, the operator assumes the input tensor is not symmetric.

Reviewed By: aartbik

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

20 months ago[windows-itanium] Propagate DLL storage class to Initialisation Guard Variables
Ben Dunbobbin [Thu, 24 Nov 2022 00:12:11 +0000 (00:12 +0000)]
[windows-itanium] Propagate DLL storage class to Initialisation Guard Variables

Initialisation Guard Variables should take their DLL storage class
from the guarded variable. Otherwise, there will be a link error if
the compiler inlines a reference to the guard variable into another
module but that guard variable is not exported from the defining
module.

This is required for platforms such as PlayStation and
windows-itanium, that are aiming for source compatibility with MSVC
w.r.t. dllimport/export annotations, given Clang's existing design
which allows for inlining of a dllimport function as long as all the
variables/functions referenced are also marked dllimport.

A similar change exists for the MSVC ABI:
https://reviews.llvm.org/D4136.

I have added a run test for windows-itanium for this issue to the
build recipe: https://reviews.llvm.org/D88124.

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

20 months ago[mlir][spirv] Define `OpSMulExtended` and `OpUMulExtended` ops
Jakub Kuderski [Thu, 24 Nov 2022 00:04:43 +0000 (19:04 -0500)]
[mlir][spirv] Define `OpSMulExtended` and `OpUMulExtended` ops

These perform exact multiplication and return the high half as a second
result.

Also factor out common code shared between 'extended binary ops'.

Reviewed By: antiagainst

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

20 months ago[mlir][vector] Simplify fold pattern for ExtractOp(constant). NFC.
Jakub Kuderski [Wed, 23 Nov 2022 23:57:02 +0000 (18:57 -0500)]
[mlir][vector] Simplify fold pattern for ExtractOp(constant). NFC.

Use helper functions. Reuse array element attributes.

Reviewed By: antiagainst

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

20 months ago[lldb] Fix a warning
Kazu Hirata [Wed, 23 Nov 2022 23:55:05 +0000 (15:55 -0800)]
[lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp:105:18:
  warning: comparison of unsigned expression in ‘>= 0’ is always true
  [-Wtype-limits]

20 months ago[libc++][clang-tidy] Enable readability-simplify-boolean-expr
Nikolas Klauser [Thu, 10 Nov 2022 22:57:43 +0000 (23:57 +0100)]
[libc++][clang-tidy] Enable readability-simplify-boolean-expr

Reviewed By: ldionne, #libc

Spies: Eugene.Zelenko, aheejin, libcxx-commits, xazax.hun

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

20 months ago[ADT] Remove Optional::{has_value,value}, etc (NFC)
Kazu Hirata [Wed, 23 Nov 2022 23:08:40 +0000 (15:08 -0800)]
[ADT] Remove Optional::{has_value,value}, etc (NFC)

This patch removes methods that I deprecated on August, 2022 in
commits b5f8d42efe3e246d582d4a1a328fac915e4ce8dc and
eeac9e923283d8535e4175fef35e132e796fa78e.

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

20 months agoUse std::nullopt_t instead of NoneType (NFC)
Kazu Hirata [Wed, 23 Nov 2022 22:16:04 +0000 (14:16 -0800)]
Use std::nullopt_t instead of NoneType (NFC)

This patch replaces those occurrences of NoneType that would trigger
an error if the definition of NoneType were missing in None.h.

To keep this patch focused, I am deliberately not replacing None with
std::nullopt in this patch or updating comments.  They will be
addressed in subsequent patches.

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

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

20 months ago[BasicAA] Add tests with __memcpy_chk.
Florian Hahn [Wed, 23 Nov 2022 22:09:49 +0000 (22:09 +0000)]
[BasicAA] Add tests with __memcpy_chk.

20 months agoAdd MC support of RISCV Zcd Extension
WuXinlong [Wed, 23 Nov 2022 13:19:43 +0000 (21:19 +0800)]
Add MC support of RISCV Zcd Extension

This patch add the instructions of Zcd extension.

Zcd is a subset of C Ext which include the double-precision floating-point instructions (c.fld, c.fldsp, c.fsd, c.fsdsp).

Reviewed By: craig.topper

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

20 months ago[Hexagon] Fix deinterleaving after vmpyh
Krzysztof Parzyszek [Wed, 23 Nov 2022 20:56:16 +0000 (12:56 -0800)]
[Hexagon] Fix deinterleaving after vmpyh

20 months ago[Hexagon] Fix order of operands in V6_vmpyhus
Krzysztof Parzyszek [Wed, 23 Nov 2022 20:54:05 +0000 (12:54 -0800)]
[Hexagon] Fix order of operands in V6_vmpyhus

The unsigned operand is second: Vdd32.w = vmpy(Vu32.h,Vv32.uh)

20 months ago[ASTReader] Fix zlib header detection 0x78 after D137885
Fangrui Song [Wed, 23 Nov 2022 21:22:44 +0000 (13:22 -0800)]
[ASTReader] Fix zlib header detection 0x78 after D137885

D137885 picked an incorrect magic so it would fail when zstd is not
enabled.

20 months ago[PowerPC][NFC] Merge LLVM_DEBUG statements to avoid unused variable warnings
Benjamin Kramer [Wed, 23 Nov 2022 20:09:33 +0000 (21:09 +0100)]
[PowerPC][NFC] Merge LLVM_DEBUG statements to avoid unused variable warnings

20 months agoUnbreak lldb build broken by d941fceca8e9
Benjamin Kramer [Wed, 23 Nov 2022 20:01:47 +0000 (21:01 +0100)]
Unbreak lldb build broken by d941fceca8e9

20 months ago[PowerPC] Exploit xxperm, check for dead vectors and substitute vperm with xxperm
Maryam Moghadas [Mon, 12 Sep 2022 14:27:57 +0000 (09:27 -0500)]
[PowerPC] Exploit xxperm, check for dead vectors and substitute vperm with xxperm

vperm instruction requires the data to be in the Altivec registers, if one of
the vector operands is not used after this vperm instruction then it can be
substituted by xxperm which doubles the number of available registers.

Reviewed By: stefanp

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

20 months ago[modules] Support zstd in .pcm file
Fangrui Song [Wed, 23 Nov 2022 19:27:49 +0000 (11:27 -0800)]
[modules] Support zstd in .pcm file

Extend SM_SLOC_BUFFER_BLOB_COMPRESSED to allow zstd, which is much faster
(compression/decompression) than zlib with a similar compression ratio.

An alternative is to add a value beside SM_SLOC_BUFFER_BLOB_COMPRESSED, but
reusing SM_SLOC_BUFFER_BLOB_COMPRESSED slightly simplifies the implementation
and leads to better diagnostics when a slightly older Clang consumes zstd
compressed blob.

Compressing AST takes a small portion of WriteAST, so we can pick a higher
compression level.

Compiling a relatively large .pcm (absl endian) with -fmodules-embed-all-files,
zstd level 9 has comparable performance with zlib-chromium level 6 (default),
but provides smaller output (5809156 => 5796016). Higher zstd levels will make
"Compress AST" notably slower and do not provide significant more size saving.

```
2.219345 Total ExecuteCompiler
0.746799 Total Frontend
0.736862 Total Source
0.339434 Total ReadAST
0.165452 Total WriteAST
0.043045 Total Compress AST
0.008236 Total ParseClass
0.00633 Total InstantiateClass
0.001887 Total isPotentialConstantExpr
0.001808 Total InstantiateFunction
0.001535 Total EvaluateForOverflow
0.000986 Total EvaluateAsRValue
0.000536 Total EvaluateAsBooleanCondition
0.000308 Total EvaluateAsConstantExpr
0.000156 Total EvaluateAsInt
3.4e-05 Total EvaluateKnownConstInt
8e-06 Total EvaluateAsInitializer
0 Total PerformPendingInstantiations
```

Reviewed By: dblaikie

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

20 months ago[mlir][index] Add and, or, and xor ops
Luca Boasso [Wed, 23 Nov 2022 19:26:02 +0000 (13:26 -0600)]
[mlir][index] Add and, or, and xor ops

This patch adds the and, or, and xor bitwise operations to
the index dialects with folders and LLVM lowerings.

Reviewed By: rriddle

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

20 months ago[memprof] Fix RAII usage of SpinMutexLock, remove unused headers.
Snehasish Kumar [Wed, 23 Nov 2022 19:00:03 +0000 (19:00 +0000)]
[memprof] Fix RAII usage of SpinMutexLock, remove unused headers.

For the RAII lock usage we need to create a local var. There were some headers which clang-tidy identified as unused.

Reviewed By: tejohnson

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

20 months ago[MLIR] Fix bug in simplify affine map with operands
Uday Bondhugula [Fri, 7 Oct 2022 10:38:23 +0000 (16:08 +0530)]
[MLIR] Fix bug in simplify affine map with operands

Fix bug in simplify affine map with operands utility; the wrong LHS and
RHS were being used in some cases post simplification. While on this,
also handle a corner case of undefined expressions.

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

20 months ago[mlir][linalg] Add a new pattern to handle folding unit reduction dims.
Hanhan Wang [Wed, 23 Nov 2022 18:46:46 +0000 (10:46 -0800)]
[mlir][linalg] Add a new pattern to handle folding unit reduction dims.

The output operands will be added to input operands if the generic op (on tensors)
becomes an elementwise operation. The outputs of the generic op is still the same.
They will be cleaned up by ReplaceWithEmptyTensorIfUnused pattern.

Reviewed By: mravishankar

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

20 months agoDo not suggest taking the address of a const pointer to get void*
Alexey Kreshchuk [Tue, 22 Nov 2022 23:47:20 +0000 (23:47 +0000)]
Do not suggest taking the address of a const pointer to get void*

It's more likely the user needs a const cast, but probably not sure
enough that we should suggest that either - so err on the side of
caution and offer no suggestion.

Fixes pr58958

Reviewed By: dblaikie

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

20 months ago[mlir] Remove clone methods from DPS interface.
Alexander Belyaev [Wed, 23 Nov 2022 17:17:13 +0000 (18:17 +0100)]
[mlir] Remove clone methods from DPS interface.

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

20 months agoAdd the ability to see when a type in incomplete.
Greg Clayton [Mon, 10 Oct 2022 23:30:49 +0000 (16:30 -0700)]
Add the ability to see when a type in incomplete.

-flimit-debug-info and other compiler options might end up removing debug info that is needed for debugging. LLDB marks these types as being forcefully completed in the metadata in the TypeSystem. These types should have been complete in the debug info but were not because the compiler omitted them to save space. When we can't find a suitable replacement for the type, we should let the user know that these types are incomplete to indicate there was an issue instead of just showing nothing for a type.

The solution is to display presented in this patch is to display "<incomplete type>" as the summary for any incomplete types. If there is a summary string or function that is provided for a type, but the type is currently forcefully completed, the installed summary will be ignored and we will display "<incomplete type>". This patch also exposes the ability to ask a SBType if it was forcefully completed with:

  bool SBType::IsTypeForcefullyCompleted();

This will allow the user interface for a debugger to also detect this issue and possibly mark the variable display up on some way to indicate to the user the type is incomplete.

To show how this is diplayed, we can look at the existing output first for the example source file from the file: lldb/test/API/functionalities/limit-debug-info/main.cpp

(lldb) frame variable inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one
(InheritsFromOne) ::inherits_from_one = (member = 47)
(InheritsFromTwo) ::inherits_from_two = (member = 47)
(OneAsMember) ::one_as_member = (one = member::One @ 0x0000000100008028, member = 47)
(TwoAsMember) ::two_as_member = (two = member::Two @ 0x0000000100008040, member = 47)
(array::One [3]) ::array_of_one = ([0] = array::One @ 0x0000000100008068, [1] = array::One @ 0x0000000100008069, [2] = array::One @ 0x000000010000806a)
(array::Two [3]) ::array_of_two = ([0] = array::Two @ 0x0000000100008098, [1] = array::Two @ 0x0000000100008099, [2] = array::Two @ 0x000000010000809a)
(ShadowedOne) ::shadowed_one = (member = 47)
(lldb) frame variable --show-types inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one
(InheritsFromOne) ::inherits_from_one = {
  (int) member = 47
}
(InheritsFromTwo) ::inherits_from_two = {
  (int) member = 47
}
(OneAsMember) ::one_as_member = {
  (member::One) one = {}
  (int) member = 47
}
(TwoAsMember) ::two_as_member = {
  (member::Two) two = {}
  (int) member = 47
}
(array::One [3]) ::array_of_one = {
  (array::One) [0] = {}
  (array::One) [1] = {}
  (array::One) [2] = {}
}
(array::Two [3]) ::array_of_two = {
  (array::Two) [0] = {}
  (array::Two) [1] = {}
  (array::Two) [2] = {}
}
(ShadowedOne) ::shadowed_one = {
  (int) member = 47
}

With this patch in place we can now see any classes that were forcefully completed to let us know that we are missing information:

(lldb) frame variable inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one
(InheritsFromOne) ::inherits_from_one = (One = <incomplete type>, member = 47)
(InheritsFromTwo) ::inherits_from_two = (Two = <incomplete type>, member = 47)
(OneAsMember) ::one_as_member = (one = <incomplete type>, member = 47)
(TwoAsMember) ::two_as_member = (two = <incomplete type>, member = 47)
(array::One[3]) ::array_of_one = ([0] = <incomplete type>, [1] = <incomplete type>, [2] = <incomplete type>)
(array::Two[3]) ::array_of_two = ([0] = <incomplete type>, [1] = <incomplete type>, [2] = <incomplete type>)
(ShadowedOne) ::shadowed_one = (func_shadow::One = <incomplete type>, member = 47)
(lldb) frame variable --show-types inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one
(InheritsFromOne) ::inherits_from_one = {
  (One) One = <incomplete type> {}
  (int) member = 47
}
(InheritsFromTwo) ::inherits_from_two = {
  (Two) Two = <incomplete type> {}
  (int) member = 47
}
(OneAsMember) ::one_as_member = {
  (member::One) one = <incomplete type> {}
  (int) member = 47
}
(TwoAsMember) ::two_as_member = {
  (member::Two) two = <incomplete type> {}
  (int) member = 47
}
(array::One[3]) ::array_of_one = {
  (array::One) [0] = <incomplete type> {}
  (array::One) [1] = <incomplete type> {}
  (array::One) [2] = <incomplete type> {}
}
(array::Two[3]) ::array_of_two = {
  (array::Two) [0] = <incomplete type> {}
  (array::Two) [1] = <incomplete type> {}
  (array::Two) [2] = <incomplete type> {}
}
(ShadowedOne) ::shadowed_one = {
  (func_shadow::One) func_shadow::One = <incomplete type> {}
  (int) member = 47
}

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