platform/upstream/llvm.git
4 years ago[SVE] Fix inline assembly parsing crash
David Sherwood [Fri, 18 Dec 2020 13:06:16 +0000 (13:06 +0000)]
[SVE] Fix inline assembly parsing crash

This patch fixes a crash encountered when compiling this code:

  ...
  float16_t a;
  __asm__("fminv %h[a], %[b], %[c].h"
          : [a] "=r" (a)
          : [b] "Upl" (b), [c] "w" (c))

The issue here is when using the 'h' modifier for a register
constraint 'r'.

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

4 years ago[RISCV] Remove unused method isUImm5NonZero() from RISCVAsmParser.cpp. NFC
Craig Topper [Mon, 4 Jan 2021 08:14:35 +0000 (00:14 -0800)]
[RISCV] Remove unused method isUImm5NonZero() from RISCVAsmParser.cpp. NFC

The operand predicate that used this has been gone for a while.

4 years ago[benchmark] Fixed a build error when using CMake 3.15.1 + NDK-R20
AnZhong Huang [Mon, 4 Jan 2021 08:00:19 +0000 (11:00 +0300)]
[benchmark] Fixed a build error when using CMake 3.15.1 + NDK-R20

std::decay_t used by llvm/utils/benchmark/include/benchmark/benchmark.h is a c++14 feature, but the CMakelist uses c++11, it's the root-cause of build error.

    There are two options to fix the error.
    1) change the CMakelist to support c++14.
    2) change std::decay_t to std::decay, it's what the patch done.

    This bug can only be reproduced by CMake 3.15, we didn't observer the bug with CMake 3.16. But based on the code's logic, it's an obvious bug of LLVM.

Reviewed By: lebedev.ri

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

4 years ago[PowerPC] Do not fold `cmp(d|w)` and `subf` instruction to `subf.` if `nsw` is not...
Kai Luo [Tue, 29 Dec 2020 13:23:17 +0000 (13:23 +0000)]
[PowerPC] Do not fold `cmp(d|w)` and `subf` instruction to `subf.` if `nsw` is not present

In `PPCInstrInfo::optimizeCompareInstr` we seek opportunities to fold `cmp(d|w)` and `subf` as an `subf.`. However, if `subf.` gets overflow, `cr0` can't reflect the correct order, violating the semantics of `cmp(d|w)`.

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

Reviewed By: #powerpc, nemanjai

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

4 years ago[IROutliner] Refactoring errors in the cost model from past patches.
Andrew Litteken [Mon, 4 Jan 2021 05:44:20 +0000 (23:44 -0600)]
[IROutliner] Refactoring errors in the cost model from past patches.

There were was the reuse of a variable that should not have been
occurred due to confusion during committing patches.

4 years ago[IROutliner] Removing a duplicate addition, causing overestimates in IROutliner.
Andrew Litteken [Mon, 4 Jan 2021 04:51:15 +0000 (22:51 -0600)]
[IROutliner] Removing a duplicate addition, causing overestimates in IROutliner.

There was an extra addition left over from a previous commit for the
cost model, this removes it.

4 years ago[Flang][openmp][5.0] Add task_reduction clause.
sameeran joshi [Mon, 4 Jan 2021 03:17:02 +0000 (08:47 +0530)]
[Flang][openmp][5.0] Add task_reduction clause.

See OMP-5.0 2.19.5.5 task_reduction Clause.
To add a positive test case we need `taskgroup` directive which is not added hence skipping the test.
This is a dependency for `taskgroup` construct.

Reviewed By: clementval

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

Co-authored-by: Valentin Clement <clementval@gmail.com>
4 years ago[compiler-rt] [Sanitizers] Extend ThreadDescriptorSize() for glibc-2.32-2.fc33.x86_64...
Jan Kratochvil [Mon, 4 Jan 2021 02:21:04 +0000 (03:21 +0100)]
[compiler-rt] [Sanitizers] Extend ThreadDescriptorSize() for glibc-2.32-2.fc33.x86_64+i686

before:
  $ echo 'int main(){}'|clang -g -fsanitize=leak -x c++ -;./a.out
  Tracer caught signal 11: addr=0x7f4f73da5f40 pc=0x4222c8 sp=0x7f4f72cffd40
  ==1164171==LeakSanitizer has encountered a fatal error.
  ==1164171==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
  ==1164171==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)
  $ _

after:
  $ echo 'int main(){}'|clang -g -fsanitize=leak -x c++ -;./a.out)
  $ _

I haven't verified the size cannot be affected by Fedora patches of
upstream glibc-2.32 - but I do not expect upstream glibc-2.32 would have
the last sizes `(1216, 2304)` from 2013 around glibc-2.12.

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

4 years ago[clang-tidy] Fix windows tests
Nathan James [Mon, 4 Jan 2021 00:39:33 +0000 (00:39 +0000)]
[clang-tidy] Fix windows tests

Attempt to fix the 2 failing tests identifier in 48646.
Appears that python3 doesn't like nested double quotes in single quoted strings, hopefully nested single quotes in double quoted strings is a-ok.

Reviewed By: thakis

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

