platform/upstream/llvm.git
2 years ago[libc++] Fix feature test macro for __cpp_lib_to_chars
Louis Dionne [Fri, 19 Nov 2021 14:52:28 +0000 (09:52 -0500)]
[libc++] Fix feature test macro for __cpp_lib_to_chars

We would have been defining it in <utility> instead of <charconv>. For
the time being, this doesn't change anything since we don't implement
the feature test macro anyways.

Also, as a fly-by, this removes obsolete feature test macro tests. There
was a brief time back in the days when we wrote feature test macro tests
manually. In particular, we had test files for __cpp_lib_to_chars and
__cpp_lib_memory_resource. Since we now have a principled way of generating
these tests with scripts, this commit removes the obsolete (and empty)
tests for these two feature test macros.

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

2 years ago[libc++] Fix some tests that were broken in the single-threaded configuration
Louis Dionne [Fri, 19 Nov 2021 14:50:05 +0000 (09:50 -0500)]
[libc++] Fix some tests that were broken in the single-threaded configuration

We never noticed it because our CI doesn't actually build against a C
library that doesn't have threading functionality, however building
against a truly thread-free platform surfaces these issues.

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

2 years ago[libc++] Avoid potential truncation warnings in std::abs test
Louis Dionne [Fri, 19 Nov 2021 14:55:45 +0000 (09:55 -0500)]
[libc++] Avoid potential truncation warnings in std::abs test

One some platforms, -Wimplicit-int-conversion is enabled by default,
which can lead to additional warnings being triggered in this test.
Since we're only trying to test errors related to calling abs(), the
assignment is superfluous.

As a fly-by fix, correct one instance of ::abs to std::abs and made
the test a .verify.cpp test instead.

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

2 years ago[MLIR][GPU] Run generic LLVM optimizations when serializing (on AMD)
Krzysztof Drewniak [Thu, 18 Nov 2021 21:45:27 +0000 (21:45 +0000)]
[MLIR][GPU] Run generic LLVM optimizations when serializing (on AMD)

- Adds hooks that allow SerializeTo* passes to arbitrarily transform
the produced LLVM Module before it is passed to the code generation
passes.

- Uses these hooks within the SerializeToHsaco pass in order to run
LLVM optimizations and to set the optimization level on the
TargetMachine.

- Adds an optLevel parameter to SerializeToHsaco

Future work may include moving much of what's been added to
SerializeToHsaco to SerializeToBlob, but that would require
confirmation from the NVVM backend maintainers that it would be
appropriate to do so.

Depends on D114107

Reviewed By: mehdi_amini

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

2 years ago[mlir][gpu] Extend shuffle op modes and add nvvm lowering
Thomas Raoux [Fri, 19 Nov 2021 19:03:10 +0000 (11:03 -0800)]
[mlir][gpu] Extend shuffle op modes and add nvvm lowering

Add up, down and idx modes to gpu shuffle ops, also change the mode from
string to enum

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

2 years ago[AMDGPU] Add an implicit use of M0 to all V_MOV_B32_indirect_read/write
Jay Foad [Fri, 19 Nov 2021 13:48:23 +0000 (13:48 +0000)]
[AMDGPU] Add an implicit use of M0 to all V_MOV_B32_indirect_read/write

NFCI. Previously the implicit use was added to V_MOV_B32_indirect_read
when building the instruction. V_MOV_B32_indirect_write didn't have an
implicit use of M0 at all, but apparently it did not cause any problems.

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

2 years ago[ELF] Support discarding .got.plt
Fangrui Song [Fri, 19 Nov 2021 18:50:53 +0000 (10:50 -0800)]
[ELF] Support discarding .got.plt

Fix a null pointer dereference when .got.plt is discarded.

This also adds a test for discarding `.plt`.

Reviewed By: ikudrin

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

2 years ago[openmp][amdgpu][nfc] Inline interop_hsa_get_kernel_info into only caller
Jon Chesterfield [Fri, 19 Nov 2021 18:40:24 +0000 (18:40 +0000)]
[openmp][amdgpu][nfc] Inline interop_hsa_get_kernel_info into only caller

2 years ago[mlir][vector] NFC, move some vector patterns in a separate file
Thomas Raoux [Fri, 19 Nov 2021 18:31:52 +0000 (10:31 -0800)]
[mlir][vector] NFC, move some vector patterns in a separate file

Move patterns related to dropping lead unit dim into their own file.

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

2 years ago[mlir][vector] Remove usage of shapecast to remove unit dim
Thomas Raoux [Fri, 19 Nov 2021 00:09:49 +0000 (16:09 -0800)]
[mlir][vector] Remove usage of shapecast to remove unit dim

Instead of using shape_cast op in the pattern removing leading unit
dimensions we use extract/broadcast ops. This is part of the effort to
restrict ShapeCastOp fuirther in the future and only allow them to
convert to or from 1D vector.

This also adds extra canonicalization to fill the gaps in simplifying
broadcast/extract ops.

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

2 years ago[SROA] Add new test cases to cover existing SROA behavior that structs will be scalar...
Mingming Liu [Fri, 19 Nov 2021 18:16:11 +0000 (18:16 +0000)]
[SROA] Add new test cases to cover existing SROA behavior that structs will be scalarized.

Add an IR in unit test directory, which demonstrate the scalarization for struct allocations.
This is added to pave the way for an SROA change to skip scalarization for some cases.

Reviewed By: davidxl

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

2 years ago[DSE] Improve handling of `strncpy` in Dead Store Elimination
Fabian Wolff [Fri, 19 Nov 2021 17:46:17 +0000 (17:46 +0000)]
[DSE] Improve handling of `strncpy` in Dead Store Elimination

Fixes PR#52062 and one of the remaining cases of PR#47644.

Reviewed By: fhahn

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

2 years ago[analyzer][NFC] MaybeUInt -> MaybeCount
Balazs Benics [Fri, 19 Nov 2021 17:36:55 +0000 (18:36 +0100)]
[analyzer][NFC] MaybeUInt -> MaybeCount

I forgot to include this in D113594

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

