platform/upstream/llvm.git
19 months ago[ELF] Fix build after getSectionAndRelocations Refactoring
Aiden Grossman [Thu, 9 Mar 2023 17:20:18 +0000 (17:20 +0000)]
[ELF] Fix build after getSectionAndRelocations Refactoring

Didn't fail locally for some reason with my gcc toolchain.

19 months agoRevert two patches to fix GH58452 regression
Erich Keane [Wed, 8 Mar 2023 20:12:33 +0000 (12:12 -0800)]
Revert two patches to fix GH58452 regression

GH58452 is a regression in the 16.0 release branch caused by both:
b8a1b698afb2fc84819c7596090aabf4d826b436 and
3a0309c53674be56b5cfce038d78a0c2c6e2a98c

This patch reverts both of those to make the 'valid' code stop
diagnosing
at the expense of crashes on invalid + unclear diagnostics.

This patch also adds the tests from GH58452 to prevent any
re-application from breaking this again.

Revert "[clang] Improve diagnostics for expansion length mismatch"
This reverts commit 3a0309c53674be56b5cfce038d78a0c2c6e2a98c.
Revert "[clang] fix missing initialization of original number of expansions"
This reverts commit b8a1b698afb2fc84819c7596090aabf4d826b436.

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

19 months ago[ELF] Move getSectionAndRelocations to ELF.cpp from ELFDumper.cpp
Aiden Grossman [Sat, 25 Feb 2023 10:18:34 +0000 (10:18 +0000)]
[ELF] Move getSectionAndRelocations to ELF.cpp from ELFDumper.cpp

This refactoring will allow for this utility function to be used in
other places in the codebase outside of the llvm-readobj tool.

Reviewed By: jhenderson, rahmanl

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

19 months ago[libc] Extend the linux thread implementation for riscv64.
Siva Chandra [Thu, 9 Mar 2023 16:53:31 +0000 (16:53 +0000)]
[libc] Extend the linux thread implementation for riscv64.

Also, added riscv64 startup code for static linking which is used
by the integration tests. Functions from the C standard threads
library have been enabled.

Reviewed By: mikhail.ramalho

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

19 months ago[Polly] Fix plugin build.
Michael Kruse [Thu, 9 Mar 2023 16:48:02 +0000 (10:48 -0600)]
[Polly] Fix plugin build.

The target_link_libraries call was accidentially removed in
D142580 (Remove Polly-ACC).

19 months ago[VPlan] Replace invariance fields from VPWidenGEPRecipe.
Florian Hahn [Thu, 9 Mar 2023 16:52:22 +0000 (17:52 +0100)]
[VPlan] Replace invariance fields from VPWidenGEPRecipe.

There is no need to store information about invariance in the recipe.
Replace the fields with checks of the operands using
isDefinedOutsideVectorRegions.

Reviewed By: Ayal

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

19 months ago[ASAN] Address a style issue noticed during review of D145175 [nfc]
Philip Reames [Thu, 9 Mar 2023 16:36:45 +0000 (08:36 -0800)]
[ASAN] Address a style issue noticed during review of D145175 [nfc]

19 months ago[flang] Check if dummy is allocated before deallocation for optional intent(out)
Valentin Clement [Thu, 9 Mar 2023 16:48:11 +0000 (17:48 +0100)]
[flang] Check if dummy is allocated before deallocation for optional intent(out)

Similary to non-optional argument, check if the argument is allocated before
doing the deallocation for intent(out) optional.

Depends on D145679

Reviewed By: PeteSteinfeld

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

19 months ago[RISCV][NFC] Add tests for interleave shuffle costs
Luke Lau [Thu, 9 Mar 2023 14:33:35 +0000 (14:33 +0000)]
[RISCV][NFC] Add tests for interleave shuffle costs

Pre-commit test for D145678

Reviewed By: reames

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

19 months ago[scudo] Slightly improve the handling of last block in a region
Chia-hung Duan [Wed, 8 Mar 2023 23:08:50 +0000 (23:08 +0000)]
[scudo] Slightly improve the handling of last block in a region

Instead of going through all those trailing blocks, just count the
number and increase the counter at once.

Reviewed By: cferris

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

19 months ago[ASAN] Support memory checks on scalable vector typed loads and stores
Philip Reames [Thu, 9 Mar 2023 15:55:07 +0000 (07:55 -0800)]
[ASAN] Support memory checks on scalable vector typed loads and stores

This only covers the common load/store case. There will be further patches required for masked load/store and some of the fast-path optimization cases.

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

19 months ago[MergeICmps] Adapt to non-eq comparisons, fix bug for cases need be spilted
zhongyunde [Thu, 9 Mar 2023 15:48:51 +0000 (23:48 +0800)]
[MergeICmps] Adapt to non-eq comparisons, fix bug for cases need be spilted

Fix the last runtime issue as some sequent comparisons need be spilted.
For the origin equal comparisons chain, the new spilted Icmp chain will
still be end with equal, while for the new not-equal comparisons chain,
the new spilted Icmp chain will still be end with equal, so should address
this carefully, see detail wih case partial_sequent_ne.

Thanks for @glandium and @ayzhao report the runtime issue and carefully
examine.
Fix https://github.com/llvm/llvm-project/issues/59740.

Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141188

19 months ago[clang][Interp][NFC] Take a const Descriptor* in dtor,move,ctorFns
Timm Bäder [Mon, 6 Mar 2023 13:57:19 +0000 (14:57 +0100)]
[clang][Interp][NFC] Take a const Descriptor* in dtor,move,ctorFns

We are not mutating the descriptors here.

19 months ago[flang] Only apply PointerIsAssociatedWith fix for derived-type
Valentin Clement [Thu, 9 Mar 2023 15:05:57 +0000 (16:05 +0100)]
[flang] Only apply PointerIsAssociatedWith fix for derived-type