4 years ago[NFC][SimplifyCFG] Hoist 'original' DomTree verification from simplifyOnce() into...
Roman Lebedev [Sun, 3 Jan 2021 18:53:11 +0000 (21:53 +0300)]
[NFC][SimplifyCFG] Hoist 'original' DomTree verification from simplifyOnce() into run()

This is NFC since SimplifyCFG still currently defaults to not preserving DomTree.

SimplifyCFGOpt::simplifyOnce() is only be called from SimplifyCFGOpt::run(),
and can not be called externally, since SimplifyCFGOpt is defined in .cpp
This avoids some needless verifications, and is thus a bit faster
without sacrificing precision.

4 years ago[SimplifyCFG] SimplifyTerminatorOnSelect(): fix/tune DomTree updates
Roman Lebedev [Sun, 3 Jan 2021 18:17:11 +0000 (21:17 +0300)]
[SimplifyCFG] SimplifyTerminatorOnSelect(): fix/tune DomTree updates

We only need to remove non-TrueBB/non-FalseBB successors,
and we only need to do that once. We don't need to insert
any new edges, because no new successors will be added.

4 years ago[NFC][SimplifyCFG] SimplifyTerminatorOnSelect(): pull out OldTerm->getParent() into...
Roman Lebedev [Sun, 3 Jan 2021 18:14:41 +0000 (21:14 +0300)]
[NFC][SimplifyCFG] SimplifyTerminatorOnSelect(): pull out OldTerm->getParent() into a variable

4 years ago[NFC][SimplifyCFG] Add a test where we fail to preserve DomTree validity
Roman Lebedev [Sun, 3 Jan 2021 17:29:24 +0000 (20:29 +0300)]
[NFC][SimplifyCFG] Add a test where we fail to preserve DomTree validity

4 years ago[InstSimplify] Fold nnan/ninf violation to poison
Nikita Popov [Sun, 3 Jan 2021 21:03:53 +0000 (22:03 +0100)]
[InstSimplify] Fold nnan/ninf violation to poison

As the comment already indicates, performing an operation with
nnan/ninf flags on a nan/inf or undef results in poison. Now that
we have a proper poison value, we no longer need to relax it to
undef.

4 years ago[LoopUnswitch] Precommit initial partial unswitching test cases.
Florian Hahn [Sun, 3 Jan 2021 20:27:17 +0000 (20:27 +0000)]
[LoopUnswitch] Precommit initial partial unswitching test cases.

4 years ago[InstSimplify] Fold division by zero to poison
Nikita Popov [Sun, 3 Jan 2021 17:19:37 +0000 (18:19 +0100)]
[InstSimplify] Fold division by zero to poison

Div/rem by zero is immediate undefined behavior and anything goes.
Currently we fold it to undef, this patch changes it to fold to
poison instead, which is slightly stronger.

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

4 years ago[llvm] Call *(Set|Map)::erase directly (NFC)
Kazu Hirata [Sun, 3 Jan 2021 17:57:47 +0000 (09:57 -0800)]
[llvm] Call *(Set|Map)::erase directly (NFC)

We can erase an item in a set or map without checking its membership
first.

4 years ago[Target] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Sun, 3 Jan 2021 17:57:45 +0000 (09:57 -0800)]
[Target] Construct SmallVector with iterator ranges (NFC)

4 years ago[Target] Use llvm::append_range (NFC)
Kazu Hirata [Sun, 3 Jan 2021 17:57:43 +0000 (09:57 -0800)]
[Target] Use llvm::append_range (NFC)

4 years ago[InstSimplify] Fix addo/subo with undef (PR43188)
Nikita Popov [Sun, 3 Jan 2021 17:51:49 +0000 (18:51 +0100)]
[InstSimplify] Fix addo/subo with undef (PR43188)

We can't fold the first result to undef, because not all values
may be reachable under the constraint that no overflow occurred.
Use the same folds we do for saturated math instead.

Proofs:
uaddo: https://alive2.llvm.org/ce/z/zf55N_
saddo: https://alive2.llvm.org/ce/z/a_xPgS
usubo: https://alive2.llvm.org/ce/z/DmRqwt
ssubo: https://alive2.llvm.org/ce/z/8ag7U-

4 years ago[InstSimplify] Return poison for out of bounds extractelement
Nikita Popov [Sun, 3 Jan 2021 17:05:33 +0000 (18:05 +0100)]
[InstSimplify] Return poison for out of bounds extractelement

This is the same change as D93990, but for extractelement rather
than insertelement.

> If idx exceeds the length of val for a fixed-length vector, the
> result is a poison value. For a scalable vector, if the value of
> idx exceeds the runtime length of the vector, the result is a
> poison value.

4 years ago[X86] Make deinterleave8bitStride3 use unary CreateShuffleVector
Juneyoung Lee [Sun, 3 Jan 2021 16:09:48 +0000 (01:09 +0900)]
[X86] Make deinterleave8bitStride3 use unary CreateShuffleVector

This patch makes X86InterleavedAccessGroup::deinterleave8bitStride3 use the unary CreateShuffleVector.

This is a continuation of D93923. There were a few missing replacements.

IIUC, this patch does not cause change in the generated programs' semantics because the
function inserts shufflevectors that only choose elements from the first vector.

Reviewed By: nikic

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

