platform/upstream/llvm.git
2 years ago[clang][dataflow] Fix handling of base-class fields.
Yitzhak Mandelbaum [Wed, 23 Mar 2022 00:01:55 +0000 (00:01 +0000)]
[clang][dataflow] Fix handling of base-class fields.

Currently, the framework does not track derived class access to base
fields. This patch adds that support and a corresponding test.

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

2 years ago[InstCombine] Add additional tests for strlen/strnlen (NFC)
Martin Sebor [Fri, 1 Apr 2022 14:58:38 +0000 (16:58 +0200)]
[InstCombine] Add additional tests for strlen/strnlen (NFC)

Taken from D122686.

2 years agoAdd prototypes to functions which need them; NFC
Aaron Ballman [Fri, 1 Apr 2022 14:31:59 +0000 (10:31 -0400)]
Add prototypes to functions which need them; NFC

2 years ago[MemCpyOpt] Add test for PR54682 (NFC)
Nikita Popov [Fri, 1 Apr 2022 14:31:08 +0000 (16:31 +0200)]
[MemCpyOpt] Add test for PR54682 (NFC)

2 years ago[LV] Add SCEV workaround from 80e8025 to epilogue vector code path.
Florian Hahn [Fri, 1 Apr 2022 14:14:47 +0000 (15:14 +0100)]
[LV] Add SCEV workaround from 80e8025 to epilogue vector code path.

This was exposed by 14e3650f. The recommit of 14e3650f will hit the
problematic code path requiring the workaround.
test case that crashes without the workaround.

2 years ago[OpenMP] Make linker wrapper thin-lto default thread count use all
Joseph Huber [Fri, 1 Apr 2022 13:42:21 +0000 (09:42 -0400)]
[OpenMP] Make linker wrapper thin-lto default thread count use all

Summary:
Currently there is no option to configure the number of thin-backend
threads to use when performing thin-lto on the device, but we should
default to use all the threads rather than just one. In the future we
should use the same arguments that gold / lld use and parse it here.

2 years ago[mlir][tensor][bufferize] Support 0-d collapse_shape with offset
Matthias Springer [Fri, 1 Apr 2022 13:07:00 +0000 (22:07 +0900)]
[mlir][tensor][bufferize] Support 0-d collapse_shape with offset

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

2 years ago[x86] add tests for funnel+or == 0; NFC
Sanjay Patel [Thu, 31 Mar 2022 19:10:47 +0000 (15:10 -0400)]
[x86] add tests for funnel+or == 0; NFC

This is another family of patterns based on issue #49541

2 years agofix bazel build after 369337e3c2
Mikhail Goncharov [Fri, 1 Apr 2022 13:27:12 +0000 (15:27 +0200)]
fix bazel build after 369337e3c2

2 years ago[clangd] Record IO precentage for first preamble build of the instance
Kadir Cetinkaya [Fri, 1 Apr 2022 11:53:16 +0000 (13:53 +0200)]
[clangd] Record IO precentage for first preamble build of the instance

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

2 years ago[demangler] Fix node matcher test
Nathan Sidwell [Fri, 1 Apr 2022 12:47:35 +0000 (05:47 -0700)]
[demangler] Fix node matcher test

Move node matcher compilation test to non-anonymous namespace and
avoid using attribute.

2 years ago[AMDGPU] Only count global-to-global as indirect accesses
Jay Foad [Thu, 31 Mar 2022 12:39:02 +0000 (13:39 +0100)]
[AMDGPU] Only count global-to-global as indirect accesses

Previously any load (global, local or constant) feeding into a
global load or store would be counted as an indirect access. This
patch only counts global loads feeding into a global load or store.
The rationale is that the latency for global loads is generally
much larger than the other kinds.

As a side effect this makes it easier to write small kernels test
cases that are not counted as having indirect accesses, despite
the fact that arguments to the kernel are accessed with an SMEM
load.

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

2 years ago[LV] Re-use TripCount from EPI.TripCount.
Florian Hahn [Fri, 1 Apr 2022 12:47:34 +0000 (13:47 +0100)]
[LV] Re-use TripCount from EPI.TripCount.

During skeleton construction for the epilogue vector loop, generic
helpers use getOrCreateTripCount, which will re-expand the trip count
computation. Instead, re-use the TripCount created during main loop
vectorization.

2 years ago[demangler] Fix node matchers
Nathan Sidwell [Tue, 29 Mar 2022 13:19:18 +0000 (06:19 -0700)]
[demangler] Fix node matchers

* Add instantiation tests to ItaniumDemangleTest, to make sure all
  match functions provide constructor arguments to the provided functor.

* Fix the Node constructors that lost const qualification on arguments.

Reviewed By: dblaikie

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

2 years ago[MLIR][Presburger][NFC] Use "disjunct" to refer to disjuncts in PresburgerRelation
Groverkss [Fri, 1 Apr 2022 12:08:27 +0000 (17:38 +0530)]
[MLIR][Presburger][NFC] Use "disjunct" to refer to disjuncts in PresburgerRelation

This patch modifies the name "integerRelations" and "relation" to refer to the
disjuncts in PresburgerRelation to "disjunct(s)".  This is done to be
consistent with the rest of the interface.

Reviewed By: arjunp

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

2 years ago[demangler][NFC] Use def file for node names
Nathan Sidwell [Wed, 30 Mar 2022 12:59:16 +0000 (05:59 -0700)]
[demangler][NFC] Use def file for node names

