platform/upstream/llvm.git
22 months ago[bazel] fix libc build
Mikhail Goncharov [Fri, 2 Sep 2022 16:32:27 +0000 (18:32 +0200)]
[bazel] fix libc build

For a4d48e3b0b66cacb8c42be8421608f7efd170c24

22 months agoRevert rG11765b77be84d793ebedc5b5436c463490746131 "[CostModel][X86] Add CostKinds...
Simon Pilgrim [Fri, 2 Sep 2022 16:21:25 +0000 (17:21 +0100)]
Revert rG11765b77be84d793ebedc5b5436c463490746131 "[CostModel][X86] Add CostKinds handling for fmul ops"

I need to address some x87 codegen changes before re-committing this.

22 months ago[CostModel][X86] Add CostKinds handling for fmul ops
Simon Pilgrim [Fri, 2 Sep 2022 15:55:12 +0000 (16:55 +0100)]
[CostModel][X86] Add CostKinds handling for fmul ops

This was achieved with an updated version of the 'cost-tables vs llvm-mca' script D103695

As we're using 'typical' worst case values, not all cost entries come from a single CPU - e.g. the latency/throughput from haswell but the size-latency(uops) from zen1/alderlake-e due to 'double pumping'

22 months ago[lldb] From unordered_map synthetic provider, return std::pair children
Dave Lee [Fri, 14 Jan 2022 05:17:02 +0000 (21:17 -0800)]
[lldb] From unordered_map synthetic provider, return std::pair children

Change the behavior of the libc++ `unordered_map` synthetic provider to present
children as `std::pair` values, just like `std::map` does.

The synthetic provider for libc++ `std::unordered_map` has returned children
that expose a level of internal structure (over top of the key/value pair). For
example, given an unordered map initialized with `{{1,2}, {3, 4}}`, the output
is:

```
(std::unordered_map<int, int, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<const int, int> > >) map = size=2 {
  [0] = {
    __cc = (first = 3, second = 4)
  }
  [1] = {
    __cc = (first = 1, second = 2)
  }
}
```

It's not ideal/necessary to have the numbered children embdedded in the `__cc`
field.

Note: the numbered children have type
`std::__hash_node<std::__hash_value_type<Key, T>, void *>::__node_value_type`,
and the `__cc` fields have type `std::__hash_value_type<Key, T>::value_type`.

Compare this output to `std::map`:

```
(std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int> > >) map = size=2 {
  [0] = (first = 1, second = 2)
  [1] = (first = 3, second = 4)
```

Where the numbered children have type `std::pair<const Key, T>`.

This changes the behavior of the synthetic provider for `unordered_map` to also
present children as `pairs`, just like `std::map`.

It appears the synthetic provider implementation for `unordered_map` was meant
to provide this behavior, but was maybe incomplete (see
d22a94377f7554a7e9df050f6dfc3ee42384e3fe). It has both an `m_node_type` and an
`m_element_type`, but uses only the former. The latter is exactly the type
needed for the children pairs. With this existing code, it's not much of a
change to make this work.

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

22 months agoRevert "[debuginfo-tests] Un-XFAIL no passing unused-merged-value.c test"
Adrian Prantl [Fri, 2 Sep 2022 15:46:38 +0000 (08:46 -0700)]
Revert "[debuginfo-tests] Un-XFAIL no passing unused-merged-value.c test"

This reverts commit 96f00f63b2d65ebe759ae1746c30115e73cbd4f2 because D128830 has been reverted.

22 months ago[CostModel][X86] Add CostKinds to SSE42 fadd/fsub/fneg ops
Simon Pilgrim [Fri, 2 Sep 2022 15:04:39 +0000 (16:04 +0100)]
[CostModel][X86] Add CostKinds to SSE42 fadd/fsub/fneg ops

These were missed in an earlier commit, the latency/codesize/size-latency numbers aren't different from the SSE2 values that it was falling through to, hence no test change, but it did mean we were wasting a lookup.

22 months ago[AggressiveInstCombine] Lower Table Based CTTZ
Djordje Todorovic [Thu, 1 Sep 2022 07:21:34 +0000 (09:21 +0200)]
[AggressiveInstCombine] Lower Table Based CTTZ

This patch introduces recognition of table-based ctz implementation
during the AggressiveInstCombine.

This fixes the [0].

[0] https://bugs.llvm.org/show_bug.cgi?id=46434

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

22 months ago[lsan][darwin] Unmask camouflaged class_rw_t pointers
Leonard Grey [Thu, 1 Sep 2022 14:58:13 +0000 (10:58 -0400)]
[lsan][darwin] Unmask camouflaged class_rw_t pointers

Detailed motivation here: https://docs.google.com/document/d/1xUNo5ovPKJMYxitiHUQVRxGI3iUmspI51Jm4w8puMwo

check-asan (with LSAN enabled) and check-lsan are currently broken on recent macOS versions, due to pervasive false positives. Whenever the Objective-C runtime realizes a class, it allocates data for it, then stores that data with flags in the low bits. This means LSAN can not recognize it as a pointer while scanning.

This change checks every potential pointer on Apple platforms, and if the high bit is set, attempts to extract a pointer by masking out the high bit and flags. This is ugly, but it's also the best approach I could think of (see doc above); very open to other suggestions.

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

22 months ago[VP] Correct LEGALPOS for more VP nodes.
Craig Topper [Fri, 2 Sep 2022 15:04:27 +0000 (08:04 -0700)]
[VP] Correct LEGALPOS for more VP nodes.

