platform/upstream/llvm.git
2 years ago[x86] split memcmp tests for 32/64-bit targets; NFC
Sanjay Patel [Sun, 15 Aug 2021 17:39:28 +0000 (13:39 -0400)]
[x86] split memcmp tests for 32/64-bit targets; NFC

memcmp is defined as taking a size_t length arg,
so that differs depending on pointer size of the
target.

We casually matched non-compliant function signatures
as memcmp, but that can cause crashing as seen with
PR50850.

If we fix that bug, these tests would no longer be
testing the expected behavior for a 32-bit target,
so I have duplicated all tests and adjusted them
to match the stricter definition of memcmp/bcmp
by changing the length arg to i32 on a 32-bit target.

2 years ago[DAGCombiner] Stop visitEXTRACT_SUBVECTOR creating illegal BITCASTs post legalisation.
Paul Walker [Sun, 15 Aug 2021 13:24:20 +0000 (14:24 +0100)]
[DAGCombiner] Stop visitEXTRACT_SUBVECTOR creating illegal BITCASTs post legalisation.

visitEXTRACT_SUBVECTOR can sometimes create illegal BITCASTs when
removing "redundant" INSERT_SUBVECTOR operations.  This patch adds
an extra check to ensure such combines only occur after operation
legalisation if any resulting BITBAST is itself legal.

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

2 years ago[gn build] (manually) port 957334382cd1
Nico Weber [Sun, 15 Aug 2021 17:21:36 +0000 (13:21 -0400)]
[gn build] (manually) port 957334382cd1

2 years ago[AsmParser] Remove MDSignedOrUnsignedField (NFC)
Kazu Hirata [Sun, 15 Aug 2021 16:31:39 +0000 (09:31 -0700)]
[AsmParser] Remove MDSignedOrUnsignedField (NFC)

The last use was removed on Apr 18, 2020 in commit
aad3d578da0ddf6d0d3d95e5e09a32e47f6dfeb8.

2 years ago[InstCombine] Add call to matchSAddSubSat from min/max
David Green [Sun, 15 Aug 2021 16:25:16 +0000 (17:25 +0100)]
[InstCombine] Add call to matchSAddSubSat from min/max

This adds a call to matchSAddSubSat from smin/smax instrinsics, allowing
the same patterns to match if the canonical form of a min/max is an
intrinsics, not a icmp/select.

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