In order to add a unit test, we need to expose the node names beyond
ItaniumDemangle.h.  This breaks them out into a def file.

Reviewed By: dblaikie

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

2 years ago[analyzer][ctu] Only import const and trivial VarDecls
Gabor Marton [Fri, 1 Apr 2022 09:58:17 +0000 (11:58 +0200)]
[analyzer][ctu] Only import const and trivial VarDecls

Do import the definition of objects from a foreign translation unit if that's type is const and trivial.

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

2 years ago[AMDGPU][DOC][NFC] Added GFX1013 assembler syntax description
Dmitry Preobrazhensky [Fri, 1 Apr 2022 11:44:24 +0000 (14:44 +0300)]
[AMDGPU][DOC][NFC] Added GFX1013 assembler syntax description

2 years ago[MLIR][Presburger] subtract: fix bug when an input set has duplicate divisions
Arjun P [Fri, 1 Apr 2022 11:21:46 +0000 (12:21 +0100)]
[MLIR][Presburger] subtract: fix bug when an input set has duplicate divisions

Previously, when an input set had a duplicate division, the duplicates might
be removed by a call to mergeLocalIds due to being detected as being duplicate
for the first time. The subtraction implementation cannot handle existing
locals being removed, so this would lead to unexpected behaviour. Resolve this
by removing all the duplicates up front.

Reviewed By: Groverkss

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

2 years ago[CoroSplit] Use freeze instead of bitcast for dummy instructions
Nikita Popov [Fri, 1 Apr 2022 11:06:44 +0000 (13:06 +0200)]
[CoroSplit] Use freeze instead of bitcast for dummy instructions

Not all types that can appear in arguments can be bitcasts -- in
particular, bitcasts do not support struct types.

2 years agoRefine tls-load-hoista llvm option
Xiang1 Zhang [Fri, 1 Apr 2022 10:12:38 +0000 (18:12 +0800)]
Refine tls-load-hoista llvm option

Reviewed By: LuoYuanke

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

2 years ago[compiler-rt] [scudo] Use -mcrc32 on x86 when available
Michał Górny [Thu, 31 Mar 2022 07:55:25 +0000 (09:55 +0200)]
[compiler-rt] [scudo] Use -mcrc32 on x86 when available

Update the hardware CRC32 logic in scudo to support using `-mcrc32`
instead of `-msse4.2`.  The CRC32 intrinsics use the former flag
in the newer compiler versions, e.g. in clang since 12fa608af44a.
With these versions of clang, passing `-msse4.2` is insufficient
to enable the instructions and causes build failures when `-march` does
not enable CRC32 implicitly:

    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.cpp:20:10: error: always_inline function '_mm_crc32_u32' requires target feature 'crc32', but would be inlined into function 'computeHardwareCRC32' that is compiled without support for 'crc32'
      return CRC32_INTRINSIC(Crc, Data);
             ^
    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/scudo_crc32.h:27:27: note: expanded from macro 'CRC32_INTRINSIC'
    #  define CRC32_INTRINSIC FIRST_32_SECOND_64(_mm_crc32_u32, _mm_crc32_u64)
                              ^
    /var/tmp/portage/sys-libs/compiler-rt-sanitizers-14.0.0/work/compiler-rt/lib/scudo/../sanitizer_common/sanitizer_platform.h:132:36: note: expanded from macro 'FIRST_32_SECOND_64'
    #  define FIRST_32_SECOND_64(a, b) (a)
                                       ^
    1 error generated.

For backwards compatibility, use `-mcrc32` when available and fall back
to `-msse4.2`.  The `<smmintrin.h>` header remains in use as it still
works and is compatible with GCC, while clang's `<crc32intrin.h>`
is not.

Use __builtin_ia32*() rather than _mm_crc32*() when using `-mcrc32`
to preserve compatibility with GCC.  _mm_crc32*() are aliases
to __builtin_ia32*() in both compilers but GCC requires `-msse4.2`
for the former, while both use `-mcrc32` for the latter.

Originally reported in https://bugs.gentoo.org/835870.

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

2 years ago[MLIR][Presburger] Factor out some functionality from LexSimplex into a LexSimplexBase
Arjun P [Fri, 1 Apr 2022 10:53:25 +0000 (11:53 +0100)]
[MLIR][Presburger] Factor out some functionality from LexSimplex into a LexSimplexBase

LexSimplex cannot be made to support symbols for symbolic lexmin; this requires
a second class. In preparation for upstreaming support for symbolic lexmin,
keep the part of LexSimplex that are specific to non-symbolic lexmin in LexSimplex
and move the parts that are required to a common class LexSimplexBase for both to
inherit from.

Reviewed By: Groverkss

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

2 years ago[X86] Add getBT helper node for attempting to create a X86ISD::BT node
Simon Pilgrim [Fri, 1 Apr 2022 10:28:34 +0000 (11:28 +0100)]
[X86] Add getBT helper node for attempting to create a X86ISD::BT node

Avoids repeating all the extension/legalization wrappers in every use

2 years ago[CoroSplit] Handle argument being the frame pointer (PR54523)
Nikita Popov [Thu, 24 Mar 2022 09:31:47 +0000 (10:31 +0100)]
[CoroSplit] Handle argument being the frame pointer (PR54523)

If the frame pointer is an argument of the original pointer (which
happens with opaque pointers), then we currently first replace the
argument with undef, which will prevent later replacement of the
old frame pointer with the new one.