4 years ago[InstSimplify] Regenerate test checks (NFC)
Nikita Popov [Sun, 3 Jan 2021 17:09:58 +0000 (18:09 +0100)]
[InstSimplify] Regenerate test checks (NFC)

4 years ago[InstSimplify] Return poison if insertelement touches out of bounds
Juneyoung Lee [Sun, 3 Jan 2021 15:05:08 +0000 (00:05 +0900)]
[InstSimplify] Return poison if insertelement touches out of bounds

This is a simple patch that updates InstSimplify to return poison if the index is/can be out-of-bounds

Reviewed By: nikic

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

4 years ago[ArgPromotion] Add test with dead GEP when promoting.
Florian Hahn [Sun, 3 Jan 2021 15:22:46 +0000 (15:22 +0000)]
[ArgPromotion] Add test with dead GEP when promoting.

This adds test coverage for the case where we do argument promotion and
there's a dead GEP that should be removed/ignored.

4 years ago[Scalarizer] Use poison as insertelement's placeholder
Juneyoung Lee [Sun, 3 Jan 2021 14:08:01 +0000 (23:08 +0900)]
[Scalarizer] Use poison as insertelement's placeholder

This patch makes Scalarizer to use poison as insertelement's placeholder.

It contains two changes in Scalarizer.cpp, and the both changes does not change the semantics of the optimized program.
It is because the placeholder value (poison) is already completely hidden by following insertelement instructions.

The first change at visitBitCastInst() creates poison vector of MidTy and consecutively inserts FanIn times,
which is # of elems of MidTy.
The second change at ScalarizerVisitor::finish() creates poison with Op->getType(), and it is filled with
Count insertelements.

The test diffs show that the poison value is never exposed after insertelements.

Reviewed By: nikic

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

4 years agoUpdate *-inseltpoison.ll tests at Transforms/InstCombine/X86 by replacing undef with...
Juneyoung Lee [Sun, 3 Jan 2021 13:40:04 +0000 (22:40 +0900)]
Update *-inseltpoison.ll tests at Transforms/InstCombine/X86 by replacing undef with poison (NFC)

4 years ago[SCEV] Simplify trunc to zero based on known bits
Gil Rapaport [Wed, 30 Dec 2020 21:11:20 +0000 (23:11 +0200)]
[SCEV] Simplify trunc to zero based on known bits

Let getTruncateExpr() short-circuit to zero when the value being truncated is
known to have at least as many trailing zeros as the target type.

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

4 years ago[dsymutil][DWARFLinker][NFC] Refactor usages of UniquingStringPool.
Alexey Lapshin [Wed, 16 Dec 2020 13:34:12 +0000 (16:34 +0300)]
[dsymutil][DWARFLinker][NFC] Refactor usages of UniquingStringPool.

That refactoring is helpful since it reduces data inter-dependencies.
Which is good for current implementation and even more good for
fully multi-thread implementation. The idea of the refactoring
is to delete UniquingStringPool from the global DWARFLinker level.
It is used to unique type names while ODR deduplication is done.
Thus we move UniquingStringPool into the DeclContextTree which
matched to UniquingStringPool usage scope.

golden-dsymutil/dsymutil 23787992
clang MD5: 7d9873ff94f0246b6ab1ec3e8d0f3f06

build-Release/bin/dsymutil 23921272
clang MD5: 7d9873ff94f0246b6ab1ec3e8d0f3f06

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

4 years agoRevert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detectio...
Nico Weber [Sat, 2 Jan 2021 23:54:37 +0000 (18:54 -0500)]
Revert "[sanitizer] Define SANITIZER_GLIBC to refine SANITIZER_LINUX feature detection and support musl"

...and follow-ups. It still doesn't build on Android, see https://reviews.llvm.org/D93848#2476310

This reverts commit a92d01534f1c4fb79210975573e774d0393f2533.
This reverts commit 52d7e183bf25ea38e1149e39e19d21e6212e701f.
This reverts commit 34489da81b39972b40d2ff5581fe48911339406e.

4 years ago[RuntimeDyld] Fix dangling reference in RuntimeDyldELF.
Lang Hames [Thu, 31 Dec 2020 03:20:53 +0000 (14:20 +1100)]
[RuntimeDyld] Fix dangling reference in RuntimeDyldELF.

Patch by Moritz Sichert. Thanks Moritz!

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

4 years ago[gn build] Port 5799fc79c3f
LLVM GN Syncbot [Sat, 2 Jan 2021 22:46:43 +0000 (22:46 +0000)]
[gn build] Port 5799fc79c3f