2 years agoReland [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form...
Roman Lebedev [Sun, 15 Aug 2021 16:01:44 +0000 (19:01 +0300)]
Reland [SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)

... with test change this time.

LLVM IR SSA form is "implicit" in `@pr51125`. While is a valid LLVM IR,
and does not require any PHI nodes, that completely breaks the further logic
in `CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses()`
that updates the live-out uses of the bonus instructions.

What i believe we need to do, is to first make the SSA form explicit,
by inserting tautological PHI nodes, and rewriting the offending uses.

```
$ /builddirs/llvm-project/build-Clang12/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -load-pass-plugin /repositories/alive2/build-Clang-release/tv/tv.so -tv -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10 -tv -o /dev/null /tmp/test.ll

----------------------------------------
@global_pr51125 = global 4 bytes, align 4

define i32 @pr51125() {
%entry:
  br label %L

%L:
  %ld = load i32, * @global_pr51125, align 4
  %iszero = icmp eq i32 %ld, 0
  br i1 %iszero, label %exit, label %L2

%L2:
  store i32 4294967295, * @global_pr51125, align 4
  %cmp = icmp eq i32 %ld, 4294967295
  br i1 %cmp, label %L, label %exit

%exit:
  %r = phi i32 [ %ld, %L2 ], [ %ld, %L ]
  ret i32 %r
}
=>
@global_pr51125 = global 4 bytes, align 4

define i32 @pr51125() {
%entry:
  %ld.old = load i32, * @global_pr51125, align 4
  %iszero.old = icmp eq i32 %ld.old, 0
  br i1 %iszero.old, label %exit, label %L2

%L2:
  %ld2 = phi i32 [ %ld.old, %entry ], [ %ld, %L2 ]
  store i32 4294967295, * @global_pr51125, align 4
  %cmp = icmp ne i32 %ld2, 4294967295
  %ld = load i32, * @global_pr51125, align 4
  %iszero = icmp eq i32 %ld, 0
  %or.cond = select i1 %cmp, i1 1, i1 %iszero
  br i1 %or.cond, label %exit, label %L2

%exit:
  %ld1 = phi i32 [ poison, %L2 ], [ %ld.old, %entry ]
  %r = phi i32 [ %ld2, %L2 ], [ %ld.old, %entry ]
  ret i32 %r
}
Transformation seems to be correct!

```

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

Reviewed By: nikic

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

2 years agoRevert "[SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form...
Roman Lebedev [Sun, 15 Aug 2021 16:15:09 +0000 (19:15 +0300)]
Revert "[SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)"

Forgot to stage the test change.

This reverts commit 78af5cb213b2f9fe3f47bf23947f14ac07024155.

2 years ago[SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before...
Roman Lebedev [Sun, 15 Aug 2021 16:01:44 +0000 (19:01 +0300)]
[SimplifyCFG] performBranchToCommonDestFolding(): form block-closed SSA form before cloning instructions (PR51125)

LLVM IR SSA form is "implicit" in `@pr51125`. While is a valid LLVM IR,
and does not require any PHI nodes, that completely breaks the further logic
in `CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses()`
that updates the live-out uses of the bonus instructions.

What i believe we need to do, is to first make the SSA form explicit,
by inserting tautological PHI nodes, and rewriting the offending uses.

```
$ /builddirs/llvm-project/build-Clang12/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -load-pass-plugin /repositories/alive2/build-Clang-release/tv/tv.so -tv -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -bonus-inst-threshold=10 -tv -o /dev/null /tmp/test.ll

----------------------------------------
@global_pr51125 = global 4 bytes, align 4

define i32 @pr51125() {
%entry:
  br label %L

%L:
  %ld = load i32, * @global_pr51125, align 4
  %iszero = icmp eq i32 %ld, 0
  br i1 %iszero, label %exit, label %L2

%L2:
  store i32 4294967295, * @global_pr51125, align 4
  %cmp = icmp eq i32 %ld, 4294967295
  br i1 %cmp, label %L, label %exit

%exit:
  %r = phi i32 [ %ld, %L2 ], [ %ld, %L ]
  ret i32 %r
}
=>
@global_pr51125 = global 4 bytes, align 4

define i32 @pr51125() {
%entry:
  %ld.old = load i32, * @global_pr51125, align 4
  %iszero.old = icmp eq i32 %ld.old, 0
  br i1 %iszero.old, label %exit, label %L2

%L2:
  %ld2 = phi i32 [ %ld.old, %entry ], [ %ld, %L2 ]
  store i32 4294967295, * @global_pr51125, align 4
  %cmp = icmp ne i32 %ld2, 4294967295
  %ld = load i32, * @global_pr51125, align 4
  %iszero = icmp eq i32 %ld, 0
  %or.cond = select i1 %cmp, i1 1, i1 %iszero
  br i1 %or.cond, label %exit, label %L2

%exit:
  %ld1 = phi i32 [ poison, %L2 ], [ %ld.old, %entry ]
  %r = phi i32 [ %ld2, %L2 ], [ %ld.old, %entry ]
  ret i32 %r
}
Transformation seems to be correct!

```

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

Reviewed By: nikic

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

2 years ago[NFC][SimplifyCFG] Autogenerate check lines in a test to declutter further update
Roman Lebedev [Sun, 15 Aug 2021 16:02:32 +0000 (19:02 +0300)]
[NFC][SimplifyCFG] Autogenerate check lines in a test to declutter further update

2 years ago[NFCI][IndVars] rewriteLoopExitValues(): nowadays SCEV should not change `GEP` base...
Roman Lebedev [Sun, 15 Aug 2021 15:59:32 +0000 (18:59 +0300)]
[NFCI][IndVars] rewriteLoopExitValues(): nowadays SCEV should not change `GEP` base pointer

Currently/previously, while SCEV guaranteed that it produces the same value,
the way it was produced may be illegal IR, so we have an ugly check that
the replacement is valid.

But now that the SCEV strictness wrt the pointer/integer types has been improved,
i believe this invariant is already upheld by the SCEV itself, natively.

I think we should add an assertion, wait for a week, and then, if all is good,
rip out all this checking.
Or we could just do the latter directly i guess.

This reverts commit rL127839.

Reviewed By: nikic

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

2 years ago[IndVars] Don't check for pointer exit count (NFC)
Nikita Popov [Sun, 15 Aug 2021 14:47:27 +0000 (16:47 +0200)]
[IndVars] Don't check for pointer exit count (NFC)

After recent changes, exit counts and BE taken counts are always
integers, so convert these to assertions.

While here, also convert the loop invariance checks to asserts.
Exit counts are always loop invariant.

2 years ago[NFC] Simply update a FIXME comment
Qiu Chaofan [Sun, 15 Aug 2021 14:43:46 +0000 (22:43 +0800)]
[NFC] Simply update a FIXME comment

X86 overrided LowerOperationWrapper was moved to common implementation
in a7eae62.

2 years ago[FunctionImport] Fix build with old mingw (NFC)
Nikita Popov [Sun, 15 Aug 2021 13:46:25 +0000 (15:46 +0200)]
[FunctionImport] Fix build with old mingw (NFC)

std::errc::operation_not_supported is not universally supported.
Make use of LLVM's errc interoperability header, which lists
known-good errc values.

2 years ago[ExecutionEngine] Check for libunwind before calling __register_frame
Harald van Dijk [Sun, 15 Aug 2021 12:35:53 +0000 (13:35 +0100)]
[ExecutionEngine] Check for libunwind before calling __register_frame

libgcc and libunwind have different flavours of __register_frame. Both
 flavours are already correctly handled, except that the code to handle
the libunwind flavour is guarded by __APPLE__. This change uses the
presence of __unw_add_dynamic_fde in libunwind instead to detect whether
libunwind is used, rather than hardcoding it as Apple vs. non-Apple.

Fixes PR44074.

Thanks to Albert Jin <albert.jin@gmail.com> and Chris Schafmeister
<chris.schaf@verizon.net> for identifying the problem.

Reviewed By: lhames

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

2 years ago[Clang] Updated warning-wall.c test file
Dávid Bolvanský [Sun, 15 Aug 2021 11:54:58 +0000 (13:54 +0200)]
[Clang] Updated warning-wall.c test file

-Wbool-operation was moved to -Wall and test file needs to be adjusted.

2 years ago[Clang] Put -Wbool-operation under -Wall
Dávid Bolvanský [Sun, 15 Aug 2021 11:34:24 +0000 (13:34 +0200)]
[Clang] Put -Wbool-operation under -Wall

To keep compatibility with GCC.

2 years ago[LoopVectorize] Don't emit remarks about lack of scalable vectors unless they're...
Paul Walker [Fri, 13 Aug 2021 11:47:51 +0000 (12:47 +0100)]
[LoopVectorize] Don't emit remarks about lack of scalable vectors unless they're specifically requested.

Previously we emitted a "does not support scalable vectors"
remark for all targets whenever vectorisation is attempted. This
pollutes the output for architectures that don't support scalable
vectors and is likely confusing to the user.

Instead this patch introduces a debug message that reports when
scalable vectorisation is allowed by the target and only issues
the previous remark when scalable vectorisation is specifically
requested, for example:

  #pragma clang loop vectorize_width(2, scalable)

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

2 years ago[AArch64] Fix comparison peephole opt with non-0/1 immediate (PR51476)
Nikita Popov [Sat, 14 Aug 2021 21:35:27 +0000 (23:35 +0200)]
[AArch64] Fix comparison peephole opt with non-0/1 immediate (PR51476)

This is a non-intrusive fix for
https://bugs.llvm.org/show_bug.cgi?id=51476 intended for backport
to the 13.x release branch. It expands on the current hack by
distinguishing between CmpValue of 0, 1 and 2, where 0 and 1 have
the obvious meaning and 2 means "anything else". The new optimization
from D98564 should only be performed for CmpValue of 0 or 1.

For main, I think we should switch the analyzeCompare() and
optimizeCompare() APIs to use int64_t instead of int, which is in
line with MachineOperand's notion of an immediate, and avoids this
problem altogether.

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

2 years agoRevert "[Remarks] Emit optimization remarks for atomics generating CAS loop"
Dávid Bolvanský [Sun, 15 Aug 2021 09:44:13 +0000 (11:44 +0200)]
Revert "[Remarks] Emit optimization remarks for atomics generating CAS loop"

This reverts commit 435785214f73ff0c92e97f2ade6356e3ba3bf661. Still same compile time issues for -O0 -g, eg. +1.3% for sqlite3.

2 years ago[flang][nfc] Move `Semantics` from `FrontendAction` to `CompilerInstance`
Andrzej Warzynski [Fri, 13 Aug 2021 13:03:21 +0000 (13:03 +0000)]
[flang][nfc] Move `Semantics` from `FrontendAction` to `CompilerInstance`

`CompilerInstance` is a more appropriate place for a key component of
the frontend like `Semantics`.

This change opens a path for us to introduce new frontend actions that
will also run semantics, but for which inheriting from
`PrescanAndSemaAction` wouldn't make much sense. For example, for
code-gen actions we plan to introduce a dedicate hierarchy of action
classes.

I've also added a doxyment for `CompilerInstance` to add a bit of
context for this change (and also make future refactoring more informed).
As `CompilerInstance` in Flang has been inspired by its counterpart in
Clang, this comment is roughly a verbatim copy of the comment in Clang
(with some adjustments from me). Credits to Daniel Dunbar for the great
design and the original comment.

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

2 years ago[asan][test] Un-xfail Posix/unpoison-alternate-stack.cpp on Solaris again
Rainer Orth [Sun, 15 Aug 2021 07:21:08 +0000 (09:21 +0200)]
[asan][test] Un-xfail Posix/unpoison-alternate-stack.cpp on Solaris again

`Posix/unpoison-alternate-stack.cpp` currently `XPASS`es on Solaris.  The
`XFAIL` had already been removed in D97933
<https://reviews.llvm.org/D97933>, but reintroduced by commit
f03d29601e0951da2c88f07d4234128e14e87870
<https://reviews.llvm.org/rGf03d29601e0951da2c88f07d4234128e14e87870> which
was never posted or justified.

Given the `XPASS`, this obviously wasn't NFC, so I suggest to remove it again.

Tested on `amd64-pc-solaris2.11` and `x86_64-pc-linux-gnu`.

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

2 years ago[Remarks] Emit optimization remarks for atomics generating CAS loop
Anshil Gandhi [Sun, 15 Aug 2021 05:37:15 +0000 (23:37 -0600)]
[Remarks] Emit optimization remarks for atomics generating CAS loop

Implements ORE in AtomicExpand pass to report atomics generating
a compare and swap loop.

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

2 years ago[Linker] Import GlobalIFunc when importing symbols from another module
Itay Bookstein [Sun, 15 Aug 2021 05:01:10 +0000 (22:01 -0700)]
[Linker] Import GlobalIFunc when importing symbols from another module

Reviewed By: MaskRay

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

2 years ago[msan] Fix ppc64 format warning
Vitaly Buka [Sun, 15 Aug 2021 01:42:05 +0000 (18:42 -0700)]
[msan] Fix ppc64 format warning

2 years ago[sanitizer] Improve VSNPrintf internal diagnostics
Vitaly Buka [Sun, 15 Aug 2021 01:33:03 +0000 (18:33 -0700)]
[sanitizer] Improve VSNPrintf internal diagnostics

2 years ago[X86] Add parentheses around casts in X86 intrinsic headers.
Craig Topper [Sun, 15 Aug 2021 00:24:21 +0000 (17:24 -0700)]
[X86] Add parentheses around casts in X86 intrinsic headers.

Fixes PR51324.

2 years agosanitizer_common: support %l in format strings
Dmitry Vyukov [Sun, 15 Aug 2021 00:41:14 +0000 (17:41 -0700)]
sanitizer_common: support %l in format strings

Currently we only support %z and %ll width modifiers,
but surprisingly not %l. This makes it impossible to print longs
(sizeof(long) not necessary equal to sizeof(size_t)).
We had some printf's that printed longs with %zu,
but that's wrong and now with __attribute__((format)) in place
they are flagged by compiler. So we either have a choice of
doing static_cast<uptr>(long) everywhere or add %l.
Adding %l looks better, that's a standard modifier.

Reviewed By: vitalybuka

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

2 years ago[X86] AVX512FP16 instructions enabling 2/6
Wang, Pengfei [Sun, 15 Aug 2021 00:17:30 +0000 (08:17 +0800)]
[X86] AVX512FP16 instructions enabling 2/6

Enable FP16 binary operator instructions.

Ref.: https://software.intel.com/content/www/us/en/develop/download/intel-avx512-fp16-architecture-specification.html

Reviewed By: LuoYuanke

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

2 years ago[sanitizer] Define 32bit uptr as uint
Vitaly Buka [Sat, 14 Aug 2021 23:51:10 +0000 (16:51 -0700)]
[sanitizer] Define 32bit uptr as uint

This makes it consistent with uintptr_t.

2 years ago[sanitizer] Fix format string
Vitaly Buka [Sat, 14 Aug 2021 23:26:06 +0000 (16:26 -0700)]
[sanitizer] Fix format string

2 years ago[X86] Use a do {} while (0) in the _MM_EXTRACT_FLOAT implementation.
Craig Topper [Sat, 14 Aug 2021 23:41:50 +0000 (16:41 -0700)]
[X86] Use a do {} while (0) in the _MM_EXTRACT_FLOAT implementation.

Previously we just used {}, but that doesn't work in situations
like this.

if (1)
  _MM_EXTRACT_FLOAT(d, x, n);
else
  ...

The semicolon would terminate the if.

2 years ago[X86] Use __builtin_bit_cast _mm_extract_ps instead of type punning through a union...
Craig Topper [Sat, 14 Aug 2021 23:34:52 +0000 (16:34 -0700)]
[X86] Use __builtin_bit_cast _mm_extract_ps instead of type punning through a union. NFC

2 years ago[test] Avoid unportable echo in Other/lit-quoting.txt
Rainer Orth [Sat, 14 Aug 2021 22:20:47 +0000 (00:20 +0200)]
[test] Avoid unportable echo in Other/lit-quoting.txt

`LLVM :: Other/lit-quoting.txt` currently `FAIL`s on Solaris:

  llvm/test/Other/lit-quoting.txt:8:9: error: CHECK2: expected string not found in input
  CHECK2: {{^a\[b\\c$}}
          ^
  <stdin>:1:1: note: scanning from here
  a[b
  ^

This happens because echo with backslashes or special characters is
unportable, as extensively documented in the Autoconf manual.  In the case
at hand, `echo 'a[b\c'` yields `a[b\c` on Linux, but `a[b` (no newline) on
Solaris.

This patch fixes this by using the portable alternative suggested in the
Autoconf manual.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

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

2 years agoSimplify a .mailmap entry
Nico Weber [Sat, 14 Aug 2021 21:58:21 +0000 (17:58 -0400)]
Simplify a .mailmap entry

Only one person committed with these email addresses, so there's no need to use
the map-different-names-for-one-email-address syntax.

No behavior change.

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

2 years ago[InstCombine] Extend sadd.sat tests to include min/max patterns. NFC
David Green [Sat, 14 Aug 2021 21:48:10 +0000 (22:48 +0100)]
[InstCombine] Extend sadd.sat tests to include min/max patterns. NFC

This tests code starting from smin/smax, as opposed to the icmp/select
form. Also adds a ARM MVE phase ordering test for vectorizing to
sadd.sat from the original IR.

2 years ago[MLIR] Move TestDialect to ::test namespace
Stephen Neuendorffer [Thu, 24 Sep 2020 18:54:46 +0000 (11:54 -0700)]
[MLIR] Move TestDialect to ::test namespace

While the changes are extensive, they basically fall into a few
categories:
1) Moving the TestDialect itself.
2) Updating C++ code in tablegen to explicitly use ::mlir, since it
will be put in a headers that shouldn't expect a 'using'.
3) Updating some generic MLIR Interface definitions to do the same thing.
4) Updating the Tablegen generator in a few places to be explicit about
namespaces
5) Doing the same thing for llvm references, since we no longer pick
up the definitions from mlir/Support/LLVM.h

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

