platform/upstream/llvm.git
2 years ago[NFC] Move isSameDefaultTemplateArgument into ASTContext
Chuanqi Xu [Fri, 8 Jul 2022 06:32:33 +0000 (14:32 +0800)]
[NFC] Move isSameDefaultTemplateArgument into ASTContext

Move isSameDefaultTemplateArgument into ASTContext to keep consistent
with other ASTContext:isSame* methods.

2 years ago[SLP] Add missing space to optimization remark.
Craig Topper [Fri, 8 Jul 2022 06:25:21 +0000 (23:25 -0700)]
[SLP] Add missing space to optimization remark.

Reviewed By: vporpo

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

2 years ago[RISCV] Change VECTOR_SPLICE mask operation from expand to promote
Lian Wang [Wed, 29 Jun 2022 01:38:25 +0000 (01:38 +0000)]
[RISCV] Change VECTOR_SPLICE mask operation from expand to promote

Reviewed By: craig.topper

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

2 years agoRevert "[Attributor] Replace AAValueSimplify with AAPotentialValues"
Johannes Doerfert [Fri, 8 Jul 2022 05:53:38 +0000 (00:53 -0500)]
Revert "[Attributor] Replace AAValueSimplify with AAPotentialValues"

This reverts commit f17639ea0cd30f52ac853ba2eb25518426cc3bb8 as three
AMDGPU tests haven't been updated. Will need to verify the changes are
not regressions we should avoid.

2 years ago[Attributor] Replace AAValueSimplify with AAPotentialValues
Johannes Doerfert [Tue, 21 Jun 2022 15:30:10 +0000 (10:30 -0500)]
[Attributor] Replace AAValueSimplify with AAPotentialValues

For the longest time we used `AAValueSimplify` and
`genericValueTraversal` to determine "potential values". This was
problematic for many reasons:
- We recomputed the result a lot as there was no caching for the 9
  locations calling `genericValueTraversal`.
- We added the idea of "intra" vs. "inter" procedural simplification
  only as an afterthought. `genericValueTraversal` did offer an option
  but `AAValueSimplify` did not. Thus, we might end up with "too much"
  simplification in certain situations and then gave up on it.