4 years ago[SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservati...
Roman Lebedev [Sat, 2 Jan 2021 22:26:42 +0000 (01:26 +0300)]
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation, take 2

4 years ago[NFC][SimplifyCFG] Add another test for switch creation where we fail to maintain...
Roman Lebedev [Sat, 2 Jan 2021 21:45:53 +0000 (00:45 +0300)]
[NFC][SimplifyCFG] Add another test for switch creation where we fail to maintain DomTree

4 years ago[SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation
Roman Lebedev [Sat, 2 Jan 2021 18:27:19 +0000 (21:27 +0300)]
[SimplifyCFG] FoldValueComparisonIntoPredecessors(): fine-tune/fix DomTree preservation

4 years ago[NFC][SimplifyCFG] Add test for switch creation where we fail to maintain DomTree
Roman Lebedev [Sat, 2 Jan 2021 17:11:48 +0000 (20:11 +0300)]
[NFC][SimplifyCFG] Add test for switch creation where we fail to maintain DomTree

Reduced from vanilla test-suite

4 years ago[llvm-reduce] Refactor global variable delta pass
Roman Lebedev [Sat, 2 Jan 2021 16:56:27 +0000 (19:56 +0300)]
[llvm-reduce] Refactor global variable delta pass

The limitation of the current pass that it skips initializer-less GV's
seems arbitrary, in all the reduced cases i (personally) looked at,
the globals weren't needed, yet they were kept.

So let's do two things:
1. allow reducing initializer-less globals
2. before reducing globals, reduce their initializers, much like we do function bodies

4 years ago[llvm-reduce] Fix removal of unused llvm intrinsics declarations
Roman Lebedev [Sat, 2 Jan 2021 16:29:01 +0000 (19:29 +0300)]
[llvm-reduce] Fix removal of unused llvm intrinsics declarations

ee6e25e4391a6d3ac0a3c89615474e512f44cda6 changed
the delta pass to skip intrinsics, which means we may end up being
left with declarations of intrinsics, that aren't otherwise referenced
in the module. This is obviously unwanted, do drop them.

4 years ago[SimplifyCFG][AMDGPU] AMDGPUUnifyDivergentExitNodes: SimplifyCFG isn't ready to prese...
Roman Lebedev [Sat, 2 Jan 2021 18:58:48 +0000 (21:58 +0300)]
[SimplifyCFG][AMDGPU] AMDGPUUnifyDivergentExitNodes: SimplifyCFG isn't ready to preserve PostDomTree

There is a number of transforms in SimplifyCFG that take DomTree out of
DomTreeUpdater, and do updates manually. Until they are fixed,
user passes are unable to claim that PDT is preserved.

Note that the default for SimplifyCFG is still not to preserve DomTree,
so this is still effectively NFC.

4 years agoMoving UniqueInternalLinkageNamesPass to the start of IR pipelines.
Hongtao Yu [Sat, 2 Jan 2021 07:05:43 +0000 (23:05 -0800)]
Moving UniqueInternalLinkageNamesPass to the start of IR pipelines.

`UniqueInternalLinkageNamesPass` is useful to CSSPGO, especially when pseudo probe is used. It solves naming conflict for static functions which otherwise will share a merged profile and likely have a profile quality issue with mismatched CFG checksums. Since the pseudo probe instrumentation happens very early in the pipeline, I'm moving `UniqueInternalLinkageNamesPass` right before it. This is being done only to the new pass manager.

Reviewed By: dblaikie, aeubanks

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

4 years ago[NFC] Switch up some dyn_cast calls
Nathan James [Sat, 2 Jan 2021 19:56:27 +0000 (19:56 +0000)]
[NFC] Switch up some dyn_cast calls

4 years ago[PowerPC] NFC: Apply minor clang-format fix
Brandon Bergren [Sat, 2 Jan 2021 18:21:28 +0000 (12:21 -0600)]
[PowerPC] NFC: Apply minor clang-format fix

4 years ago[PowerPC] Enable OpenMP for powerpcle target. [5/5]
Brandon Bergren [Sat, 2 Jan 2021 18:18:07 +0000 (12:18 -0600)]
[PowerPC] Enable OpenMP for powerpcle target. [5/5]

Enable OpenMP for powerpcle to match the rest of powerpc*.

Update tests.

Reviewed By: MaskRay

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

4 years ago[PowerPC] Support powerpcle target in LLD [4/5]
Brandon Bergren [Sat, 2 Jan 2021 18:18:05 +0000 (12:18 -0600)]
[PowerPC] Support powerpcle target in LLD [4/5]

Add support for linking powerpcle code in LLD.

Rewrite lld/test/ELF/emulation-ppc.s to use a shared check block and add powerpcle tests.

Update tests.

Reviewed By: MaskRay

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

4 years ago[PowerPC] Support powerpcle target in Clang [3/5]
Brandon Bergren [Sat, 2 Jan 2021 18:17:58 +0000 (12:17 -0600)]
[PowerPC] Support powerpcle target in Clang [3/5]

Add powerpcle support to clang.

For FreeBSD, assume a freestanding environment for now, as we only need it in the first place to build loader, which runs in the OpenFirmware environment instead of the FreeBSD environment.

For Linux, recognize glibc and musl environments to match current usage in Void Linux PPC.

Adjust driver to match current binutils behavior regarding machine naming.

Adjust and expand tests.

Reviewed By: MaskRay

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

4 years ago[PowerPC] Support powerpcle target in LLVMObject [2/5]
Brandon Bergren [Sat, 2 Jan 2021 18:17:39 +0000 (12:17 -0600)]
[PowerPC] Support powerpcle target in LLVMObject [2/5]

Add object file handling for powerpcle-*-*.

Adjust tests.

Reviewed By: MaskRay

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

4 years ago[PowerPC] Add the LLVM triple for powerpcle [1/5]
Brandon Bergren [Sat, 2 Jan 2021 18:17:22 +0000 (12:17 -0600)]
[PowerPC] Add the LLVM triple for powerpcle [1/5]

Add a triple for powerpcle-*-*.

This is a little-endian encoding of the 32-bit PowerPC ABI, useful in certain niche situations:

1) A loader such as the FreeBSD loader which will be loading a little endian kernel. This is required for PowerPC64LE to load properly in pseries VMs.
Such a loader is implemented as a freestanding ELF32 LSB binary.

2) Userspace emulation of a 32-bit LE architecture such as x86 on 64-bit hosts such as PowerPC64LE with tools like box86 requires having a 32-bit LE toolchain and library set, as they operate by translating only the main binary and switching to native code when making library calls.