Fix this by replacing arguments with some dummy instructions first,
and then replacing those with undef later. This gives us a chance
to replace the frame pointer before it becomes undef.

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

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

2 years ago[Float2Int] Add test for PR54669 (NFC)
Nikita Popov [Fri, 1 Apr 2022 10:27:14 +0000 (12:27 +0200)]
[Float2Int] Add test for PR54669 (NFC)

2 years agoRevert rGff2d1bb2b749bd8a5697c25d2380b7c97a59ae06 "[X86] Add getBT helper node for...
Simon Pilgrim [Fri, 1 Apr 2022 10:20:51 +0000 (11:20 +0100)]
Revert rGff2d1bb2b749bd8a5697c25d2380b7c97a59ae06 "[X86] Add getBT helper node for attempting to create a X86ISD::BT node"

Typo means that this doesn't return a value in all cases.

2 years ago[InstCombine] Add additional memchr tests (NFC)
Martin Sebor [Fri, 1 Apr 2022 10:15:31 +0000 (12:15 +0200)]
[InstCombine] Add additional memchr tests (NFC)

2 years ago[X86] Add getBT helper node for attempting to create a X86ISD::BT node
Simon Pilgrim [Fri, 1 Apr 2022 10:12:12 +0000 (11:12 +0100)]
[X86] Add getBT helper node for attempting to create a X86ISD::BT node

Avoids repeating all the extension/legalization wrapper in every use

2 years ago[FuncSpec][NFC] Cache code metrics for analyzed functions.
Alexandros Lamprineas [Thu, 31 Mar 2022 14:27:09 +0000 (15:27 +0100)]
[FuncSpec][NFC] Cache code metrics for analyzed functions.

This isn't expected to reduce compilation times as 'max-iters' is set to
one by default, but it helps with recursive functions that require higher
iteration counts.

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

2 years ago[X86] lowerV8I16Shuffle - use explicit SmallVector<SDValue, 4> width to avoid MSVC...
Simon Pilgrim [Fri, 1 Apr 2022 09:54:14 +0000 (10:54 +0100)]
[X86] lowerV8I16Shuffle - use explicit SmallVector<SDValue, 4> width to avoid MSVC AVX alignment bug

As discussed on Issue #54645 - building llc with /AVX can result in incorrectly aligned structs

2 years ago[MLIR][Presburger] Use PresburgerSpace in constructors
Groverkss [Fri, 1 Apr 2022 09:32:27 +0000 (15:02 +0530)]
[MLIR][Presburger] Use PresburgerSpace in constructors

This patch modifies IntegerPolyhedron, IntegerRelation, PresburgerRelation,
PresburgerSet, PWMAFunction, constructors to take PresburgerSpace instead of
dimensions. This allows information present in PresburgerSpace to be carried
better and allows for a general interface.

Reviewed By: arjunp

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

2 years ago[LLDB] Fix TestJobControl.py decorators import
Muhammad Omair Javaid [Fri, 1 Apr 2022 09:13:11 +0000 (14:13 +0500)]
[LLDB] Fix TestJobControl.py decorators import

2 years ago[LLDB] Skip TestJobControl.py AArch64/Arm Linux
Muhammad Omair Javaid [Fri, 1 Apr 2022 08:58:16 +0000 (13:58 +0500)]
[LLDB] Skip TestJobControl.py AArch64/Arm Linux

TestJobControl.py is randomly failing on AArch64/Arm Linux buildbots.
I am marking it as skipped to make buildbot stable.

2 years ago[OMPIRBuilder] Remove unused variable in test (NFC)
Adrian Kuegel [Fri, 1 Apr 2022 08:33:08 +0000 (10:33 +0200)]
[OMPIRBuilder] Remove unused variable in test (NFC)

2 years ago[OMPIRBuilder] Support ordered clause specified without parameter
Peixin-Qiao [Fri, 1 Apr 2022 08:17:29 +0000 (16:17 +0800)]
[OMPIRBuilder] Support ordered clause specified without parameter

This patch supports ordered clause specified without parameter in
worksharing-loop directive in the OpenMPIRBuilder and lowering MLIR to
LLVM IR.

Reviewed By: Meinersbur

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

2 years ago[C++20][Modules] Limit ModuleInternalLinkage to modules-ts.
Iain Sandoe [Tue, 29 Jun 2021 07:06:26 +0000 (08:06 +0100)]
[C++20][Modules] Limit ModuleInternalLinkage to modules-ts.

At present, we are generating wrong code for C++20 modules entities which
should have internal linkage.  This is because we are assigning
'ModuleInternalLinkage' unconditionally to such entities.  However this mode
is only applicable to the modules-ts.

This change makes the special linkage mode conditional on fmodules-ts and
adds a unit test to verify that we generate the correct linkage.

Currently, static variables and functions in module purview are emitted into
object files as external. On some platforms, lambdas are emitted as global
weak defintions (on Windows this causes a mangler crash).

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

2 years agoRevert "[compiler-rt] [scudo] Use -mcrc32 on x86 when available"
Nikita Popov [Fri, 1 Apr 2022 07:34:13 +0000 (09:34 +0200)]
Revert "[compiler-rt] [scudo] Use -mcrc32 on x86 when available"

This reverts commit 09b53121c323f260ab97cecd067d4e7b3be1bf7c.

Breaks the build with GCC 11.2 on x86_64:

In file included from /home/npopov/repos/llvm-project/compiler-rt/lib/scudo/scudo_crc32.h:27,
                 from /home/npopov/repos/llvm-project/compiler-rt/lib/scudo/scudo_crc32.cpp:14:
