platform/upstream/llvm.git
23 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

23 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

23 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

23 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

23 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

23 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:

23 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

23 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

23 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

23 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

23 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.

23 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

23 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

23 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

23 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.

23 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

23 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

23 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

23 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

23 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.

23 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

23 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.

23 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

23 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.

23 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

23 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

23 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

23 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

23 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

23 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

23 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.

23 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

23 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`.

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

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

23 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

23 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

23 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.

23 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))

23 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

23 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

23 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

23 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

23 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

23 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

23 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

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

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

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

23 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

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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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]

23 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

23 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

23 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

23 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.

23 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

23 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

23 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)

23 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.

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 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

23 months ago[WebAssembly] Remove unnecessary GEP insts from table tests
Paulo Matos [Tue, 22 Nov 2022 14:58:58 +0000 (15:58 +0100)]
[WebAssembly] Remove unnecessary GEP insts from table tests

Removes the unnecessary GEP instructions from WebAssembly Table tests.

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

23 months agoCloneModule: Handling cloning ifuncs
Matt Arsenault [Tue, 22 Nov 2022 19:53:43 +0000 (14:53 -0500)]
CloneModule: Handling cloning ifuncs

This is tested in a future llvm-reduce patch.

23 months ago[AArch64][SME]: Generate streaming-compatible code for int-minmax, fp-minmax
Hassnaa Hamdi [Wed, 23 Nov 2022 15:48:46 +0000 (15:48 +0000)]
[AArch64][SME]: Generate streaming-compatible code for int-minmax, fp-minmax

1-To generate code compatible to streaming mode:
 - enable custom lowering for SMIN, SMAX, UMIN, UMAX,
   FMAXNUM, FMINNUM, FMAXIMUM, FMINIMUM.
2-Testing files:
 - int-minmax.ll
 - fp-minmax.ll

Reviewed By: david-arm, sdesmalen

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

23 months ago[AArch64][SME]: Add precursory tests for D138292
Hassnaa Hamdi [Fri, 18 Nov 2022 13:42:38 +0000 (13:42 +0000)]
[AArch64][SME]: Add precursory tests for D138292

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

23 months ago[libc++][NFC] Fix documentation build
Louis Dionne [Wed, 23 Nov 2022 15:31:21 +0000 (10:31 -0500)]
[libc++][NFC] Fix documentation build

23 months agoRevert "Make -fsanitize=scudo use scudo_standalone. Delete check-scudo."
Hans Wennborg [Wed, 23 Nov 2022 15:07:07 +0000 (16:07 +0100)]
Revert "Make -fsanitize=scudo use scudo_standalone. Delete check-scudo."

It broke the build, see comments on code review.

> Leaves the implementation and tests files in-place for right now, but
> deletes the ability to build the old sanitizer-common based scudo. This
> has been on life-support for a long time, and the newer scudo_standalone
> is much better supported and maintained.
>
> Also patches up some GWP-ASan wording, primarily related to the fact
> that -fsanitize=scudo now is scudo_standalone, and therefore the way to
> reference the GWP-ASan options through the environment variable has
> changed.
>
> Future follow-up patches will delete the original scudo, and migrate all
> its tests over to be part of the scudo_standalone test suite.
>
> Reviewed By: vitalybuka
>
> Differential Revision: https://reviews.llvm.org/D138157

This reverts commit ab1a5991fe765d71c0f3262f25726d6b4d66a545.

23 months ago[SystemZ] Extend combineGET_CCMASK() to handle a truncated SELECT_CCMASK.
Jonas Paulsson [Fri, 18 Nov 2022 20:22:01 +0000 (15:22 -0500)]
[SystemZ]  Extend combineGET_CCMASK() to handle a truncated SELECT_CCMASK.

In cases where the SELECT_CCMASK has an additional user of the carry, a
truncated SELECT_CCMASK may result as the input to the GET_CCMASK, which need
to be recognized.

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

Reviewed By: Ulrich Weigand

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

23 months ago[analyzer] getBinding should auto-detect type only if it was not given
Balazs Benics [Wed, 23 Nov 2022 14:52:11 +0000 (15:52 +0100)]
[analyzer] getBinding should auto-detect type only if it was not given

Casting a pointer to a suitably large integral type by reinterpret-cast
should result in the same value as by using the `__builtin_bit_cast()`.
The compiler exploits this: https://godbolt.org/z/zMP3sG683

However, the analyzer does not bind the same symbolic value to these
expressions, resulting in weird situations, such as failing equality
checks and even results in crashes: https://godbolt.org/z/oeMP7cj8q

Previously, in the `RegionStoreManager::getBinding()` even if `T` was
non-null, we replaced it with `TVR->getValueType()` in case the `MR` was
`TypedValueRegion`.
It doesn't make much sense to auto-detect the type if the type is
already given. By not doing the auto-detection, we would just do the
right thing and perform the load by that type.
This means that we will cast the value to that type.

So, in this patch, I'm proposing to do auto-detection only if the type
was null.

Here is a snippet of code, annotated by the previous and new dump values.
`LocAsInteger` should wrap the `SymRegion`, since we want to load the
address as if it was an integer.
In none of the following cases should type auto-detection be triggered,
hence we should eventually reach an `evalCast()` to lazily cast the loaded
value into that type.

```lang=C++
void LValueToRValueBitCast_dumps(void *p, char (*array)[8]) {
  clang_analyzer_dump(p);     // remained: &SymRegion{reg_$0<void * p>}
  clang_analyzer_dump(array); // remained: {{&SymRegion{reg_$1<char (*)[8] array>}
  clang_analyzer_dump((unsigned long)p);
  // remained: {{&SymRegion{reg_$0<void * p>} [as 64 bit integer]}}
  clang_analyzer_dump(__builtin_bit_cast(unsigned long, p));     <--------- change #1
  // previously: {{&SymRegion{reg_$0<void * p>}}}
  // now:        {{&SymRegion{reg_$0<void * p>} [as 64 bit integer]}}
  clang_analyzer_dump((unsigned long)array); // remained: {{&SymRegion{reg_$1<char (*)[8] array>} [as 64 bit integer]}}
  clang_analyzer_dump(__builtin_bit_cast(unsigned long, array)); <--------- change #2
  // previously: {{&SymRegion{reg_$1<char (*)[8] array>}}}
  // now:        {{&SymRegion{reg_$1<char (*)[8] array>} [as 64 bit integer]}}
}
```

Reviewed By: xazax.hun

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

23 months ago[libc++] Remove default definition of std::char_traits
Louis Dionne [Thu, 17 Nov 2022 15:47:18 +0000 (10:47 -0500)]
[libc++] Remove default definition of std::char_traits

This patch removes the base template implementation for std::char_traits.
If my reading of http://eel.is/c++draft/char.traits is correct, the
Standard mandates that the library provides specializations for several
types like char and wchar_t, but not any implementation in the base
template. Indeed, such an implementation is bound to be incorrect for
most types anyways, since things like `eof()` and `int_type` will definitely
have to be customized.

Since the base template implementation should not have worked for anyone,
this shouldn't be a breaking change (I expect that anyone defining a
custom character type today will already have to provide their own
specialization of char_traits). However, since we're aware of some users
of char_traits for unsigned char and signed char, we're keeping those two
specializations around for two releases to give people some time to migrate.

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

23 months ago[libc++] Add missing __has_include checks for C headers not provided by libc++
Louis Dionne [Tue, 22 Nov 2022 18:42:33 +0000 (13:42 -0500)]
[libc++] Add missing __has_include checks for C headers not provided by libc++

This makes the library consistent in how it handles C library headers. For C headers provided by libc++,
we unconditionally include <foo.h> from <cfoo>, and then <foo.h> conditionally include_next <foo.h>.
For headers not provided by libc++, <cfoo> conditionally includes the system's <foo.h> directly.

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

23 months ago[lld/mac] Reorder an assert() and a printArchiveMemberLoad() call
Nico Weber [Wed, 23 Nov 2022 14:40:17 +0000 (09:40 -0500)]
[lld/mac] Reorder an assert() and a printArchiveMemberLoad() call

No behavior difference in practice, but makes it possible to use `-t`
for debugging when that assert fails.

23 months ago[flang] Fix unittests in standalone build for third-party move
Michał Górny [Wed, 23 Nov 2022 12:19:47 +0000 (13:19 +0100)]
[flang] Fix unittests in standalone build for third-party move

Update external unittest rules for flang standalone builds to account
for the unittest components (gtest, gmock) being moved to `third-party`
directory, in a11cd0d94ed3cabf0998a0289aead05da94c86eb.

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

23 months ago[LLDB][RISCV] Add RV32F instruction support for EmulateInstructionRISCV
Emmmer [Sun, 6 Nov 2022 13:36:44 +0000 (21:36 +0800)]
[LLDB][RISCV] Add RV32F instruction support for EmulateInstructionRISCV

Add:

- RV32F instruction set.
- corresponding unittests.

Further work:

- RV32FC, RV64F and RV64FC instructions support.
- update execution exceptions to fcsr register in RVM instructions.

Reviewed By: DavidSpickett

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

23 months ago[Assignment Tracking] Fix DbgVariableIntrinsic::replaceVariableLocationOp
OCHyams [Wed, 23 Nov 2022 13:32:53 +0000 (13:32 +0000)]
[Assignment Tracking] Fix DbgVariableIntrinsic::replaceVariableLocationOp

Fix replaceVariableLocationOp unconditionally replacing the first operand of a
dbg.assign.

Reviewed By: jryans

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

23 months agoUtils: Fix deleting calls to null in non-0 address spaces
Matt Arsenault [Wed, 23 Nov 2022 04:59:26 +0000 (23:59 -0500)]
Utils: Fix deleting calls to null in non-0 address spaces