2 years ago[Tests] Remove explicit -enable-mssa-loop-dependency options (NFC)
Nikita Popov [Sat, 14 Aug 2021 18:54:19 +0000 (20:54 +0200)]
[Tests] Remove explicit -enable-mssa-loop-dependency options (NFC)

This is enabled by default. Drop explicit uses in preparation for
removing the option.

Also drop RUN lines that are now the same (typically modulo a
-verify-memoryssa option).

2 years ago[JITLink] Unify x86-64 MachO and ELF 's optimize GOT/Stub function
luxufan [Sat, 14 Aug 2021 16:30:42 +0000 (00:30 +0800)]
[JITLink] Unify x86-64 MachO and ELF 's optimize GOT/Stub function

This patch  unify optimizeELF_x86_64_GOTAndStubs and optimizeMachO_x86_64_GOTAndStubs into a pure optimize_x86_64_GOTAndStubs

Reviewed By: lhames

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

2 years ago[Aarch64] Remove redundant c_str (NFC)
Kazu Hirata [Sat, 14 Aug 2021 15:49:40 +0000 (08:49 -0700)]
[Aarch64] Remove redundant c_str (NFC)

Identified with readability-redundant-string-cstr.

2 years ago[clang-format] Distinguish K&R C function definition and attribute
Owen [Thu, 12 Aug 2021 13:12:25 +0000 (06:12 -0700)]
[clang-format] Distinguish K&R C function definition and attribute