/usr/lib/gcc/x86_64-redhat-linux/11/include/smmintrin.h: In function ‘__sanitizer::u32 __scudo::computeHardwareCRC32(__sanitizer::u32, __sanitizer::uptr)’:
/usr/lib/gcc/x86_64-redhat-linux/11/include/smmintrin.h:846:1: error: inlining failed in call to ‘always_inline’ ‘long long unsigned int _mm_crc32_u64(long long unsigned int, long long unsigned int)’: target specific option mismatch
  846 | _mm_crc32_u64 (unsigned long long __C, unsigned long long __V)

2 years ago[libcxx] [test] Avoid spurious test breakage in clang-cl-dll configs with newer CMake
Martin Storsjö [Wed, 30 Mar 2022 10:34:02 +0000 (13:34 +0300)]
[libcxx] [test] Avoid spurious test breakage in clang-cl-dll configs with newer CMake

The pointer.volatile.pass.cpp test was already marked as XFAIL for
mingw-dll (for reasons explained in the comment above it).

The same issue also appears in clang-cl-dll when built with newer
CMake versions. (It didn't appear with older versions of CMake, as
CMake built the library with the clang-cl flag `-std:c++latest` when
we've requested C++ 20 - which practically built it in c++2b mode with
current clang versions. With current versions of CMake, it passes
`-std:c++20` instead.)

As it succeeds/fails dependent on factors we don't
directly control, mark it as UNSUPPORTED instead of XFAIL.

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

2 years ago[libcxx] [ci] Enable -Werror for libcxxabi and libunwind too
Martin Storsjö [Thu, 31 Mar 2022 08:51:30 +0000 (11:51 +0300)]
[libcxx] [ci] Enable -Werror for libcxxabi and libunwind too

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

2 years agoUpdate callers to SendPacket with std::string's to not devolve to c-strs
Jason Molenda [Fri, 1 Apr 2022 06:44:17 +0000 (23:44 -0700)]
Update callers to SendPacket with std::string's to not devolve to c-strs

Many callers of SendPacket() in RNBRemote.cpp have a local std::string
object, call c_str() on it to pass a c-string, which is then copied into
a std::string temporary object.

Also free JSONGenerator objects once we've formatted them into
ostringstream and don't need the objects any longer, to reduce max
memory use in debugserver.

Differential Revision: https://reviews.llvm.org/D122848
rdar://91117263

2 years agoFix MLIR test pass
Mehdi Amini [Fri, 1 Apr 2022 06:36:34 +0000 (06:36 +0000)]
Fix MLIR test pass

Inadvertently removed `populateWithGenerated` while testing native
patterns.

2 years ago[C++20] [Modules] Don't generate strong function of a partition in importing modules
Chuanqi Xu [Fri, 1 Apr 2022 06:35:35 +0000 (14:35 +0800)]
[C++20] [Modules] Don't generate strong function of a partition in importing modules

This solves the multiple defintiion issue
https://github.com/llvm/llvm-project/issues/54269.

I think the cause of the bug might be an oversight. We just forget to
edit this when implementing partitions. And it should be a good fix.

Reviewed By: iains

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

2 years ago[CSKY] AsmBackend: Wrap Inst.dump() in LLVM_DEBUG
Kees Cook [Fri, 1 Apr 2022 06:27:10 +0000 (23:27 -0700)]
[CSKY] AsmBackend: Wrap Inst.dump() in LLVM_DEBUG

-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=CSKY -DLLVM_ENABLE_ASSERTIONS=OFF
builds will fail to link due to undefined `llvm::MCInst::dump() const`

```
ld.lld: error: undefined symbol: llvm::MCInst::dump() const
>>> referenced by CSKYAsmBackend.cpp
>>>               /home/kees/src/built-compilers/llvm/stage2-prof-gen/lto.cache/llvmcache-0656FC38C728A7FE0F767D10CD84C7F820114C46:(llvm::CSKYAsmBackend::relaxInstruction(llvm::MCInst&, llvm::MCSubtargetInfo const&) const)
```

Wrap it in LLVM_DEBUG().

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

Reviewed By: MaskRay

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

2 years agoAdd a test case for `applyPatternsAndFoldGreedily` to support the revert of 59bbc7a08
Mehdi Amini [Fri, 1 Apr 2022 05:52:25 +0000 (05:52 +0000)]
Add a test case for `applyPatternsAndFoldGreedily` to support the revert of 59bbc7a08

This shows that pushing constant to the right in a commutative op leads
to `applyPatternsAndFoldGreedily` to converge without applying all the
patterns.

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

2 years agoRevert "[GreedPatternRewriter] Preprocess constants while building worklist when...
Mehdi Amini [Fri, 1 Apr 2022 06:16:00 +0000 (06:16 +0000)]
Revert "[GreedPatternRewriter] Preprocess constants while building worklist when not processing top down"

This reverts commit 59bbc7a0851b6e0054bb3ed47df0958822f08880.

This exposes an issue breaking the contract of
`applyPatternsAndFoldGreedily` where we "converge" without applying
remaining patterns.

2 years ago[X86] Set frame-setup/frame-destroy on prologue/epilogue CFI instructions
Fangrui Song [Fri, 1 Apr 2022 06:04:50 +0000 (23:04 -0700)]
[X86] Set frame-setup/frame-destroy on prologue/epilogue CFI instructions