3) The Void Linux for PowerPC project is experimenting with running an entire powerpcle userland.

Reviewed By: MaskRay

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

4 years ago[Process/NetBSD] Copy changes from FreeBSDRemote and reformat
Michał Górny [Fri, 18 Dec 2020 15:07:20 +0000 (16:07 +0100)]
[Process/NetBSD] Copy changes from FreeBSDRemote and reformat

Copy changes, including:

- NativeProcessNetBSD::GetLoadedModuleFileSpec()
  and NativeProcessNetBSD::GetFileLoadAddress() methods

- split x86 register sets by CPU extensions

- use offset/size-based register reading/writing

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

4 years ago[lldb] Deduplicate more lldb-server tests
Pavel Labath [Sun, 27 Dec 2020 14:01:37 +0000 (15:01 +0100)]
[lldb] Deduplicate more lldb-server tests

Use auto-generation of lldb-server&debugserver variants.

4 years ago[lldb/test] Deduplicate the rest of TestLldbGdbServer.py
Pavel Labath [Sun, 27 Dec 2020 13:46:37 +0000 (14:46 +0100)]
[lldb/test] Deduplicate the rest of TestLldbGdbServer.py

4 years ago[Transforms] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Sat, 2 Jan 2021 17:24:16 +0000 (09:24 -0800)]
[Transforms] Construct SmallVector with iterator ranges (NFC)

4 years ago[llvm] Use llvm::erase_value and llvm::erase_if (NFC)
Kazu Hirata [Sat, 2 Jan 2021 17:24:15 +0000 (09:24 -0800)]
[llvm] Use llvm::erase_value and llvm::erase_if (NFC)

4 years ago[TableGen] Use llvm::append_range (NFC)
Kazu Hirata [Sat, 2 Jan 2021 17:24:13 +0000 (09:24 -0800)]
[TableGen] Use llvm::append_range (NFC)

4 years ago[LV] Clean up trailing whitespace (NFC).
Florian Hahn [Sat, 2 Jan 2021 12:19:52 +0000 (12:19 +0000)]
[LV] Clean up trailing whitespace (NFC).

Clean up some stray whitespace that sneaked in recently.

4 years ago[LV] Add missed optimization fold-tail test
Gil Rapaport [Sat, 2 Jan 2021 11:43:33 +0000 (13:43 +0200)]
[LV] Add missed optimization fold-tail test

The loop vectorizer avoids folding the tail for loop's whose trip-count is
known to SCEV to be divisible by VF. In this case the assumption providing this
information is not taken into account, so the tail is needlessly folded.

4 years ago[SimplifyCFG] Don't actually take DomTreeUpdater unless we intend to maintain DomTree...
Roman Lebedev [Sat, 2 Jan 2021 11:40:55 +0000 (14:40 +0300)]
[SimplifyCFG] Don't actually take DomTreeUpdater unless we intend to maintain DomTree validity

This guards against unintentional mistakes
like the one i just fixed in previous commit.

4 years ago[NFCI][CodeGen] DwarfEHPrepare: don't actually pass DTU into simplifyCFG by default
Roman Lebedev [Sat, 2 Jan 2021 11:38:52 +0000 (14:38 +0300)]
[NFCI][CodeGen] DwarfEHPrepare: don't actually pass DTU into simplifyCFG by default

also, don't verify DomTree unless we intend to maintain it.
This is a very dumb think-o, i guess i was even warned about it
by subconsciousness in 4b80647367950ba3da6a08260487fd0dbc50a9c5's
commit message..

Fixes a compile-time regression reported by Martin Storsjö
in post-commit review of 2461cdb41724298591133c811df82b0064adfa6b.

4 years agoTemporarily disable to clang-tidy tests on Windows
Nico Weber [Sat, 2 Jan 2021 04:19:48 +0000 (23:19 -0500)]
Temporarily disable to clang-tidy tests on Windows

They fail at least on my Win bot after switching it to Py3.
See PR48646 for details.

4 years agofix typos to cycle bots
Nico Weber [Sat, 2 Jan 2021 03:58:40 +0000 (22:58 -0500)]
fix typos to cycle bots

4 years agofix typo to cycle bots
Nico Weber [Sat, 2 Jan 2021 03:28:11 +0000 (22:28 -0500)]
fix typo to cycle bots

4 years ago[gn build] (manually) port 5e31e226b5: Use Py3 for the build
Nico Weber [Sat, 2 Jan 2021 03:12:58 +0000 (22:12 -0500)]
[gn build] (manually) port 5e31e226b5: Use Py3 for the build