This is a follow-up to https://reviews.llvm.org/D107950 which
missed user-defined types in K&R C.

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

2 years ago[LoopIdiom] let the pass deal with runtime memset size
eopXD [Sat, 14 Aug 2021 07:58:05 +0000 (15:58 +0800)]
[LoopIdiom] let the pass deal with runtime memset size

The current LIR does not deal with runtime-determined memset-size. This patch
utilizes SCEV and check if the PointerStrideSCEV and the MemsetSizeSCEV are equal.
Before comparison the pass would try to fold the expression that is already
protected by the loop guard.

Testcase file `memset-runtime.ll`, `memset-runtime-debug.ll` added.

This patch deals with proper loop-idiom. Proceeding patch wants to deal with SCEV-s
that are inequal after folding with the loop guards.

Reviewed By: lebedev.ri, Whitney

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

2 years ago[clang-tidy] [PR50069] readability-braces-around-statements doesn't work well with...
mydeveloperday [Sat, 14 Aug 2021 11:05:21 +0000 (12:05 +0100)]
[clang-tidy] [PR50069] readability-braces-around-statements doesn't work well with [[likely]] [[unlikely]]

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

When clang-tidy sees:

```
if (true) [[unlikely]] {
    ...
}
```

It thinks the braces are missing and add them again.

```
if (true)  { [[unlikely]] {
    ...
  }
}
```

This revision aims to prevent that incorrect code generation

Reviewed By: aaron.ballman

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

2 years ago[clang-format] NFC update the ClangFormatStyleOption.rst following previous change
mydeveloperday [Sat, 14 Aug 2021 09:29:07 +0000 (10:29 +0100)]
[clang-format] NFC update the ClangFormatStyleOption.rst following previous change

clang/docs/tool/dump_format_style.py was not run as part of  {D99840}

Bring ClangFormatStyleOptions.rst back in line.

Reviewed By: HazardyKnusperkeks

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

2 years ago[NFC][DSE] Clean up KnownNoReads and MemorySSAScanLimit in DSE
Dawid Jurczak [Tue, 10 Aug 2021 10:56:44 +0000 (12:56 +0200)]
[NFC][DSE] Clean up KnownNoReads and MemorySSAScanLimit in DSE