This approach is used by AArch64/RISCV to make frame-setup/frame-destroy
instructions contiguous instead of being interleaved by CFI instructions. Code
checking `MBBI->getFlag(MachineInstr::FrameSetup) || MBBI->isCFIInstruction()`
can be simplified to just check FrameSetup.

This helps locate all CFI instructions in the prologue, which can be handy to use
.cfi_remember_state/.cfi_restore_state to decrease unwind table size (D114545).

Reviewed By: RKSimon

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

2 years ago[PowerPC] Add cmpxchg test for pwr7 in atomic expand pass. NFC.
Kai Luo [Fri, 1 Apr 2022 05:16:11 +0000 (13:16 +0800)]
[PowerPC] Add cmpxchg test for pwr7 in atomic expand pass. NFC.

2 years agoDestroy ValueNames after all unique_ptr<Value>
Vitaly Buka [Fri, 1 Apr 2022 03:39:03 +0000 (20:39 -0700)]
Destroy ValueNames after all unique_ptr<Value>

This UB detected by -fsanitize-memory-use-after-dtor in tensorflow/MLIR.

2 years ago[llvm-cov] Add test cases for coverage_watermark
Tan Jinhua [Thu, 31 Mar 2022 06:43:47 +0000 (14:43 +0800)]
[llvm-cov] Add test cases for coverage_watermark

Add test cases for coverage_watermark in llvm-cov, also refer to
https://reviews.llvm.org/D116876

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

2 years agoFix Typo in SmallVector doc
Jake Vossen [Fri, 1 Apr 2022 03:38:14 +0000 (03:38 +0000)]
Fix Typo in SmallVector doc

Replace forward slash with backward slash.

Reviewed By: kiranchandramohan

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

2 years ago[RISCV] Supplement SDNode patterns for vfwmul/vfwadd/vfwsub
Lian Wang [Thu, 31 Mar 2022 01:51:06 +0000 (01:51 +0000)]
[RISCV] Supplement SDNode patterns for vfwmul/vfwadd/vfwsub

Reviewed By: jacquesguan

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

2 years agoAn expression should only contain an unexpanded parameter pack if it
Richard Smith [Fri, 1 Apr 2022 01:40:40 +0000 (18:40 -0700)]
An expression should only contain an unexpanded parameter pack if it
lexically contains a mention of the pack.

Systematically distinguish between syntactic and semantic references to
packs, especially when propagating dependence from a type into an
expression. We should consult the type-as-written when computing
syntactic dependence and should consult the semantic type when computing
semantic dependence.

Fixes #54402.

2 years ago[VP] Add more cast VPintrinsic and docs.
yanming [Wed, 23 Mar 2022 06:11:55 +0000 (14:11 +0800)]
[VP] Add more cast VPintrinsic and docs.

Add vp.fptoui, vp.uitofp, vp.fptrunc, vp.fpext, vp.trunc, vp.zext, vp.sext, vp.ptrtoint, vp.inttoptr intrinsic and docs.

Reviewed By: frasercrmck, craig.topper

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

2 years ago[llvm-profgen] Fixing a context attribure update issue due to a non-derministic proce...
Hongtao Yu [Thu, 31 Mar 2022 19:35:40 +0000 (12:35 -0700)]
[llvm-profgen] Fixing a context attribure update issue due to a non-derministic processing order on different platforms.

 A context can  be created by invoking the `getFunctionProfileForContext` function in two ways:
      - by using a probe and its calling context.
      - by removing the leaf frame from an existing contexts. The first way is used when generating a function profile for a given LBR range, and the input `WasLeafInlined` is computed depending on the actually probe in the LBR range. The second way is used when using the entry count of an inlinee function profile to update its inliner callsite count, so `WasLeafInlined` is unknown for the inliner frame.

The two  invocations can happen in different order on different platforms, since the lbr ranges are stored in an unordered_map, and  we are making sure `ContextWasInlined` is always set correctly.

This should fix the random test failure introduced by D121655

Reviewed By: wenlei

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

2 years agoFix MemorySSAUpdater::insertDef for dead code
Artur Pilipenko [Thu, 31 Mar 2022 23:30:14 +0000 (16:30 -0700)]
Fix MemorySSAUpdater::insertDef for dead code

Fix for https://github.com/llvm/llvm-project/issues/51257.

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

2 years agoRevert "[LLDB][NativePDB] Minor fix on inline line table."
Zequan Wu [Thu, 31 Mar 2022 23:07:49 +0000 (16:07 -0700)]
Revert "[LLDB][NativePDB] Minor fix on inline line table."

This reverts commit 4b2af365b6fadde9e578ca08e6de332388b2f9c2.

2 years agoAdd output filename to UUID hash
Leonard Grey [Thu, 31 Mar 2022 18:49:12 +0000 (14:49 -0400)]
Add output filename to UUID hash

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

2 years agoTarget: Use getPointerSizeInBits instead of 8 * getPointerSize
Matt Arsenault [Thu, 31 Mar 2022 21:57:39 +0000 (17:57 -0400)]
Target: Use getPointerSizeInBits instead of 8 * getPointerSize

2 years agoX86/GlobalISel: Use LLT form of getMachineMemOperand
Matt Arsenault [Thu, 31 Mar 2022 21:42:02 +0000 (17:42 -0400)]
X86/GlobalISel: Use LLT form of getMachineMemOperand

2 years agoX86/GlobalISel: Regenerate test checks
Matt Arsenault [Thu, 31 Mar 2022 21:43:32 +0000 (17:43 -0400)]
X86/GlobalISel: Regenerate test checks

