platform/upstream/llvm.git
3 years agoRevert "[LoopDeletion] Break backedge of loops when known not taken"
Philip Reames [Mon, 4 Jan 2021 17:50:47 +0000 (09:50 -0800)]
Revert "[LoopDeletion] Break backedge of loops when known not taken"

This reverts commit dd6bb367d19e3bf18353e40de54d35480999a930.

Multi-stage builders are showing an assertion failure w/LCSSA not being preserved on entry to IndVars.  Reason isn't clear, reverting while investigating.

3 years ago[LoopDeletion] Break backedge of loops when known not taken
Philip Reames [Mon, 4 Jan 2021 17:19:29 +0000 (09:19 -0800)]
[LoopDeletion] Break backedge of loops when known not taken

The basic idea is that if SCEV can prove the backedge isn't taken, we can go ahead and get rid of the backedge (and thus the loop) while leaving the rest of the control in place. This nicely handles cases with dispatch between multiple exits and internal side effects.

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

3 years ago[OpenMP] Add using bit flags to select Libomptarget Information
Joseph Huber [Fri, 18 Dec 2020 20:14:44 +0000 (15:14 -0500)]
[OpenMP] Add using bit flags to select Libomptarget Information

Summary:
This patch adds more fine-grained support over which information is output from the libomptarget runtime when run with the environment variable LIBOMPTARGET_INFO set. An extensible set of flags can be used to pick and choose which information the user is interested in.

Reviewers: jdoerfert JonChesterfield grokos

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

3 years ago[ProfileData] GCOVFile::readGCNO - silence undefined pointer warning. NFCI.
Simon Pilgrim [Mon, 4 Jan 2021 16:39:07 +0000 (16:39 +0000)]
[ProfileData] GCOVFile::readGCNO - silence undefined pointer warning. NFCI.

Silence clang static analyzer warning that 'fn' could still be in an undefined state - this shouldn't happen depending on the likely tag order, but the analyzer can't know that.

3 years ago[libomptarget][amdgpu] Call into deviceRTL instead of ockl
Jon Chesterfield [Mon, 4 Jan 2021 16:48:46 +0000 (16:48 +0000)]
[libomptarget][amdgpu] Call into deviceRTL instead of ockl

[libomptarget][amdgpu] Call into deviceRTL instead of ockl