Another simple cleanups set in DSE. CheckCache is removed since 1f1145006b32 and in consequence KnownNoReads is useless.
Also update description of MemorySSAScanLimit which default value is 150 instead 100.

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

2 years ago[JITLink][x86-64] Rename *Relaxable edges to *REXRelaxable.
Lang Hames [Sat, 14 Aug 2021 08:27:16 +0000 (18:27 +1000)]
[JITLink][x86-64] Rename *Relaxable edges to *REXRelaxable.

The existing relaxable edges all assume a REX prefix. ELF includes non-REX
relaxations, so rename these edges to make room for the new kinds.

2 years ago[JITLink][x86-64] Rename BranchPCRel32ToPtrJumpStub(Relaxable -> Bypassable).
Lang Hames [Sat, 14 Aug 2021 07:49:31 +0000 (17:49 +1000)]
[JITLink][x86-64] Rename BranchPCRel32ToPtrJumpStub(Relaxable -> Bypassable).

ELF allows for branch optimizations other than bypass, so rename this edge kind
to avoid any confusion.

2 years agoRevert "[Remarks] Emit optimization remarks for atomics generating CAS loop"
Anshil Gandhi [Sat, 14 Aug 2021 05:58:04 +0000 (23:58 -0600)]
Revert "[Remarks] Emit optimization remarks for atomics generating CAS loop"

This reverts commit c4e5425aa579d21530ef1766d7144b38a347f247.

2 years ago[Remarks] Emit optimization remarks for atomics generating CAS loop
Anshil Gandhi [Fri, 13 Aug 2021 22:32:02 +0000 (16:32 -0600)]
[Remarks] Emit optimization remarks for atomics generating CAS loop

Implements ORE in AtomicExpandPass to report atomics generating a compare
and swap loop.

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

2 years ago[clang-tidy] fix duplicate '{}' in cppcoreguidelines-pro-type-member-init
liuke [Sat, 14 Aug 2021 02:47:27 +0000 (10:47 +0800)]
[clang-tidy] fix duplicate '{}' in cppcoreguidelines-pro-type-member-init

The overload of the constructor will repeatedly fix the member variables that need to be initialized.
Removed the duplicate '{}'.

```
struct A {
  A() {}
  A(int) {}
  int _var;  // int _var{}{};  <--  wrong fix
};
```

Reviewed By: aaron.ballman

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

2 years agoMigrate DWARFVerifier tests to lit-based yaml instead of gtest with embedded yaml
David Blaikie [Fri, 13 Aug 2021 05:56:43 +0000 (22:56 -0700)]
Migrate DWARFVerifier tests to lit-based yaml instead of gtest with embedded yaml

Improves maintainability (edit/modify the tests without recompiling) and
error messages (previously the failure would be a gtest failure
mentioning nothing of the input or desired text) and the option to
improve tests with more checks.

(maybe these tests shouldn't all be in separate files - we could
probably have DWARF yaml that contains multiple errors while still being
fairly maintainable - the various invalid offsets (ref_addr, rnglists,
ranges, etc) could probably be all in one test, but for the simple sake
of the migration I just did the mechanical thing here)

2 years ago[GlobalISel] Narrow binops feeding into G_AND with a mask
Jessica Paquette [Wed, 11 Aug 2021 20:20:33 +0000 (13:20 -0700)]
[GlobalISel] Narrow binops feeding into G_AND with a mask

This is a fairly common pattern:

```
%mask = G_CONSTANT iN <mask val>
%add = G_ADD %lhs, %rhs
%and = G_AND %add, %mask
```

We have combines to eliminate G_AND with a mask that does nothing.

If we combined the above to this:

```
%mask = G_CONSTANT iN <mask val>
%narrow_lhs = G_TRUNC %lhs
%narrow_rhs = G_TRUNC %rhs
%narrow_add = G_ADD %narrow_lhs, %narrow_rhs
%ext = G_ZEXT %narrow_add
%and = G_AND %ext, %mask
```

We'd be able to take advantage of those combines using the trunc + zext.

For this to work (or be beneficial in the best case)

- The operation we want to narrow then widen must only be used by the G_AND
- The G_TRUNC + G_ZEXT must be free
- Performing the operation at a narrower width must not produce a different
  value than performing it at the original width *after masking.*

Example comparison between SDAG + GISel: https://godbolt.org/z/63jzb1Yvj

At -Os for AArch64, this is a 0.2% code size improvement on CTMark/pairlocalign.

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

2 years agoGlobalISel: Add helper function for getting EVT from LLT
Matt Arsenault [Sat, 31 Jul 2021 16:05:33 +0000 (12:05 -0400)]
GlobalISel: Add helper function for getting EVT from LLT

This can only give an imperfect approximation, but is enough to avoid
crashing in places where we call into EVT functions starting from LLTs.

2 years ago[RISCV] Support RISCVISD::SELECT_CC in ComputeNumSignBitsForTargetNode.
Craig Topper [Sat, 14 Aug 2021 00:39:52 +0000 (17:39 -0700)]
[RISCV] Support RISCVISD::SELECT_CC in ComputeNumSignBitsForTargetNode.

2 years agoAMDGPU: Stop attributor adding attributes to intrinsic declarations
Matt Arsenault [Thu, 12 Aug 2021 19:19:54 +0000 (15:19 -0400)]
AMDGPU: Stop attributor adding attributes to intrinsic declarations

2 years agoAMDGPU: Add indirect and extern calls to attributor test
Matt Arsenault [Wed, 11 Aug 2021 23:01:30 +0000 (19:01 -0400)]
AMDGPU: Add indirect and extern calls to attributor test

2 years agoAMDGPU: Respect compute ABI attributes with unknown OS
Matt Arsenault [Fri, 13 Aug 2021 13:20:17 +0000 (09:20 -0400)]
AMDGPU: Respect compute ABI attributes with unknown OS