2 years ago[analyzer][NFC] Use enum for CallDescription flags
Balazs Benics [Fri, 19 Nov 2021 17:32:13 +0000 (18:32 +0100)]
[analyzer][NFC] Use enum for CallDescription flags

Yeah, let's prefer a slightly stronger type representing this.

Reviewed By: martong, xazax.hun

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

2 years ago[analyzer][NFC] Consolidate the inner representation of CallDescriptions
Balazs Benics [Fri, 19 Nov 2021 17:32:13 +0000 (18:32 +0100)]
[analyzer][NFC] Consolidate the inner representation of CallDescriptions

`CallDescriptions` have a `RequiredArgs` and `RequiredParams` members,
but they are of different types, `unsigned` and `size_t` respectively.
In the patch I use only `unsigned` for both, that should be large enough
anyway.
I also introduce the `MaybeUInt` type alias for `Optional<unsigned>`.

Additionally, I also avoid the use of the //smart// less-than operator.

  template <typename T>
  constexpr bool operator<=(const Optional<T> &X, const T &Y);

Which would check if the optional **has** a value and compare the data
only after. I found it surprising, thus I think we are better off
without it.

Reviewed By: martong, xazax.hun

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

2 years ago[analyzer][NFC] CallDescription should own the qualified name parts
Balazs Benics [Fri, 19 Nov 2021 17:32:13 +0000 (18:32 +0100)]
[analyzer][NFC] CallDescription should own the qualified name parts

Previously, CallDescription simply referred to the qualified name parts
by `const char*` pointers.
In the future we might want to dynamically load and populate
`CallDescriptionMaps`, hence we will need the `CallDescriptions` to
actually **own** their qualified name parts.

Reviewed By: martong, xazax.hun

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

2 years ago[analyzer][NFC] Demonstrate the use of CallDescriptionSet
Balazs Benics [Fri, 19 Nov 2021 17:32:13 +0000 (18:32 +0100)]
[analyzer][NFC] Demonstrate the use of CallDescriptionSet

Reviewed By: martong, xazax.hun

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

2 years ago[analyzer][NFC] Switch to using CallDescription::matches() instead of isCalled()
Balazs Benics [Fri, 19 Nov 2021 17:32:13 +0000 (18:32 +0100)]
[analyzer][NFC] Switch to using CallDescription::matches() instead of isCalled()

This patch replaces each use of the previous API with the new one.
In variadic cases, it will use the ADL `matchesAny(Call, CDs...)`
variadic function.
Also simplifies some code involving such operations.

Reviewed By: martong, xazax.hun

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

2 years ago[analyzer][NFC] Introduce CallDescription::matches() in addition to isCalled()
Balazs Benics [Fri, 19 Nov 2021 17:32:13 +0000 (18:32 +0100)]
[analyzer][NFC] Introduce CallDescription::matches() in addition to isCalled()

This patch introduces `CallDescription::matches()` member function,
accepting a `CallEvent`.
Semantically, `Call.isCalled(CD)` is the same as `CD.matches(Call)`.

The patch also introduces the `matchesAny()` variadic free function template.
It accepts a `CallEvent` and at least one `CallDescription` to match
against.

Reviewed By: martong

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

2 years ago[analyzer][NFC] Introduce CallDescriptionSets
Balazs Benics [Fri, 19 Nov 2021 17:32:13 +0000 (18:32 +0100)]
[analyzer][NFC] Introduce CallDescriptionSets

Sometimes we only want to decide if some function is called, and we
don't care which of the set.
This `CallDescriptionSet` will have the same behavior, except
instead of `lookup()` returning a pointer to the mapped value,
the `contains()` returns `bool`.
Internally, it uses the `CallDescriptionMap<bool>` for implementing the
behavior. It is preferred, to reuse the generic
`CallDescriptionMap::lookup()` logic, instead of duplicating it.
The generic version might be improved by implementing a hash lookup or
something along those lines.

Reviewed By: martong, Szelethus

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

2 years ago[LV] Remove obsolete comment about creating a dummy block (NFC)
Florian Hahn [Fri, 19 Nov 2021 17:17:03 +0000 (17:17 +0000)]
[LV] Remove obsolete comment about creating a dummy block (NFC)

No dummy pre-entry block is created since a6c4969f5f45. The comment is
stale now and can be removed.

Mentioned by @Ayal in D113182.

2 years ago[MLIR] Make the ROCM integration tests runnable
Krzysztof Drewniak [Thu, 18 Nov 2021 20:21:33 +0000 (20:21 +0000)]
[MLIR] Make the ROCM integration tests runnable

- Move the #define s to the GPU Transform library from GPU Ops so that
SerializeToHsaco is non-trivially compiled

- Add required includes to SerializeToHsaco

- Move MCSubtargetInfo creation to the correct point in the
compilation process

- Change mlir in ROCM tests to account for renamed/moved ops

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

2 years agoSkip tests when compiler with older versions of clang
Adrian Prantl [Fri, 19 Nov 2021 17:05:38 +0000 (09:05 -0800)]
Skip tests when compiler with older versions of clang

2 years ago[libc][Obvious][NFC] A bunch of cosmetic cleanup.
Siva Chandra Reddy [Fri, 19 Nov 2021 07:32:58 +0000 (07:32 +0000)]
[libc][Obvious][NFC] A bunch of cosmetic cleanup.

* Added missing header guards.
* Fixed license header format in a few files.
* Renamed files to more suitable names.

2 years ago[lldb/test] Add ability to terminate connection from a gdb-client handler
Pavel Labath [Thu, 18 Nov 2021 12:56:36 +0000 (13:56 +0100)]
[lldb/test] Add ability to terminate connection from a gdb-client handler

We were using the client socket close as a way to terminate the handler
thread. But this kind of concurrent access to the same socket is not
safe. It also complicates running the handler without a dedicated thread
(next patch).

Instead, here I add an explicit way for a packet handler to request
termination. Waiting for lldb to terminate the connection would almost
be sufficient, but in the pty test we want to keep the pty open so we
can examine its state. Ability to disconnect at an arbitrary point may
be useful for testing other aspects of lldb functionality as well.