2 years agoSelectionDAG: Avoid some uses of getPointerTy
Matt Arsenault [Thu, 31 Mar 2022 21:25:11 +0000 (17:25 -0400)]
SelectionDAG: Avoid some uses of getPointerTy

Avoids use of the default address space parameter, and avoids some
assumptions about the incoming address space.

2 years agoMSP430: Avoid using getPointerSize/getPointerTy
Matt Arsenault [Thu, 31 Mar 2022 21:10:35 +0000 (17:10 -0400)]
MSP430: Avoid using getPointerSize/getPointerTy

Use the contextually appropriate value instead of relying on the
default address space default parameters. Usually you should be
reusing a pre-existing type.

2 years ago[gn build] Port fc7573f29c79
LLVM GN Syncbot [Thu, 31 Mar 2022 22:04:13 +0000 (22:04 +0000)]
[gn build] Port fc7573f29c79

2 years ago[LLDB][NativePDB] Minor fix on inline line table.
Zequan Wu [Thu, 31 Mar 2022 21:56:47 +0000 (14:56 -0700)]
[LLDB][NativePDB] Minor fix on inline line table.

2 years agoRevert "[misexpect] Re-implement MisExpect Diagnostics"
Jorge Gorbe Moya [Thu, 31 Mar 2022 21:54:41 +0000 (14:54 -0700)]
Revert "[misexpect] Re-implement MisExpect Diagnostics"

This reverts commit 46774df307159444d65083c2fd82f8574f0ab1d9.

2 years agoinclude stddef.h for size_t
Luboš Luňák [Thu, 31 Mar 2022 20:22:21 +0000 (22:22 +0200)]
include stddef.h for size_t

Needed at least for -DLLVM_ENABLE_MODULES=On.

2 years agoresolve typo in the manual.
Shivam [Thu, 31 Mar 2022 21:45:17 +0000 (03:15 +0530)]
resolve typo in the manual.

2 years ago[Darwin] Limit parallelism for sanitizer tests that use shadow memory on AS
Julian Lettner [Wed, 30 Mar 2022 17:24:11 +0000 (10:24 -0700)]
[Darwin] Limit parallelism for sanitizer tests that use shadow memory on AS

On Darwin, we want to limit the parallelism during test execution for
sanitizer tests that use shadow memory.  The reason is explained by this
existing comment:

> Only run up to 3 processes that require shadow memory simultaneously
> on 64-bit Darwin. Using more scales badly and hogs the system due to
> inefficient handling of large mmap'd regions (terabytes) by the
> kernel.

Previously we detected 3 cases:
* on-device: limit to 1 process
* 64-bit: macOS & simulators, limit to 3 processes
* others (32-bit): no limitation

We checked for the 64-bit case like this: `if arch in ['x86_64',
'x86_64h']` which misses macOS running on AS. Additionally, we don't
care about 32-bit anymore, so I've simplified this to 2 cases: on-device
and everything else.

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

2 years agoAdd a setting to not require --overwrite to overwrite commands.
Jim Ingham [Thu, 31 Mar 2022 21:11:39 +0000 (14:11 -0700)]
Add a setting to not require --overwrite to overwrite commands.

Protecting against accidental overwriting of commands is good, but
having to pass a flag to overwrite the command when developing your
commands is pretty annoying.  This adds a setting to defeat the protection
so you can do this once at the start of your session and not have to
worry about it again.

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

2 years ago[CUDA] Don't call inferCUDATargetForImplicitSpecialMember too early.
Artem Belevich [Thu, 31 Mar 2022 18:58:44 +0000 (11:58 -0700)]
[CUDA] Don't call inferCUDATargetForImplicitSpecialMember too early.

Otherwise we may crash because the special member has not been sufficiently set
up yet. Fixes https://github.com/llvm/llvm-project/issues/54537

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

2 years agoARM/GlobalISel: Get pointer type from value instead of getPointerSize
Matt Arsenault [Wed, 30 Mar 2022 21:30:28 +0000 (17:30 -0400)]
ARM/GlobalISel: Get pointer type from value instead of getPointerSize

Avoid using getPointerSize and pass through the original value type.

2 years agoAMDGPU: Update test checks to include -NEXT
Matt Arsenault [Mon, 28 Mar 2022 15:29:08 +0000 (11:29 -0400)]
AMDGPU: Update test checks to include -NEXT

2 years agoRegAllocGreedy: Fix typo
Matt Arsenault [Mon, 28 Feb 2022 23:26:41 +0000 (18:26 -0500)]
RegAllocGreedy: Fix typo

2 years agoX86: Use -NEXT checks in a test
Matt Arsenault [Mon, 28 Mar 2022 18:18:48 +0000 (14:18 -0400)]
X86: Use -NEXT checks in a test

2 years ago[X86] setcc.ll - add PR39174 test case and i686 coverage
Simon Pilgrim [Thu, 31 Mar 2022 20:29:07 +0000 (21:29 +0100)]
[X86] setcc.ll - add PR39174 test case and i686 coverage

2 years ago[LLDB] Applying clang-tidy modernize-use-equals-default over LLDB
Shafik Yaghmour [Thu, 31 Mar 2022 20:20:46 +0000 (13:20 -0700)]
[LLDB] Applying clang-tidy modernize-use-equals-default over LLDB

Applied modernize-use-equals-default clang-tidy check over LLDB.

This check is already present in the lldb/.clang-tidy config.

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