Only apply the change made in D145604 for derived-type.
zero-sized character for example are supposed to give a false result

Reviewed By: PeteSteinfeld

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

19 months ago[flang] Reset dynamic type for optional intent(out) allocatable polymorphic dummy
Valentin Clement [Thu, 9 Mar 2023 14:47:59 +0000 (15:47 +0100)]
[flang] Reset dynamic type for optional intent(out) allocatable polymorphic dummy

Allocatable intent(out) are deallocated at the beginning of a function/subroutine.
For polyrmophic entities, the dynamic type need to be reseted to the declared
type. This patch makes sure this is done when the dummy argument is optional and
present.

Depends on D145674

Reviewed By: PeteSteinfeld

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

19 months ago[flang] Simplify same_type_as condition
Valentin Clement [Thu, 9 Mar 2023 14:46:59 +0000 (15:46 +0100)]
[flang] Simplify same_type_as condition

Restore the behavior changed in D145384 and add proper
unit tests.

Unallocated unlimited poymorphic allocatable and disassociated
unlimited polymorphic pointer should return false.

Reviewed By: PeteSteinfeld

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

19 months ago[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS
ManuelJBrito [Thu, 9 Mar 2023 14:31:33 +0000 (14:31 +0000)]
[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS

Ignoring freeze(undef) if it has multiple uses in LowerAVXCONCAT_VECTORS
causes the custom INSERT_SUBVECTOR for vector widening to be ignored.

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

19 months agoSwitch from int to unsigned int; NFC
Aaron Ballman [Thu, 9 Mar 2023 14:26:13 +0000 (09:26 -0500)]
Switch from int to unsigned int; NFC

This silences a GCC conversion diagnostic about assigning `1` to a
1-bit signed bit-field changing the value from `1` to `-1`.

Co-authored-by: Igor Kushnir <igorkuo@gmail.com>
19 months ago[AMDGPU] Speedup GCNDownwardRPTracker::advanceBeforeNext
Valery Pykhtin [Tue, 28 Feb 2023 18:00:48 +0000 (19:00 +0100)]
[AMDGPU] Speedup GCNDownwardRPTracker::advanceBeforeNext

The function makes liveness tests for the entire live register set for every instruction it passes by.
This becomes very slow on high RP regions such as ASAN enabled code.

Instead only uses of last tracked instruction should be tested and this greatly improves compilation time.

This patch revealed few bugs in SIFormMemoryClauses and PreRARematStage::sinkTriviallyRematInsts which should
be fixed first.

Reviewed By: arsenm

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

19 months ago[Flang][OpenMP] Restrict check to worksharing construct reductions
Kiran Chandramohan [Thu, 9 Mar 2023 14:05:08 +0000 (14:05 +0000)]
[Flang][OpenMP] Restrict check to worksharing construct reductions

The outer context private check for reduction variables was firing
for all constructs. This check is not applicable to non-worksharing
constructs.

OpenMP 5.2: Section 5.5.8
A list item that appears in a reduction clause on a worksharing construct
must be shared in the parallel region to which a correspodning worksharing
region binds.

Reviewed By: peixin

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

19 months agoAMDGPU: Update checks for a couple of tests. NFC
Diana Picus [Thu, 9 Mar 2023 13:50:14 +0000 (14:50 +0100)]
AMDGPU: Update checks for a couple of tests. NFC

19 months ago[Flang] Fix ALLOCATE with MOLD where MOLD is a scalar
Peter Steinfeld [Mon, 6 Mar 2023 21:00:10 +0000 (13:00 -0800)]
[Flang] Fix ALLOCATE with MOLD where MOLD is a scalar

We were failing tests where an ALLOCATE statement that allocated an
array had a non-character scalar MOLD argument.

I fixed this by merging the code for ALLOCATE statements with MOLD and
SOURCE arguments.

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

19 months ago[Flang][MLIR][OpenMP] Add support for logical eqv in worksharing-loop
Dylan Fleming [Mon, 6 Mar 2023 15:47:16 +0000 (15:47 +0000)]
[Flang][MLIR][OpenMP] Add support for logical eqv in worksharing-loop

The patch adds the lowering from Flang parse-tree to FIR+OpenMP. The
conversion code is also added in MLIR.

Reviewed By: kiranchandramohan

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

Co-authored-by: Kiran Chandramohan <kiran.chandramohan@arm.com>
19 months ago[Libomptarget] Remove unused arguments from bitcode compilation
Joseph Huber [Thu, 9 Mar 2023 13:53:47 +0000 (07:53 -0600)]
[Libomptarget] Remove unused arguments from bitcode compilation

Summary:
We passed `-fopenmp-target=` when we compiled the bitcode, which isn't
necessary since the 15 release. Also adjust an error message.

19 months ago[libc++] Add missing includes to optional
Krasimir Georgiev [Thu, 9 Mar 2023 13:02:45 +0000 (14:02 +0100)]
[libc++] Add missing includes to optional

After commit 0a4aa8a122aa097499c498b639a75b5e9a73e9f0 we see failures
like:
optional:722:7: error: missing '#include <__type_traits/conjunction.h>';
'_And' must be declared before it is used
and:
optional:683:46: error: missing '#include
<__type_traits/disjunction.h>'; '_Or' must be declared before it is used
      using __check_constructible_from_opt = _Or<

Adding these here fixes that.
I'm not familiar with the libcxx codebase, will ask the author to take a
look too.

19 months ago[libc++] Remove XFAIL for a test that now passes on FreeBSD
Ed Maste [Wed, 1 Mar 2023 22:13:09 +0000 (17:13 -0500)]
[libc++] Remove XFAIL for a test that now passes on FreeBSD

19 months agoRevert "Add __builtin_set_flt_rounds"
Aaron Ballman [Thu, 9 Mar 2023 13:02:31 +0000 (08:02 -0500)]
Revert "Add __builtin_set_flt_rounds"

This reverts commit 24b823554acd25009731b2519880aa18c7263550.

These changes broke the PPC build bot.

19 months agoRevert "Disable test for __builtin_set_flt_rounds to avoid breaking PPC buildbot"
Aaron Ballman [Thu, 9 Mar 2023 13:01:55 +0000 (08:01 -0500)]
Revert "Disable test for __builtin_set_flt_rounds to avoid breaking PPC buildbot"

This reverts commit d4fcc692ee15b2c6d249daabe31208d6a5afa025.

(This change removed all test coverage from a previous change, also to be reverted.)

19 months ago[libc] Add missing header for LIBC_INLINE macro
Joseph Huber [Thu, 9 Mar 2023 12:45:50 +0000 (06:45 -0600)]
[libc] Add missing header for LIBC_INLINE macro

Summray:
Forgot to do this in the last patch

19 months ago[libc] Add intrinsic for thread fence to the atomic support
Joseph Huber [Wed, 8 Mar 2023 21:17:14 +0000 (15:17 -0600)]
[libc] Add intrinsic for thread fence to the atomic support

This function mimics the std::atomic_thread_fence function from
<atomic>. This has no uses in source currently, but this will be used by
the proposed RPC client for the GPU mode support. There is varying
support for direct memory ordering for the GPU atomics on shared memory
resources. So the implementation will use relaxed atomics and explicit
memory fences.

Some additional work may need to be done to map this to `NVPTX` system
level fences.

Reviewed By: sivachandra

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

19 months ago[X86] combineConcatVectorOps - add basic TRUNCATE handling on AVX512 targets
Simon Pilgrim [Thu, 9 Mar 2023 12:32:11 +0000 (12:32 +0000)]
[X86] combineConcatVectorOps - add basic TRUNCATE handling on AVX512 targets

This really should be in shuffle combining, but we're still struggling to handle mismatched vector sizes

19 months ago[libc++] Safe allocator tests
Advenam Tacet [Thu, 9 Mar 2023 12:20:28 +0000 (13:20 +0100)]
[libc++] Safe allocator tests

This revision adds:
- New test allocator, which cleans memory during allocation and deallocation,
- tests using that allocator to vector.

This patch is part of our efforts to add support for ASan annotations with every
allocator.

This commit adds a new allocator for testing purposes only. The safe allocator
ensures that memory is cleand (zeroed) during allocation and deallocation, and
is intendted to test ASan annotations for every allocator in std::vector.
Check: D136765

Those tests should work correctly, even if support for every allocator in std::vector
is not yet available.

Support in ASan API was added here: rGdd1b7b797a116eed588fd752fbe61d34deeb24e4

Reviewed By: philnik, #libc

Spies: libcxx-commits

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

19 months ago[Flang] Give fir.if RegionBranchOpInterface
Sacha Ballantyne [Thu, 9 Mar 2023 10:22:05 +0000 (10:22 +0000)]
[Flang] Give fir.if RegionBranchOpInterface

fir.if currently isn't treated as a 'proper' conditional, so passes are unable to determine which regions are executed at times.

This patch gives fir.if this interface, which shouldn't do too much on its own but should allow future changes to take advantage
for various purposes

Reviewed By: vzakhari

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

19 months ago[X86] Add test case showing failure to fold concat_v32i8(trunc_v16i16(x),trunc_v16i16...
Simon Pilgrim [Thu, 9 Mar 2023 12:07:40 +0000 (12:07 +0000)]
[X86] Add test case showing failure to fold concat_v32i8(trunc_v16i16(x),trunc_v16i16(y)) -> trunc_v32i16(concat_v16i16(x,y))

We have similar tests but nothing that should only fold on BWI targets

19 months ago[ConstantFolding] Preserve inbounds when casting GEP indices
Nikita Popov [Thu, 9 Mar 2023 11:41:40 +0000 (12:41 +0100)]
[ConstantFolding] Preserve inbounds when casting GEP indices

This canonicalization just makes the implicit sext/trunc explicit,
and does not affect the inbounds-ness of the GEP.

19 months ago[InstSimplify] Fix newlines in test (NFC)
Nikita Popov [Thu, 9 Mar 2023 12:01:50 +0000 (13:01 +0100)]
[InstSimplify] Fix newlines in test (NFC)

This file used CRLF newlines.

19 months agoRevert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"
ManuelJBrito [Thu, 9 Mar 2023 11:55:09 +0000 (11:55 +0000)]
Revert "[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS"

This reverts commit e2817933fdd4417673eb7f96a2842ae2dca8fc59.

19 months agoRevert "[clang-format] Add -j to clang-format-diff to speed up formatting"
Nikita Popov [Thu, 9 Mar 2023 11:30:48 +0000 (12:30 +0100)]
Revert "[clang-format] Add -j to clang-format-diff to speed up formatting"

This reverts commit d14e7ee3d17cfa60d44256d742c10e9949a6048f.

Makes clang_format_diff.py always fail with:

    Traceback (most recent call last):
      File "/home/npopov/repos/llvm-project/clang/tools/clang-format/clang-format-diff.py", line 177, in <module>
        main()
      File "/home/npopov/repos/llvm-project/clang/tools/clang-format/clang-format-diff.py", line 174, in main
        process_subprocess_result(proc, args)
      File "/home/npopov/repos/llvm-project/clang/tools/clang-format/clang-format-diff.py", line 42, in process_subprocess_result
        with open(filename) as f:
                  ^^^^^^^^
    NameError: name 'filename' is not defined

19 months agoReapply [lld][flang] Add exceptions for Flang runtime libraries on MinGW.
Markus Mützel [Thu, 9 Mar 2023 10:55:53 +0000 (12:55 +0200)]
Reapply [lld][flang] Add exceptions for Flang runtime libraries on MinGW.

When linking a shared library with Flang on MinGW, the functions from the
Flang runtime are exported from the shared library. When trying to link an
executable to that library using Flang, the linker errors out because the
functions from the runtime conflict with the functions exported from the
shared library.

Add the Flang runtime libraries to the list of libraries for which no
symbols are exported.

Reapplying the patch with the git author name corrected.

Reviewed By: mstorsjo

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

19 months agoRevert "[lld][flang] Add exceptions for Flang runtime libraries on MinGW."
Martin Storsjö [Thu, 9 Mar 2023 11:18:04 +0000 (13:18 +0200)]
Revert "[lld][flang] Add exceptions for Flang runtime libraries on MinGW."

This reverts commit 04fc67bf08daef5031f78c4a52a069ff29cff099.

The patch was applied with the wrong git author name (forgot to
amend in the right user name after applying the patch); I'll
reapply it with the right author name.

19 months ago[X86] combineConcatVectorOps - add ADD/SUB/MUL handling
Simon Pilgrim [Thu, 9 Mar 2023 11:16:44 +0000 (11:16 +0000)]
[X86] combineConcatVectorOps - add ADD/SUB/MUL handling

19 months ago[lld][flang] Add exceptions for Flang runtime libraries on MinGW.
Martin Storsjö [Thu, 9 Mar 2023 10:55:53 +0000 (12:55 +0200)]
[lld][flang] Add exceptions for Flang runtime libraries on MinGW.

When linking a shared library with Flang on MinGW, the functions from the
Flang runtime are exported from the shared library. When trying to link an
executable to that library using Flang, the linker errors out because the
functions from the runtime conflict with the functions exported from the
shared library.

Add the Flang runtime libraries to the list of libraries for which no
symbols are exported.

Reviewed By: mstorsjo

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

19 months ago[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS
ManuelJBrito [Thu, 9 Mar 2023 10:57:05 +0000 (10:57 +0000)]
[X86] Drop single use check for freeze(undef) in LowerAVXCONCAT_VECTORS

Ignoring freeze(undef) if it has multiple uses in LowerAVXCONCAT_VECTORS
causes the custom INSERT_SUBVECTOR for vector widening to be ignored.

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

19 months ago[clang][analyzer][NFC] Refactor code of StdLibraryFunctionsChecker.
Balázs Kéri [Thu, 9 Mar 2023 10:13:52 +0000 (11:13 +0100)]
[clang][analyzer][NFC] Refactor code of StdLibraryFunctionsChecker.

The code was difficult to maintain (big internal class definitions
with long inline functions, other functions of the same class at
different location far away, irregular ordering of classes and
function definitions). It is now improved to some extent.
New functions are added to RangeConstraint to remove code repetition,
these are useful for planned new features too.
Comments are improved.

Reviewed By: Szelethus

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

19 months ago[bazel] Port for 0aac9a2875bad4f065367e4a6553fad78605f895
Haojian Wu [Thu, 9 Mar 2023 10:36:37 +0000 (11:36 +0100)]
[bazel] Port for 0aac9a2875bad4f065367e4a6553fad78605f895

19 months ago[OpenCL] Add builtin header TableGen emitter
Sven van Haastregt [Thu, 9 Mar 2023 10:20:04 +0000 (10:20 +0000)]
[OpenCL] Add builtin header TableGen emitter

Add an emitter to produce something similar to opencl-c.h from the
OpenCL builtin descriptions in OpenCLBuiltins.td

This only adds the emitter, without any direct use of it.  This allows
opencl-c.h additions to be generated from the builtin descriptions by
manually invoking `clang-tblgen -gen-clang-opencl-builtin-header`.

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

19 months agoFix SGPR + VGPR + offset Scratch offset folding
Petar Avramovic [Wed, 8 Mar 2023 16:06:29 +0000 (17:06 +0100)]
Fix SGPR + VGPR + offset Scratch offset folding

Values in SGPR and VGPR register are treated as unsigned by hardware.

When value in 32-bit SGPR or VGPR base can be negative calculate offset
using 32-bit add instructions, otherwise use
sgpr(unsigned) + vgpr(unsigned) + offset.

LoopStrengthReduce.cpp changes offsets to negative and in some
iterations value in SGPR or VGPR register could be negative.

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

19 months agoFix VGPR + offset Scratch offset folding
Petar Avramovic [Wed, 8 Mar 2023 15:42:14 +0000 (16:42 +0100)]
Fix VGPR + offset Scratch offset folding

Values in VGPR register are treated as unsigned by hardware.

When value in 32-bit VGPR base can be negative calculate offset using
32-bit add instruction, otherwise use vgpr base(unsigned) + offset.
Does not affect case where whole offset comes from VGPR register
(immediate offset is 0).

LoopStrengthReduce.cpp changes offsets to negative and in some
iterations value in VGPR register could be negative.

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

19 months agoFix SGPR + offset Scratch offset folding
Petar Avramovic [Wed, 8 Mar 2023 15:18:56 +0000 (16:18 +0100)]
Fix SGPR + offset Scratch offset folding

Values in SGPR register are treated as unsigned by hardware.

When value in 32-bit SGPR base can be negative calculate offset using
32-bit add instruction, otherwise use sgpr base(unsigned) + offset.
Does not affect case where whole offset comes from SGPR register
(immediate offset is 0).

LoopStrengthReduce.cpp changes offsets to negative and in some
iterations value in SGPR register could be negative.

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

19 months ago[IR][DAG][RISCV] Allow scalable vector ISD::STRICT_FP_EXTEND and RISC-V supports...
Yeting Kuo [Tue, 7 Mar 2023 12:06:19 +0000 (20:06 +0800)]
[IR][DAG][RISCV] Allow scalable vector ISD::STRICT_FP_EXTEND and RISC-V supports for vector ISD::STRICT_FP_EXTEND.

The patch mainly does two things. The first is allowing scalable vector
ISD::STRICT_FP_EXTEND. The second is making RISC-V customized lower
strict_fpextend to riscv_strict_fpextend_vl, the strict version of
riscv_fpextend_vl.

Reviewed By: craig.topper

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

19 months ago[Modules] Remove unnecessary check when generating name lookup table in ASTWriter
Chuanqi Xu [Thu, 9 Mar 2023 09:25:59 +0000 (17:25 +0800)]
[Modules] Remove unnecessary check when generating name lookup table in ASTWriter

Close https://github.com/llvm/llvm-project/issues/61065.

We will avoid writing the names from external AST naturally. But
currently its check is often false positive since we may have already
marked the declarations as external but
DeclContext::hasNeedToReconcileExternalVisibleStorage would be false
after reconciling.

Tested with libcxx's modular build.

This patch can improve 8% compilation time in an internal workloads.

19 months ago[IPSCCP] Don't require noundef for !range annotation
Nikita Popov [Tue, 21 Feb 2023 11:00:11 +0000 (12:00 +0100)]
[IPSCCP] Don't require noundef for !range annotation

Since https://reviews.llvm.org/D141386 !range violations return
poison instead of causing immediate undefined behavior. As such,
it is fine for IPSCCP to infer !range even if the value might be
poison. (The value cannot be undef as this would promote undef to
poison, but this is already checked separately.)

This basically undoes the late change done to D83952, restoring
it to its original version (which is now valid).

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

19 months ago[LangRef] Use new memory attribute syntax (NFC)
Nikita Popov [Thu, 9 Mar 2023 09:18:20 +0000 (10:18 +0100)]
[LangRef] Use new memory attribute syntax (NFC)

Use the memory() spelling in a few places that were using the
old syntax.

The documented attributes for llvm.type.checked.load don't match
the actual attributes, I've raised this here:
https://reviews.llvm.org/D21121#inline-1406792

19 months ago[SROA] Fix bug where CandidateTys is appended while being iterated
Han Zhu [Thu, 9 Mar 2023 09:16:04 +0000 (01:16 -0800)]
[SROA] Fix bug where CandidateTys is appended while being iterated

Fix a crash when compiling Skia. See https://reviews.llvm.org/D143225#4180342
for more details

19 months ago[SanitizerBinaryMetadata] Do not add to GPU code
Marco Elver [Tue, 7 Mar 2023 19:00:12 +0000 (20:00 +0100)]
[SanitizerBinaryMetadata] Do not add to GPU code

SanitizerBinaryMetadata should only apply to to host code, and not GPU
code. Recently AMD GPU target code has experimental sanitizer support.

If we're compiling a mixed host/device source file, only add sanitizer
metadata to host code.

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

19 months ago[llvm][TableGen][Jupyter] Correct notebook name in example command
David Spickett [Thu, 9 Mar 2023 09:14:13 +0000 (09:14 +0000)]
[llvm][TableGen][Jupyter] Correct notebook name in example command

19 months ago[llvm-c] Remove PassManagerBuilder APIs
Nikita Popov [Mon, 6 Mar 2023 15:53:35 +0000 (16:53 +0100)]
[llvm-c] Remove PassManagerBuilder APIs

The legacy PM is only supported for codegen, and PassManagerBuilder
is exclusively about the middle-end optimization pipeline. Drop it.

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

19 months ago[libc][Obvious] Fix bad include and type in threads/tss_get.h.
Siva Chandra Reddy [Thu, 9 Mar 2023 08:38:02 +0000 (08:38 +0000)]
[libc][Obvious] Fix bad include and type in threads/tss_get.h.

19 months ago[Tooling/Inclusion] Add atomic family symbols
Haojian Wu [Wed, 8 Mar 2023 09:42:19 +0000 (10:42 +0100)]
[Tooling/Inclusion] Add atomic family symbols

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

19 months ago[Tooling/Inclusion] Add missing placerholder _1 symbols.
Haojian Wu [Wed, 8 Mar 2023 08:49:40 +0000 (09:49 +0100)]
[Tooling/Inclusion] Add missing placerholder _1 symbols.

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

19 months ago[doc] Deprecate the '-fmodule-file=<module-name>=<path-BMI>' for named modules in...
Chuanqi Xu [Thu, 9 Mar 2023 08:18:55 +0000 (16:18 +0800)]
[doc] Deprecate the '-fmodule-file=<module-name>=<path-BMI>' for named modules in the document

The option '-fmodule-file=<module-name>=<path-BMI>' is already
deprecated now. This patch mentions it in the document.

19 months ago[libc][NFC] Compile tests also with -fpie.
Siva Chandra Reddy [Thu, 9 Mar 2023 07:41:06 +0000 (07:41 +0000)]
[libc][NFC] Compile tests also with -fpie.

The libc runtime code is already compiled with -fpie.

19 months ago[bazel] Don't alwayslink clang-tidy libraries
Aaron Siddhartha Mondal [Thu, 9 Mar 2023 07:43:20 +0000 (08:43 +0100)]
[bazel] Don't alwayslink clang-tidy libraries

These libraries are only ever used in clang-tidy itself, so there is no
need to unconditionally keep all symbols.

Reviewed By: GMNGeoffrey, #bazel_build

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

19 months ago[compiler-rt] Avoid signed shift overflow in __muloXi4 and __mulvXi3
Karl-Johan Karlsson [Thu, 9 Mar 2023 07:37:47 +0000 (08:37 +0100)]
[compiler-rt] Avoid signed shift overflow in __muloXi4 and __mulvXi3

When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warning:

UBSan: int_mulo_impl.inc:21:36: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long')

This can be avoided by simply doing the shift in a matching unsigned variant of
the type.

The same kind of pattern seems to exist in int_mulv_impl.inc

This was found in an out of tree target.

Reviewed By: MaskRay

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

19 months ago[libc][Obvious] Add missing dep to include.sys_mman.
Siva Chandra Reddy [Thu, 9 Mar 2023 07:25:35 +0000 (07:25 +0000)]
[libc][Obvious] Add missing dep to include.sys_mman.

19 months ago[mlir][llvm] Add inalloca attribute to alloca op.
Théo Degioanni [Thu, 9 Mar 2023 07:10:36 +0000 (08:10 +0100)]
[mlir][llvm] Add inalloca attribute to alloca op.

This revision adds the inalloca attribute to the alloca operation in the LLVMIR dialect.
It also adds tests for import and export.

Reviewed By: gysit

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

19 months ago[RISCV] Enable subregister liveness by default
Piyou Chen [Thu, 9 Mar 2023 06:17:19 +0000 (22:17 -0800)]
[RISCV] Enable subregister liveness by default

This commit enable the subregister liveness by default in RISC-V.

It was previously disabled in https://reviews.llvm.org/D129646 after a previous attempt to enabled it https://reviews.llvm.org/D128016.

We believe that https://reviews.llvm.org/D129735 fixes the issue that caused it to be disabled.

Reviewed By: craig.topper, kito-cheng

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

19 months ago[RISCV] Don't try to use fli.h with Zfa+Zfhmin.
Craig Topper [Thu, 9 Mar 2023 06:54:25 +0000 (22:54 -0800)]
[RISCV] Don't try to use fli.h with Zfa+Zfhmin.

fli.h requires Zfh or Zvfh. We need to check for this in
isFPImmLegal. Zvfh support will come in another patch.

I had to split the test file because there are other issues with
Zfhmin and some intrinsics.

19 months ago[X86][MemFold] Update some records for X86MemFoldTables.inc
Bing1 Yu [Wed, 8 Feb 2023 07:08:16 +0000 (15:08 +0800)]
[X86][MemFold] Update some records for X86MemFoldTables.inc

Update X86MemFoldTables.inc according to https://reviews.llvm.org/D142084's auto-gen table

Reviewed By: skan

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

19 months ago[libc++][test] Fix transitive_includes
Igor Zhukov [Thu, 9 Mar 2023 05:58:13 +0000 (12:58 +0700)]
[libc++][test] Fix transitive_includes

Reviewed By: #libc

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

19 months ago[lldb] Fix -Wdangling-else warning in CommunicationTest
Jonas Devlieghere [Thu, 9 Mar 2023 06:21:00 +0000 (22:21 -0800)]
[lldb] Fix -Wdangling-else warning in CommunicationTest

Fixed warning: suggest explicit braces to avoid ambiguous ‘else’
[-Wdangling-else]

19 months ago[lldb] Fix typo in SymbolVendorELF
Jonas Devlieghere [Thu, 9 Mar 2023 06:15:35 +0000 (22:15 -0800)]
[lldb] Fix typo in SymbolVendorELF

19 months agolldb] Re-enable TestSymbolFileJSON on non Darwin platforms
Jonas Devlieghere [Thu, 9 Mar 2023 06:11:23 +0000 (22:11 -0800)]
lldb] Re-enable TestSymbolFileJSON on non Darwin platforms

Fix the crash in SymbolVendorELF and re-enable the test.

19 months ago[RISCV] Remove seemingly unneeded !isPosZero from Zfa code in isFPImmLegal.
Craig Topper [Thu, 9 Mar 2023 06:05:52 +0000 (22:05 -0800)]
[RISCV] Remove seemingly unneeded !isPosZero from Zfa code in isFPImmLegal.

This was added after the patch was approved. I'm not sure why its
there. It doesn't fire in any lit test.

19 months ago[RISCV] Remove some trailing whitespace. NFC
Craig Topper [Thu, 9 Mar 2023 05:33:36 +0000 (21:33 -0800)]
[RISCV] Remove some trailing whitespace. NFC

19 months ago[lldb] Temporarily disable TestSymbolFileJSON on non Darwin platforms
Jonas Devlieghere [Thu, 9 Mar 2023 05:29:16 +0000 (21:29 -0800)]
[lldb] Temporarily disable TestSymbolFileJSON on non Darwin platforms

The new test is triggering a crash in LLDB on the Windows and Linux
bots. Temporarily disable the test while I investigate.

19 months ago[polly] Remove unused variable 'VectorLoops' in IslNodeBuilder.cpp (NFC)
Jie Fu [Thu, 9 Mar 2023 04:51:22 +0000 (12:51 +0800)]
[polly] Remove unused variable 'VectorLoops' in IslNodeBuilder.cpp (NFC)

/home/jiefu/llvm-project/polly/lib/CodeGen/IslNodeBuilder.cpp:80:11: error: unused variable 'VectorLoops' [-Werror,-Wunused-variable]
STATISTIC(VectorLoops, "Number of generated vector for-loops");
          ^
1 error generated.

19 months agoDisable test for __builtin_set_flt_rounds to avoid breaking PPC buildbot
jinge90 [Thu, 9 Mar 2023 05:13:50 +0000 (13:13 +0800)]
Disable test for __builtin_set_flt_rounds to avoid breaking PPC buildbot

Signed-off-by: jinge90 <ge.jin@intel.com>
19 months ago[lldb] Introduce new SymbolFileJSON and ObjectFileJSON
Jonas Devlieghere [Thu, 9 Mar 2023 02:28:50 +0000 (18:28 -0800)]
[lldb] Introduce new SymbolFileJSON and ObjectFileJSON

Introduce a new object and symbol file format with the goal of mapping
addresses to symbol names. I'd like to think of is as an extremely
simple textual symtab. The file format consists of a triple, a UUID and
a list of symbols. JSON is used for the encoding, but that's mostly an
implementation detail. The goal of the format was to be simple and human
readable.

The new file format is motivated by two use cases:

 - Stripped binaries: when a binary is stripped, you lose the ability to
   do thing like setting symbolic breakpoints. You can keep the
   unstripped binary around, but if all you need is the stripped
   symbols then that's a lot of overhead. Instead, we could save the
   stripped symbols to a file and load them in the debugger when
   needed. I want to extend llvm-strip to have a mode where it emits
   this new file format.

 - Interactive crashlogs: with interactive crashlogs, if we don't have
   the binary or the dSYM for a particular module, we currently show an
   unnamed symbol for those frames. This is a regression compared to the
   textual format, that has these frames pre-symbolicated. Given that
   this information is available in the JSON crashlog, we need a way to
   tell LLDB about it. With the new symbol file format, we can easily
   synthesize a symbol file for each of those modules and load them to
   symbolicate those frames.

Here's an example of the file format:

 {
     "triple": "arm64-apple-macosx13.0.0",
     "uuid": "36D0CCE7-8ED2-3CA3-96B0-48C1764DA908",
     "symbols": [
         {
             "name": "main",
             "type": "code",
             "size": 32,
             "address": 4294983568
         },
         {
             "name": "foo",
             "type": "code",
             "size": 8,
             "address": 4294983560
         }
     ]
 }

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

19 months agoRevert "Add map info for dereference pointer."
Ron Lieberman [Thu, 9 Mar 2023 04:01:22 +0000 (22:01 -0600)]
Revert "Add map info for dereference pointer."

breaks amdgpu buildbot

This reverts commit 0f2f378425821de77e50a0dcb67c4504389a56e8.

19 months ago[clang][nfc] Update some documentation referring to old clang flags
Nathan Lanza [Thu, 9 Mar 2023 04:01:52 +0000 (23:01 -0500)]
[clang][nfc] Update some documentation referring to old clang flags

-cfg-dump and -cfg-view were removed long ago. The rest are gone, but
I'm opting not to remove these lines without finding a replacement.

19 months agoAdd __builtin_set_flt_rounds
jinge90 [Thu, 9 Mar 2023 03:48:51 +0000 (11:48 +0800)]
Add __builtin_set_flt_rounds

This builtin will be converted to llvm.set.rounding intrinsic
in IR level and should be work with "#pragma STDC FENV_ACCESS ON"
since it changes default FP environment. Users can change rounding
mode via this builtin without introducing libc dependency.

Reviewed by: andrew.w.kaylor, rjmccall, sepavloff
Differential Revision: https://reviews.llvm.org/D144454
Signed-off-by: jinge90 <ge.jin@intel.com>
19 months ago[mlir] Fix -Wdeprecated-copy in SparseTensorType.h (NFC)
Jie Fu [Thu, 9 Mar 2023 02:35:01 +0000 (10:35 +0800)]
[mlir] Fix -Wdeprecated-copy in SparseTensorType.h (NFC)

/data/jiefu/llvm-project/mlir/include/mlir/Dialect/SparseTensor/IR/SparseTensorType.h:63:21: error: definition of implicit copy constructor for 'SparseTensorType' is deprecated because it has a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
  SparseTensorType &operator=(const SparseTensorType &) = delete;
                    ^
/data/jiefu/llvm-project/mlir/lib/Dialect/SparseTensor/Transforms/SparseTensorStorageLayout.h:239:9: note: in implicit copy constructor for 'mlir::sparse_tensor::SparseTensorType' first required here
      : rType(stt), fields(fields) {
        ^
1 error generated.

19 months ago[libc++] Add missing includes to __format/container_adaptor.h
Nikolas Klauser [Thu, 9 Mar 2023 02:29:12 +0000 (03:29 +0100)]
[libc++] Add missing includes to __format/container_adaptor.h

19 months agoClean up conditional, don't set load binaries twice
Jason Molenda [Thu, 9 Mar 2023 01:59:46 +0000 (17:59 -0800)]
Clean up conditional, don't set load binaries twice

Follow Alex Langford's feedback to my patch from
https://reviews.llvm.org/D145547 , and fix a
side issue I noticed while testing this, where
binaries loaded via LC_NOTE metadata were loaded
in the Target twice unnecessarily.

19 months agoAdd map info for dereference pointer.
Jennifer Yu [Wed, 1 Mar 2023 16:22:21 +0000 (08:22 -0800)]
Add map info for dereference pointer.

This is to fix run time problem when use:

int **a;
map((*a)[:3]), (*a)[1] or map(**a).

current we skip generate map info for dereference pointer:
&(*a), &(*a)[0], 3*sizeof(int), TARGET_PARAM | TO | FROM

One way to fix runtime problem is to generate map info for dereference
pointer.

map((*a)[:3]):
&(*a), &(*a), sizeof(pointer),  TARGET_PARAM | TO | FROM
&(*a), &(*a)[0], 3*sizeof(int),  PTR_AND_OBJ | TO | FROM

map(**a):
&(*a), &(*a), sizeof(pointer),  TARGET_PARAM | TO | FROM
&(*a), &(**a), sizeof(int),  PTR_AND_OBJ | TO | FROM

The change in CGOpenMPRuntime.cpp add that.

The change in SemaOpenMP is to fix variable of dereference pointer to array
captured by reference.  That is wrong. That cause run time to fail.

The rule is:
If variable is identified in a map clause it is always captured by
reference except if it is a pointer that is dereferenced somehow.

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

19 months ago[RISCV] Add more testcases for overflow-intrinsics.ll
LiaoChunyu [Thu, 9 Mar 2023 01:13:30 +0000 (09:13 +0800)]
[RISCV] Add more testcases for overflow-intrinsics.ll

19 months agoDon't load non-kexts in darwin kernel debug; handle unslid segs
Jason Molenda [Thu, 9 Mar 2023 00:49:28 +0000 (16:49 -0800)]
Don't load non-kexts in darwin kernel debug; handle unslid segs

We have some non-kexts in the binary list in the Darwin kernel
in some situations.  The binary has likely already been loaded;
check if it has been, and don't re-load it.  Also, if we do need
to load it at this point, if in-memory segment vmaddrs have not
been updated to the actual load addresses, calculate a fixed slide
for the in-memory image and apply that slide to the ondisk binary.

Differential Revision: https://reviews.llvm.org/D145547
rdar://106343477

19 months ago[mlir][sparse] Factoring out Merger::expIsTensor
wren romano [Wed, 8 Mar 2023 23:20:10 +0000 (15:20 -0800)]
[mlir][sparse] Factoring out Merger::expIsTensor

Depends On D145611

Reviewed By: aartbik

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

19 months ago[lldb] Make repeat commands work for regex commands
Dave Lee [Mon, 6 Feb 2023 22:58:11 +0000 (14:58 -0800)]
[lldb] Make repeat commands work for regex commands

Fix logic for repeat commands, so that regex commands (specificially `bt`) are
given the opportunity to provide a repeat command.

rdar://104562616

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

19 months agoRevert "[lld-macho] Warn on method name collisions from category definitions"
Jez Ng [Wed, 8 Mar 2023 23:57:24 +0000 (15:57 -0800)]
Revert "[lld-macho] Warn on method name collisions from category definitions"

This reverts commit ef122753db7fe8e9a0b7bedd46d2f3668a780fcb.

Apparently it is causing some crashes:
https://reviews.llvm.org/D142916#4178869

19 months ago[Polly] Remove Polly-ACC.
Michael Kruse [Wed, 25 Jan 2023 20:03:57 +0000 (14:03 -0600)]
[Polly] Remove Polly-ACC.

Polly-ACC is unmaintained and since it has never been ported to the NPM pipeline, since D136621 it is not even accessible anymore without manually specifying the passes on the `opt` command line.

Since there is no plan to put it to a maintainable state, remove it from Polly.

Reviewed By: grosser

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

19 months ago[mlir][sparse] Making SortMask into an enum-class
wren romano [Wed, 8 Mar 2023 21:42:07 +0000 (13:42 -0800)]
[mlir][sparse] Making SortMask into an enum-class

This helps to reduce the confusion from using `unsigned` everywhere.

Depends On D145606

Reviewed By: Peiming

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

19 months ago[NFC][AArch64] Document and improve FMV code.
Pavel Iliin [Wed, 8 Mar 2023 01:19:02 +0000 (01:19 +0000)]
[NFC][AArch64] Document and improve FMV code.

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

19 months ago[mlir][sparse] Making deletion of SparseTensorType copy-assignment explicit
wren romano [Wed, 8 Mar 2023 21:10:26 +0000 (13:10 -0800)]
[mlir][sparse] Making deletion of SparseTensorType copy-assignment explicit

The copy assignment is already implicitly deleted, but making it explicit helps clean up compilation error messages.

Reviewed By: Peiming

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

19 months ago[LSAN] Disable leaks in test using environment variables instead of not running them...
Kirill Stoimenov [Wed, 8 Mar 2023 22:04:40 +0000 (22:04 +0000)]
[LSAN] Disable leaks in test using environment variables instead of not running them with ASAN.

Reviewed By: vitalybuka

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

19 months ago[libc] Widen the riscv64 full build config.
Siva Chandra [Wed, 8 Mar 2023 22:45:20 +0000 (22:45 +0000)]
[libc] Widen the riscv64 full build config.

19 months ago[scudo] Shuffle the regions
Chia-hung Duan [Wed, 8 Mar 2023 22:46:53 +0000 (22:46 +0000)]
[scudo] Shuffle the regions

Shuffle the regions' base address so that the layout of all regions is
less predictable.

Reviewed By: cferris, cryptoad

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

19 months ago[flang] Fix linker test on Windows.
Michael Kruse [Wed, 8 Mar 2023 18:56:29 +0000 (12:56 -0600)]
[flang] Fix linker test on Windows.

The linker-flags.f90 test checks for the linker command line. The `-target` indicates cross-compiling, the toolchain executables themselves are still running on the native platform. If it is Windows, the driver will try to fully resolve the path to `ld` which may include an `.exe` suffix.

In my case, it resolves to the MinGW installation (`"C:\\tools\\msys64\\usr\\bin\\ld.exe"`) found in `PATH`. The GNU ld that comes with the MSYS2 distribution does not support `elf64lppc` or MacOS emulation modes (`acosx_version_min`), but the test also does not require executing the linker.

Reviewed By: awarzynski

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

19 months ago[mlir][linalg] Downscale 2D convolution with unit dimensions to 1D convolution
Devajith Valaparambil Sreeramaswamy [Wed, 8 Mar 2023 22:30:16 +0000 (14:30 -0800)]
[mlir][linalg] Downscale 2D convolution with unit dimensions to 1D convolution

Decompose conv_2d -> conv_1d.

This MR follows a similar approach to https://reviews.llvm.org/D112928.

This patch adds support to convert conv_2D operation with either unit height or unit width to conv_1D operation.

This is useful when 2D convolution is tiled to have a single dimension for either height or width and then can be vectorized once it is decomposed into 1D convolution.

This patch https://reviews.llvm.org/D145160 adds vector support for linalg.conv_1d operation and thereby allowing us to vectorize linalg.conv_2d operation after proper tiling.

This missing feature is reported here: https://discourse.llvm.org/t/vectorization-of-convolution-op/60458.

Reviewed By: hanchung

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