Made necessary by 20670ba440, the first Py3-only change.

4 years ago[CodeGen][NFC] Fix a build warning due to an extra semicolon
Yang Fan [Sat, 2 Jan 2021 02:42:58 +0000 (10:42 +0800)]
[CodeGen][NFC] Fix a build warning due to an extra semicolon

4 years ago[MLIR] Fix affine_map compose with multi-symbols
Chengji Yao [Sat, 2 Jan 2021 01:25:40 +0000 (06:55 +0530)]
[MLIR] Fix affine_map compose with multi-symbols

Fix bug: https://bugs.llvm.org/show_bug.cgi?id=46845

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

4 years ago[NFC][RISCV] Move vmsge{u}.vx processing to RISCVAsmParser.
Hsiangkai Wang [Fri, 1 Jan 2021 16:29:40 +0000 (00:29 +0800)]
[NFC][RISCV] Move vmsge{u}.vx processing to RISCVAsmParser.

We could expand vmsge{u}.vx pseudo instructions in RISCVAsmParser.
It is more appropriate to expand it before encoding.

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

4 years ago[sanitizer] Enable mallopt and mallinfo interceptors on Android after D93848
Fangrui Song [Fri, 1 Jan 2021 22:43:08 +0000 (14:43 -0800)]
[sanitizer] Enable mallopt and mallinfo interceptors on Android after D93848

Reviewed By: aeubanks

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

4 years ago[compiler-rt][test] Suppress stderr of ldd output
Fangrui Song [Fri, 1 Jan 2021 22:09:13 +0000 (14:09 -0800)]
[compiler-rt][test] Suppress stderr of ldd output

4 years ago[AMDGPU][SimplifyCFG] Teach AMDGPUUnifyDivergentExitNodes to preserve {,Post}DomTree
Roman Lebedev [Fri, 1 Jan 2021 20:18:35 +0000 (23:18 +0300)]
[AMDGPU][SimplifyCFG] Teach AMDGPUUnifyDivergentExitNodes to preserve {,Post}DomTree

This is a (last big?) part of the patch series to make SimplifyCFG
preserve DomTree. Currently, it still does not actually preserve it,
even thought it is pretty much fully updated to preserve it.

Once the default is flipped, a valid DomTree must be passed into
simplifyCFG, which means that whatever pass calls simplifyCFG,
should also be smart about DomTree's.

As far as i can see from `check-llvm` with default flipped,
this is the last LLVM test batch (other than bugpoint tests)
that needed fixes to not break with default flipped.

The changes here are boringly identical to the ones i did
over 42+ times/commits recently already,
so while AMDGPU is outside of my normal ecosystem,
i'm going to go for post-commit review here,
like in all the other 42+ changes.

Note that while the pass is taught to preserve {,Post}DomTree,
it still doesn't do that by default, because simplifycfg
still doesn't do that by default, and flipping default
in this pass will implicitly flip the default for simplifycfg.
That will happen, but not right now.

4 years ago[SimplifyCFG] Teach removeUndefIntroducingPredecessor to preserve DomTree
Roman Lebedev [Fri, 1 Jan 2021 18:58:12 +0000 (21:58 +0300)]
[SimplifyCFG] Teach removeUndefIntroducingPredecessor to preserve DomTree

4 years ago[CodeGen][SimplifyCFG] Teach DwarfEHPrepare to preserve DomTree
Roman Lebedev [Fri, 1 Jan 2021 17:27:09 +0000 (20:27 +0300)]
[CodeGen][SimplifyCFG] Teach DwarfEHPrepare to preserve DomTree

Once the default for SimplifyCFG flips, we can no longer pass nullptr
instead of DomTree to SimplifyCFG, so we need to propagate it here.

We don't strictly need to actually preserve DomTree in DwarfEHPrepare,
but we might as well do it, since it's trivial.

4 years ago[NFC][CodeGen][Tests] Mark all tests that fail to preserve DomTree for SimplifyCFG...
Roman Lebedev [Fri, 1 Jan 2021 18:15:07 +0000 (21:15 +0300)]
[NFC][CodeGen][Tests] Mark all tests that fail to preserve DomTree for SimplifyCFG as such

These tests start to fail when the SimplifyCFG's default regarding DomTree
updating is switched on, so mark them as needing changes.

4 years ago[NFC][CodeGen] Split DwarfEHPrepare pass into an actual transform and an legacy-PM...
Roman Lebedev [Fri, 1 Jan 2021 16:06:44 +0000 (19:06 +0300)]
[NFC][CodeGen] Split DwarfEHPrepare pass into an actual transform and an legacy-PM wrapper

This is consistent with the layout of other passes,
and simplifies further refinements regarding DomTree handling.

This is indended to be a NFC commit.

4 years ago[NFC] clang-format the entire DwarfEHPrepare.cpp
Roman Lebedev [Fri, 1 Jan 2021 14:57:14 +0000 (17:57 +0300)]
[NFC] clang-format the entire DwarfEHPrepare.cpp