Unfortunately Mesa is still using amdgcn-- as the triple for OpenGL,
so we still have the awkward unknown OS case to deal with. Previously
if the HSA ABI intrinsics appeared, we we would not add the ABI
registers to the function. We would emit an error later, but we still
need to produce some compile result. Start adding the registers to any
compute function, regardless of the OS. This keeps the internal state
more consistent, and will help avoid numerous test crashes in a future
patch which starts assuming the ABI inputs are present on functions by
default.

2 years ago[NFC] One more AttributeList::getAttribute(FunctionIndex) -> getFnAttr()
Arthur Eubanks [Fri, 13 Aug 2021 23:56:42 +0000 (16:56 -0700)]
[NFC] One more AttributeList::getAttribute(FunctionIndex) -> getFnAttr()

2 years ago[CallPromotion] Check for inalloca/byval mismatch
Arthur Eubanks [Sat, 7 Aug 2021 07:28:19 +0000 (00:28 -0700)]
[CallPromotion] Check for inalloca/byval mismatch

Previously we would allow promotion even if the byval/inalloca
attributes on the call and the callee didn't match.

It's ok if the byval/inalloca types aren't the same. For example, LTO
importing may rename types.

Fixes PR51397.

Reviewed By: rnk

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

2 years ago[NFC] One more AttributeList::getAttribute(FunctionIndex) -> getFnAttr()
Arthur Eubanks [Fri, 13 Aug 2021 23:49:05 +0000 (16:49 -0700)]
[NFC] One more AttributeList::getAttribute(FunctionIndex) -> getFnAttr()

2 years ago[NFC] Make AttributeList::hasAttribute(AttributeList::ReturnIndex) its own method
Arthur Eubanks [Fri, 13 Aug 2021 21:35:48 +0000 (14:35 -0700)]
[NFC] Make AttributeList::hasAttribute(AttributeList::ReturnIndex) its own method

AttributeList::hasAttribute() is confusing. In an attempt to change the
name to something that suggests using other methods, fix up some
existing uses.

2 years ago[NFC] Cleanup calls to AttributeList::getAttribute(FunctionIndex)
Arthur Eubanks [Fri, 13 Aug 2021 21:16:44 +0000 (14:16 -0700)]
[NFC] Cleanup calls to AttributeList::getAttribute(FunctionIndex)

getAttribute() is confusing, use a clearer method.

2 years ago[libcxx][ranges] Move `namespace views` into `namespace ranges` and add an alias.
zoecarver [Fri, 13 Aug 2021 18:36:55 +0000 (11:36 -0700)]
[libcxx][ranges] Move `namespace views` into `namespace ranges` and add an alias.

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

2 years ago[lldb] skip host build for lldb_tblgen with LLDB_TABLEGEN_EXE set
Manoj Gupta [Fri, 13 Aug 2021 20:25:14 +0000 (13:25 -0700)]
[lldb] skip host build for lldb_tblgen with LLDB_TABLEGEN_EXE set

When cross compiling lldb-server, do not create a host build
for building lldb-tblgeb when LLDB_TABLEGEN_EXE is already
provided. This avoids an expensive and time-consuming build step
if lldb-tblgen was already built previously for host.

Reviewed By: JDevlieghere

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

2 years ago[x86] add tests for fcmps with logic ops; NFC
Sanjay Patel [Fri, 13 Aug 2021 21:03:22 +0000 (17:03 -0400)]
[x86] add tests for fcmps with logic ops; NFC

2 years ago[mlir] Add support for moving reductions to outer most dimensions in vector.multi_red...
harsh-nod [Fri, 13 Aug 2021 19:54:30 +0000 (12:54 -0700)]
[mlir] Add support for moving reductions to outer most dimensions in vector.multi_reduction

The approach for handling reductions in the outer most
dimension follows that for inner most dimensions, outlined
below

First, transpose to move reduction dims, if needed
Convert reduction from n-d to 2-d canonical form
Then, for outer reductions, we emit the appropriate op
(add/mul/min/max/or/and/xor) and combine the results.

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

2 years ago[NFC] Cleanup callers of AttributeList::hasAttributes()
Arthur Eubanks [Fri, 13 Aug 2021 19:07:05 +0000 (12:07 -0700)]
[NFC] Cleanup callers of AttributeList::hasAttributes()

AttributeList::hasAttributes() is confusing, use clearer methods like
hasFnAttrs().

2 years ago[NFC] Clean up users of AttributeList::hasAttribute()
Arthur Eubanks [Fri, 13 Aug 2021 18:59:18 +0000 (11:59 -0700)]
[NFC] Clean up users of AttributeList::hasAttribute()

AttributeList::hasAttribute() is confusing, use clearer methods like
hasParamAttr()/hasRetAttr().

Add hasRetAttr() since it was missing from AttributeList.

2 years ago[NFC] Remove public uses of AttributeList::getAttributes()
Arthur Eubanks [Fri, 13 Aug 2021 18:37:26 +0000 (11:37 -0700)]
[NFC] Remove public uses of AttributeList::getAttributes()

Use methods that better convey the intent.

2 years ago[gn build] Port df324bba5c4c
LLVM GN Syncbot [Fri, 13 Aug 2021 18:34:09 +0000 (18:34 +0000)]
[gn build] Port df324bba5c4c

2 years ago[gn build] Port 7b20e05c714e
LLVM GN Syncbot [Fri, 13 Aug 2021 18:34:09 +0000 (18:34 +0000)]
[gn build] Port 7b20e05c714e

2 years ago[libcxx][ranges] Add `ranges::join_view`.
zoecarver [Fri, 6 Aug 2021 22:33:46 +0000 (15:33 -0700)]
[libcxx][ranges] Add `ranges::join_view`.

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

2 years ago[libcxx][ranges] Add `ranges::iota_view`.
zoecarver [Tue, 3 Aug 2021 20:05:20 +0000 (13:05 -0700)]
[libcxx][ranges] Add `ranges::iota_view`.

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

2 years agoAdd missed rename of getFnAttributes() -> getFnAttrs()
Arthur Eubanks [Fri, 13 Aug 2021 18:29:20 +0000 (11:29 -0700)]
Add missed rename of getFnAttributes() -> getFnAttrs()