The way this works is that now each packet handler can optionally return
a list of responses (instead of just one). One of those responses (it
only makes sense for it to be the last one) can be a special
RESPONSE_DISCONNECT object, which triggers a disconnection (via a new
TerminateConnectionException).

As the mock server now cleans up the connection whenever it disconnects,
the pty test needs to explicitly dup(2) the descriptors in order to
inspect the post-disconnect state.

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

2 years ago[SCEV] Revert two speculative compile time optimizations which made no difference
Philip Reames [Fri, 19 Nov 2021 16:40:24 +0000 (08:40 -0800)]
[SCEV] Revert two speculative compile time optimizations which made no difference

Revert "[SCEV] Defer all work from ea12c2cb as late as possible"
Revert "[SCEV] Defer loop property checks from ea12c2cb as late as possible"

This reverts commit 734abbad79dbcbd0e880510fbab1ef0e701cfc7b and  1a5666acb281c7510504e726ba481d09ab5f5b95.

Both of these changes were speculative attempts to address a compile time regression.  Neither worked, and both complicated the code in undesirable ways.

2 years ago[RISCV] Don't call setHasMultipleConditionRegisters(), so icmp is sunk
Philipp Tomsich [Fri, 19 Nov 2021 03:13:46 +0000 (19:13 -0800)]
[RISCV] Don't call setHasMultipleConditionRegisters(), so icmp is sunk

On RISC-V, icmp is not sunk (as the following snippet shows) which
generates the following suboptimal branch pattern:
```
  core_list_find:
lh a2, 2(a1)
seqz a3, a0         <<
bltz a2, .LBB0_5
bnez a3, .LBB0_9    << should sink the seqz
        [...]
j .LBB0_9
  .LBB0_5:
bnez a3, .LBB0_9    << should sink the seqz
lh a1, 0(a1)
        [...]
```
due to an icmp not being sunk.

The blocks after `codegenprepare` look as follows:
```
  define dso_local %struct.list_head_s* @core_list_find(%struct.list_head_s* readonly %list, %struct.list_data_s* nocapture readonly %info) local_unnamed_addr #0 {
  entry:
    %idx = getelementptr inbounds %struct.list_data_s, %struct.list_data_s* %info, i64 0, i32 1
    %0 = load i16, i16* %idx, align 2, !tbaa !4
    %cmp = icmp sgt i16 %0, -1
    %tobool.not37 = icmp eq %struct.list_head_s* %list, null
    br i1 %cmp, label %while.cond.preheader, label %while.cond9.preheader

  while.cond9.preheader:                            ; preds = %entry
    br i1 %tobool.not37, label %return, label %land.rhs11.lr.ph
```
where the `%tobool.not37` is the result of the icmp that is not sunk.
Note that it is computed in the basic-block up until what becomes the
`bltz` instruction and the `bnez` is a basic-block of its own.

Compare this to what happens on AArch64 (where the icmp is correctly sunk):
```
  define dso_local %struct.list_head_s* @core_list_find(%struct.list_head_s* readonly %list, %struct.list_data_s* nocapture readonly %info) local_unnamed_addr #0 {
  entry:
    %idx = getelementptr inbounds %struct.list_data_s, %struct.list_data_s* %info, i64 0, i32 1
    %0 = load i16, i16* %idx, align 2, !tbaa !6
    %cmp = icmp sgt i16 %0, -1
    br i1 %cmp, label %while.cond.preheader, label %while.cond9.preheader

  while.cond9.preheader:                            ; preds = %entry
    %1 = icmp eq %struct.list_head_s* %list, null
    br i1 %1, label %return, label %land.rhs11.lr.ph
```

This is caused by sinkCmpExpression() being skipped, if multiple
condition registers are supported.

Given that the check for multiple condition registers affect only
sinkCmpExpression() and shouldNormalizeToSelectSequence(), this change
adjusts the RISC-V target as follows:
 * we no longer signal multiple condition registers (thus changing
   the behaviour of sinkCmpExpression() back to sinking the icmp)
 * we override shouldNormalizeToSelectSequence() to let always select
   the preferred normalisation strategy for our backend

With both changes, the test results remain unchanged.  Note that without
the target-specific override to shouldNormalizeToSelectSequence(), there
is worse code (more branches) generated for select-and.ll and select-or.ll.

The original test case changes as expected:
```
  core_list_find:
lh a2, 2(a1)
bltz a2, .LBB0_5
beqz a0, .LBB0_9    <<
        [...]
j .LBB0_9
.LBB0_5:
beqz a0, .LBB0_9    <<
lh a1, 0(a1)
        [...]
```

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

2 years ago[RISCV] Pre-commit test for D98932. NFC
Craig Topper [Fri, 19 Nov 2021 06:15:09 +0000 (22:15 -0800)]
[RISCV] Pre-commit test for D98932. NFC

2 years ago[PowerPC] Add a flag for conditional trap optimization
Victor Huang [Fri, 19 Nov 2021 16:10:19 +0000 (10:10 -0600)]
[PowerPC] Add a flag for conditional trap optimization

This patch adds a flag to enable/disable conditional trap optimization.
Optimization disabled by default.

Peer reviewed by: nemanjai

2 years ago[DSE] Add additional strncpy tests.
Fabian Wolff [Fri, 19 Nov 2021 16:01:36 +0000 (16:01 +0000)]
[DSE] Add additional strncpy tests.

Test for PR#52062 and one of the remaining cases of PR#47644.

2 years ago[NFC][llvm] Inclusive language: remove instance of master in IntrinsicsNVVM.td
Quinn Pham [Thu, 18 Nov 2021 21:10:49 +0000 (15:10 -0600)]
[NFC][llvm] Inclusive language: remove instance of master in IntrinsicsNVVM.td

[NFC] As part of using inclusive language within the llvm project, this patch
replaces master with main in `IntrinsicsNVVM.td`.

Reviewed By: steffenlarsen

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

2 years ago[libc++][nfc] Move functions to a generic place.
Mark de Wever [Fri, 19 Nov 2021 15:38:35 +0000 (16:38 +0100)]
[libc++][nfc] Move functions to a generic place.

This allows the floating-point formatter to use the same functions as
the integral formatter. This was tested in D114001.