- Because `genericValueTraversal` was not a real `AA` we ended up with
  problems like the infinite recursion bug (#54981) as well as code
  duplication.

This patch introduces `AAPotentialValues` and replaces the
`AAValueSimplify` uses with it. `genericValueTraversal` is folded into
`AAPotentialValues` as are the instruction simplifications performed in
`AAValueSimplify` before. We further distinguish "intra" and "inter"
procedural simplification now.

`AAValueSimplify` was not deleted as we haven't ported the
re-materialization of instructions yet. There are other differences over
the former handling, e.g., we may not fold trivially foldable
instructions right now, e.g., `add i32 1, 1` is not folded to `i32 2`
but if an operand would be simplified to `i32 1` we would fold it still.

We are also even more aware of function/SCC boundaries in CGSCC passes,
which is good even if some tests look like they regress.

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

Note: A previous version was flawed and consequently reverted in
      6555558a80589d1c5a1154b92cc3af9495f8f86c.

2 years ago[AMDGPU] Use the HasNoUse predicate for no-ret atomic op selection
Abinav Puthan Purayil [Sun, 8 May 2022 18:09:49 +0000 (23:39 +0530)]
[AMDGPU] Use the HasNoUse predicate for no-ret atomic op selection

This change replaces the C++ predicates with the HasNoUse builtin
predicate that would enable the no-ret atomic op selection in
GlobalISel.

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

2 years ago[GlobalISel][SelectionDAG] Implement the HasNoUse builtin predicate
Abinav Puthan Purayil [Sun, 8 May 2022 15:54:52 +0000 (21:24 +0530)]
[GlobalISel][SelectionDAG] Implement the HasNoUse builtin predicate

This change introduces the HasNoUse builtin predicate in PatFrags that
checks for the absence of use of the first result operand.
GlobalISelEmitter will allow source PatFrags with this predicate to be
matched with destination instructions with empty outs. This predicate is
required for selecting the no-return variant of atomic instructions in
AMDGPU.

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

2 years ago[AMDGPU] Use AddedComplexity for ret and noret atomic ops selection
Abinav Puthan Purayil [Mon, 20 Jun 2022 09:18:14 +0000 (14:48 +0530)]
[AMDGPU] Use AddedComplexity for ret and noret atomic ops selection

This patch removes the predicate for return atomic ops and uses
AddedComplexity to distinguish its selection from its no return variant.
This will produce better matchers that doesn't unnecessarily check for
the negated predicate if the initial predicate failed. Also, it
simplifies the enabling of no return atomic ops selection in GlobalISel.

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

2 years ago[mlir] Delete ForwardDataFlowAnalysis
Mogball [Mon, 27 Jun 2022 20:46:29 +0000 (13:46 -0700)]
[mlir] Delete ForwardDataFlowAnalysis

With SCCP and integer range analysis ported to the new framework, this old framework is redundant. Delete it.

Depends on D128866

Reviewed By: rriddle

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

2 years ago[docs] Add document "Debugging C++ Coroutines"
Chuanqi Xu [Mon, 13 Jun 2022 09:40:45 +0000 (17:40 +0800)]
[docs] Add document "Debugging C++ Coroutines"

Previously in D99179, I tried to construct debug information for
coroutine frames in the middle end to enhance the debugability for
coroutines. But I forget to add ReleaseNotes to hint people and
documents to help people to use. My bad. @probinson revealed this in
https://github.com/llvm/llvm-project/issues/55916.

So I try to add the use document now.

Reviewed By: erichkeane

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

2 years ago[mlir] Swap integer range inference to the new framework
Mogball [Thu, 23 Jun 2022 19:03:27 +0000 (19:03 +0000)]
[mlir] Swap integer range inference to the new framework

Integer range inference has been swapped to the new framework. The integer value range lattices automatically updates the corresponding constant value on update.

Depends on D127173

Reviewed By: krzysz00, rriddle

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

2 years ago[C++20] [Modules] Don't complain about duplicated default template argument across...
Chuanqi Xu [Fri, 8 Jul 2022 03:10:49 +0000 (11:10 +0800)]
[C++20] [Modules] Don't complain about duplicated default template argument across modules

 See https://github.com/cplusplus/draft/pull/5204 for a detailed
 background.

 Simply, the test redundant-template-default-arg.cpp attached to this
 patch should be accepted instead of being complained about the
 redefinition.

 Reviewed By: urnathan, rsmith, ChuanqiXu

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

2 years ago[mlir][complex] Lower complex.angle to libm
lewuathe [Fri, 8 Jul 2022 02:30:26 +0000 (04:30 +0200)]
[mlir][complex] Lower complex.angle to libm

complex.angle corresponds to arg function in libm. We can lower complex.angle to arg and argf.

Reviewed By: pifon2a

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

2 years ago[X86] Fix collectLeaves for adds used by phi that forms loop
Haohai Wen [Fri, 8 Jul 2022 02:27:02 +0000 (10:27 +0800)]
[X86] Fix collectLeaves for adds used by phi that forms loop

When add has additional users, we should indentify whether add's
user is phi that forms loop rather than root's.

Reviewed By: LuoYuanke

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

2 years ago[RISCV] Recommit test for D128717
Lian Wang [Fri, 8 Jul 2022 02:19:46 +0000 (02:19 +0000)]
[RISCV] Recommit test for D128717

Reviewed By: craig.topper

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

2 years ago[X86][FP16] Fix crash when lowering copysign for f16
Phoebe Wang [Fri, 8 Jul 2022 00:13:29 +0000 (17:13 -0700)]
[X86][FP16] Fix crash when lowering copysign for f16

This is to address the assertion fail reported in https://reviews.llvm.org/D107082#3635612
Not sure if it is a problem of promoting FCOPYSIGN + libcall FP_ROUND.
The promoting will set the rounding mode to 1 https://github.com/llvm/llvm-project/blob/a442c628882eb07fffff8c9f7c87a317af14555a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp#L4810-L4814
While libcall cannot handle the rounding mode equals to 1 https://github.com/llvm/llvm-project/blob/a442c628882eb07fffff8c9f7c87a317af14555a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp#L4324-L4328
So changing the action to Expand to workaround the problem.

Reviewed By: clementval, MaskRay

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

2 years agoRevert "[RISCV] Precommit test for D128717"
Lian Wang [Fri, 8 Jul 2022 01:56:29 +0000 (01:56 +0000)]
Revert "[RISCV] Precommit test for D128717"

This reverts commit b3b37f3ecfd6be665c385455561603bdfc7d6c76.

2 years ago[RISCV] Precommit test for D128717
Lian Wang [Wed, 29 Jun 2022 02:44:02 +0000 (02:44 +0000)]
[RISCV] Precommit test for D128717

Reviewed By: craig.topper

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

2 years ago[ms] [llvm-ml] Add support for the remaining binary named operators
Eric Astor [Thu, 7 Jul 2022 15:59:41 +0000 (11:59 -0400)]
[ms] [llvm-ml] Add support for the remaining binary named operators

Finish adding support for the remaining binary named operators in expression context: XOR, SHL, and SHR.

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

2 years ago[clang-repl][NFC] Split weak symbol test to a new test
Jun Zhang [Thu, 7 Jul 2022 14:14:04 +0000 (22:14 +0800)]
[clang-repl][NFC] Split weak symbol test to a new test

Windows has some issues when we try to use `__attribute__((weak))` in
JIT, so we disabled that. But it's not worth to disable the whole test
just for this single feature. This patch split that part from the
original test so we can keep testing stuff that normally working in
Windows.

Signed-off-by: Jun Zhang <jun@junz.org>
Differential Revision: https://reviews.llvm.org/D129250

2 years ago[mlir][complex] Convert complex.abs to libm
lewuathe [Fri, 8 Jul 2022 00:24:34 +0000 (09:24 +0900)]
[mlir][complex] Convert complex.abs to libm

Convert complex.abs to libm library

Reviewed By: bixia

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

2 years ago[llvm-objdump][Docs] Document new flag
Joseph Huber [Fri, 8 Jul 2022 00:41:37 +0000 (20:41 -0400)]
[llvm-objdump][Docs] Document new flag

2 years ago[mlir][bzl] Update for 1a92dbcfa88a857bf735c897125d9a2f9be53e9e and cab44c515c63db876...
Jacques Pienaar [Fri, 8 Jul 2022 00:36:28 +0000 (17:36 -0700)]
[mlir][bzl] Update for 1a92dbcfa88a857bf735c897125d9a2f9be53e9e and cab44c515c63db876a7f626fdc36be4a9157ebad

2 years agoRevert "[Sanitizer][Darwin] Cleanup MaybeReexec() function and usage"
Julian Lettner [Fri, 8 Jul 2022 00:26:19 +0000 (17:26 -0700)]
Revert "[Sanitizer][Darwin] Cleanup MaybeReexec() function and usage"

Many tests for the `UBSan-Standalone-iossim-x86_64` fail with this.
Reverting so I can investigate.

This reverts commit 0a9667b0f56b1b450abd02f74c6175bea54f832e.

2 years agoAdd a little extra test coverage for simple template names
David Blaikie [Fri, 8 Jul 2022 00:11:09 +0000 (00:11 +0000)]
Add a little extra test coverage for simple template names

This would fail with an overly naive approach to simple template
name (clang's -gsimple-template-names) since the names wouldn't be
unique per specialization, creating ambiguity/chance that a query for
one specialization would find another.

2 years ago[mlir] add complex type to getZeroAttr
Aart Bik [Thu, 7 Jul 2022 20:16:49 +0000 (13:16 -0700)]
[mlir] add complex type to getZeroAttr

Fixes issue encountered with <sparse> complex constant
https://github.com/llvm/llvm-project/issues/56428

Reviewed By: rriddle

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

2 years ago[AArch64] Try to re-use extended operand for SETCC with vector ops.
Florian Hahn [Thu, 7 Jul 2022 23:50:00 +0000 (16:50 -0700)]
[AArch64] Try to re-use extended operand for SETCC with vector ops.

Try to re-use an already extended operand for SetCC with vector operands
feeding an extended select. Doing so avoids requiring another full
extension of the SET_CC result when lowering the select.

This improves lowering for certain extend/cmp/select patterns operating.
For example with  v16i8, this replaces 6 instructions for the extra extension
with 4 separate selects.

This improves the generated code for loops like the one below in
combination with D96522.

    int foo(uint8_t *p, int N) {
      unsigned long long sum = 0;
      for (int i = 0; i < N ; i++, p++) {
        unsigned int v = *p;
        sum += (v < 127) ? v : 256 - v;
      }
      return sum;
    }

https://clang.godbolt.org/z/Wco866MjY

On the AArch64 cores I have access to, the patch improves performance of
the vector loop by ~10%.

This could be generalized per follow-ups, but the initial version
targets one of the more important cases in combination with D96522.

Alive2 modeling:
* sext EQ https://alive2.llvm.org/ce/z/5upBvb
* sext NE https://alive2.llvm.org/ce/z/zbEcJp
* zext EQ https://alive2.llvm.org/ce/z/_xMwof
* zext NE https://alive2.llvm.org/ce/z/5FwKfc
* zext unsigned predicate: https://alive2.llvm.org/ce/z/iEwLU3
* sext signed predicate: https://alive2.llvm.org/ce/z/aMBega

Reviewed By: dmgreen

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

2 years ago[Sanitizer][Darwin] Cleanup MaybeReexec() function and usage
Julian Lettner [Fri, 1 Jul 2022 18:05:40 +0000 (11:05 -0700)]
[Sanitizer][Darwin] Cleanup MaybeReexec() function and usage

While investigating another issue, I noticed that `MaybeReexec()` never
actually "re-executes via `execv()`" anymore.  `DyldNeedsEnvVariable()`
only returned true on macOS 10.10 and below.

Usually, I try to avoid "unnecessary" cleanups (it's hard to be certain
that there truly is no fallout), but I decided to do this one because:

* I initially tricked myself into thinking that `MaybeReexec()` was
  relevant to my original investigation (instead of being dead code).
* The deleted code itself is quite complicated.
* Over time a few other things were mushed into `MaybeReexec()`:
  initializing `MonotonicNanoTime()`, verifying interceptors are
  working, and stripping the `DYLD_INSERT_LIBRARIES` env var to avoid
  problems when forking.
* This platform-specific thing leaked into `sanitizer_common.h`.
* The `ReexecDisabled()` config nob relies on the "strong overrides weak
  pattern", which is now problematic and can be completely removed.
* `ReexecDisabled()` actually hid another issue with interceptors not
  working in unit tests.  I added an explicit `verify_interceptors`
  (defaults to `true`) option instead.

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

2 years agoRevert "[LLDB][NFC] Decouple dwarf location table from DWARFExpression."
Jonas Devlieghere [Thu, 7 Jul 2022 23:28:35 +0000 (16:28 -0700)]
Revert "[LLDB][NFC] Decouple dwarf location table from DWARFExpression."

This reverts commit 227dffd0b6d78154516ace45f6ed28259c7baa48 and its
follow up 562c3467a6738aa89203f72fc1d1343e5baadf3c because it breaks a
bunch of tests on GreenDragon:

https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/45155/

2 years ago[libcxx][ranges] Create a test tool `ProxyIterator` that customises `iter_move` and...
Hui Xie [Tue, 5 Jul 2022 00:16:19 +0000 (01:16 +0100)]
[libcxx][ranges] Create a test tool `ProxyIterator` that customises `iter_move` and `iter_swap`

It is meant to be used in ranges algorithm tests.
It is much simplified version of C++23's tuple + zip_view.
Using std::swap would cause compilation failure and using `std::move` would not create the correct rvalue proxy which would result in copies.

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

2 years agoRevert "[RISCV] Optimize 2x SELECT for floating-point types"
Diego Caballero [Thu, 7 Jul 2022 22:32:15 +0000 (22:32 +0000)]
Revert "[RISCV] Optimize 2x SELECT for floating-point types"

This reverts commit 1178992c72b002c3b2c87203252c566eeb273cc1.

2 years ago[clang-format][NFC] Clean up IndentForLevel in LevelIndentTracker
owenca [Tue, 5 Jul 2022 04:59:43 +0000 (21:59 -0700)]
[clang-format][NFC] Clean up IndentForLevel in LevelIndentTracker

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

2 years ago[mlir] An implementation of dense data-flow analysis
Mogball [Thu, 23 Jun 2022 19:03:12 +0000 (19:03 +0000)]
[mlir] An implementation of dense data-flow analysis

This patch introduces an implementation of dense data-flow analysis. Dense
data-flow analysis attaches a lattice before and after the execution of every
operation. The lattice state is propagated across operations by a user-defined
transfer function. The state is joined across control-flow and callgraph edges.

Thge patch provides an example pass that uses both a dense and a sparse analysis
together.

Depends on D127139

Reviewed By: rriddle, phisiart

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

2 years ago[LLDB] Fix aggregate-indirect-arg.cpp failure introduced by 227dffd0b6d78154516ace45f...
Zequan Wu [Thu, 7 Jul 2022 21:56:19 +0000 (14:56 -0700)]
[LLDB] Fix aggregate-indirect-arg.cpp failure introduced by 227dffd0b6d78154516ace45f6ed28259c7baa48

2 years ago[gn build/mac] Use -mmacos-version-min instead of -mmacosx-version-min
Nico Weber [Thu, 7 Jul 2022 21:56:03 +0000 (23:56 +0200)]
[gn build/mac] Use -mmacos-version-min instead of -mmacosx-version-min

The two flags do the same thing, but the OS is called macOS these days.

(The new flag is 5 years old: https://reviews.llvm.org/D32796)

No behavior change.

2 years ago[vscode-mlir] Bump to version 0.0.10
River Riddle [Thu, 7 Jul 2022 21:40:46 +0000 (14:40 -0700)]
[vscode-mlir] Bump to version 0.0.10

Since version 0.9 we've:

* Bumped the language-client to `8.0.2-next.5` to fix various bugs/stability issues
* Fixed an issue with starting a language server for non-workspace files

2 years ago[Attributor] Make heap2stack record alloca placement
Johannes Doerfert [Thu, 7 Jul 2022 21:05:52 +0000 (16:05 -0500)]
[Attributor] Make heap2stack record alloca placement

We recently learned to place the alloca during the heap2stack
transformation in the entry block but we did not account for other
concurrent modifications. We need to record our decision rather than
checking (then outdated) passes during the manifest stage. This will
also allow us to use a custom (=optimistic) "loop info" in the future.

2 years ago[Attributor][NFC] Improve heap2stack result readability and code style
Johannes Doerfert [Thu, 7 Jul 2022 21:43:27 +0000 (16:43 -0500)]
[Attributor][NFC] Improve heap2stack result readability and code style

2 years ago[OpenMP] Ensure to not use SPMD mode in the absence of parallel regions
Johannes Doerfert [Tue, 21 Jun 2022 22:17:01 +0000 (17:17 -0500)]
[OpenMP] Ensure to not use SPMD mode in the absence of parallel regions

2 years ago[sanitizer] Deduplicate dn_expand test
Vitaly Buka [Thu, 7 Jul 2022 03:51:59 +0000 (20:51 -0700)]
[sanitizer] Deduplicate dn_expand test

Reviewed By: kstoimenov

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

2 years ago[hwasan] Refactor frame record info into function
Leonard Chan [Thu, 7 Jul 2022 18:43:26 +0000 (11:43 -0700)]
[hwasan] Refactor frame record info into function

This way it can be reused easily in D128387.

Note this changes the IR slightly. Before The steps for calculating and storing the frame record info were:

1. getPC
2. getSP
3. inttoptr
4. or SP, PC
5. store

Now the steps are:

1. getPC
2. getSP
3. or SP, PC
4. inttoptr
5. store

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

2 years ago[hwasan][fuchsia] Fix features bitmask checking
Leonard Chan [Thu, 7 Jul 2022 21:42:08 +0000 (14:42 -0700)]
[hwasan][fuchsia] Fix features bitmask checking

Update the address tagging bitmask check to just see if
ZX_ARM64_FEATURE_ADDRESS_TAGGING_TBI is enabled rather than checking
if it's the only thing that's enabled.

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

2 years ago[clang] [MinGW] Fix paths on Gentoo
Mark Harmstone [Wed, 6 Jul 2022 21:20:42 +0000 (00:20 +0300)]
[clang] [MinGW] Fix paths on Gentoo

There's code in clang/lib/Driver/ToolChains/Gnu.cpp for Clang to use Gentoo's include and lib paths, but this is missing for mingw, meaning that any C++ programs using the STL will fail to compile.

See https://bugs.gentoo.org/788430

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

2 years ago[gn build] (manually) port 36f01909a0e2 (llvm-debuginfod)
Nico Weber [Thu, 7 Jul 2022 21:25:04 +0000 (23:25 +0200)]
[gn build] (manually) port 36f01909a0e2 (llvm-debuginfod)

LLVM_ENABLE_HTTPLIB is always off in the GN build. This means the
test for this won't run, so it's not really necessary to add the
llvm-debuginfod binary (and the binary might not even be that
interesting with LLVM_ENABLE_HTTPLIB off). But maybe we want
to add support for LLVM_ENABLE_HTTPLIB at some point, so let's
add the binary too. (Usually we wouldn't, since it's not needed
to get tests to pass.)

2 years ago[mlir][AMDGPU] Use the correct values for OOB_SELECT on gfx10
Krzysztof Drewniak [Wed, 6 Jul 2022 21:38:58 +0000 (21:38 +0000)]
[mlir][AMDGPU] Use the correct values for OOB_SELECT on gfx10

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

2 years ago[InstCombine] Fold memchr and strchr equality with first argument
Martin Sebor [Thu, 30 Jun 2022 19:54:34 +0000 (13:54 -0600)]
[InstCombine] Fold memchr and strchr equality with first argument

Enhance memchr and strchr handling to simplify calls to the functions
used in equality expressions with the first argument to at most two
integer comparisons:

- memchr(A, C, N) == A to N && *A == C for either a dereferenceable
  A or a nonzero N,
- strchr(S, C) == S to *S == C for any S and C, and
- strchr(S, '\0') == 0 to true for any S

Reviewed By: nikic

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

2 years ago[flang] Fix typo in runtime message
Peter Steinfeld [Thu, 7 Jul 2022 20:53:59 +0000 (13:53 -0700)]
[flang] Fix typo in runtime message

The title says it.

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

2 years ago[AArch64] Add vector select tests with odd element types.
Florian Hahn [Thu, 7 Jul 2022 21:07:25 +0000 (14:07 -0700)]
[AArch64] Add vector select tests with odd element types.

Additional tests for D120481.

2 years ago[libc++] Add test for algorithm result type alias declarations
Nikolas Klauser [Wed, 6 Jul 2022 23:19:52 +0000 (01:19 +0200)]
[libc++] Add test for algorithm result type alias declarations

Reviewed By: var-const, #libc

Spies: libcxx-commits, jeroen.dobbelaere

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

2 years ago[NFC] [DirectX] Cleanup test for comput_ids.
Xiang Li [Thu, 7 Jul 2022 21:00:52 +0000 (14:00 -0700)]
[NFC] [DirectX] Cleanup test for comput_ids.

Cleanup test for review in https://reviews.llvm.org/D127990

2 years agoRemove dead code: TypeMap::RemoveMismatchedTypes(TypeClass type_class)
David Blaikie [Tue, 28 Jun 2022 20:41:07 +0000 (20:41 +0000)]
Remove dead code: TypeMap::RemoveMismatchedTypes(TypeClass type_class)

2 years ago[mlir:LSP] Add support for MLIR code completions
River Riddle [Wed, 6 Jul 2022 04:46:05 +0000 (21:46 -0700)]
[mlir:LSP] Add support for MLIR code completions

This commit adds code completion results to the MLIR LSP using
a new code completion context in the MLIR parser. This commit
adds initial completion for dialect, operation, SSA value, and
block names.

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

2 years ago[mlir-vscode] Bump the language client version
River Riddle [Wed, 6 Jul 2022 09:51:00 +0000 (02:51 -0700)]
[mlir-vscode] Bump the language client version

This includes a fix for a code completion/document update bug where
code completion results were being requested before the document actually
updated.

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

2 years ago[mlir-vscode] Explicitly set the return type for didOpen
River Riddle [Wed, 6 Jul 2022 00:44:43 +0000 (17:44 -0700)]
[mlir-vscode] Explicitly set the return type for didOpen

In the newer versions of the language client, this explicitly expects a
Promise<void> return type, otherwise it errors out.

Fixes #56297

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

2 years ago[libcxx] [ci] Don't disable libc++experimental in mingw builds
Martin Storsjö [Thu, 7 Jul 2022 06:37:18 +0000 (09:37 +0300)]
[libcxx] [ci] Don't disable libc++experimental in mingw builds

Since dfa88927ae1411ccc3b248b7e624f2acf623d947, the static
libc++experimental should work in mingw dll builds. (It probably worked
all along in static mingw builds.)

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

2 years ago[RISCV] Adjust fixed vector coverage for get.active.lane.mask
Philip Reames [Thu, 7 Jul 2022 18:36:57 +0000 (11:36 -0700)]
[RISCV] Adjust fixed vector coverage for get.active.lane.mask

Make sure we include at least one case where the vsadd/vmsltu lowering
requires only LMUL1.  We should be able to generate all of the fixed
vector variants from scalar to vector idioms, but this is probably not
very important right now given the fixed length variants we'd actually
use when vectorizing with LMUL=1 are reasonable.

2 years agoSimplify some AsCString usage that was also explicitly handling default
David Blaikie [Thu, 7 Jul 2022 20:27:05 +0000 (20:27 +0000)]
Simplify some AsCString usage that was also explicitly handling default

2 years ago[clang][dataflow] Return a solution from the solver when `Constraints` are `Satisfiable`.
Wei Yi Tee [Thu, 7 Jul 2022 12:43:47 +0000 (12:43 +0000)]
[clang][dataflow] Return a solution from the solver when `Constraints` are `Satisfiable`.

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

2 years agoRetrieve as StringRef since that's how it'll be used
David Blaikie [Thu, 7 Jul 2022 19:58:41 +0000 (19:58 +0000)]
Retrieve as StringRef since that's how it'll be used

2 years ago[scudo] Add [[no_unique_address]] attribute to new MapPlatformData variables
Dominic Chen [Thu, 7 Jul 2022 19:59:44 +0000 (12:59 -0700)]
[scudo] Add [[no_unique_address]] attribute to new MapPlatformData variables

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

2 years ago[lldb] Add comments to describe m_memory_addr and IsInMemory
Augusto Noronha [Thu, 7 Jul 2022 19:05:30 +0000 (12:05 -0700)]
[lldb] Add comments to describe m_memory_addr and IsInMemory

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

2 years agoRevert "[clang][dataflow] Return a solution from the solver when `Constraints` are...
Dmitri Gribenko [Thu, 7 Jul 2022 19:37:26 +0000 (21:37 +0200)]
Revert "[clang][dataflow] Return a solution from the solver when `Constraints` are `Satisfiable`."

This reverts commit 19e21887eb18aa019000c2384ea7f2c91d937489. I
accidentally landed the non-final version of the patch that used
decomposition declarations (not yet usable in LLVM/Clang source).

2 years agoUse StringRef to avoid unnecessary copies into std::strings
David Blaikie [Thu, 7 Jul 2022 19:47:46 +0000 (19:47 +0000)]
Use StringRef to avoid unnecessary copies into std::strings

2 years ago[TableGen] Rewrite type set intersection in type inference
Krzysztof Parzyszek [Wed, 6 Jul 2022 14:34:25 +0000 (07:34 -0700)]
[TableGen] Rewrite type set intersection in type inference

The previous code had a bug when dealing with matching iPTR against a
set of integer types. It was trying to handle it all in a compact way,
but that implementation couldn't be modified to correct the problem in
a simple way. The code wasn't long, and it was easier to rewrite it.

The actual issue was that non-scalar-integer types were considered when
matching against iPTR. For example {iPTR} intersected with {i32 f32}
was {iPTR} (due to multiple types in the other set), but should be just
{i32}, because i32 is the only integer scalar in the other set.

2 years ago[flang] SET_EXPONENT(-0.0) should return -0.0
Peter Steinfeld [Thu, 7 Jul 2022 17:42:47 +0000 (10:42 -0700)]
[flang] SET_EXPONENT(-0.0) should return -0.0

Section 16.9.171 says:

If X has the value zero, the result has the same value as X

So if X is -0.0, SET_EXPONENT should return -0.0.

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

2 years ago[mlir][spirv] Add path for math.round to spirv for OCL and GLSL
Robert Suderman [Thu, 7 Jul 2022 19:19:13 +0000 (19:19 +0000)]
[mlir][spirv] Add path for math.round to spirv for OCL and GLSL

OpenCL's round function matches `math.round` so we can directly lower to
the op, this includes adding the op definition to the SPIRV OCL ops.
GLSL does not guarantee rounding direction so we include custom rounding
code to guarantee correct rounding direction.

Reviewed By: antiagainst

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

2 years ago[llvm-objdump] Change some nonnull pointers to references. NFC
Fangrui Song [Thu, 7 Jul 2022 19:14:59 +0000 (12:14 -0700)]
[llvm-objdump] Change some nonnull pointers to references. NFC

2 years ago[LSR] Fix bug - check if loop has preheader before calling isInductionPHI
Zaara Syeda [Thu, 7 Jul 2022 18:29:06 +0000 (14:29 -0400)]
[LSR] Fix bug - check if loop has preheader before calling isInductionPHI

Fix bug exposed by https://reviews.llvm.org/D125990
rewriteLoopExitValues calls InductionDescriptor::isInductionPHI which requires
the PHI node to have an incoming edge from the loop preheader. This adds checks
before calling InductionDescriptor::isInductionPHI to see that the loop has a
preheader. Also did some refactoring.

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

2 years ago[sanitizer] Extract check_mem_is_good into header
Vitaly Buka [Thu, 7 Jul 2022 02:22:48 +0000 (19:22 -0700)]
[sanitizer] Extract check_mem_is_good into header

Reviewed By: kstoimenov

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

2 years ago[clang][dataflow] Return a solution from the solver when `Constraints` are `Satisfiable`.
Wei Yi Tee [Thu, 7 Jul 2022 12:02:25 +0000 (14:02 +0200)]
[clang][dataflow] Return a solution from the solver when `Constraints` are `Satisfiable`.

A truth assignment to atomic boolean values which satisfy `Constraints` will be returned if found by the solver.
This gives us more information which can be helpful for debugging or constructing warning messages.

Reviewed By: hlopko, gribozavr2, sgatev

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

2 years agoTry to fix shared lib buildbot failures after 36f01909a0e2 (D114846)
Noah Shutty [Thu, 7 Jul 2022 18:48:45 +0000 (18:48 +0000)]
Try to fix shared lib buildbot failures after 36f01909a0e2 (D114846)

2 years ago[llvm] [Debuginfod] LLVM debuginfod server.
Noah Shutty [Thu, 7 Jul 2022 17:55:25 +0000 (17:55 +0000)]
[llvm] [Debuginfod] LLVM debuginfod server.

This implements a debuginfod server in llvm using the `DebuginfodCollection` and `DebuginfodServer` classes. This is tested with lit tests against the debuginfod-find client.

The server scans 0 or more local directories for artifacts. It serves the debuginfod protocol over HTTP. Only the `executable` and `debuginfo` endpoints are supported (no `/source` endpoint).
The server also uses the debuginfod client as a fallback, so it can hit the local debuginfod cache or federate to other known debuginfod servers.
The client behavior is controllable through the standard environment variables (`DEBUGINFOD_URLS`, `DEBUGINFOD_CACHE_PATH`, `DEBUGINFOD_TIMEOUT`)

The server implements on-demand collection updates as follows:
If the build-id is not found by a local lookup, rescan immediately and look up the build-id again before returning 404. To protect against DoS attacks, do not rescan more frequently than once per N seconds (specified by `-m`).

Lit tests are provided which test the `llvm-debuginfod-find` client against the `llvm-debuginfod` server.

Reviewed By: mysterymath

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

2 years ago[docs] Move code contribution from GettingStarted.rst to Contributing.rst
Fangrui Song [Thu, 7 Jul 2022 17:51:20 +0000 (10:51 -0700)]
[docs] Move code contribution from GettingStarted.rst to Contributing.rst

For code contribution, GettingStarted.rst duplicates information in Contributing.rst.
The dedicated Contributing.rst is a better place for code contribution, so move
the content there.

Notes:

* D41665 added `Contributing.rst`
* D110976 mentioned `git cherry-pick e3659d43d8911e91739f3b0c5935598bceb859aa` workaround

Reviewed By: cjdb, fhahn, nickdesaulniers

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

2 years ago[scudo] Pass MapPlatformData in more calls
Dominic Chen [Wed, 6 Jul 2022 22:52:32 +0000 (15:52 -0700)]
[scudo] Pass MapPlatformData in more calls

Allow platforms to avoid looking up private data by providing private context

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

2 years ago[NFC][sanitizer] Minor change: eliminate loop
theidexisted [Thu, 7 Jul 2022 17:27:56 +0000 (10:27 -0700)]
[NFC][sanitizer] Minor change: eliminate loop

Reviewed By: #sanitizers, fmayer, vitalybuka

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

2 years ago[LLDB][NFC] Decouple dwarf location table from DWARFExpression.
Zequan Wu [Fri, 13 May 2022 00:46:12 +0000 (17:46 -0700)]
[LLDB][NFC] Decouple dwarf location table from DWARFExpression.

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

2 years ago[clang] Cleanup ASTContext before output files in crash recovery for modules
Ben Langmuir [Thu, 7 Jul 2022 17:06:49 +0000 (10:06 -0700)]
[clang] Cleanup ASTContext before output files in crash recovery for modules

When we recover from a crash in a module compilation thread, we need to
ensure any output streams owned by the ASTConsumer (e.g. in
RawPCHContainerGenerator) are deleted before we call clearOutputFiles().
This has the same theoretical issues with proxy streams that Duncan
discusses in the commit 2d133867833fe8eb. In practice, this was observed
as a use-after-free crash on a downstream branch that uses such a proxy
stream in this code path. Add an assertion so it won't regress.

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

rdar://96525032

2 years ago[lldb] Improve the error message in run_to_breakpoint_do_run
Jonas Devlieghere [Thu, 7 Jul 2022 16:53:05 +0000 (09:53 -0700)]
[lldb] Improve the error message in run_to_breakpoint_do_run

Improve the error message when we fail to hit the initial breakpoint in
run_to_breakpoint_do_run. In addition to the process state, we now also
report the exit code and reason (if the process exited) as well as the
inferior's output.

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

2 years ago[ELF] Relax R_RISCV_CALL and R_RISCV_CALL_PLT
Fangrui Song [Thu, 7 Jul 2022 17:18:45 +0000 (10:18 -0700)]
[ELF] Relax R_RISCV_CALL and R_RISCV_CALL_PLT

A pair of auipc+jalr relocated by R_RISCV_CALL or R_RISCV_CALL_PLT can be
converted to c.j, c.jal, or jal.

* c.j: RVC and displacement is representable as an int12
* c.jal: RV32C and displacement is representable as an int12
* jal: displacement is representable as an int21

Use the D127581 relaxation framework to implement the relaxation. If a shorter
sequence is satisfied, we record the new relocation type in `relocTypes` and
saves the new instruction into `writes`. Finally let `riscvFinalizeRelax` rewrite the
instruction by setting `skip`.

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

2 years ago[clangd] Disable flaky test
Sam McCall [Thu, 7 Jul 2022 17:14:37 +0000 (19:14 +0200)]
[clangd] Disable flaky test

2 years ago[mlir] An implementation of sparse data-flow analysis
Mogball [Thu, 23 Jun 2022 19:02:58 +0000 (19:02 +0000)]
[mlir] An implementation of sparse data-flow analysis

This patch introduces a (forward) sparse data-flow analysis implemented with the data-flow analysis framework. The analysis interacts with liveness information that can be provided by dead-code analysis to be conditional. This patch re-implements SCCP using dead-code analysis and (conditional) constant propagation analyses.

Depends on D127064

Reviewed By: rriddle, phisiart

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

2 years ago[ELF] Relax R_RISCV_ALIGN
Fangrui Song [Thu, 7 Jul 2022 17:16:09 +0000 (10:16 -0700)]
[ELF] Relax R_RISCV_ALIGN

Alternative to D125036. Implement R_RISCV_ALIGN relaxation so that we can handle
-mrelax object files (i.e. -mno-relax is no longer needed) and creates a
framework for future relaxation.

`relaxAux` is placed in a union with InputSectionBase::jumpInstrMod, storing
auxiliary information for relaxation. In the first pass, `relaxAux` is allocated.
The main data structure is `relocDeltas`: when referencing `relocations[i]`, the
actual offset is `r_offset - (i ? relocDeltas[i-1] : 0)`.

`relaxOnce` performs one relaxation pass. It computes `relocDeltas` for all text
section. Then, adjust st_value/st_size for symbols relative to this section
based on `SymbolAnchor`. `bytesDropped` is set so that `assignAddresses` knows
that the size has changed.

Run `relaxOnce` in the `finalizeAddressDependentContent` loop to wait for
convergence of text sections and other address dependent sections (e.g.
SHT_RELR). Note: extrating `relaxOnce` into a separate loop works for many cases
but has issues in some linker script edge cases.

After convergence, compute section contents: shrink the NOP sequence of each
R_RISCV_ALIGN as appropriate. Instead of deleting bytes, we run a sequence of
memcpy on the content delimitered by relocation locations. For R_RISCV_ALIGN let
the next memcpy skip the desired number of bytes. Section content computation is
parallelizable, but let's ensure the implementation is mature before
optimizations. Technically we can save a copy if we interleave some code with
`OutputSection::writeTo`, but let's not pollute the generic code (we don't have
templated relocation resolving, so using conditions can impose overhead to
non-RISCV.)

Tested:
`make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- LLVM=1 defconfig all` built Linux kernel using -mrelax is bootable.
FreeBSD RISCV64 system using -mrelax is bootable.
bash/curl/firefox/libevent/vim/tmux using -mrelax works.

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

2 years ago[InstCombine] Do not fold 'and (sext (ashr X, Shift)), C' if Shift < 0
Daniel Bertalan [Thu, 7 Jul 2022 15:31:59 +0000 (17:31 +0200)]
[InstCombine] Do not fold 'and (sext (ashr X, Shift)), C' if Shift < 0

The 'and (sext (ashr X, ShiftC)), C' --> 'lshr (sext X), ShiftC'
transformation would access out of bounds bits in APInt::getLowBitsSet
if the shift count was larger than X's bit width or if it was negative.

Fixes #56424

2 years ago[libc][nfc] update get_explicit_mantissa
Michael Jones [Wed, 6 Jul 2022 23:51:12 +0000 (16:51 -0700)]
[libc][nfc] update get_explicit_mantissa

The get_explicit_mantissa function returns the mantissa of an FPBits
floating point value with the implicit leading 1, if appropriate. This
function existed previously, but did not handle non-normal numbers
properly.

Reviewed By: lntue

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

2 years ago[libc++][doc] Removes a colon in a title.
Mark de Wever [Thu, 7 Jul 2022 17:07:03 +0000 (19:07 +0200)]
[libc++][doc] Removes a colon in a title.

2 years ago[AArch64][NFC] Prepare test cases (for D128302) to show more accurate cost estimation...
Mingming Liu [Thu, 30 Jun 2022 21:15:18 +0000 (14:15 -0700)]
[AArch64][NFC] Prepare test cases (for D128302) to show more accurate cost estimation of extract-element could generate better assembly code.

Pre-commit the test cases (for D128302) to show that more accurate cost
estimation of extract-element could generate better code.

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

2 years ago[LinkerWrapper] Identify offloading sections using ELF type
Joseph Huber [Thu, 7 Jul 2022 16:23:44 +0000 (12:23 -0400)]
[LinkerWrapper] Identify offloading sections using ELF type

Summary:
A previous patch added a new ELF section type for LLVM offloading. We
should use this when extracting the offloading sections rather than
checking the string. This pach also removes the implicit support for
COFF and MACH-O because we don't support those currently and should not
be included.

2 years ago[TableGen] Fix CodeGenRegisterClass::hasType for simple-type arguments
Krzysztof Parzyszek [Wed, 6 Jul 2022 18:02:04 +0000 (11:02 -0700)]
[TableGen] Fix CodeGenRegisterClass::hasType for simple-type arguments

The `hasType` function may be given a type that has been modified from
its original form (in particular made "simple", due to a predicate).
Make sure that such a type is still recognized as associated with a
register class, if the class contains it under any hw-mode.
This is somewhat optimistic though, since there is no information as
to where that simple type originated from.

2 years ago[AMDGPU] Disable FillMFMAShadowMutation by default
Austin Kerbow [Wed, 6 Jul 2022 04:10:12 +0000 (21:10 -0700)]
[AMDGPU] Disable FillMFMAShadowMutation by default

Disable amdgpu mfma power sched.

Reviewed By: rampitec

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

2 years ago[VE] Change displacement type in MEM..i from i32 to i64
Krzysztof Parzyszek [Thu, 7 Jul 2022 13:52:01 +0000 (06:52 -0700)]
[VE] Change displacement type in MEM..i from i32 to i64

In selection patterns, addresses (like tblockaddr) are passed as the
displacement (the i in MEM..i) to instructions taking MEM operands.
Since addresses are 64-bit, having this part of the MEM..i operand as
i32 causes a type inference error. The instructions actually only encode
32 bits of the displacement, but there is no way to manually extract
these bits (either the high or the low half) in selection patterns.

This didn't happen before, because of a bug in type inference when
dealing with iPTR.

2 years ago[OpenMP][NFC] Claim order clause modifiers (reproducible and unconstrained)
Chi Chun Chen [Thu, 7 Jul 2022 16:29:48 +0000 (11:29 -0500)]
[OpenMP][NFC] Claim order clause modifiers (reproducible and unconstrained)

2 years ago[flang][NFC] Make LEN parameters homogenous
Valentin Clement [Thu, 7 Jul 2022 07:37:12 +0000 (09:37 +0200)]
[flang][NFC] Make LEN parameters homogenous

This patch is part of the upstreaming effort from fir-dev branch.
This is the last patch for the upstreaming effort.

Reviewed By: jeanPerier

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[TableGen] Move printing to stream directly to MachineValueTypeSet
Krzysztof Parzyszek [Wed, 6 Jul 2022 21:16:38 +0000 (14:16 -0700)]
[TableGen] Move printing to stream directly to MachineValueTypeSet

2 years ago[msan] Fix dn_comp interceptor after D126851
Vitaly Buka [Thu, 7 Jul 2022 02:03:32 +0000 (19:03 -0700)]
[msan] Fix dn_comp interceptor after D126851

Unpoison by strlen(dest), as dn_expand
returns the size if the compressed name (src).

Reviewed By: kstoimenov

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

2 years ago[Metadata] Add 'exclude' metadata to add the exclude flags on globals
Joseph Huber [Tue, 5 Jul 2022 16:55:36 +0000 (12:55 -0400)]
[Metadata] Add 'exclude' metadata to add the exclude flags on globals

This patchs adds a new metadata kind `exclude` which implies that the
global variable should be given the necessary flags during code
generation to not be included in the final executable. This is done
using the ``SHF_EXCLUDE`` flag on ELF for example. This should make it
easier to specify this flag on a variable without needing to explicitly
check the section name in the target backend.

Depends on D129053 D129052

Reviewed By: jdoerfert

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

2 years ago[llvm-objdump] Update offload dumping to use SHT_LLVM_OFFLOADING
Joseph Huber [Sun, 3 Jul 2022 22:47:28 +0000 (18:47 -0400)]
[llvm-objdump] Update offload dumping to use SHT_LLVM_OFFLOADING

In order to be more in-line with ELF semantics, a previous patch added
support for a new ELF section type to indicate if a section contains
offloading data. This allows us to now check using this rather than
checking the section name directly. This patch updates the logic to
check the type now instead.

I chose to make this emit a warning if the input is not an ELF-object
file. I could have made the logic fall-back to the section name, but
this offloading in LLVM is currently not supported on any other targets
so it's probably best to emit a warning until we improve support.

Depends on D129052

Reviewed By: jhenderson

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

2 years ago[Object] Add ELF section type for offloading objects
Joseph Huber [Sun, 3 Jul 2022 20:46:31 +0000 (16:46 -0400)]
[Object] Add ELF section type for offloading objects

Currently we use the `.llvm.offloading` section to store device-side
objects inside the host, creating a fat binary. The contents of these
sections is currently determined by the name of the section while it
should ideally be determined by its type. This patch adds the new
`SHT_LLVM_OFFLOADING` section type to the ELF section types. Which
should make it easier to identify this specific data format.

Reviewed By: jhenderson

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

2 years ago[Clang] Use metadata to make identifying embedded objects easier
Joseph Huber [Sat, 2 Jul 2022 02:40:41 +0000 (22:40 -0400)]
[Clang] Use metadata to make identifying embedded objects easier

Currently we use the `embedBufferInModule` function to store binary
strings containing device offloading data inside the host object to
create a fatbinary. In the case of LTO, we need to extract this object
from the LLVM-IR. This patch adds a metadata node for the embedded
objects containing the embedded pointers and the sections they were
stored at. This should create a cleaner interface for identifying these
values.

In the future it may be worthwhile to also encode an `ID` in the
metadata corresponding to the object's special section type if relevant.
This would allow us to extract the data from an object file and LLVM-IR
using the same ID.

Reviewed By: jdoerfert

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

2 years ago[IndVars] Add tests for more different float->int conversions.
Florian Hahn [Thu, 7 Jul 2022 16:16:46 +0000 (09:16 -0700)]
[IndVars] Add tests for more different float->int conversions.

Extra tests for D129140.

2 years ago[RISCV] Test coverage for missing commute of vsadd(u)
Philip Reames [Thu, 7 Jul 2022 16:05:33 +0000 (09:05 -0700)]
[RISCV] Test coverage for missing commute of vsadd(u)

For some reason, this appears to only happen with fixed length vectors.  Scalable ones commute just fine in all the cases I've seen.