2 years ago[NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes()
Arthur Eubanks [Fri, 13 Aug 2021 18:16:52 +0000 (11:16 -0700)]
[NFC] Rename AttributeList::getParam/Ret/FnAttributes() -> get*Attributes()

This is more consistent with similar methods.

2 years ago[NFC] Rename AttributeList::hasFnAttribute() -> hasFnAttr()
Arthur Eubanks [Fri, 13 Aug 2021 18:09:18 +0000 (11:09 -0700)]
[NFC] Rename AttributeList::hasFnAttribute() -> hasFnAttr()

This is more consistent with similar methods.

2 years ago[NFC] Remove AttributeList::hasParamAttribute()
Arthur Eubanks [Fri, 13 Aug 2021 17:57:15 +0000 (10:57 -0700)]
[NFC] Remove AttributeList::hasParamAttribute()

It's the same as AttributeList::hasParamAttr().

2 years ago[Polly] Rename CodeGen -> generateCode. NFC.
Michael Kruse [Fri, 13 Aug 2021 17:39:23 +0000 (12:39 -0500)]
[Polly] Rename CodeGen -> generateCode. NFC.

To conform to function naming convention: camelCase and start with a
verb.

2 years ago[Polly] Decompose object construction and detection algorithm. NFC.
Michael Kruse [Fri, 13 Aug 2021 17:26:35 +0000 (12:26 -0500)]
[Polly] Decompose object construction and detection algorithm. NFC.

Avoid doing the detection work inside the constructor. In addition to
polymorphism being unintuitive in constructors and other design problems
such as if an exception is thrown, the ScopDetection class is usable
without detection in the sense of "no Scop found" or "function skipped".

2 years ago[PowerPC] Disable CTR Loop generate for fma with the PPC double double type.
Amy Kwan [Fri, 13 Aug 2021 16:22:38 +0000 (11:22 -0500)]
[PowerPC] Disable CTR Loop generate for fma with the PPC double double type.

It is possible to generate the llvm.fmuladd.ppcf128 intrinsic, and there is no actual
FMA instruction that corresponds to this intrinsic call for ppcf128. Thus, this
intrinsic needs to remain as a call as it cannot be lowered to any instruction, which
also means we need to disable CTR loop generation for fma involving the ppcf128 type.
This patch accomplishes this behaviour.

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

2 years ago[IFS] Fix the copy constructor warning in IFSStub.cpp
Haowei Wu [Thu, 12 Aug 2021 21:33:47 +0000 (14:33 -0700)]
[IFS] Fix the copy constructor warning in IFSStub.cpp

This change fixes the gcc warning on copy constructor in IFSStub.cpp
file.

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

2 years ago[Flang] Fix for CI failure, Remove default case
Kiran Chandramohan [Fri, 13 Aug 2021 17:05:35 +0000 (18:05 +0100)]
[Flang] Fix for CI failure, Remove default case

Remove default case when all the enum values are covered in switch
statements.

2 years ago[sanitizer_common] disable format errors.
Florian Mayer [Fri, 13 Aug 2021 15:24:11 +0000 (16:24 +0100)]
[sanitizer_common] disable format errors.

This broke https://lab.llvm.org/buildbot/#/builders/37/builds/6061/steps/32/logs/stdio

Reviewed By: dvyukov

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

2 years ago[Clang] Add an explicit makeArrayRef to appease gcc 5.4.
Craig Topper [Fri, 13 Aug 2021 16:42:06 +0000 (09:42 -0700)]
[Clang] Add an explicit makeArrayRef to appease gcc 5.4.

2 years ago[X86] Add parentheses around casts in some of the X86 intrinsic headers.
Craig Topper [Fri, 13 Aug 2021 16:22:43 +0000 (09:22 -0700)]
[X86] Add parentheses around casts in some of the X86 intrinsic headers.

This covers the SSE and AVX/AVX2 headers. AVX512 has a lot more macros
due to rounding mode.

Fixes part of PR51324.

Reviewed By: pengfei

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

2 years ago[AsmWriter][NFC] Simplify writeDIGenericSubrange
Alfonso Gregory [Fri, 13 Aug 2021 16:31:13 +0000 (09:31 -0700)]
[AsmWriter][NFC] Simplify writeDIGenericSubrange

Reviewed By: MaskRay

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

2 years ago[AArch64][GlobalISel] Legalize scalar G_SSUBSAT + G_SADDSAT
Jessica Paquette [Mon, 9 Aug 2021 18:41:52 +0000 (11:41 -0700)]
[AArch64][GlobalISel] Legalize scalar G_SSUBSAT + G_SADDSAT

These are lowered, matching SDAG behaviour. (See
llvm/test/CodeGen/AArch64/ssub_sat.ll and llvm/test/CodeGen/AArch64/sadd_sat.ll)

These fall back ~159 times on a build of clang with GISel enabled.

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

2 years ago[MLIR][Linalg] Fix typo
Lorenzo Chelini [Fri, 13 Aug 2021 16:00:14 +0000 (18:00 +0200)]
[MLIR][Linalg] Fix typo

2 years agotsan/dd: fix format strings
Dmitry Vyukov [Fri, 13 Aug 2021 15:16:27 +0000 (17:16 +0200)]
tsan/dd: fix format strings

Reviewed By: melver

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

2 years agoRevert "[clang-format] Distinguish K&R C function definition and attribute"
David Spickett [Fri, 13 Aug 2021 15:25:32 +0000 (16:25 +0100)]
Revert "[clang-format] Distinguish K&R C function definition and attribute"

This reverts commit de763c4037157e60551ba227ccd0ed02e109c317.

Causing test failures on the Arm/AArch64 quick bots:
https://lab.llvm.org/buildbot/#/builders/188/builds/2202

2 years agoFix bad assert in print-changed code
Jamie Schmeiser [Fri, 13 Aug 2021 14:53:24 +0000 (10:53 -0400)]
Fix bad assert in print-changed code

Summary:
The assertion that both functions were not missing was incorrect and would
fail when one of the functions was missing. Fixed it and moved the
assertion earlier to check the input parameters to better capture
first-failure.  Added lit test.

Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: aeubanks (Arthur Eubanks)
Differential Revision: https://reviews.llvm.org/D107989

2 years agoRevert "[SCEV] Remove premature assert. PR46786"
Roman Lebedev [Fri, 13 Aug 2021 14:38:36 +0000 (17:38 +0300)]
Revert "[SCEV] Remove premature assert. PR46786"

Since then, the SCEV pointer handling as been improved,
so the assertion should now hold.

This reverts commit b96114c1e1fc4448ea966bce013706359aee3fa9,
relanding the assertion from commit 141e845da5dda6743a09f858b4aec0133a931453.

2 years ago[flang][OpenMP] Add semantic check for teams nesting
Peixin Qiao [Fri, 13 Aug 2021 14:20:38 +0000 (10:20 -0400)]
[flang][OpenMP] Add semantic check for teams nesting

This patch implements the following check for TEAMS construct:
```
OpenMP Version 5.0 Teams construct restriction: A teams region can
only be strictly nested within the implicit parallel region or a target
region. If a teams construct is nested within a target construct, that
target construct must contain no statements, declarations or directives
outside of the teams construct.
```

Also add one test case for the check.

Reviewed By: kiranchandramohan, clementval

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

2 years agotsan: fix latent bug in shadow computation
Dmitry Vyukov [Fri, 13 Aug 2021 13:24:23 +0000 (15:24 +0200)]
tsan: fix latent bug in shadow computation

We use kShadowCnt (number of shadow cells per application granule)
when computing shadow, but it's wrong. We need the ratio
between shadow and app memory (how much shadow is larger than app memory),
which is kShadowMultiplier.
Currently both are equal to 4, so it works fine.
Use the correct constant.

Reviewed By: melver

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

2 years ago[analyzer][NFC] Make test/Analysis/self-assign.cpp readable
Kristóf Umann [Fri, 13 Aug 2021 13:46:32 +0000 (15:46 +0200)]
[analyzer][NFC] Make test/Analysis/self-assign.cpp readable

2 years ago[flang][OpenMP] Add semantic checks for cancellation nesting
Peixin Qiao [Fri, 13 Aug 2021 12:19:01 +0000 (08:19 -0400)]
[flang][OpenMP] Add semantic checks for cancellation nesting

This patch implements the following semantic checks for cancellation constructs:
```
OpenMP Version 5.0 Section 2.18.1: CANCEL construct restriction:
If construct-type-clause is taskgroup, the cancel construct must be
closely nested inside a task or a taskloop construct and the cancel
region must be closely nested inside a taskgroup region. If
construct-type-clause is sections, the cancel construct must be closely
nested inside a sections or section construct. Otherwise, the cancel
construct must be closely nested inside an OpenMP construct that matches
the type specified in construct-type-clause of the cancel construct.

OpenMP Version 5.0 Section 2.18.2: CANCELLATION POINT restriction:
A cancellation point construct for which construct-type-clause is
taskgroup must be closely nested inside a task or taskloop construct,
and the cancellation point region must be closely nested inside a
taskgroup region. A cancellation point construct for which
construct-type-clause is sections must be closely nested inside a
sections or section construct. A cancellation point construct for which
construct-type-clause is neither sections nor taskgroup must be closely
nested inside an OpenMP construct that matches the type specified in
construct-type-clause.
```

Also add test cases for the check.

Reviewed By: kiranchandramohan

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

2 years ago[NFC] Drop idle compiler option from the test.
Alexey Bader [Fri, 13 Aug 2021 06:04:09 +0000 (09:04 +0300)]
[NFC] Drop idle compiler option from the test.

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

2 years ago[OpenCL] Clang diagnostics allow reporting C++ for OpenCL version.
Justas Janickas [Fri, 6 Aug 2021 12:50:13 +0000 (13:50 +0100)]
[OpenCL] Clang diagnostics allow reporting C++ for OpenCL version.

Some Clang diagnostics could only report OpenCL C version. Because
C++ for OpenCL can be used as an alternative to OpenCL C, the text
for diagnostics should reflect that.

Desrciptions modified for these diagnostics:
`err_opencl_unknown_type_specifier`
`warn_option_invalid_ocl_version`
`err_attribute_requires_opencl_version`
`warn_opencl_attr_deprecated_ignored`
`ext_opencl_ext_vector_type_rgba_selector`

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

2 years agoReland "[NFCI][SimplifyCFG] simplifyCondBranch(): assert that branch is non-tautologi...
Roman Lebedev [Fri, 13 Aug 2021 12:08:10 +0000 (15:08 +0300)]
Reland "[NFCI][SimplifyCFG] simplifyCondBranch(): assert that branch is non-tautological""

The commit originally unearthed a problem, reported as
https://reviews.llvm.org/rGf30a7dff8a5b32919951dcbf92e4a9d56c4679ff#1019890
Now that the problem has been fixed, and the assertion no longer fires,
let's see if there are other cases it fires on.

This reverts commit 5c8c24d2decae4a76047777271d60411fc3316eb,
relanding commit f30a7dff8a5b32919951dcbf92e4a9d56c4679ff.

2 years ago[SimplifyCFG] Restart if `removeUndefIntroducingPredecessor()` made changes
Roman Lebedev [Fri, 13 Aug 2021 12:35:01 +0000 (15:35 +0300)]
[SimplifyCFG] Restart if `removeUndefIntroducingPredecessor()` made changes

It might changed the condition of a branch into a constant,
so we should restart and constant-fold terminator,
instead of continuing with the tautological "conditional" branch.
This fixes the issue reported at https://reviews.llvm.org/rGf30a7dff8a5b32919951dcbf92e4a9d56c4679ff

2 years ago[NFC][SimplifyCFG] Add test for failed assertion
Roman Lebedev [Fri, 13 Aug 2021 12:08:00 +0000 (15:08 +0300)]
[NFC][SimplifyCFG] Add test for failed assertion

This would trigger an assertion that was added in rGf30a7dff8a5b.
Need to fix that before relanding.

Reduced from https://reviews.llvm.org/rGf30a7dff8a5b#1019890