LEGALPOS appears to only be used by LegalizeVectorOps. It needs
to point at a vector operand. Stores need to point at the second
operand since the result and the first operand are MVT::Other.
Reductions need to point at the second operand since the result
and the first operand are scalsrs.

Reviewed By: rogfer01

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

22 months ago[AMDGPU][NFC] Fix typo in commment: replace SiMemOpInfo by SIMemOpInfo
Juan Manuel MARTINEZ CAAMAÑO [Fri, 2 Sep 2022 12:26:38 +0000 (14:26 +0200)]
[AMDGPU][NFC] Fix typo in commment: replace SiMemOpInfo by SIMemOpInfo

22 months ago[libc] Add Buildbot to External Links
Jeff Bailey [Fri, 2 Sep 2022 06:44:08 +0000 (06:44 +0000)]
[libc] Add Buildbot to External Links

Reviewed By: sivachandra

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

22 months agoExpose QualType::getNonReferenceType in libclang
Luca Di Sera [Fri, 2 Sep 2022 13:54:10 +0000 (09:54 -0400)]
Expose QualType::getNonReferenceType in libclang

The method is now wrapped by clang_getNonReferenceType.

A declaration for clang_getNonReferenceType was added to clang-c/Index.h
to expose it to user of the library.

An implementation for clang_getNonReferenceType was introduced in
CXType.cpp, wrapping the equivalent method of the underlying QualType of
a CXType.

An export symbol for the new function was added to libclang.map under
the LLVM_16 version entry.

A test was added to LibclangTest.cpp that tests the removal of
ref-qualifiers for some CXTypes.

The release-notes for the clang project was updated to include a
notification of the new addition under the "libclang" section.

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