2 years ago[PowerPC] Fix lowering of byval parameters for sizes greater than 8 bytes.
Stefan Pintilie [Thu, 31 Mar 2022 19:12:19 +0000 (14:12 -0500)]
[PowerPC] Fix lowering of byval parameters for sizes greater than 8 bytes.

To store a byval parameter the existing code would store as many 8 byte elements
as was required to store the full size of the byval parameter.
For example, a paramter of size 16 would store two element of 8 bytes.
A paramter of size 12 would also store two elements of 8 bytes.
This would sometimes store too many bytes as the size of the paramter is not
always a factor of 8.

This patch fixes that issue and now byval paramters are stored with the correct
number of bytes.

Reviewed By: nemanjai, #powerpc, quinnp, amyk

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

2 years ago[llvm-readobj] Support non 64bit platforms too
Vy Nguyen [Thu, 31 Mar 2022 19:39:17 +0000 (15:39 -0400)]
[llvm-readobj] Support non 64bit platforms too
(Orignal phab: https://reviews.llvm.org/D116787)

2 years ago[flang] Keep fully qualified !fir.heap type for fir.freemem op
Valentin Clement [Thu, 31 Mar 2022 19:34:55 +0000 (21:34 +0200)]
[flang] Keep fully qualified !fir.heap type for fir.freemem op

Re-introduce a fully qualified type on teh fir.freemem operation.
Since this is the only operation where the prefix gets elided in fir, this
patch make it fully qualified so the dialect syntax feels more consistent.

Reviewed By: vdonaldson

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

2 years ago[BOLT] LongJmp: Check for shouldEmit
Vladislav Khmelevsky [Sun, 20 Mar 2022 13:10:27 +0000 (16:10 +0300)]
[BOLT] LongJmp: Check for shouldEmit

Check that the function will be emitted in the final binary. Preserving
old function address is needed in case it is PLT trampiline, that is
currently not moved by the BOLT.

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

2 years ago[BOLT] AArch64: Emit text objects
Vladislav Khmelevsky [Sun, 20 Mar 2022 12:31:16 +0000 (15:31 +0300)]
[BOLT] AArch64: Emit text objects

BOLT treats aarch64 objects located in text as empty functions with
contant islands. Emit them with at least 8-byte alignment to the new
text section.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

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

2 years agobetter syntax
Nico Weber [Thu, 31 Mar 2022 19:25:43 +0000 (15:25 -0400)]
better syntax

2 years ago[llvm-readobj] Fix forward build breakages caused by https://reviews.llvm.org/rG33b3c...
Vy Nguyen [Thu, 31 Mar 2022 19:21:23 +0000 (15:21 -0400)]
[llvm-readobj] Fix forward build breakages caused by https://reviews.llvm.org/rG33b3c86afab06ad61d46456c85c0b565cfff8287

Change: use std::function instead of function_ref because it's not safe to store a function_ref

(original phab: https://reviews.llvm.org/D116787)

2 years ago[GreedPatternRewriter] Preprocess constants while building worklist when not processi...
River Riddle [Tue, 29 Mar 2022 23:28:38 +0000 (16:28 -0700)]
[GreedPatternRewriter] Preprocess constants while building worklist when not processing top down

This avoids accidentally reversing the order of constants during successive
application, e.g. when running the canonicalizer. This helps reduce the number
of iterations, and also avoids unnecessary changes to input IR.

Fixes #51892

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

2 years ago[PowerPC] Set the special DSCR with a compiler option.
Stefan Pintilie [Thu, 31 Mar 2022 17:46:51 +0000 (12:46 -0500)]
[PowerPC] Set the special DSCR with a compiler option.

Add a compiler option and the instructions required to set the
special Data Stream Control Register (DSCR). The special register will
not be set by default.

Original patch by: Muhammad Usman

Reviewed By: nemanjai, #powerpc

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

2 years ago[libc++] Fixes calendar function visibility.
Mark de Wever [Thu, 31 Mar 2022 16:55:18 +0000 (18:55 +0200)]
[libc++] Fixes calendar function visibility.

Note of the functions was marked as _LIBCPP_HIDE_FROM_ABI.

Did some minor formatting fixes to keep consistency. To keep it easy to
review not all odd formatting has been fixed.

Reviewed By: ldionne, #libc

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

2 years ago[OpenMP][libomp] NFC: Move omp_* functions out of kmp_* section
Jonathan Peyton [Thu, 31 Mar 2022 18:37:50 +0000 (13:37 -0500)]
[OpenMP][libomp] NFC: Move omp_* functions out of kmp_* section

2 years agoReland "[llvm-readobj][MachO] Add option to sort the symbol table before dumping...
Vy Nguyen [Thu, 31 Mar 2022 13:36:10 +0000 (09:36 -0400)]
Reland  "[llvm-readobj][MachO] Add option to sort the symbol table before dumping (MachO only, for now)."
    https://reviews.llvm.org/D116787

This reverts commit 33b3c86afab06ad61d46456c85c0b565cfff8287.

New change: fixed build failures:
 - in stabs-sorted:restore the the ERR-KEY statements, which were accidentally deleted during refactoring
 - in ObjDumper.h/MachODumper.cpp: refactor so that current dumpers which didn't provide an impl that accept a SymCom still works

2 years agoRevert "Added an empty __init__.py file to the MLIR Python bindings"
Alex Zinenko [Thu, 31 Mar 2022 18:01:12 +0000 (20:01 +0200)]
Revert "Added an empty __init__.py file to the MLIR Python bindings"

This reverts commit b50893db528cce45e5eb8d0ce367bc5b686b5558.

Post-commit review pointed out that adding this file will require the
entire Python tree (including out-of-tree projects) to come from the
same directory, which might be problematic in non-default installations.
Reverting pending further discussion.

2 years agoRevert "Recommit "[LV] Remove unneeded createHeaderBranch.(NFCI)""
Florian Hahn [Thu, 31 Mar 2022 18:00:48 +0000 (19:00 +0100)]
Revert "Recommit "[LV] Remove unneeded createHeaderBranch.(NFCI)""

This reverts commit 8378a71b6cce611e01f42690713fd7b561ff3f30.

It looks like this patch uncovered another issue, e.g. see
https://lab.llvm.org/buildbot/#/builders/168/builds/5518

2 years ago[gn build] Port 46774df30715
LLVM GN Syncbot [Thu, 31 Mar 2022 17:50:34 +0000 (17:50 +0000)]
[gn build] Port 46774df30715

2 years ago[lld-macho][NFC] Encapsulate symbol priority implementation.
Roger Kim [Thu, 31 Mar 2022 17:29:03 +0000 (13:29 -0400)]
[lld-macho][NFC] Encapsulate symbol priority implementation.

Just some code clean up.

Reviewed By: #lld-macho, int3

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

2 years agoUse functions with prototypes when appropriate; NFC
Aaron Ballman [Thu, 31 Mar 2022 17:43:53 +0000 (13:43 -0400)]
Use functions with prototypes when appropriate; NFC

A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

2 years ago[misexpect] Re-implement MisExpect Diagnostics
Paul Kirth [Tue, 29 Mar 2022 17:20:12 +0000 (17:20 +0000)]
[misexpect] Re-implement MisExpect Diagnostics

Reimplements MisExpect diagnostics from D66324 to reconstruct its
original checking methodology only using MD_prof branch_weights
metadata.

New checks rely on 2 invariants:

1) For frontend instrumentation, MD_prof branch_weights will always be
   populated before llvm.expect intrinsics are lowered.

2) for IR and sample profiling, llvm.expect intrinsics will always be
   lowered before branch_weights are populated from the IR profiles.