Amdgpu codegen presently emits a call into ockl. The same functionality
is already present in the deviceRTL. Adds an amdgpu specific entry point
to avoid the dependency. This lets simple openmp code (specifically, that
which doesn't use libm) run without rocm device libraries installed.

Reviewed By: ronlieb

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

3 years ago[Hexagon] Fix bad SDNodeXForm
Krzysztof Parzyszek [Mon, 4 Jan 2021 16:34:17 +0000 (10:34 -0600)]
[Hexagon] Fix bad SDNodeXForm

Fixes https://llvm.org/PR48651

3 years ago[SimplifyCFG] Enabled hoisting late in LTO pipeline.
Florian Hahn [Mon, 4 Jan 2021 16:26:58 +0000 (16:26 +0000)]
[SimplifyCFG] Enabled hoisting late in LTO pipeline.

bb7d3af1139c disabled hoisting in SimplifyCFG by default, but enabled it
late in the pipeline. But it appears as if the LTO pipelines got missed.

This patch adjusts the LTO pipelines to also enable hoisting in the
later stages.

Unfortunately there's no easy way to add a test for the change I think.

Reviewed By: lebedev.ri

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

3 years ago[RISCV][NFC] Add additional cmov tests
Michael Munday [Mon, 4 Jan 2021 16:00:38 +0000 (16:00 +0000)]
[RISCV][NFC] Add additional cmov tests

One or more cmov instructions could be generated for these functions
when the Zbt extension is present.

Reviewed By: craig.topper

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

3 years ago[InterleavedAccess] Return correct 'modified' status.
Florian Hahn [Mon, 4 Jan 2021 15:49:47 +0000 (15:49 +0000)]
[InterleavedAccess] Return correct 'modified' status.

Both tryReplaceExtracts and replaceBinOpShuffles may modify the IR, even
if no interleaved loads are generated, but currently the pass pretends
no changes were made.

This patch updates the pass to return true if either of the functions
made any changes. In case of tryReplaceExtracts, changes are made if
there are any Extracts and true is returned.

`replaceBinOpShuffles` always makes changes if BinOpShuffles is not empty.
It also always returned true, so I went ahead and change it to just
`replaceBinOpShuffles`.

Fixes PR48208.

Reviewed By: SjoerdMeijer

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

3 years ago[IR] CallBase::getBundleOpInfoForOperand - ensure Current iterator is defined. NFCI.
Simon Pilgrim [Mon, 4 Jan 2021 15:30:15 +0000 (15:30 +0000)]
[IR] CallBase::getBundleOpInfoForOperand - ensure Current iterator is defined. NFCI.

Fix clang static analyzer undefined pointer warning in the case Begin == End.

3 years agoDeclCXX - Fix getAs<> null-dereference static analyzer warnings. NFCI.
Simon Pilgrim [Mon, 4 Jan 2021 15:12:55 +0000 (15:12 +0000)]
DeclCXX - Fix getAs<> null-dereference static analyzer warnings. NFCI.

getAs<> can return null if the cast is invalid, which can lead to null pointer deferences. Use castAs<> instead which will assert that the cast is valid.

3 years ago[OpenMP] Add definition/interface for target memory routines
Hansang Bae [Fri, 18 Dec 2020 00:43:36 +0000 (18:43 -0600)]
[OpenMP] Add definition/interface for target memory routines

The change includes new routines introduced in 5.1 and Fortran
interface.

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

3 years ago[Sparc] SparcMCExpr::printVariantKind - fix Wcovered-switch-default gcc warning....
Simon Pilgrim [Mon, 4 Jan 2021 14:08:09 +0000 (14:08 +0000)]
[Sparc] SparcMCExpr::printVariantKind - fix Wcovered-switch-default gcc warning. NFCI.

3 years ago[AArch64][SVE]Add cost model for masked gather and scatter for scalable vector.
Caroline Concatto [Thu, 17 Dec 2020 16:15:28 +0000 (16:15 +0000)]
[AArch64][SVE]Add cost model for masked gather and scatter for scalable vector.

    A new TTI interface has been added 'Optional <unsigned>getMaxVScale' that
    returns the maximum vscale for a given target.
    When known getMaxVScale is used to compute the cost of masked gather scatter
    for scalable vector.

    Depends on D92094

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

3 years ago[AArch64] Add patterns for FMCLA*_indexed.
Florian Hahn [Mon, 4 Jan 2021 13:28:44 +0000 (13:28 +0000)]
[AArch64] Add patterns for FMCLA*_indexed.

This patch adds patterns for the indexed variants of FCMLA. Mostly based
on a patch by Tim Northover.

Reviewed By: SjoerdMeijer

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

3 years ago[Support] Add KnownBits::icmp helpers.
Simon Pilgrim [Mon, 4 Jan 2021 12:18:59 +0000 (12:18 +0000)]
[Support] Add KnownBits::icmp helpers.

Check if all possible values for a pair of knownbits give the same icmp result - these are based off the checks performed in InstCombineCompares.cpp and D86578.

Add exhaustive unit test coverage - a followup will update InstCombineCompares.cpp to use this.

3 years ago[ARM] Extend lowering for i64 reductions
David Green [Mon, 4 Jan 2021 12:44:43 +0000 (12:44 +0000)]
[ARM] Extend lowering for i64 reductions

The lowering of a <4 x i16> or <4 x i8> vecreduce.add into an i64 would
previously be expanded, due to the i64 not being legal. This patch
adjusts our reduction matchers, making it produce a VADDLV(sext A to
v4i32) instead.

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

3 years ago[Sparc] Fixes for the internal assembler
LemonBoy [Mon, 4 Jan 2021 08:41:58 +0000 (09:41 +0100)]
[Sparc] Fixes for the internal assembler

* Prevent the generation of invalid shift instructions by constraining
  the immediate field. I've limited the shift field to constant values
  only, adding the `R_SPARC_5`/`R_SPARC_6` relocations is trivial if
  needed (but I can't really think of a use case for those).
* Fix the generation of PC-relative `call`
* Fix the transformation of `jmp sym` into `jmpl`
* Emit fixups for simm13 operands

I moved the choice of the correct relocation into the code emitter as I've
seen the other backends do, it can be definitely cleaner but the aim was
to reduce the scope of the patch as much as possible.

Fixes the problems raised by joerg in L254199

Reviewed By: dcederman

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

3 years ago[docs] Release notes for IsDecl in DIModule.
Chih-Ping Chen [Fri, 18 Dec 2020 21:12:57 +0000 (16:12 -0500)]
[docs] Release notes for IsDecl in DIModule.

Please see https://reviews.llvm.org/D93462 for the actual code change.

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

3 years ago[AArch64] Attempt to fix Mac tests with a more specific triple. NFC
David Green [Mon, 4 Jan 2021 11:29:18 +0000 (11:29 +0000)]
[AArch64] Attempt to fix Mac tests with a more specific triple. NFC

3 years ago[VE] Change default CPU name to "generic"
Kazushi (Jam) Marukawa [Sun, 27 Dec 2020 14:28:20 +0000 (23:28 +0900)]
[VE] Change default CPU name to "generic"

Change default CPU name of SX-Aurora VE from "ve" to "generic" similar
to other architectures.

Reviewed By: simoll

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

3 years ago[AARCH64] Improve accumulator forwarding for Cortex-A57 model
Usman Nadeem [Mon, 4 Jan 2021 10:58:43 +0000 (10:58 +0000)]
[AARCH64] Improve accumulator forwarding for Cortex-A57 model

The old CPU model only had MLA->MLA forwarding. I added some missing
MUL->MLA read advances and a missing absolute diff accumulator read
advance according to the Cortex A57 Software Optimization Guide.

The patch improves performance in EEMBC rgbyiqv2 by about 6%-7% and
spec2006/milc by 8% (repeated runs on multiple devices), causes no
significant regressions (none in SPEC).

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

3 years ago[ArgPromotion] Delay dead GEP removal until doPromotion.
Florian Hahn [Mon, 4 Jan 2021 09:51:20 +0000 (09:51 +0000)]
[ArgPromotion] Delay dead GEP removal until doPromotion.

Currently ArgPromotion removes dead GEPs as part of the legality check
in isSafeToPromoteArgument. If no promotion happens, this means the pass
claims no modifications happened, even though GEPs were removed.

This patch fixes the issue by delaying removal of dead GEPs until
doPromotion: isSafeToPromoteArgument can simply skips dead GEPs and
the code in doPromotion dealing with GEPs is updated to account for
dead GEPs. Once we committed to promotion, it should be safe to
remove dead GEPs.

Alternatively isSafeToPromoteArgument could return an additional boolean
to indicate whether it made changes, but this is quite cumbersome and
there should be no real benefit of weeding out some dead GEPs here if we
do not perform promotion.

I added a test for the case where dead GEPs need to be removed when
promotion happens in 578c5a0c6e71.

Fixes PR47477.

Reviewed By: jdoerfert

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

3 years agoRevert "[Sema] Fix deleted function problem in implicitly movable test"
Yang Fan [Mon, 4 Jan 2021 09:21:19 +0000 (17:21 +0800)]
Revert "[Sema] Fix deleted function problem in implicitly movable test"

This reverts commit 89b0972a

3 years ago[VE] Remove VA.needsCustom checks
Kazushi (Jam) Marukawa [Mon, 28 Dec 2020 02:17:16 +0000 (11:17 +0900)]
[VE] Remove VA.needsCustom checks

Remove VA.needsCustom checks which are copied from Sparc implementation
at the very beginning of VE implementation.  Add assert to sanity-check
VA.needsCustom flag, also.

Reviewed By: simoll

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

3 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

3 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.

3 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

3 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

3 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.

3 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.

3 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>
3 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

3 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

3 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.

3 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.

3 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

3 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

3 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.

3 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.

3 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

3 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.

3 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)

3 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)

3 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-

3 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.

3 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

3 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)

3 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

3 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.

3 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

3 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)

3 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

3 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

3 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.

3 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

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

3 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

3 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

3 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

3 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

3 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

3 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.

3 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.

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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.

3 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

3 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)

3 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)

3 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)

3 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.

3 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.

3 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.

3 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.

3 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.

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

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

3 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.

3 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

3 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

3 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

3 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

3 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

3 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.

3 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

3 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.

3 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.

3 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.

3 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

3 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`

3 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

3 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