2 years ago[libc++] Adds (to|from)_chars_result operator==.
Mark de Wever [Sat, 23 Oct 2021 16:28:31 +0000 (18:28 +0200)]
[libc++] Adds (to|from)_chars_result operator==.

Implements part of P1614 The Mothership has Landed.

Reviewed By: #libc, Quuxplusone, Mordante

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

2 years ago[ORC] Fix materialization of weak local symbols
Ben Langmuir [Fri, 19 Nov 2021 00:47:16 +0000 (16:47 -0800)]
[ORC] Fix materialization of weak local symbols

We were adding all defined weak symbols to the materialization
responsibility, but local symbols will not be in the symbol table, so it
failed to materialize due to the "missing" symbol.

Local weak symbols come up in practice when using `ld -r` with a hidden
weak symbol.

rdar://85574696

2 years ago[X86] Selective relocation relaxation for +tagged-globals
Matt Morehouse [Fri, 19 Nov 2021 14:12:51 +0000 (06:12 -0800)]
[X86] Selective relocation relaxation for +tagged-globals

For tagged-globals, we only need to disable relaxation for globals that
we actually tag.  With this patch function pointer relocations, which
we do not instrument, can be relaxed.

This patch also makes tagged-globals work properly with LTO, as
-Wa,-mrelax-relocations=no doesn't work with LTO.

Reviewed By: pcc

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

2 years ago[SLP][NFC]Introduce TreeEntry::getVectorFactor member function, NFC.
Alexey Bataev [Thu, 18 Nov 2021 21:02:43 +0000 (13:02 -0800)]
[SLP][NFC]Introduce TreeEntry::getVectorFactor member function, NFC.

Added TreeEntry::getVectorFactor to get the final vectotization factor
to simplify the code.

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

2 years ago[OpenMP] support depend clause for taskwait directive, by Deepak
Alexey Bataev [Fri, 19 Nov 2021 13:59:40 +0000 (05:59 -0800)]
[OpenMP] support depend clause for taskwait directive, by Deepak
Eachempati.

This patch adds clang (parsing, sema, serialization, codegen) support for the 'depend' clause on the 'taskwait' directive.

Reviewed By: ABataev

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

2 years ago[asm] Allow block address operands in `asm inteldialect`
Nico Weber [Thu, 18 Nov 2021 16:38:52 +0000 (11:38 -0500)]
[asm] Allow block address operands in `asm inteldialect`

This makes the following program build with -masm=intel:

    int foo(int count) {
      asm goto ("dec %0; jb %l[stop]" : "+r" (count) : : : stop);
      return count;
    stop:
      return 0;
    }

It's also is another step towards merging EmitGCCInlineAsmStr() and
EmitMSInlineAsmStr().

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

2 years ago[lld/mac] Crash even less on undefined symbols with --icf=all
Nico Weber [Thu, 18 Nov 2021 21:59:21 +0000 (16:59 -0500)]
[lld/mac] Crash even less on undefined symbols with --icf=all

Follow-up to https://reviews.llvm.org/D112643. Even after that change, we were
still asserting if two separate functions that are eligible for ICF (same size,
same data, same number of relocs, same reloc types, ...) referred to
Undefineds. This fixes that oversight.

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

2 years ago[asm] Remove explicit branch for modifier 'l'
Nico Weber [Fri, 19 Nov 2021 03:50:42 +0000 (22:50 -0500)]
[asm] Remove explicit branch for modifier 'l'

No intended behavior change.

EmitGCCInlineAsmStr() used to explicitly check for modifier 'l'
after handling block address and machine basic block operands.
This prevented passing a MachineOperand with 'l' modifier to
PrintAsmMemoryOperand(). Conceptually that seems kind of nice,
but in practice the overrides of PrintAsmMemoryOperand() in all (*)
AsmPrinter subclasses already reject modifiers they don't know about,
and none of them don't know about 'l'. So removing this doesn't have
a behavior difference, is less code, and it makes EmitGCCInlineAsmStr()
and EmitMSInlineAsmStr() more similar, to prepare for merging them later.