These invariants allow the checking to assume how the existing branch
weights are populated depending on the profiling method used, and emit
the correct diagnostics. If these invariants are ever invalidated, the
MisExpect related checks would need to be updated, potentially by
re-introducing MD_misexpect metadata, and ensuring it always will be
transformed the same way as branch_weights in other optimization passes.

Frontend based profiling is now enabled without using LLVM Args, by
introducing a new CodeGen option, and checking if the -Wmisexpect flag
has been passed on the command line.

Reviewed By: tejohnson

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

2 years ago[OpenMP][Tools] Fix handling of initial-task-end
Joachim Protze [Thu, 31 Mar 2022 17:31:18 +0000 (12:31 -0500)]
[OpenMP][Tools] Fix handling of initial-task-end

Latest OpenMP spec says parallel_data is NULL for initial/implicit-task-end.
We nevertheless need to cleanup the ParallelData here, as there is no other
callback for the end of the implicit parallel region. We can use the reference
stored in the TaskData.

Reviewed By: dreachem

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

2 years ago[AMDGPU] Add missing use check in SIOptimizeExecMasking pass.
Thomas Symalla [Thu, 31 Mar 2022 10:23:38 +0000 (12:23 +0200)]
[AMDGPU] Add missing use check in SIOptimizeExecMasking pass.

Whenever a v_cmp, s_and_saveexec instruction sequence shall be
transformed to an equivalent s_mov, v_cmpx sequence, it needs
to be detected if the v_cmp target register is used between
the two instructions as the v_cmp result gets omitted by
using the v_cmpx instruction, resulting in invalid code.

Reviewed By: foad

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

2 years ago[X86] Remove redundant FIXME
Simon Pilgrim [Thu, 31 Mar 2022 17:05:19 +0000 (18:05 +0100)]
[X86] Remove redundant FIXME

lowerV64I8Shuffle has been extended a lot since this was added.

2 years ago[X86] lowerV64I8Shuffle - don't use lowerShuffleWithPERMV until we've tried simpler...
Simon Pilgrim [Thu, 31 Mar 2022 17:04:09 +0000 (18:04 +0100)]
[X86] lowerV64I8Shuffle - don't use lowerShuffleWithPERMV until we've tried simpler options

Shuffle combining will still lower to this with better fast cross lane checks.

Noticed while triaging Issue #54658

2 years ago[mlir] Bubble up tensor.extract_slice above linalg operation
Okwan Kwon [Fri, 18 Mar 2022 16:48:34 +0000 (16:48 +0000)]
[mlir] Bubble up tensor.extract_slice above linalg operation

Bubble up extract_slice above Linalg operation.

A sequence of operations

    %0 = linalg.<op> ... arg0, arg1, ...
    %1 = tensor.extract_slice %0 ...

can be replaced with

    %0 = tensor.extract_slice %arg0
    %1 = tensor.extract_slice %arg1
    %2 = linalg.<op> ... %0, %1, ...

This results in the reduce computation of the linalg operation.

The implementation uses the tiling utility functions. One difference
from the tiling process is that we don't need to insert the checking
code for the out-of-bound accesses. The use of the slice itself
represents that the code writer is sure about the boundary condition.
To avoid adding the boundary condtion check code, `omitPartialTileCheck`
is introduced for the tiling utility functions.

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