22 months agoApply clang-tidy fixes for llvm-qualified-auto in DecomposeLinalgOps.cpp (NFC)
Mehdi Amini [Mon, 29 Aug 2022 10:48:50 +0000 (10:48 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in DecomposeLinalgOps.cpp (NFC)

22 months agoApply clang-tidy fixes for llvm-qualified-auto in ConstantFold.cpp (NFC)
Mehdi Amini [Mon, 29 Aug 2022 10:48:06 +0000 (10:48 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in ConstantFold.cpp (NFC)

22 months ago[llvm][Support] Add DenseMapInfo for std::variant
Kadir Cetinkaya [Fri, 2 Sep 2022 12:35:40 +0000 (14:35 +0200)]
[llvm][Support] Add DenseMapInfo for std::variant

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

22 months ago[InstCombine] Baseline tests for reducing test-for-overflow of shifted value
Tian Zhou [Fri, 2 Sep 2022 12:59:23 +0000 (08:59 -0400)]
[InstCombine] Baseline tests for reducing test-for-overflow of shifted value

Baseline tests for this patch https://reviews.llvm.org/D132888

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

22 months ago[mlir][SCF] foreach_thread: Capture shared output tensors explicitly
Matthias Springer [Fri, 2 Sep 2022 12:48:35 +0000 (14:48 +0200)]
[mlir][SCF] foreach_thread: Capture shared output tensors explicitly

This change refines the semantics of scf.foreach_thread. Tensors that are inserted into in the terminator must now be passed to the region explicitly via `shared_outs`. Inside of the body of the op, those tensors are then accessed via block arguments.

The body of a scf.foreach_thread is now treated as a repetitive region. I.e., op dominance can no longer be used in conflict detection when using a value that is defined outside of the body. Such uses may now be considered as conflicts (if there is at least one read and one write in the body), effectively privatizing the tensor. Shared outputs are not privatized when they are used via their corresponding block arguments.

As part of this change, it was also necessary to update the "tiling to scf.foreach_thread", such that the generated tensor.extract_slice ops use the scf.foreach_thread's block arguments. This is implemented by cloning the TilingInterface op inside the scf.foreach_thread, rewriting all of its outputs with block arguments and then calling the tiling implementation. Afterwards, the cloned op is deleted again.

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

22 months ago[mlir][bufferize] Add isRepetitiveRegion to BufferizableOpInterface
Matthias Springer [Fri, 2 Sep 2022 12:32:04 +0000 (14:32 +0200)]
[mlir][bufferize] Add isRepetitiveRegion to BufferizableOpInterface

This method allows to declare regions as "repetitive" even if the parent op does not implement the RegionBranchOpInterface.

This is needed to support loop-like ops that have parallel semantics but do not branch between regions.

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

22 months agoUpdate the docs about IRC
Aaron Ballman [Fri, 2 Sep 2022 12:41:49 +0000 (08:41 -0400)]
Update the docs about IRC

We haven't had a Geordi bot in years and we moved the build bot to
another channel. This updates the documentation to be more reflective
of reality, and it also identifies whether a channel is actively
moderated or not.

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

22 months ago[LoopLoadElim] Add stores with matching sizes as load-store candidates
Jolanta Jensen [Fri, 8 Jul 2022 10:14:08 +0000 (11:14 +0100)]
[LoopLoadElim] Add stores with matching sizes as load-store candidates

We are not building up a proper list of load-store candidates because
we are throwing away stores where the type don't match the load.
This patch adds stores with matching store sizes as candidates.
Author of the original patch: David Sherwood.

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

22 months ago[TypePromotionPass] Rename variable to avoid name conflict. NFC
David Green [Fri, 2 Sep 2022 11:35:15 +0000 (12:35 +0100)]
[TypePromotionPass] Rename variable to avoid name conflict. NFC

22 months ago[Clang][Comments] Fix `Index/comment-lots-of-unknown-commands.c`
Egor Zhdan [Thu, 1 Sep 2022 12:30:22 +0000 (13:30 +0100)]
[Clang][Comments] Fix `Index/comment-lots-of-unknown-commands.c`

This re-enables a test after it was disabled in https://reviews.llvm.org/D133009.

Fixes #57484.

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

22 months agoRevert "[InstCombine] Treat passing undef to noundef params as UB"
Muhammad Omair Javaid [Fri, 2 Sep 2022 11:09:50 +0000 (16:09 +0500)]
Revert "[InstCombine] Treat passing undef to noundef params as UB"

This reverts commit c911befaec494c52a63e3b957e28d449262656fb.

It has broken LLDB Arm/AArch64 Linux buildbots. I dont really understand
the underlying reason. Reverting for now make buildbot green.

https://reviews.llvm.org/D133036

22 months ago[bazel] additional build fixes for libc
Mikhail Goncharov [Fri, 2 Sep 2022 11:04:51 +0000 (13:04 +0200)]
[bazel] additional build fixes for libc

after fe41529755df946521df64ca9932b58c8eecb52b

22 months ago[CostModel][X86] Add CostKinds handling for fadd/fsub/fneg ops
Simon Pilgrim [Fri, 2 Sep 2022 10:49:46 +0000 (11:49 +0100)]
[CostModel][X86] Add CostKinds handling for fadd/fsub/fneg ops

This was achieved with an updated version of the 'cost-tables vs llvm-mca' script D103695 which I'll update shortly

As we're using 'typical' worst case values, not all cost entries come from a single CPU - e.g. the latency/throughput from haswell but the size-latency(uops) from zen1/alderlake-e due to 'double pumping'

22 months ago[GlobalOpt] Add test case for #56762.
Florian Hahn [Fri, 2 Sep 2022 10:33:06 +0000 (11:33 +0100)]
[GlobalOpt] Add test case for #56762.

Add test case where GlobalOpt fails to remove loads to global fields
with struct types.

22 months ago[clang] Skip re-building lambda expressions in parameters to consteval fns.
Utkarsh Saxena [Tue, 30 Aug 2022 14:57:07 +0000 (16:57 +0200)]
[clang] Skip re-building lambda expressions in parameters to consteval fns.

As discussed in this [comment](https://github.com/llvm/llvm-project/issues/56183#issuecomment-1224331699),
we end up building the lambda twice: once while parsing the function calls and then again while handling the immediate invocation.

This happens specially during removing nested immediate invocation.
Eg: When we have another consteval function as the parameter along with this lambda expression. Eg: `foo(bar([]{}))`, `foo(bar(), []{})`

While removing such nested immediate invocations, we should not rebuild this lambda. (IIUC, rebuilding a lambda would always generate a new type which will never match the original type from parsing)

Fixes: https://github.com/llvm/llvm-project/issues/56183
Fixes: https://github.com/llvm/llvm-project/issues/51695
Fixes: https://github.com/llvm/llvm-project/issues/50455
Fixes: https://github.com/llvm/llvm-project/issues/54872
Fixes: https://github.com/llvm/llvm-project/issues/54587

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

22 months ago[GlobalOpt] Fix debug variance problem in hasOnlyColdCalls
Mikael Holmen [Fri, 2 Sep 2022 08:56:11 +0000 (10:56 +0200)]
[GlobalOpt] Fix debug variance problem in hasOnlyColdCalls

hasOnlyColdCalls skipped over calls to intrinsics, but it did so after
checking the linkage of the called function. This meant that the presence
of a call to a debug intrinsic could affect the outcome of the
optimization.

In my original reproducer (for an out of tree target) it was particularly
interesting, because the actual IR after GlobalOpt was not different with
debug instrinsics present, so -print-after-all printouts didn't show
anything there.

However, without debuginfo, GlobalOpt went further and ran
BlockFrequencyAnalysis and (more importanly) LoopAnalysis, and later on in
the pipeline, instcombine behaved in different ways when LoopInfo was
present.

So a call to a dbg.declare prevented running LoopAnalysis in
GlobalOpt, which later prevented InstCombine from doing an optimization.

The dbg-intrinsic-loopanalysis.ll testcase tries to expose this.

Then I also noted that adding a dbg.declare actually made the existing
testcase colccc_coldsites.ll generate different code, so I modified that
to now test it behaves the same way with and without the dbg.declare.

Reviewed By: nikic, fhahn

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

22 months ago[JumpThreading] Process range comparisions with non-local cmp instructions
Sergey Kachkov [Fri, 2 Sep 2022 10:21:05 +0000 (12:21 +0200)]
[JumpThreading] Process range comparisions with non-local cmp instructions

Use getPredicateOnEdge method if value is a non-local
compare-with-a-constant instruction, that can give more precise
results than getConstantOnEdge.

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

22 months ago[SPIRV] Add tests to improve test coverage
Andrey Tretyakov [Tue, 30 Aug 2022 01:14:49 +0000 (04:14 +0300)]
[SPIRV] Add tests to improve test coverage

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

22 months ago[LoongArch][test] Replace bashism `|&` to `2>&1 |` (NFC)
wanglei [Fri, 2 Sep 2022 10:10:43 +0000 (18:10 +0800)]
[LoongArch][test] Replace bashism `|&` to `2>&1 |` (NFC)

The bash syntax `|&` is unsupported on other shells.

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

22 months ago[TTI] Improve description of TargetCostKind enums to aid targets in choosing cost...
Simon Pilgrim [Fri, 2 Sep 2022 10:08:57 +0000 (11:08 +0100)]
[TTI] Improve description of TargetCostKind enums to aid targets in choosing cost values

I'm not sure how much to add to the description as we've tried to allow targets to interpret the TargetCostKind enums in their own way. But we need to make it clear that certain cost kinds need to match threshold numbers used by various passes (and vice-versa when passes are determining a cost-benefit threshold).

I'm not keen on the "The weighted sum of size and latency" description, but its very difficult to come up with anything else that's suitably generic (e.g. X86 will use uop counts here to easily work with LoopMicroOpBufferSize thresholds, even though high latency fdiv/fsqrt instructions still often have low uop counts).

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

22 months ago[LoongArch] Support lowering br_jt
WANG Xuerui [Fri, 2 Sep 2022 09:57:29 +0000 (17:57 +0800)]
[LoongArch] Support lowering br_jt

Jump tables cannot be generated yet, due to missing support for emitting
local addresses.

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

22 months ago[FLANG][NFCI]De-duplicate code in SimplifyIntrinsics
Mats Petersson [Fri, 19 Aug 2022 16:45:35 +0000 (17:45 +0100)]
[FLANG][NFCI]De-duplicate code in SimplifyIntrinsics

This removes a bunch of duplicated code, by adding an intermediate
function simplifyReduction that takes a std::function argument
for the actual replacement of the code.

No functional change intended.

Reviewed By: vzakhari

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

22 months ago[LICM] Add test for missed load promotion opportunity (NFC)
Nikita Popov [Fri, 2 Sep 2022 09:35:26 +0000 (11:35 +0200)]
[LICM] Add test for missed load promotion opportunity (NFC)

22 months ago[NFC] Cleanup lookup for coroutine allocation/deallocation
Chuanqi Xu [Fri, 2 Sep 2022 08:13:05 +0000 (16:13 +0800)]
[NFC] Cleanup lookup for coroutine allocation/deallocation

22 months ago[mlir][Vector] Refactor vector distribution and fix an issue related to non-homogenou...
Nicolas Vasilache [Thu, 1 Sep 2022 12:47:32 +0000 (05:47 -0700)]
[mlir][Vector] Refactor vector distribution and fix an issue related to non-homogenous transfer indices.

Running: `mlir-opt -test-vector-warp-distribute=rewrite-warp-ops-to-scf-if -canonicalize -verify-each=0`.

Prior to this revision, IR resembling the following would be produced:
```
  %4 = "vector.load"(%3, %arg0) : (memref<1x32xf32, 3>, index) -> vector<1x1xf32>
```
This fails verification since it needs 2 indices to load but only 1 is provided.

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

22 months ago[MLIR] Remove unused config attributes from lit.site.cfg.py
Christian Sigg [Fri, 26 Aug 2022 10:04:32 +0000 (12:04 +0200)]
[MLIR] Remove unused config attributes from lit.site.cfg.py

Reviewed By: herhut

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

22 months ago[SPIRV] Add tests to improve test coverage
Andrey Tretyakov [Sun, 28 Aug 2022 23:19:14 +0000 (02:19 +0300)]
[SPIRV] Add tests to improve test coverage

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

22 months ago[mlir][Linalg] Apply ClangTidy performance finding.
Adrian Kuegel [Fri, 2 Sep 2022 08:57:28 +0000 (10:57 +0200)]
[mlir][Linalg] Apply ClangTidy performance finding.

Loop variable is copied but only used as const reference.

22 months ago[cmake] Append CLANG_LIBDIR_SUFFIX to scan-build-py installation destination
Sinan Lin [Fri, 2 Sep 2022 08:16:23 +0000 (16:16 +0800)]
[cmake] Append CLANG_LIBDIR_SUFFIX to scan-build-py installation destination

met this issue when building llvm with config LLVM_LIBDIR_SUFFIX=64, and
the installation destination of scan-build-py does not respect the given
suffix.

Reviewed By: phosek

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

22 months ago[X86] Add missing key feature for core2
Freddy Ye [Fri, 2 Sep 2022 03:53:43 +0000 (11:53 +0800)]
[X86] Add missing key feature for core2

Reviewed By: erichkeane

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

22 months ago[flang] Avoid copyin/copyout if the actual argument is contiguous at runtime
Valentin Clement [Fri, 2 Sep 2022 07:46:01 +0000 (09:46 +0200)]
[flang] Avoid copyin/copyout if the actual argument is contiguous at runtime

This patch adds contiguity check with the runtime to avoid copyin/copyout
in case the actual argument is actually contiguous.

Reviewed By: jeanPerier

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

22 months agoRevert "[DSE] Eliminate noop store even through has clobbering between LoadI and...
Nikita Popov [Fri, 2 Sep 2022 07:28:48 +0000 (09:28 +0200)]
Revert "[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI"

This reverts commit cd8f3e75813995c1d2da35370ffcf5af3aff9c2f.

As pointed out by Eli on the review, this is missing an alignment
check. The value might be written at an offset.

22 months ago[LICM] Allow load-only scalar promotion in the presence of unwinding
Nikita Popov [Thu, 1 Sep 2022 12:33:55 +0000 (14:33 +0200)]
[LICM] Allow load-only scalar promotion in the presence of unwinding

Currently, we bail out of scalar promotion if the loop may unwind
and the memory may be visible on unwind. This is because we can't
insert stores of the promoted value on unwind edges.

However, nowadays scalar promotion also has support for only
promoting loads, while leaving stores in place. This kind of
promotion is safe even in the presence of unwinding.

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

22 months ago[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI
luxufan [Wed, 24 Aug 2022 13:51:58 +0000 (13:51 +0000)]
[DSE] Eliminate noop store even through has clobbering between LoadI and StoreI

For noop store of the form of LoadI and StoreI,
An invariant should be kept is that the memory state of the related
MemoryLoc before LoadI is the same as before StoreI.
For this example:
```
define void @pr49927(i32* %q, i32* %p) {
  %v = load i32, i32* %p, align 4
  store i32 %v, i32* %q, align 4
  store i32 %v, i32* %p, align 4
  ret void
}
```
Here the definition of the store's destination is different with the
definition of the load's destination, which it seems that the
invariant mentioned above is broken. But the definition of the
store's destination would write a value that is LoadI, actually, the
invariant is still kept. So we can safely ignore it.

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

22 months ago[ORC-RT] Fix typo.
Lang Hames [Fri, 2 Sep 2022 06:16:45 +0000 (23:16 -0700)]
[ORC-RT] Fix typo.

Removes the stray '$' that slipped in to c1c585a065e5.

22 months ago[ORC-RT] Don't unconditionally add dependence on llvm-jitlink.
Lang Hames [Fri, 2 Sep 2022 05:42:39 +0000 (22:42 -0700)]
[ORC-RT] Don't unconditionally add dependence on llvm-jitlink.

Commit 4adc5bead4a moved a dependence on llvm-jitlink from
SANITIZER_COMMON_LIT_TEST_DEPS to ORC_TEST_DEPS, but in doing so it moved it
out from under a 'NOT COMPILER_RT_STANDALONE_BUILD ...' conditional. This led
to failures on standalone builds.

This commit adds the conditional to the ORC_TEST_DEPS assignment to work
around the issue while we look a longer term fix.

rdar://99453446

22 months ago[mlir][sparse] codegen for sparse dealloc
Aart Bik [Fri, 2 Sep 2022 00:18:56 +0000 (17:18 -0700)]
[mlir][sparse] codegen for sparse dealloc

Reviewed By: bixia

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

22 months ago[RISCV] Rename some V extension multiclasses for consistency. NFC
Craig Topper [Thu, 1 Sep 2022 23:22:57 +0000 (16:22 -0700)]
[RISCV] Rename some V extension multiclasses for consistency. NFC

Use "SDNode" in the name is the convention for the VLMax patterns
in RISCVInstrInfoVSDPatterns.td. This files use "VL".

22 months ago[lldb] Fix a warning
Kazu Hirata [Fri, 2 Sep 2022 05:14:25 +0000 (22:14 -0700)]
[lldb] Fix a warning

This patch fixes:

  lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h:51:5:
  error: default label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

22 months ago[mlir][sparse] codegen for trivial tensor cast
Aart Bik [Fri, 2 Sep 2022 01:44:48 +0000 (18:44 -0700)]
[mlir][sparse] codegen for trivial tensor cast

Reviewed By: bixia

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

22 months ago[AArch64InstPrinter] Add some `<reg:...>` for llvm-mc --mdis output
Fangrui Song [Fri, 2 Sep 2022 04:34:56 +0000 (21:34 -0700)]
[AArch64InstPrinter] Add some `<reg:...>` for llvm-mc --mdis output

22 months ago[X86InstPrinter] Introduce markup tags emission
Antonio Frighetto [Fri, 2 Sep 2022 04:04:34 +0000 (21:04 -0700)]
[X86InstPrinter] Introduce markup tags emission

x86 assembly syntax emission now leverages markup tags, if enabled.

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

22 months ago[AArch64InstPrinter] Introduce immediate markup tags emission
Antonio Frighetto [Fri, 2 Sep 2022 03:58:42 +0000 (20:58 -0700)]
[AArch64InstPrinter] Introduce immediate markup tags emission

AArch64 assembly syntax emission now leverages markup tags for immediates, if enabled.

Reviewed By: MaskRay

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

22 months ago[ORC][ORC-RT] Consistently use pointed-to type as template arg to wrap/unwrap.
Lang Hames [Thu, 1 Sep 2022 23:07:38 +0000 (16:07 -0700)]
[ORC][ORC-RT] Consistently use pointed-to type as template arg to wrap/unwrap.

Saves wrap/unwrap implementers from having to use std::remove_pointer_t to get
at the pointed-to type.

22 months ago[MipsInstPrinter] Introduce markup tags emission
Antonio Frighetto [Fri, 2 Sep 2022 03:52:08 +0000 (20:52 -0700)]
[MipsInstPrinter] Introduce markup tags emission

MIPS assembly syntax emission now leverages markup tags, if enabled.

Reviewed By: MaskRay

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

22 months ago[InstCombine] Precommit tests for umul_with_overflow. nfc
Chenbing Zheng [Fri, 2 Sep 2022 03:13:54 +0000 (11:13 +0800)]
[InstCombine] Precommit tests for umul_with_overflow. nfc

22 months ago[msan] Fix debug info with getNextNode
Vitaly Buka [Thu, 1 Sep 2022 04:49:15 +0000 (21:49 -0700)]
[msan] Fix debug info with getNextNode

When we want to add instrumentation after
an instruction, instrumentation still should
keep debug info of the instruction.

Reviewed By: kda, kstoimenov

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

22 months ago[InstCombine] complete fold extractvalue (any_mul_with_overflow X, -1)
Chenbing Zheng [Fri, 2 Sep 2022 02:58:42 +0000 (10:58 +0800)]
[InstCombine] complete fold extractvalue (any_mul_with_overflow X, -1)

When we do extractvalue (any_mul_with_overflow X, -1) --> (-X and icmp),
which left partly failed to match vector constant with poison element.
This patch try to fix it.

Alive2: https://alive2.llvm.org/ce/z/2rGp_3

Reviewed By: spatel

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

22 months ago[msan] Use no-origin functions when possible
Vitaly Buka [Fri, 2 Sep 2022 02:02:25 +0000 (19:02 -0700)]
[msan] Use no-origin functions when possible

Saves 1.8% of .text size on CTMark

Reviewed By: kda

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

22 months ago[LLDB][RISCV] Add more instruction decode and execute for EmulateInstructionRISCV
Emmmer [Sat, 27 Aug 2022 14:40:02 +0000 (22:40 +0800)]
[LLDB][RISCV] Add more instruction decode and execute for EmulateInstructionRISCV

Add:
- most of instructions from RVI base instructions set.
- some instruction decode tests from objdump.

Further work:
- implement riscv imac extension.

Reviewed By: DavidSpickett

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

22 months ago[NFC] fix typo
Chenbing Zheng [Fri, 2 Sep 2022 02:04:52 +0000 (10:04 +0800)]
[NFC] fix typo

22 months ago[test][msan] Add implicit-check-not rename some prefixes
Vitaly Buka [Fri, 2 Sep 2022 02:00:28 +0000 (19:00 -0700)]
[test][msan] Add implicit-check-not rename some prefixes

22 months ago[flang] Add lcobound and ucobound to the list of intrinsics
Katherine Rasmussen [Sat, 14 May 2022 04:41:21 +0000 (21:41 -0700)]
[flang] Add lcobound and ucobound to the list of intrinsics

Add the coarray intrinsic functions, lcobound and ucobound, to the
list of intrinsics. For both of these functions, add a check to
ensure that if the optional dim argument is present and statically
checkable, its value is in the inclusive range of 1 and the corank
of the coarray argument. In the semantics tests for lcobound and
ucobound, remove the XFAIL directive, add the ERROR directives and
add additional standard-conforming and non-standard conforming
calls.

Reviewed By: klausler, craig.rasmussen

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

22 months agoFix inconsistent target arch when attaching to arm64 binaries on
Adrian Prantl [Wed, 31 Aug 2022 23:14:09 +0000 (16:14 -0700)]
Fix inconsistent target arch when attaching to arm64 binaries on
arm64e platforms.

On arm64e-capable Apple platforms, the system libraries are always
arm64e, but applications often are arm64. When a target is created
from file, LLDB recognizes it as an arm64 target, but debugserver will
still (technically correct) report the process as being arm64e. For
consistency, set the target to arm64 here.

rdar://92248684

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

22 months ago[mlir][sparse] added codegen for dimop, pointers, indices, values
Aart Bik [Thu, 1 Sep 2022 19:34:58 +0000 (12:34 -0700)]
[mlir][sparse] added codegen for dimop, pointers, indices, values

Demonstrates how sparse tensor type -> tuple -> getter
will eventually yield actual code on the memrefs directly

Reviewed By: Peiming

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

22 months ago[CUDA] Allow using -o with -fsyntax-only
Artem Belevich [Thu, 1 Sep 2022 18:24:35 +0000 (11:24 -0700)]
[CUDA] Allow using -o with -fsyntax-only

-fsyntax-only breaks down CUDA compilation pipeline and make it look like
multiple independent subcompilations and that trips the multiple arguments check
when -o is specified.

We do want to allow -fsyntax-only to be used with otherwise unmodified clang
options as it's commonly used by various tooling.

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

22 months ago[mlir][sparse] Add SparseTensorStorageExpansion Pass to expand compounded sparse...
Peiming Liu [Thu, 1 Sep 2022 17:06:31 +0000 (17:06 +0000)]
[mlir][sparse] Add SparseTensorStorageExpansion Pass to expand compounded sparse tensor tuples

This patch adds SparseTensorStorageExpansion pass, it flattens the tuple used to store a sparse
tensor handle.

Right now, it only set up the skeleton for the pass, more lowering rules for sparse tensor storage
operation need to be added.

Reviewed By: aartbik

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

22 months ago[flang] Make use of do variable more consistent.
Slava Zakharin [Thu, 1 Sep 2022 19:33:39 +0000 (12:33 -0700)]
[flang] Make use of do variable more consistent.

Instead of using the IV block argument of the do-loop we will use
the do-variable value loaded from its location. This usage is consistent
with other uses of the do-variable inside the loop.

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

22 months ago[clang] Give better message for unsupported no_sanitize on globals
Alex Brachet [Thu, 1 Sep 2022 22:35:42 +0000 (22:35 +0000)]
[clang] Give better message for unsupported no_sanitize on globals

Previously if you specified no_sanitize("known_sanitizer") on a global you
would yield a misleading error "'no_sanitize' attribute only applies to
functions and methods", but no_sanitize("unknown") would simply be a warning,
"unknown sanitizer 'unknown' ignored". This changes the former to a warning
"'no_sanitize' attribute argument not supported for globals: known_sanitizer".

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

22 months ago[InstCombine] Treat passing undef to noundef params as UB
Arthur Eubanks [Wed, 31 Aug 2022 18:17:10 +0000 (11:17 -0700)]
[InstCombine] Treat passing undef to noundef params as UB

Reviewed By: nikic

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

22 months ago[mlir][tosa] Add remaining tosa comparison folders
Rob Suderman [Thu, 1 Sep 2022 21:10:19 +0000 (14:10 -0700)]
[mlir][tosa] Add remaining tosa comparison folders

Added numerical splat folders for comparison operations and
equal of two identical int values.

Reviewed By: NatashaKnk

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

22 months ago[libc][NFC] Use cpp::optional for checking exceptional values of math functions.
Tue Ly [Thu, 1 Sep 2022 18:30:51 +0000 (14:30 -0400)]
[libc][NFC] Use cpp::optional for checking exceptional values of math functions.

Update the utility functions for checking exceptional values of math
functions to use cpp::optional return values.

Reviewed By: sivachandra

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

22 months ago[PGO] Support PGO annotation of CallBrInst
Rong Xu [Thu, 1 Sep 2022 21:13:50 +0000 (14:13 -0700)]
[PGO] Support PGO annotation of CallBrInst

We currently instrument CallBrInst but do not annotate it with
the branch weight. This patch enables PGO annotation of CallBrInst.

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

22 months ago[llvm-objdump][COFF] Correctly decode `UOP_Epilog` opcodes
Arpad Borsos [Thu, 1 Sep 2022 21:05:13 +0000 (14:05 -0700)]
[llvm-objdump][COFF] Correctly decode `UOP_Epilog` opcodes

At least `ntdll` is using the undocumented version 2 unwind info, and opcode 6, which is already defined as `UOP_Epilog`.
Using `llvm-objdump --unwind` with `ntdll` would previously result in unreachable assertions because this code was missing from `getNumUsedSlots` and `getUnwindCodeTypeName`.
The slots of these codes comes from https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/coreclr/inc/win64unwind.h#L51-L52 which I would assume is a good authoritative source.

Reviewed By: MaskRay

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

22 months ago[MSAN] removing redundant tests and parameters (NFC)
Kevin Athey [Wed, 19 Jan 2022 00:04:05 +0000 (16:04 -0800)]
[MSAN] removing redundant tests and parameters (NFC)

Reviewed By: vitalybuka

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

22 months ago[msan] Combine shadow check of the same instruction
Vitaly Buka [Wed, 31 Aug 2022 23:58:32 +0000 (16:58 -0700)]
[msan] Combine shadow check of the same instruction

Reduces .text size by 1% on our large binary.

On CTMark (-O2 -fsanitize=memory -fsanitize-memory-use-after-dtor -fsanitize-memory-param-retval)
Size -0.4%
Time -0.8%

Reviewed By: kda

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

22 months ago[clangd] Fix tests for implicit C function declaration
Aleksandr Platonov [Thu, 1 Sep 2022 18:51:25 +0000 (21:51 +0300)]
[clangd] Fix tests for implicit C function declaration

clangd code fixes at D122983 were not right.
We need to check that clangd provides IncludeFixer fixits for implicit function declaration even if this is not an error (e.g. implicit function declaration in C89).

Reviewed By: sammccall

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

22 months ago[JITLink] Sink ELFX86RelocationKind into implementation file (ELF_x86_64.cpp).
Lang Hames [Thu, 1 Sep 2022 19:26:47 +0000 (12:26 -0700)]
[JITLink] Sink ELFX86RelocationKind into implementation file (ELF_x86_64.cpp).

The ELF/x86-64 backend uses the generic x86_64 edges now, so the
ELFX86RelocationKind is just an implementation detail.

22 months ago[SCCP][PhaseOrdering] add tests for sdiv/srem range transforms; NFC
Sanjay Patel [Thu, 1 Sep 2022 19:58:20 +0000 (15:58 -0400)]
[SCCP][PhaseOrdering] add tests for sdiv/srem range transforms; NFC

issue #57472

22 months ago[LLDB][NativePDB] Fix a minor bug.
Zequan Wu [Wed, 31 Aug 2022 21:45:27 +0000 (14:45 -0700)]
[LLDB][NativePDB] Fix a minor bug.

llvm::codeview::visitMemberRecordStream in CompleteTagDecl will call
GetOrCreateType create type if not seen before, which inserts new entries
into m_decl_to_status. This may invalidates status which is a reference to
std::pair::second from DenseMapIterator.

22 months ago[nfc][msan] Group checks per instruction
Vitaly Buka [Wed, 31 Aug 2022 22:55:18 +0000 (15:55 -0700)]
[nfc][msan] Group checks per instruction

It's a preparation of to combine shadow checks of the same instruction

Reviewed By: kda, kstoimenov

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

22 months agoRevert "[flang] Avoid copyin/copyout if the actual argument is contiguous at runtime"
Valentin Clement [Thu, 1 Sep 2022 20:04:29 +0000 (22:04 +0200)]
Revert "[flang] Avoid copyin/copyout if the actual argument is contiguous at runtime"

This reverts commit 6ab6f23b14d51d65bfe86df64d0e976ebb573429.

22 months ago[ADT] bit.h - replace <stdint.h> with <cstdint>
Simon Pilgrim [Thu, 1 Sep 2022 19:44:56 +0000 (20:44 +0100)]
[ADT] bit.h - replace <stdint.h> with <cstdint>

This is a C++ header after all.

22 months ago[mlir:PDLL] Actually run the integration tests
River Riddle [Thu, 1 Sep 2022 02:21:50 +0000 (19:21 -0700)]
[mlir:PDLL] Actually run the integration tests

This revealed that the test was a bit out of date and failing, this
commit also tweaks the .mlir to actually test pdll properly.

22 months ago[X86] Fix reciprocal instruction throughput/uops counts
Simon Pilgrim [Thu, 1 Sep 2022 19:25:52 +0000 (20:25 +0100)]
[X86] Fix reciprocal instruction throughput/uops counts

Matches numbers from AMD SoG + Agner - should always be on FPU Pipes 0+1, no additional uops for folded instructions and znver1 double pumps 256-bit vectors

Noticed while adding CostKinds support to the x86 cost models

22 months ago[clang][dataflow] Refactor `TypeErasedDataflowAnalysisTest` - replace usage of the...
Wei Yi Tee [Thu, 1 Sep 2022 17:34:22 +0000 (17:34 +0000)]
[clang][dataflow] Refactor `TypeErasedDataflowAnalysisTest` - replace usage of the deprecated overload of `checkDataflow`.

Reviewed By: gribozavr2, sgatev

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

22 months ago[flang] Avoid copyin/copyout if the actual argument is contiguous at runtime
Valentin Clement [Thu, 1 Sep 2022 19:15:48 +0000 (21:15 +0200)]
[flang] Avoid copyin/copyout if the actual argument is contiguous at runtime

This patch adds contiguity check with the runtime to avoid copyin/copyout
in case the actual argument is actually contiguous.

Reviewed By: jeanPerier

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

22 months ago[libc++] Avoids self references in transitive include test.
Mark de Wever [Sat, 27 Aug 2022 10:58:14 +0000 (12:58 +0200)]
[libc++] Avoids self references in transitive include test.

The output of --trace-includes starts with the header whose includes are
being processed. Since the sanitize script processed all lines this
include was added to the list of transitive includes. This looks odd
since it implies all headers have a cyclic dependency on themselves.
This change removes this self-include.

Instead of just dropping the first line extract that header and use it
to guard against cyclic dependencies in the header itself.

The regex used has a small improvement; don't capture groups that aren't
extracted.

Depends on D132284

Reviewed By: ldionne, #libc

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

22 months ago[libc] add division, modulo, and power to UInt
Michael Jones [Thu, 18 Aug 2022 18:46:58 +0000 (11:46 -0700)]
[libc] add division, modulo, and power to UInt

This adds division and power implementations to UInt. Modulo and
division are handled by the same function. These are necessary for some
higher order mathematics, often involving large floating point numbers.

Reviewed By: sivachandra, lntue

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

22 months ago[libc] move builtin_wrappers out of fputil
Michael Jones [Wed, 31 Aug 2022 18:14:27 +0000 (11:14 -0700)]
[libc] move builtin_wrappers out of fputil

builtin_wrappers contains the wrappers for the clz builtins, which do
not depend on anything in fputil. This patch moves the file out of
FPUtil. The location is updated as appropriate.

Reviewed By: lntue

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

22 months ago[MachineFunctionPass] Support -filter-passes for -print-changed
Fangrui Song [Thu, 1 Sep 2022 18:06:06 +0000 (11:06 -0700)]
[MachineFunctionPass] Support -filter-passes for -print-changed

[MachineFunctionPass] Support -filter-passes for -print-changed

-filter-passes specifies a `PassID` (a lower-case dashed-separated pass name,
also used by -print-after, -stop-after, etc) instead of a CamelCasePass.

`-filter-passes=CamelCaseNewPMPass` seems like a workaround for new PM passes before
we can use lower-case dashed-separated pass names (as used by `-passes=`).

Example:
```
# getPassName() is "IRTranslator". PassID is "irtranslator"
llc -mtriple=aarch64 -print-changed -filter-passes=irtranslator < print-changed-machine.ll
```

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

Reviewed By: aeubanks

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

22 months ago[gn build] Port f6b66cbc7df1
LLVM GN Syncbot [Thu, 1 Sep 2022 18:01:38 +0000 (18:01 +0000)]
[gn build] Port f6b66cbc7df1

22 months ago[libc][bazel] split fputil into individual targets
Michael Jones [Thu, 1 Sep 2022 00:03:48 +0000 (17:03 -0700)]
[libc][bazel] split fputil into individual targets

This matches the change made to cmake, mostly. I've left the process of
splitting the inclusions for all the math functions for a later time.

Reviewed By: lntue, sivachandra

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

22 months ago[test][msan] Basic debug info test
Vitaly Buka [Thu, 1 Sep 2022 04:46:17 +0000 (21:46 -0700)]
[test][msan] Basic debug info test

22 months ago[libomptarget] Enable the device allocator for AMDGPU
Joseph Huber [Thu, 1 Sep 2022 17:26:26 +0000 (12:26 -0500)]
[libomptarget] Enable the device allocator for AMDGPU

This patch adds support for the device memory type, this is currently equivalent
to the default type so it should be treated as the same.

Reviewed By: JonChesterfield

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

22 months ago[llvm][Testing/ADT] Implement `IsStringMapEntry` testing matcher for verifying the...
Wei Yi Tee [Thu, 1 Sep 2022 16:15:55 +0000 (16:15 +0000)]
[llvm][Testing/ADT] Implement `IsStringMapEntry` testing matcher for verifying the entries in a `StringMap`.

Reviewed By: gribozavr2, ymandel, sgatev

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

22 months ago[mlir] fix ubsan when loading array<i0>
Jeff Niu [Thu, 1 Sep 2022 16:49:53 +0000 (09:49 -0700)]
[mlir] fix ubsan when loading array<i0>

22 months ago[mlir][sparse] refined doc of sparse tensor ops
Aart Bik [Thu, 1 Sep 2022 03:31:24 +0000 (20:31 -0700)]
[mlir][sparse] refined doc of sparse tensor ops

Reviewed By: bixia

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