(Why not _add_ the branch to EmitMSInlineAsmStr() instead? Because that
always works with X86AsmPrinter I think, and
X86AsmPrinter::PrintAsmMemoryOperand() very decisively rejects the 'l'
modifier, so it's hard to motivate adding that branch.)

*: The one exception was AVRAsmPrinter, which had an llvm_unreachable instead
of returning true. So this commit changes that, so that the AVR target keeps
emitting an error instead of crashing when passing a mem operand with a :l
modifier to it. All the other targets already don't crash on this.

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

2 years agoThe _Float16 type is supported on x86 systems with SSE2 enabled.
Zahira Ammarguellat [Wed, 17 Nov 2021 16:53:36 +0000 (11:53 -0500)]
The _Float16 type is supported on x86 systems with SSE2 enabled.
Operations are emulated by software emulation and “float” instructions.
This patch is allowing the support of _Float16 type without the use of
-max512fp16 flag. The final goal being, perform _Float16 emulation for
all arithmetic expressions.

2 years agoMake clang-format fuzz through Lexing with asserts enabled.
Manuel Klimek [Fri, 19 Nov 2021 13:11:53 +0000 (14:11 +0100)]
Make clang-format fuzz through Lexing with asserts enabled.

Makes clang-format bail out if an in-memory source file with an
unsupported BOM is handed in instead of creating source locations that
are violating clang's assumptions.

In the future, we should add support to better transport error messages
like this through clang-format instead of printing to stderr and not
creating any changes.

2 years ago[AMDGPU] Use new opcode for indexed vgpr reads
Jay Foad [Fri, 19 Nov 2021 10:32:35 +0000 (10:32 +0000)]
[AMDGPU] Use new opcode for indexed vgpr reads

Introduce V_MOV_B32_indirect_read for indexed vgpr reads
(and rename the old V_MOV_B32_indirect to
V_MOV_B32_indirect_write) so they can be unambiguously
distinguished from regular V_MOV_B32_e32. Previously they
were distinguished by looking for extra implicit operands
but this is fragile because regular moves sometimes have
extra implicit operands too:
- either by accident, when instructions end up with
  duplicate implicit operands (see e.g. D100939)
- or by design, when SIInstrInfo::copyPhysReg breaks a
  multi-dword copy into individual subreg mov instructions
  and adds implicit operands for the super-register.

The effect of this is that SIInstrInfo::isFoldableCopy can
be simplified and identifies more foldable copies. The test
diffs show that more immediate 0 values have been folded as
inline operands.

SIInstrInfo::isReallyTriviallyReMaterializable could
probably be simplified too but that is not part of this
patch.

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

2 years ago[X86][Costmodel] `getReplicationShuffleCost()`: promote 1 bit-wide elements to 8...
Roman Lebedev [Fri, 19 Nov 2021 12:55:31 +0000 (15:55 +0300)]
[X86][Costmodel] `getReplicationShuffleCost()`: promote 1 bit-wide elements to 8 bit when have AVX512BW+AVX512VBMI

If in addition to AVX512BW (that provides `{k}<->{i8,i16}` casts and i16 shuffles),
we have AVX512VBMI, which provides i8 shuffles, we are in an optimal situation.

Reviewed By: RKSimon

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

2 years ago[X86][Costmodel] `trunc v16i8 to v8i1` can appear after legalization, cost is same...
Roman Lebedev [Fri, 19 Nov 2021 12:55:21 +0000 (15:55 +0300)]
[X86][Costmodel] `trunc v16i8 to v8i1` can appear after legalization, cost is same as for `trunc v8i8 to v8i1`

Note that there are many other missing costs, i'm *only* adding the ones that are queried
from `getReplicationShuffleCost()` for the existing (quite exhaustive) test coverage.

Reviewed By: RKSimon

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

2 years ago[X86][Costmodel] `getReplicationShuffleCost()`: promote 1 bit-wide elements to 16...
Roman Lebedev [Fri, 19 Nov 2021 12:55:07 +0000 (15:55 +0300)]
[X86][Costmodel] `getReplicationShuffleCost()`: promote 1 bit-wide elements to 16 bit when have AVX512BW

Here we get pretty lucky. AVX512F does not provide any instructions
to convert between a `k` vector mask and a vector,
but AVX512BW adds `{k}<->nX{i8,i16}`conversions,
and just as it happens, with AVX512BW we have a i16 shuffle.

Reviewed By: RKSimon

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

2 years ago[LangRef][VP] Correct operands' types in vp.select documentation
Fraser Cormack [Fri, 19 Nov 2021 12:06:54 +0000 (12:06 +0000)]
[LangRef][VP] Correct operands' types in vp.select documentation

The types of llvm.vp.select's operands much match the return type.

2 years ago[X86] LowerRotate - recognise hidden ROTR patterns for better vXi8 codegen
Simon Pilgrim [Fri, 19 Nov 2021 11:48:49 +0000 (11:48 +0000)]
[X86] LowerRotate - recognise hidden ROTR patterns for better vXi8 codegen

Check for a hidden ISD::ROTR (rotl(sub(0,x))) - vXi8 lowering can handle both (its always beneficial for splats, but otherwise only if we have VPTERNLOG).

We currently hit infinite loops in TargetLowering::expandROT if we set ISD::ROTR to custom, which needs addressing before we extend this much further.

2 years ago[ELF] Ensure output section is not discarded in addStartEndSymbols()
Andrew Ng [Wed, 17 Nov 2021 17:15:20 +0000 (17:15 +0000)]
[ELF] Ensure output section is not discarded in addStartEndSymbols()

Fixes https://bugs.llvm.org/show_bug.cgi?id=52534.

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

2 years ago[DAG] MatchRotate - support rotate-by-constant of illegal types
Simon Pilgrim [Fri, 19 Nov 2021 10:37:54 +0000 (10:37 +0000)]
[DAG] MatchRotate - support rotate-by-constant of illegal types

Patch to fix some of the regressions in D77804.

By folding to rotate/funnel-shift by constant amounts for illegal types, we prevent SimplifyDemandedBits from destroying the patterns prematurely, allowing us to use the rotate/funnel-shift legalization that was added in D112443.

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

2 years ago[analyzer][docs] Ellaborate the docs of cplusplus.StringChecker
Balazs Benics [Fri, 19 Nov 2021 10:59:46 +0000 (11:59 +0100)]
[analyzer][docs] Ellaborate the docs of cplusplus.StringChecker

Let's describe accurately what the users can expect from the checker in
a direct way.
Also, add an example warning message.

Reviewed By: martong, Szelethus

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

2 years ago[fir] Add fir.no_reassoc conversion
Valentin Clement [Fri, 19 Nov 2021 10:33:57 +0000 (11:33 +0100)]
[fir] Add fir.no_reassoc conversion

Currently `fir.no_reassoc` is just removed in the conversion.

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

Reviewed By: kiranchandramohan

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

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[ASTImporter][NFC] Dump decl name at assertion violation
Balazs Benics [Fri, 19 Nov 2021 10:31:01 +0000 (11:31 +0100)]
[ASTImporter][NFC] Dump decl name at assertion violation

Sometimes it would be useful to see which Decl kind caused some issue,
along with the name of the concrete instance of the Decl in the source
code.

Reviewed By: martong

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

2 years ago[ELF] Expand LMA region if output section alignment introduces padding
Konstantin Schwarz [Thu, 18 Nov 2021 14:21:21 +0000 (15:21 +0100)]
[ELF] Expand LMA region if output section alignment introduces padding

When aligning the start address of an output section introduces a gap between the current dot pointer
and the new aligned address, we were already properly expanding the memory region, if available.

D74286 introduced a new behavior to also align the LMA address if an LMA region is specified.
However, this did not expand the corresponding LMA region.
Now, we also expand the LMA region if it is set.

This fixes PR52510.

Reviewed By: MaskRay

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

2 years ago[clang-tidy] Fix false positive in readability-identifier-naming check involving...
Fabian Wolff [Fri, 19 Nov 2021 09:22:07 +0000 (22:22 +1300)]
[clang-tidy] Fix false positive in readability-identifier-naming check involving override attribute

Overriding methods should not get a readability-identifier-naming
warning because the issue can only be fixed in the base class; but the
current check for whether a method is overriding does not take the
override attribute into account.

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

2 years ago[flang] Fix printing of constc and parsing of #fir.real
Diana Picus [Wed, 17 Nov 2021 10:29:42 +0000 (10:29 +0000)]
[flang] Fix printing of constc and parsing of  #fir.real

Printing and parsing of constc didn't agree with each other. This patch
treats the parsing of constc as the final word and fixes the printing
accordingly.

More concretely, this patch prints the RealAttrs that make up the
ConstcOp directly instead of casting to mlir::FloatAttr (which blows
up). It also fixes parseFirRealAttr to invoke APFloat's method for
getting the size of a floating point type instead of computing it as
8 * kind (which blows up for BFloat, with kind == 3 and size == 16).

Kudos to Kiran Chandramohan <kiran.chandramohan@arm.com> for noticing
that we were missing tests for constc in fir-ops.fir.

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

2 years ago[clang-tidy] fix debug-only test failure
Matt Beardsley [Fri, 19 Nov 2021 09:19:05 +0000 (10:19 +0100)]
[clang-tidy] fix debug-only test failure

The clang-tidy/infrastructure/pr37091.cpp test inherits the top-level .clang-tidy configuration because it doesn't specify its own checks. It'd be a more stable test if it operates independently of the top-level .clang-tidy settings.

I've made the clang-tidy/infrastructure/pr37091.cpp test independent of the top-level .clang-tidy (picked an arbitrary check that I saw another clang-tidy/infrastructure test was also using: clang-tidy/infrastructure/temporaries.cpp)

Reviewed By: kbobyrev

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

2 years ago[mlir] Expose region utils functions
Valentin Clement [Fri, 19 Nov 2021 08:24:11 +0000 (09:24 +0100)]
[mlir] Expose region utils functions

As discussed in D109579, this patch exposes `runRegionDCE` and
`eraseUnreachableBlocks` so they can be used as separate utilities in
other passes.

Reviewed By: rriddle, mehdi_amini

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

2 years agoBPF: Workaround InstCombine trunc+icmp => mask+icmp Optimization
Yonghong Song [Fri, 19 Nov 2021 03:02:11 +0000 (19:02 -0800)]
BPF: Workaround InstCombine trunc+icmp => mask+icmp Optimization

Patch [1] added further InstCombine trunc+icmp => mask+icmp
optimization and this caused a couple of bpf selftest failure.
Previous llvm BPF backend patch [2] introduced llvm.bpf.compare
builtin to handle such situations.

This patch further added support ">" and ">=" icmp opcodes.
Tested with bpf selftests and all tests are passed including two
previously failed ones.

Note Patch [1] also added optimization if the to-be-compared
constant is negative-power-of-2 (-C) or not-of-power-of-2 (~C).
This patch didn't implement these two cases as typical bpf
program compares a scalar to a positive length or boundary value,
and this scalar later is used as a index into an array buffer
or packet buffer.

  [1] https://reviews.llvm.org/D112634
  [2] https://reviews.llvm.org/D112938

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

2 years ago[libc++][doc] Mark project for [cmp.concept] done
Kent Ross [Fri, 19 Nov 2021 04:15:16 +0000 (20:15 -0800)]
[libc++][doc] Mark project for [cmp.concept] done

Mark [cmp.concept] implementation as completed in our documentation.

Reviewed By: ldionne, #libc

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

2 years ago[AARCH64] Teach AArch64FrameLowering::getFrameIndexReferencePreferSP really prefer SP.
Serguei Katkov [Tue, 5 Oct 2021 06:28:23 +0000 (13:28 +0700)]
[AARCH64] Teach AArch64FrameLowering::getFrameIndexReferencePreferSP really prefer SP.

Do more efforts to use sp if it is possible to lower a frame index.

Reviewers: reames, loicottet, ostannard, t.p.northover
Reviewed By: reames
Subscribers: arphaman, danilaml, hiraditya, kristof.beyls, llvm-commits, Matt, yrouban
Differential Revision: https://reviews.llvm.org/D111133

2 years ago[NFC][sanitizer] Fix naming in StackStore
Vitaly Buka [Fri, 19 Nov 2021 03:37:39 +0000 (19:37 -0800)]
[NFC][sanitizer] Fix naming in StackStore

2 years ago[NFC][sanitizer] constexpr StackStore::StackStore()
Vitaly Buka [Thu, 18 Nov 2021 22:11:54 +0000 (14:11 -0800)]
[NFC][sanitizer] constexpr StackStore::StackStore()

2 years ago[NFC][sanitizer] Change StackStore API to use StackTrace
Vitaly Buka [Mon, 15 Nov 2021 23:18:53 +0000 (15:18 -0800)]
[NFC][sanitizer] Change StackStore API to use StackTrace

2 years ago[NFC][sanitizer] Move inline implementation of StackStore into cpp
Vitaly Buka [Mon, 15 Nov 2021 21:31:45 +0000 (13:31 -0800)]
[NFC][sanitizer] Move inline implementation of StackStore into cpp

2 years ago[NFC][sanitizer] Rename PersistentAllocator to StackStore
Vitaly Buka [Mon, 15 Nov 2021 06:53:29 +0000 (22:53 -0800)]
[NFC][sanitizer] Rename PersistentAllocator to StackStore

2 years ago[nfc][dfsan] Remove obsolete comment
Vitaly Buka [Mon, 15 Nov 2021 06:47:13 +0000 (22:47 -0800)]
[nfc][dfsan] Remove obsolete comment

2 years ago[NFC][sanitizer] Rename persistent_allocator to stack_store
Vitaly Buka [Mon, 15 Nov 2021 06:37:52 +0000 (22:37 -0800)]
[NFC][sanitizer] Rename persistent_allocator to stack_store

2 years ago[clang] fix regression deducing pack expansion arguments introduced by D110216
Matheus Izvekov [Fri, 19 Nov 2021 00:17:40 +0000 (01:17 +0100)]
[clang] fix regression deducing pack expansion arguments introduced by D110216

This test case had been missing when the original code
was introduced by 2fcb863b2b278.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D114207

2 years ago[NFC][OpaquePtr][Evaluator] Remove call to PointerType::getElementType
Senran Zhang [Thu, 18 Nov 2021 01:23:05 +0000 (09:23 +0800)]
[NFC][OpaquePtr][Evaluator] Remove call to PointerType::getElementType

There are still another 2 uses of PointerType::getElementType in
Evaluator when evaluating BitCast's on pointers. BitCast's on pointers
should be removed when opaque ptr is ready, so I just keep them as is.

Reviewed By: aeubanks

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

2 years ago[msan] Clang-format the test
Vitaly Buka [Mon, 15 Nov 2021 06:36:00 +0000 (22:36 -0800)]
[msan] Clang-format the test

2 years agolibfuzzer: All building libfuzzer for ARM32
Manoj Gupta [Tue, 19 Oct 2021 19:53:51 +0000 (12:53 -0700)]
libfuzzer: All building libfuzzer for ARM32

We need libfuzzer libraries on Arm32 so that we can fuzz
Arm32 binaries on Linux (Chrome OS). Android already
allows Arm32 for libfuzzer.

Reviewed By: morehouse

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

2 years ago[SCEV] Defer all work from ea12c2cb as late as possible
Philip Reames [Fri, 19 Nov 2021 01:18:04 +0000 (17:18 -0800)]
[SCEV] Defer all work from ea12c2cb as late as possible

This is a second speculative compile time optimization to address a reported regression.  My actual suspicion is that availability of no-self-wrap is making some *other* bit of code trigger, but let's rule this out.

2 years ago[AMDGPU] Fix SIPostRABundler crash on null register used by dbg value
Stanislav Mekhanoshin [Thu, 18 Nov 2021 23:35:54 +0000 (15:35 -0800)]
[AMDGPU] Fix SIPostRABundler crash on null register used by dbg value

Recently we started generate DBG_VALUEs with $noreg operands.
This crashes SIPostRABundler, and it should not iterate these
registers anyway.

Fixes: SWDEV-311733

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

2 years ago[SampleFDO] Add pass name strings for the passes (NFC)
Rong Xu [Fri, 19 Nov 2021 00:07:37 +0000 (16:07 -0800)]
[SampleFDO] Add pass name strings for the passes (NFC)

2 years agoRemove unused variable.
Jim Ingham [Thu, 18 Nov 2021 23:57:56 +0000 (15:57 -0800)]
Remove unused variable.

2 years ago[PowerPC] Remove the redundant terminator instruction when optimizing conditional...
Victor Huang [Thu, 18 Nov 2021 23:52:04 +0000 (17:52 -0600)]
[PowerPC] Remove the redundant terminator instruction when optimizing conditional trap

This patch is a follow up patch for ae27ca9a678301969c35f2e27c76f14c9d2bb396 to
the remove redundant terminator when optimizing conditional trap.

Peer reviewed by: nemanjai

2 years ago[AMDGPU] Regenerate postra-bundle-memops.mir checks. NFC.
Stanislav Mekhanoshin [Thu, 18 Nov 2021 23:47:44 +0000 (15:47 -0800)]
[AMDGPU] Regenerate postra-bundle-memops.mir checks. NFC.

2 years ago[AArch64][PAC] Select llvm.ptrauth.sign/sign.generic to PAC*.
Ahmed Bougacha [Mon, 27 Sep 2021 15:00:00 +0000 (08:00 -0700)]
[AArch64][PAC] Select llvm.ptrauth.sign/sign.generic to PAC*.

The @llvm.ptrauth.sign/sign.generic intrinsics map cleanly to
the various AArch64 PAC[IDG][Z][AB] instructions.  Select them.

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

2 years ago[libc++][NFC] Assign some Ranges tasks to varconst.
Konstantin Varlamov [Thu, 18 Nov 2021 23:13:30 +0000 (15:13 -0800)]
[libc++][NFC] Assign some Ranges tasks to varconst.

Specifically:
- [special.mem.concepts];
- [specialized.algorithms].

2 years ago[lldb] Fix formatted log statement
Keith Smiley [Thu, 18 Nov 2021 18:40:06 +0000 (10:40 -0800)]
[lldb] Fix formatted log statement

Previously this would output literally without replacements

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

2 years agoRevert "Increase gdbremote timeout."
Adrian Prantl [Thu, 18 Nov 2021 23:07:08 +0000 (15:07 -0800)]
Revert "Increase gdbremote timeout."

This reverts commit 6424dc21bf6b73645ef98a35417e0591b2a95939.

2 years ago[mlir][vector] Insert/extract element can accept index
Mogball [Thu, 18 Nov 2021 05:41:25 +0000 (05:41 +0000)]
[mlir][vector] Insert/extract element can accept index

`vector::InsertElementOp` and `vector::ExtractElementOp` have had their `position`
operand changed to accept `AnySignlessIntegerOrIndex` for better operability with
operations that use `index`, such as affine loops.

LLVM's `extractelement` and `insertelement` can also accept `i64`, so lowering
directly to these operations without explicitly inserting casts is allowed. SPIRV's
equivalent ops can also accept `i64`.

Reviewed By: nicolasvasilache, jpienaar

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

2 years ago[MLIR][NFC] Simplex::markRowRedundant: assert that row is not already marked redundant
Arjun P [Thu, 18 Nov 2021 21:44:25 +0000 (03:14 +0530)]
[MLIR][NFC] Simplex::markRowRedundant: assert that row is not already marked redundant

2 years agollvm-dwarfdump: Rebuild type names in dwo type units
David Blaikie [Thu, 18 Nov 2021 21:49:32 +0000 (13:49 -0800)]
llvm-dwarfdump: Rebuild type names in dwo type units

2 years ago[libc++] Cast to the right `difference_type` in various algorithms
Fabian Wolff [Thu, 18 Nov 2021 22:01:11 +0000 (17:01 -0500)]
[libc++] Cast to the right `difference_type` in various algorithms

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

2 years agomake testcase more robust
Adrian Prantl [Thu, 18 Nov 2021 22:00:43 +0000 (14:00 -0800)]
make testcase more robust

2 years ago[docs] Add Loop Optimization WG to the online sync-up page
Bardia Mahjour [Thu, 18 Nov 2021 21:48:29 +0000 (16:48 -0500)]
[docs] Add Loop Optimization WG to the online sync-up page

2 years ago[SCEV] Defer loop property checks from ea12c2cb as late as possible
Philip Reames [Thu, 18 Nov 2021 21:46:59 +0000 (13:46 -0800)]
[SCEV] Defer loop property checks from ea12c2cb as late as possible

This is a speculative compile time optimization to address a reported regression.  It's the only thing which vaguely makes sense.

2 years ago[mlir][Linalg] Add method to check if LinalgTransformationFilter has been applied.
MaheshRavishankar [Thu, 18 Nov 2021 21:42:23 +0000 (13:42 -0800)]
[mlir][Linalg] Add method to check if LinalgTransformationFilter has been applied.

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

2 years ago[SystemZ][z/OS] Fix filesystem testing
Muiez Ahmed [Thu, 18 Nov 2021 20:57:50 +0000 (15:57 -0500)]
[SystemZ][z/OS] Fix filesystem testing

This patch resolves many of the failures in the `filesystems/` buckets in the libc++ tests. It adds the correct flag to `fopen` and marks a test case as unsupported. In particular, that test assumes time is stored as a 64 bit value when on MVS it is stored as 32 bit.

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

2 years ago[libc++] Resolve missing table_size symbol
Muiez Ahmed [Thu, 18 Nov 2021 20:49:45 +0000 (15:49 -0500)]
[libc++] Resolve missing table_size symbol

The aim of this patch is to resolve the missing `table_size` symbol (see reduced test case). That const variable is declared and defined in //libcxx/include/locale//; however, the test case suggests that the symbol is missing. This is due to a C++ pitfall (highlighted [[ https://quuxplusone.github.io/blog/2020/09/19/value-or-pitfall/ | here ]]). In summary, assigning the reference of `table_size` doesn't enforce the const-ness and expects to find `table_size` in the DLL. The fix is to use `constexpr` or have an out-of-line definition in the src (for consistency).

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

2 years ago[DSE] Remove getLocForWrite() (NFCI)
Nikita Popov [Thu, 18 Nov 2021 20:17:08 +0000 (21:17 +0100)]
[DSE] Remove getLocForWrite() (NFCI)

This implements nearly the same logic as getLocForWriteEx(), and
is only used in one place. In that context, we should also know
that getLocForWriteEx() returns a non-None result. As such,
consolidate everything to use one function.

2 years ago[DSE] Move removePartiallyOverlappedStores() into DSEState (NFC)
Nikita Popov [Thu, 18 Nov 2021 20:10:29 +0000 (21:10 +0100)]
[DSE] Move removePartiallyOverlappedStores() into DSEState (NFC)

So it can use getLocForWriteEx().

2 years ago[mlir] Fully qualify default generated type/attribute printer and parser
Markus Böck [Thu, 18 Nov 2021 19:23:23 +0000 (20:23 +0100)]
[mlir] Fully qualify default generated type/attribute printer and parser

This patch makes it possible to use the newly added useDefaultAttributePrinterParser and useDefaultTypePrinterParser dialect options without any using namespace declarations. Two things had to be done to make this possible:

* Fully qualify any type usages or functions from the mlir namespace in the generated C++ code
* Makes sure to emit the printers and parsers inside the same namespace as the Dialect

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

2 years ago[NFC][mlir] Inclusive language: Replace an instance of master in docs
Quinn Pham [Wed, 17 Nov 2021 16:09:16 +0000 (10:09 -0600)]
[NFC][mlir] Inclusive language: Replace an instance of master in docs

[NFC] As part of using inclusive language within the llvm project, this patch
replaces master with main in `SPIR-V.md`.

Reviewed By: mehdi_amini

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

2 years agofix syntax error
Adrian Prantl [Thu, 18 Nov 2021 18:49:51 +0000 (10:49 -0800)]
fix syntax error

2 years ago[NFC][lldb] Inclusive language: remove instances of master from comments in lldb
Quinn Pham [Wed, 17 Nov 2021 22:23:19 +0000 (16:23 -0600)]
[NFC][lldb] Inclusive language: remove instances of master from comments in lldb

[NFC] As part of using inclusive language within the llvm project, this patch
replaces master in these comments.

Reviewed By: clayborg, JDevlieghere

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

2 years ago[lldb] Deobfuscate python-swigsafecast.swig
Pavel Labath [Thu, 18 Nov 2021 10:12:19 +0000 (11:12 +0100)]
[lldb] Deobfuscate python-swigsafecast.swig

This file was way more complicated than it needed to be.

This patch removes the automagic reference-to-pointer delegation and
replaces the template specializations with regular free functions
(taking reference arguments).

The reason I chose references is twofold:
- there are more arguments being passed by reference than by pointer
- the reference arguments make it more obvious that there is a lot of
  leaking going on in there.

Currently, the code was assuming that the pointer arguments have some
kind of a special meaning and that pointer functions take ownership of
their arguments, which isn't true (it's possible it was true at some
point in the past, I haven't done the archeology).

This makes it easier to implement proper lifetime management in
follow-up patches.

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

2 years ago[SCEV] Move mustprogress based no-self-wrap logic so it applies to all exit conditions
Philip Reames [Thu, 18 Nov 2021 18:05:04 +0000 (10:05 -0800)]
[SCEV] Move mustprogress based no-self-wrap logic so it applies to all exit conditions

This change moves logic which we'd added specifically for less than tests so that it applies to equalities and greater than tests as well. The basic idea is that if we can show an IV cycles infinitely through the same series on self-wrap, and that the exit condition must be taken to prevent UB, we can conclude that it must be taken before self-wrap and thus infer said flag.

The motivation here is simple loops with unsigned induction variables w/non-one steps and inequality tests. A toy example would be:
for (unsigned i = 0; i != N; i += 2) { body; }

If body contains no side effects, and this is a mustprogress function, we can assume that this must be a finite loop and thus that the exit count is N/2.

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