4 years ago[Utils] LocalTest: fix SimplifyCFGWithNullAC test to work with `-simplifycfg-require...
Roman Lebedev [Fri, 1 Jan 2021 21:20:50 +0000 (00:20 +0300)]
[Utils] LocalTest: fix SimplifyCFGWithNullAC test to work with `-simplifycfg-require-and-preserve-domtree=1`

4 years ago[IR] PassManagerTest: Register DominatorTreeAnalysis before running SimplifyCFGPass
Roman Lebedev [Fri, 1 Jan 2021 14:06:56 +0000 (17:06 +0300)]
[IR] PassManagerTest: Register DominatorTreeAnalysis before running SimplifyCFGPass

Otherwise these particular tests fail when SimplifyCFG requires DomTree

4 years ago[SimplifyCFG] Teach eliminateDeadSwitchCases() to preserve DomTree, part 2
Roman Lebedev [Fri, 1 Jan 2021 13:37:55 +0000 (16:37 +0300)]
[SimplifyCFG] Teach eliminateDeadSwitchCases() to preserve DomTree, part 2

4 years ago[SimplifyCFG] Teach tryWidenCondBranchToCondBranch() to preserve DomTree
Roman Lebedev [Fri, 1 Jan 2021 13:33:19 +0000 (16:33 +0300)]
[SimplifyCFG] Teach tryWidenCondBranchToCondBranch() to preserve DomTree

4 years ago[SimplifyCFGPass] Ensure that DominatorTreeWrapperPass is init'd before SimplifyCFG
Roman Lebedev [Fri, 1 Jan 2021 13:31:11 +0000 (16:31 +0300)]
[SimplifyCFGPass] Ensure that DominatorTreeWrapperPass is init'd before SimplifyCFG

It's probably better than hoping that it will happen to be
already initialized.

4 years ago[llvm] Use isa instead of dyn_cast (NFC)
Kazu Hirata [Fri, 1 Jan 2021 20:44:56 +0000 (12:44 -0800)]
[llvm] Use isa instead of dyn_cast (NFC)

4 years ago[llvm] Use *Map::lookup (NFC)
Kazu Hirata [Fri, 1 Jan 2021 20:44:54 +0000 (12:44 -0800)]
[llvm] Use *Map::lookup (NFC)

4 years ago[SSAUpdater] Remove unused code InstrIsPHI (NFC)
Kazu Hirata [Fri, 1 Jan 2021 20:44:52 +0000 (12:44 -0800)]
[SSAUpdater] Remove unused code InstrIsPHI (NFC)

The last use of this function was removed on Jan 4, 2018 in commit
commit 90ecac01e9dcbcaf92781a6dcffa07a27191b661.

4 years agotest/OpenMP/parallel_codegen.cpp: Allow multiple result attributes
Fangrui Song [Fri, 1 Jan 2021 18:46:34 +0000 (10:46 -0800)]
test/OpenMP/parallel_codegen.cpp: Allow multiple result attributes

On many targets the matched line is `define dso_local i32 @main` while
on ppc64 it is `define dso_local signext i32 @main`.

4 years ago[Analysis] flatten enums for recurrence types
Sanjay Patel [Fri, 1 Jan 2021 17:09:02 +0000 (12:09 -0500)]
[Analysis] flatten enums for recurrence types

This is almost all mechanical search-and-replace and
no-functional-change-intended (NFC). Having a single
enum makes it easier to match/reason about the
reduction cases.

The goal is to remove `Opcode` from reduction matching
code in the vectorizers because that makes it harder to
adapt the code to handle intrinsics.

The code in RecurrenceDescriptor::AddReductionVar() is
the only place that required closer inspection. It uses
a RecurrenceDescriptor and a second InstDesc to sometimes
overwrite part of the struct. It seem like we should be
able to simplify that logic, but it's not clear exactly
which cmp+sel patterns that we are trying to handle/avoid.

4 years ago[Analysis] fix typo in code comment; NFC
Sanjay Patel [Fri, 1 Jan 2021 14:52:44 +0000 (09:52 -0500)]
[Analysis] fix typo in code comment; NFC

4 years ago[SLP]Add a test for correct use of the reordered loads, NFC.
Alexey Bataev [Fri, 1 Jan 2021 16:27:23 +0000 (08:27 -0800)]
[SLP]Add a test for correct use of the reordered loads, NFC.

4 years ago[InstSimplify] Add tests for gep p, -p without inbounds (NFC)
Nikita Popov [Fri, 1 Jan 2021 16:00:02 +0000 (17:00 +0100)]
[InstSimplify] Add tests for gep p, -p without inbounds (NFC)

This is additional test coverage for D93820.

4 years ago[LVI] Handle unions of conditions
Nikita Popov [Fri, 1 Jan 2021 15:32:19 +0000 (16:32 +0100)]
[LVI] Handle unions of conditions

LVI previously handled "if (L && R)" conditions, but not
"if (L || R)" conditions. The latter case can still produce
useful information if L and R both constrain the same variable.

This adds support for handling the "if (L || R)" case as well.
The only difference is that we take the union instead of the
intersection of the lattice values.

4 years ago[CVP] Add tests for union of conditions (NFC)
Nikita Popov [Fri, 1 Jan 2021 15:12:44 +0000 (16:12 +0100)]
[CVP] Add tests for union of conditions (NFC)

We currently handle intersected conditions, but not unioned
conditions.

4 years ago[TableGen] Continue cleaning up .td files
Paul C. Anagnostopoulos [Fri, 25 Dec 2020 00:02:52 +0000 (19:02 -0500)]
[TableGen] Continue cleaning up .td files

This pass includes LLVM and MLIR files.

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

4 years ago[LoopDistribute] Add tests with uncomputable BTCs.
Florian Hahn [Fri, 1 Jan 2021 13:31:59 +0000 (13:31 +0000)]
[LoopDistribute] Add tests with uncomputable BTCs.

4 years ago[LoopLoadElim] Add tests with uncomputable BTCs.
Florian Hahn [Fri, 1 Jan 2021 13:31:23 +0000 (13:31 +0000)]
[LoopLoadElim] Add tests with uncomputable BTCs.

4 years ago[LAA] Add tests with uncomputable BTCs.
Florian Hahn [Thu, 31 Dec 2020 12:40:48 +0000 (12:40 +0000)]
[LAA] Add tests with uncomputable BTCs.

4 years ago[LV] Fix crash when generating remarks with multi-exit loops.
Florian Hahn [Wed, 30 Dec 2020 16:14:40 +0000 (16:14 +0000)]
[LV] Fix crash when generating remarks with multi-exit loops.

If DoExtraAnalysis is true (e.g. because remarks are enabled), we
continue with the analysis rather than exiting. Update code to
conditionally check if the ExitBB has phis or not a single predecessor.
Otherwise a nullptr is dereferenced with DoExtraAnalysis.

4 years agoPrecommit a test for D92015 (NFC)
Juneyoung Lee [Fri, 1 Jan 2021 13:35:57 +0000 (22:35 +0900)]
Precommit a test for D92015 (NFC)

4 years ago[clang-tidy][NFC] Fix a build warning due to an extra semicolon
Yang Fan [Fri, 1 Jan 2021 06:16:12 +0000 (14:16 +0800)]
[clang-tidy][NFC] Fix a build warning due to an extra semicolon

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

4 years ago[Sema] Fix deleted function problem in implicitly movable test
Yang Fan [Fri, 1 Jan 2021 05:30:36 +0000 (13:30 +0800)]
[Sema] Fix deleted function problem in implicitly movable test

In implicitly movable test, a two-stage overload resolution is performed.
If the first overload resolution selects a deleted function, Clang directly
performs the second overload resolution, without checking whether the
deleted function matches the additional criteria.

This patch fixes the above problem.

Reviewed By: Quuxplusone

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

4 years ago[IRSim][IROutliner] Allowing call instructions to be outlined.
Andrew Litteken [Tue, 8 Sep 2020 18:42:56 +0000 (13:42 -0500)]
[IRSim][IROutliner] Allowing call instructions to be outlined.

We add an extra check to make sure that we do not outline calls to
indirect functions, but outline whatever the IRSimilarityIdentifier
finds with respect to calls.

Tests:
Removing test/Transforms/IROutliner/illegal-calls.ll
Adding test/Transforms/IROutliner/outlining-calls.ll
Adding test/Transforms/IROutliner/illegal-indirect-calls.ll

Excluding DebugInfo this is the last patch for the initial
implementation of the IROutliner!

Reviewers: jroelofs, paquette

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

4 years ago[IRSim] Letting call instructions be legal for similarity identification.
Andrew Litteken [Wed, 16 Sep 2020 03:25:05 +0000 (22:25 -0500)]
[IRSim] Letting call instructions be legal for similarity identification.

Here we let non-intrinsic calls be considered legal and valid for
similarity only if the call is not indirect, and has a name.

For two calls to be considered similar, they must have the same name,
the same function types, and the same set of parameters, including tail
calls and calling conventions.

Tests are found in unittests/Analysis/IRSimilarityIdentifierTest.cpp.

Reviewers: jroelofs, paquette

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

4 years ago[SimplifyCFG] SUCCESS! Teach createUnreachableSwitchDefault() to preserve DomTree
Roman Lebedev [Fri, 1 Jan 2021 00:19:17 +0000 (03:19 +0300)]
[SimplifyCFG] SUCCESS! Teach createUnreachableSwitchDefault() to preserve DomTree

This pretty much concludes patch series for updating SimplifyCFG
to preserve DomTree. All 318 dedicated `-simplifycfg` tests now pass
with `-simplifycfg-require-and-preserve-domtree=1`.

There are a few leftovers that apparently don't have good test coverage.
I do not yet know what gaps in test coverage will the wider-scale testing
reveal, but the default flip might be close.

4 years ago[SimplifyCFG] Teach tryToSimplifyUncondBranchWithICmpInIt() to preserve DomTree
Roman Lebedev [Thu, 31 Dec 2020 23:44:17 +0000 (02:44 +0300)]
[SimplifyCFG] Teach tryToSimplifyUncondBranchWithICmpInIt() to preserve DomTree

4 years ago[SimplifyCFG] Teach FoldValueComparisonIntoPredecessors() to preserve DomTree, part 2
Roman Lebedev [Thu, 31 Dec 2020 23:21:53 +0000 (02:21 +0300)]
[SimplifyCFG] Teach FoldValueComparisonIntoPredecessors() to preserve DomTree, part 2