platform/upstream/llvm.git
4 years ago[X86][SSE] lowerShuffleAsSplitOrBlend always returns a shuffle.
Simon Pilgrim [Thu, 10 Sep 2020 10:29:06 +0000 (11:29 +0100)]
[X86][SSE] lowerShuffleAsSplitOrBlend always returns a shuffle.

lowerShuffleAsSplitOrBlend always returns a target shuffle result (and is the default operation for lowering some shuffle types), so we don't need to check for null.

4 years ago[X86] Remove WaitInsert::TTI member. NFCI.
Simon Pilgrim [Wed, 9 Sep 2020 16:48:22 +0000 (17:48 +0100)]
[X86] Remove WaitInsert::TTI member. NFCI.

This is only ever set/used inside WaitInsert::runOnMachineFunction so don't bother storing it in the class.

4 years ago[analyzer][StdLibraryFunctionsChecker] Add better diagnostics
Gabor Marton [Thu, 10 Sep 2020 10:41:29 +0000 (12:41 +0200)]
[analyzer][StdLibraryFunctionsChecker] Add better diagnostics

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

4 years ago[SVE][CodeGen] Legalisation of truncate for scalable vectors
Kerry McLaughlin [Thu, 10 Sep 2020 08:55:54 +0000 (09:55 +0100)]
[SVE][CodeGen] Legalisation of truncate for scalable vectors

Truncating from an illegal SVE type to a legal type, e.g.
`trunc <vscale x 4 x i64> %in to <vscale x 4 x i32>`
fails after PromoteIntOp_CONCAT_VECTORS attempts to
create a BUILD_VECTOR.

This patch changes the promote function to create a sequence of
INSERT_SUBVECTORs if the return type is scalable, and replaces
these with UNPK+UZP1 for AArch64.

Reviewed By: paulwalker-arm

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

4 years ago[analyzer][StdLibraryFunctionsChecker] Remove strcasecmp
Gabor Marton [Mon, 7 Sep 2020 14:56:36 +0000 (16:56 +0200)]
[analyzer][StdLibraryFunctionsChecker] Remove strcasecmp

There are 2 reasons to remove strcasecmp and strncasecmp.
1) They are also modeled in CStringChecker and the related argumentum
   contraints are checked there.
2) The argument constraints are checked in CStringChecker::evalCall.
   This is fundamentally flawed, they should be checked in checkPreCall.
   Even if we set up CStringChecker as a weak dependency for
   StdLibraryFunctionsChecker then the latter reports the warning always.
   Besides, CStringChecker fails to discover the constraint violation
   before the call, so, its evalCall returns with `true` and then
   StdCLibraryFunctions also tries to evaluate, this causes an assertion
   in CheckerManager.

Either we fix CStringChecker to handle the call prerequisites in
checkPreCall, or we must not evaluate any pure functions in
StdCLibraryFunctions that are also handled in CStringChecker.
We do the latter in this patch.

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

4 years agoEnable InsertFreeze flag of JumpThreading when used in LTO
Juneyoung Lee [Thu, 10 Sep 2020 10:05:24 +0000 (19:05 +0900)]
Enable InsertFreeze flag of JumpThreading when used in LTO

This patch enables inserting freeze when JumpThreading converts a select to
a conditional branch when it is run in LTO.

Reviewed By: nikic

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

4 years ago[compiler-rt] [netbsd] Reintroduce __sanitizer_protoent
Kamil Rytarowski [Thu, 10 Sep 2020 09:44:12 +0000 (11:44 +0200)]
[compiler-rt] [netbsd] Reintroduce __sanitizer_protoent

Partial revert of https://reviews.llvm.org/D82424

4 years ago[ARM][LowOverheadLoops] Allow tail predication on predicated instructions with unknow...
Sam Tebbs [Wed, 9 Sep 2020 13:01:02 +0000 (14:01 +0100)]
[ARM][LowOverheadLoops] Allow tail predication on predicated instructions with unknown lane
values

The effects of unpredicated vector instruction with unknown
lanes cannot be predicted and therefore cannot be tail predicated. This
does not apply to predicated vector instructions and so this patch
allows tail predication on them.

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

4 years ago[llvm-readobj] [ARMWinEH] Fix printing of exception handlers with packed epilogues
Martin Storsjö [Tue, 8 Sep 2020 20:14:42 +0000 (23:14 +0300)]
[llvm-readobj] [ARMWinEH] Fix printing of exception handlers with packed epilogues

If there's a packed epilogue (indicated by the flag E), the EpilogueCount()
field actually should be interpreted as EpilogueOffset.

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

4 years ago[llvm-readobj] [ARMWinEH] Print set_fp/add_fp differently in epilogues
Martin Storsjö [Tue, 8 Sep 2020 06:56:45 +0000 (09:56 +0300)]
[llvm-readobj] [ARMWinEH] Print set_fp/add_fp differently in epilogues

This matches how e.g. stp/ldp and other opcodes are printed differently
for epilogues.

Also add a missing --strict-whitespace in an existing test that
was added explicitly for testing vertical alignment, and change to
using temp files for the generated object files.

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

4 years ago[mlir] [VectorOps] Enable 32-bit index optimizations
aartbik [Wed, 9 Sep 2020 18:11:52 +0000 (11:11 -0700)]
[mlir] [VectorOps] Enable 32-bit index optimizations

Rationale:
After some discussion we decided that it is safe to assume 32-bit
indices for all subscripting in the vector dialect (it is unlikely
the dialect will be used; or even work; for such long vectors).
So rather than detecting specific situations that can exploit
32-bit indices with higher parallel SIMD, we just optimize it
by default, and let users that don't want it opt-out.

Reviewed By: nicolasvasilache, bkramer

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

4 years ago[SCEV] Constant expansion cost at minsize
Sam Parker [Mon, 7 Sep 2020 11:06:02 +0000 (12:06 +0100)]
[SCEV] Constant expansion cost at minsize

As code size is the only thing we care about at minsize, query the
cost of materialising immediates when calculating the cost of a SCEV
expansion. We also modify the CostKind to TCK_CodeSize for minsize,
instead of RecipThroughput.

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

4 years ago[ARM] Tail predicate VQDMULH and VQRDMULH
Sam Parker [Wed, 9 Sep 2020 07:15:55 +0000 (08:15 +0100)]
[ARM] Tail predicate VQDMULH and VQRDMULH

Mark the family of instructions as valid for tail predication.

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

4 years ago[clang] Disallow fbasic-block-sections on non-ELF, non-x86 targets.
Snehasish Kumar [Thu, 10 Sep 2020 00:57:03 +0000 (17:57 -0700)]
[clang] Disallow fbasic-block-sections on non-ELF, non-x86 targets.

Basic block sections is untested on other platforms and binary formats apart
from x86,elf. This patch emits a warning and drops the flag if the platform
and binary format are not compatible. Add a test to ensure that
specifying an incompatible target in the driver does not enable the
feature.

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

4 years ago[mlir][Linalg] Small refactoring of ConvOpVectorization
Jakub Lichman [Thu, 10 Sep 2020 07:03:43 +0000 (07:03 +0000)]
[mlir][Linalg] Small refactoring of ConvOpVectorization

This commit addresses comments that were requested on D86619
after it was landed.

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

4 years ago[JumpThreading] Conditionally freeze its condition when unfolding select
Juneyoung Lee [Thu, 10 Sep 2020 06:49:04 +0000 (15:49 +0900)]
[JumpThreading] Conditionally freeze its condition when unfolding select

This patch fixes pr45956 (https://bugs.llvm.org/show_bug.cgi?id=45956 ).
To minimize its impact to the quality of generated code, I suggest enabling
this only for LTO as a start (it has two JumpThreading passes registered).
This patch contains a flag that makes JumpThreading enable it.

Reviewed By: efriedma

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

4 years ago[NFC] Rename variables to avoid name confusion
Max Kazantsev [Thu, 10 Sep 2020 06:38:49 +0000 (13:38 +0700)]
[NFC] Rename variables to avoid name confusion

Name `LI` is used for loop info, loop and load inst at the same
function, which causes a lot of confusion.

4 years ago[LoopLoadElim] Filter away candidates that stop being AddRecs after loop versioning...
Max Kazantsev [Thu, 10 Sep 2020 06:29:45 +0000 (13:29 +0700)]
[LoopLoadElim] Filter away candidates that stop being AddRecs after loop versioning. PR47457

The test in PR47457 demonstrates a situation when candidate load's pointer's SCEV
is no loger a SCEVAddRec after loop versioning. The code there assumes that it is
always a SCEVAddRec and crashes otherwise.

This patch makes sure that we do not consider candidates for which this requirement
is broken after the versioning.

Differential Revision: https://reviews.llvm.org/D87355
Reviewed By: asbirlea

4 years agolibclc/spirv: Add various functions
Daniel Stone [Thu, 10 Sep 2020 03:15:41 +0000 (23:15 -0400)]
libclc/spirv: Add various functions

Adds fma,fmod,ldexp.

Reviewer: jenatali jvesely

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

4 years ago[mlir][Linalg] Add Utility method to get loop ranges for a LinalgOp.
MaheshRavishankar [Thu, 10 Sep 2020 05:20:12 +0000 (22:20 -0700)]
[mlir][Linalg] Add Utility method to get loop ranges for a LinalgOp.

Also refactor the getViewSizes method to work on LinalgOp instead of
being a templated version. Keeping the templated version for
compatibility.

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

4 years ago[PowerPC] [FPEnv] Disable strict FP mutation by default
Qiu Chaofan [Thu, 10 Sep 2020 05:28:09 +0000 (13:28 +0800)]
[PowerPC] [FPEnv] Disable strict FP mutation by default

22a0edd0 introduced a config IsStrictFPEnabled, which controls the
strict floating point mutation (transforming some strict-fp operations
into non-strict in ISel). This patch disables the mutation by default
since we've finished PowerPC strict-fp enablement in backend.

Reviewed By: uweigand

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

4 years ago[lit] Use correct variable name for libxml2
Petr Hosek [Thu, 10 Sep 2020 05:03:13 +0000 (22:03 -0700)]
[lit] Use correct variable name for libxml2

This addresses an issue introduced in c4d7536136b3.

4 years ago[CMake] Simplify CMake handling for libxml2
Petr Hosek [Fri, 24 Jul 2020 22:47:38 +0000 (15:47 -0700)]
[CMake] Simplify CMake handling for libxml2

This matches the changes made to handling of zlib done in 10b1b4a
where we rely on find_package and the imported target rather than
manually appending the library and include paths. The use of
LLVM_LIBXML2_ENABLED has been replaced by LLVM_ENABLE_LIBXML2
thus reducing the number of variables.

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

4 years ago[NFC] Move definition of variable now only used in debug builds
Jordan Rupprecht [Thu, 10 Sep 2020 03:23:59 +0000 (20:23 -0700)]
[NFC] Move definition of variable now only used in debug builds

4 years agomlir/Transforms/BufferPlacement.h: Add missing override
David Blaikie [Thu, 10 Sep 2020 01:17:44 +0000 (18:17 -0700)]
mlir/Transforms/BufferPlacement.h: Add missing override

4 years ago[gcov] Delete flush_fn_list (unused since D83149)
Fangrui Song [Thu, 10 Sep 2020 00:24:45 +0000 (17:24 -0700)]
[gcov] Delete flush_fn_list (unused since D83149)

4 years ago[llvm-install-name-tool] Add -V flag
Alexander Shaposhnikov [Thu, 10 Sep 2020 00:11:08 +0000 (17:11 -0700)]
[llvm-install-name-tool] Add -V flag

This diff adds -V alias for --version to make llvm-install-name-tool
consistent with other tools (llvm-objcopy, llvm-strip, etc).

Test plan: make check-all

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

4 years ago[gcov] Delete unused llvm_gcda_increment_indirect_counter
Fangrui Song [Wed, 9 Sep 2020 23:57:33 +0000 (16:57 -0700)]
[gcov] Delete unused llvm_gcda_increment_indirect_counter

It has been unused since r157564 (2012).

4 years agoAMDGPU: Hoist check for VGPRs
Matt Arsenault [Wed, 9 Sep 2020 20:58:52 +0000 (16:58 -0400)]
AMDGPU: Hoist check for VGPRs

4 years agoAMDGPU: Skip all meta instructions in hazard recognizer
Matt Arsenault [Wed, 9 Sep 2020 22:08:48 +0000 (18:08 -0400)]
AMDGPU: Skip all meta instructions in hazard recognizer

This was not adding a necessary nop due to thinking the kill counted.

4 years agoAMDGPU: Fix inserting waitcnts before kill uses
Matt Arsenault [Wed, 9 Sep 2020 14:24:35 +0000 (10:24 -0400)]
AMDGPU: Fix inserting waitcnts before kill uses

4 years ago[Asan] Return nullptr for invalid chunks
Vitaly Buka [Wed, 9 Sep 2020 23:17:37 +0000 (16:17 -0700)]
[Asan] Return nullptr for invalid chunks

CHUNK_ALLOCATED. CHUNK_QUARANTINE are only states
which make AsanChunk useful for GetAsanChunk callers.
In either case member of AsanChunk are not useful.

Fix few cases which didn't expect nullptr. Most of the callers are already
expects nullptr.

Reviewed By: morehouse

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

4 years ago[ValueTracking] isKnownNonZero, computeKnownBits for freeze
Juneyoung Lee [Wed, 9 Sep 2020 17:55:06 +0000 (02:55 +0900)]
[ValueTracking] isKnownNonZero, computeKnownBits for freeze

This implements support for isKnownNonZero, computeKnownBits when freeze is involved.

```
  br (x != 0), BB1, BB2
BB1:
  y = freeze x
```

In the above program, we can say that y is non-zero. The reason is as follows:

(1) If x was poison, `br (x != 0)` raised UB
(2) If x was fully undef, the branch again raised UB
(3) If x was non-zero partially undef, say `undef | 1`, `freeze x` will return a nondeterministic value which is also non-zero.
(4) If x was just a concrete value, it is trivial

Reviewed By: nikic

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

4 years ago[libunwind] Bare-metal DWARF: set dso_base to 0
Ryan Prichard [Wed, 9 Sep 2020 22:43:35 +0000 (15:43 -0700)]
[libunwind] Bare-metal DWARF: set dso_base to 0

Previously, DwarfFDECache::findFDE used 0 as a special value meaning
"search the entire cache, including dynamically-registered FDEs".
Switch this special value to -1, which doesn't make sense as a DSO
base.

Fixes PR47335.

Reviewed By: compnerd, #libunwind

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

4 years ago[AMDGPU] Fix for folding v2.16 literals.
dfukalov [Fri, 4 Sep 2020 19:44:01 +0000 (22:44 +0300)]
[AMDGPU] Fix for folding v2.16 literals.

It was found some packed immediate operands (e.g. `<half 1.0, half 2.0>`) are
incorrectly processed so one of two packed values were lost.

Introduced new function to check immediate 32-bit operand can be folded.
Converted condition about current op_sel flags value to fall-through.

Fixes: SWDEV-247595

Reviewed By: rampitec

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

4 years agoMark masked.{store,scatter,compressstore} intrinsics as write-only
Krzysztof Parzyszek [Wed, 9 Sep 2020 22:27:04 +0000 (17:27 -0500)]
Mark masked.{store,scatter,compressstore} intrinsics as write-only

4 years ago[AArch64][GlobalISel] Share address mode selection code for memops
Jessica Paquette [Wed, 9 Sep 2020 16:45:54 +0000 (09:45 -0700)]
[AArch64][GlobalISel] Share address mode selection code for memops

We were missing support for the G_ADD_LOW + ADRP folding optimization in the
manual selection code for G_LOAD, G_STORE, and G_ZEXTLOAD.

As a result, we were missing cases like this:

```
@foo = external hidden global i32*
define void @baz(i32* %0) {
store i32* %0, i32** @foo
ret void
}
```

https://godbolt.org/z/16r7ad

This functionality already existed in the addressing mode functions for the
importer. So, this patch makes the manual selection code use
`selectAddrModeIndexed` rather than duplicating work.

This is a 0.2% geomean code size improvement for CTMark at -O3.

There is one code size increase (0.1% on lencod) which is likely because
`selectAddrModeIndexed` doesn't look through constants.

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

4 years ago[DSE,MemorySSA] Handle atomic stores explicitly in isReadClobber.
Florian Hahn [Wed, 9 Sep 2020 18:36:41 +0000 (19:36 +0100)]
[DSE,MemorySSA] Handle atomic stores explicitly in isReadClobber.

Atomic stores are modeled as MemoryDef to model the fact that they may
not be reordered, depending on the ordering constraints.

Atomic stores that are monotonic or weaker do not limit re-ordering, so
we do not have to treat them as potential read clobbers.

Note that llvm/test/Transforms/DeadStoreElimination/MSSA/atomic.ll
already contains a set of negative test cases.

Reviewed By: asbirlea

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

4 years ago[DAGCombiner] Fold fmin/fmax of NaN
Nikita Popov [Wed, 9 Sep 2020 20:35:02 +0000 (22:35 +0200)]
[DAGCombiner] Fold fmin/fmax of NaN

fminnum(X, NaN) is X, fminimum(X, NaN) is NaN. This mirrors the
behavior of existing InstSimplify folds.

This is expected to improve the reduction lowerings in D87391,
which use NaN as a neutral element.

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

4 years ago[ARM] Add additional fmin/fmax with nan tests (NFC)
Nikita Popov [Wed, 9 Sep 2020 21:48:44 +0000 (23:48 +0200)]
[ARM] Add additional fmin/fmax with nan tests (NFC)

Adding these to ARM which has both FMINNUM and FMINIMUM.

4 years ago[lldb] Pass the arch as part of the triple in the ARCH_CFLAGS
Jonas Devlieghere [Wed, 9 Sep 2020 21:41:00 +0000 (14:41 -0700)]
[lldb] Pass the arch as part of the triple in the ARCH_CFLAGS

4 years agoAdd REQUIRES: asserts to a test that uses an asserts only flag.
Amara Emerson [Wed, 9 Sep 2020 21:30:47 +0000 (14:30 -0700)]
Add REQUIRES: asserts to a test that uses an asserts only flag.

4 years ago[GlobalISel] Enable usage of BranchProbabilityInfo in IRTranslator.
Amara Emerson [Fri, 28 Aug 2020 23:21:34 +0000 (16:21 -0700)]
[GlobalISel] Enable usage of BranchProbabilityInfo in IRTranslator.

We weren't using this before, so none of the MachineFunction CFG edges had the
branch probability information added. As a result, block placement later in the
pipeline was flying blind.

This is enabled only with optimizations enabled like SelectionDAG.

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

4 years ago[X86] Add tests for minnum/maxnum with constant NaN (NFC)
Nikita Popov [Wed, 9 Sep 2020 20:35:56 +0000 (22:35 +0200)]
[X86] Add tests for minnum/maxnum with constant NaN (NFC)

4 years ago[GlobalISel][IRTranslator] Generate better conditional branch lowering.
Amara Emerson [Mon, 24 Aug 2020 21:10:38 +0000 (14:10 -0700)]
[GlobalISel][IRTranslator] Generate better conditional branch lowering.

This is a port of the functionality from SelectionDAG, which tries to find
a tree of conditions from compares that are then combined using OR or AND,
before using that result as the input to a branch. Instead of naively
lowering the code as is, this change converts that into a sequence of
conditional branches on the sub-expressions of the tree.

Like SelectionDAG, we re-use the case block codegen functionality from
the switch lowering utils, which causes us to generate some different code.
The result of which I've tried to mitigate in earlier combine patches.

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

4 years ago[GlobalISel] Rewrite the elide-br-by-swapping-icmp-ops combine to do less.
Amara Emerson [Mon, 24 Aug 2020 17:46:50 +0000 (10:46 -0700)]
[GlobalISel] Rewrite the elide-br-by-swapping-icmp-ops combine to do less.

This combine previously tried to take sequences like:
  %cond = G_ICMP pred, a, b
  G_BRCOND %cond, %truebb
  G_BR %falsebb
%truebb:
  ...
%falsebb:
  ...

and by inverting the compare predicate and swapping branch targets, delete the
G_BR and instead have a single conditional branch to the falsebb. Since in an
earlier patch we have a combine to fold not(icmp) into just an inverted icmp,
we don't need this combine to do as much. This patch instead generalizes the
combine by just looking for:
  G_BRCOND %cond, %truebb
  G_BR %falsebb
%truebb:
  ...
%falsebb:
  ...

and then inverting the condition using a not (xor). The xor can be folded away
in a separate combine. This change also lets us avoid some optimization code
in the IRTranslator.

I also think that deleting G_BRs in the combiner is unnecessary. That's
something that targets can decide to do at selection time and could simplify
generic code in future.

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

4 years ago[libc][MPFRWrapper] Provide a way to include MPFR header in downstream repos.
Siva Chandra Reddy [Wed, 9 Sep 2020 18:28:14 +0000 (11:28 -0700)]
[libc][MPFRWrapper] Provide a way to include MPFR header in downstream repos.

Reviewed By: asteinhauser

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

4 years agoWordsmith RegionBranchOpInterface verification errors
Sean Silva [Tue, 8 Sep 2020 22:49:50 +0000 (15:49 -0700)]
Wordsmith RegionBranchOpInterface verification errors

I was having a lot of trouble parsing the messages. In particular, the
messages like:

```
<stdin>:3:8: error: 'scf.if' op  along control flow edge from Region #0 to scf.if source #1 type '!npcomprt.tensor' should match input #1 type 'tensor<?xindex>'
```

In particular, one thing that kept catching me was parsing the "to scf.if
source #1 type" as one thing, but really it is
"to parent results: source type #1".

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

4 years ago[X86] Add support for using fast short rep mov for memcpy lowering.
Hiroshi Yamauchi [Fri, 21 Aug 2020 19:44:36 +0000 (12:44 -0700)]
[X86] Add support for using fast short rep mov for memcpy lowering.

Disabled by default behind an option.

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

4 years ago[AMDGPU] Correct gfx1031 XNACK setting documentation
Tony [Sat, 5 Sep 2020 22:53:47 +0000 (22:53 +0000)]
[AMDGPU] Correct gfx1031 XNACK setting documentation

- gfx1031 does not support XNACK.

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

4 years ago[MC] Resolve the difference of symbols in consecutive MCDataFragements
Jian Cai [Wed, 9 Sep 2020 18:58:22 +0000 (11:58 -0700)]
[MC] Resolve the difference of symbols in consecutive MCDataFragements

Try to resolve the difference of two symbols in consecutive MCDataFragments.
This is important for an idiom like "foo:instr; .if . - foo; instr; .endif"
(https://bugs.llvm.org/show_bug.cgi?id=43795).

Reviewed By: nickdesaulniers

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

4 years ago[gcov] Give the __llvm_gcov_ctr load instruction a name for more readable output
Fangrui Song [Wed, 9 Sep 2020 19:31:25 +0000 (12:31 -0700)]
[gcov] Give the __llvm_gcov_ctr load instruction a name for more readable output

4 years ago[Hexagon] Account for truncating pairs to non-pairs when widening truncates
Krzysztof Parzyszek [Wed, 9 Sep 2020 19:28:00 +0000 (14:28 -0500)]
[Hexagon] Account for truncating pairs to non-pairs when widening truncates

Added missing selection patterns for vpackl.

4 years ago[InstCombine] add tests for add/sub-of-shl; NFC
Sanjay Patel [Tue, 8 Sep 2020 21:00:40 +0000 (17:00 -0400)]
[InstCombine] add tests for add/sub-of-shl; NFC

4 years ago[gcov] Don't split entry block; add a synthetic entry block instead
Fangrui Song [Wed, 9 Sep 2020 19:06:39 +0000 (12:06 -0700)]
[gcov] Don't split entry block; add a synthetic entry block instead

The entry block is split at the first instruction where `shouldKeepInEntry`
returns false. The created basic block has a br jumping to the original entry
block. The new basic block causes the function label line and the other entry
block lines to be covered by different basic blocks, which can affect line
counts with special control flows (fork/exec in the entry block requires
heuristics in llvm-cov gcov to get consistent line counts).

  int main() { // BB0
    return 0;  // BB2 (due to entry block splitting)
  }
  // BB1 is the exit block (since gcov 4.8)

This patch adds a synthetic entry block (like PGOInstrumentation and GCC) and
inserts an edge from the synthetic entry block to the original entry block. We
can thus remove the tricky `shouldKeepInEntry` and entry block splitting. The
number of basic blocks does not change, but the emitted .gcno files will be
smaller because we can save one GCOV_TAG_LINES tag.

  // BB0 is the synthetic entry block with a single edge to BB2
  int main() { // BB2
    return 0;  // BB2
  }
  // BB1 is the exit block (since gcov 4.8)

4 years agoRevert a test using padding bits in atomics
Olivier Giroux [Wed, 9 Sep 2020 19:14:53 +0000 (12:14 -0700)]
Revert a test using padding bits in atomics

4 years ago[NFC] Separate bitcode reading for FUNC_CODE_INST_CMPXCHG(_OLD)
Guillaume Chatelet [Wed, 9 Sep 2020 19:10:30 +0000 (19:10 +0000)]
[NFC] Separate bitcode reading for FUNC_CODE_INST_CMPXCHG(_OLD)

This is preparatory work to unable storing alignment for AtomicCmpXchgInst.
See D83136 for context and bug: https://bugs.llvm.org/show_bug.cgi?id=27168

This is the fixed version of D83375, which was submitted and reverted.

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

4 years agoImplements [[likely]] and [[unlikely]] in IfStmt.
Mark de Wever [Wed, 9 Sep 2020 17:12:32 +0000 (19:12 +0200)]
Implements [[likely]] and [[unlikely]] in IfStmt.

This is the initial part of the implementation of the C++20 likelihood
attributes. It handles the attributes in an if statement.

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

4 years ago[DSE] Explicitly not use MSSA in testcase for now
Krzysztof Parzyszek [Wed, 9 Sep 2020 18:44:29 +0000 (13:44 -0500)]
[DSE] Explicitly not use MSSA in testcase for now

It fails for some reason, but it shouldn't stop switching to MSSA in DSE.

4 years ago[debugserver] Extract function for default launch flavor
Dave Lee [Tue, 8 Sep 2020 20:43:15 +0000 (13:43 -0700)]
[debugserver] Extract function for default launch flavor

Extract a function for turning `eLaunchFlavorDefault` into a concreate `eLaunchFlavor` value.

This new function encapsulates the few compile time variables involved, and also prevents clang unused code diagnostics.

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

4 years ago[DSE] Handle masked stores
Krzysztof Parzyszek [Wed, 2 Sep 2020 19:06:58 +0000 (14:06 -0500)]
[DSE] Handle masked stores

4 years agoRevert "[Attributor] Re-enable a run line in noalias.ll"
Johannes Doerfert [Wed, 9 Sep 2020 15:09:30 +0000 (10:09 -0500)]
Revert "[Attributor] Re-enable a run line in noalias.ll"

The underlying issue is still there, just hides on most systems, even
some Windows builds :(

See:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/25479/steps/test-check-all/logs/FAIL%3A%20LLVM%3A%3Anoalias.ll

This reverts commit 2600c9e2efce1dc4c64870b00a45ae0082c685fc.

4 years ago[libc++] Fix variant benchmark build for some configurations.
Eric Fiselier [Wed, 9 Sep 2020 18:25:17 +0000 (14:25 -0400)]
[libc++] Fix variant benchmark build for some configurations.

The benchmarks expect to be built in C++17 or newer, but this
isn't always how CMake configures the C++ dialect. Instead
we need to explicitly set the CXX_STANDARD target property.

4 years ago[lldb/Docs] Correct LLDB_ENABLE_TESTS to LLDB_INCLUDE_TESTS
Dave Lee [Wed, 9 Sep 2020 05:53:08 +0000 (22:53 -0700)]
[lldb/Docs] Correct LLDB_ENABLE_TESTS to LLDB_INCLUDE_TESTS

Fix references to LLDB_ENABLE_TESTS.

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

4 years ago[libc][NFC] Add spec files as dependencies of integration test.
Siva Chandra Reddy [Wed, 9 Sep 2020 17:19:37 +0000 (10:19 -0700)]
[libc][NFC] Add spec files as dependencies of integration test.

4 years ago[DAGCombine] Skip re-visiting EntryToken to avoid compile time explosion
Ulrich Weigand [Wed, 9 Sep 2020 17:09:52 +0000 (19:09 +0200)]
[DAGCombine] Skip re-visiting EntryToken to avoid compile time explosion

During the main DAGCombine loop, whenever a node gets replaced, the new
node and all its users are pushed onto the worklist.  Omit this if the
new node is the EntryToken (e.g. if a store managed to get optimized
out), because re-visiting the EntryToken and its users will not uncover
any additional opportunities, but there may be a large number of such
users, potentially causing compile time explosion.

This compile time explosion showed up in particular when building the
SingleSource/UnitTests/matrix-types-spec.cpp test-suite case on any
platform without SIMD vector support.

Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D86963

4 years agoUpdate atomic feature macros, synopsis, signatures to match C++20. Improve test cover...
Olivier Giroux [Wed, 9 Sep 2020 17:00:09 +0000 (10:00 -0700)]
Update atomic feature macros, synopsis, signatures to match C++20. Improve test coverage for non-lock-free atomics.

4 years ago[NFC][MLInliner] Don't initialize in an assert.
Mircea Trofin [Wed, 9 Sep 2020 16:55:06 +0000 (09:55 -0700)]
[NFC][MLInliner] Don't initialize in an assert.

Since the build bots have assertions enabled, this flew under the radar.

4 years ago[libc][obvious] Fix strtok_r signature in the spec.
Siva Chandra Reddy [Wed, 9 Sep 2020 15:32:51 +0000 (08:32 -0700)]
[libc][obvious] Fix strtok_r signature in the spec.

4 years ago[OpenMP] Begin Printing Information Dumps In Libomptarget and Plugins
Joseph Huber [Fri, 4 Sep 2020 19:03:49 +0000 (15:03 -0400)]
[OpenMP] Begin Printing Information Dumps In Libomptarget and Plugins

Summary:
This patch starts adding support for adding information dumps to libomptarget
and rtl plugins. The information printing is controlled by the
LIBOMPTARGET_INFO environment variable introduced in D86483. The goal of this
patch is to provide the user with additional information about the device
during kernel execution and providing the user with information dumps in the
case of failure. This patch added the ability to dump the pointer mapping table
as well as printing the number of blocks and threads in the cuda RTL.

Reviewers: jdoerfort gkistanova ye-luo

Subscribers: guansong openmp-commits sstefan1 yaxunl ye-luo

Tags: #OpenMP

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

4 years agoX86CallFrameOptimization.cpp - use const references where possible. NFCI.
Simon Pilgrim [Wed, 9 Sep 2020 15:33:19 +0000 (16:33 +0100)]
X86CallFrameOptimization.cpp - use const references where possible. NFCI.

4 years ago[DSE] Add testcase that uses masked loads and stores
Krzysztof Parzyszek [Wed, 9 Sep 2020 15:23:00 +0000 (10:23 -0500)]
[DSE] Add testcase that uses masked loads and stores

4 years ago[mlir][Linalg] Reduction dimensions specified in TC definition of ConvOps.
Jakub Lichman [Tue, 8 Sep 2020 15:04:35 +0000 (15:04 +0000)]
[mlir][Linalg] Reduction dimensions specified in TC definition of ConvOps.

This commit specifies reduction dimensions for ConvOps. This prevents
running reduction loops in parallel and enables easier detection of kernel dimensions
which we will need later on.

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

4 years agoX86FrameLowering::adjustStackWithPops - cleanup auto usage. NFCI.
Simon Pilgrim [Wed, 9 Sep 2020 15:13:55 +0000 (16:13 +0100)]
X86FrameLowering::adjustStackWithPops - cleanup auto usage. NFCI.

Don't use auto for non-obvious types, and use const references.

4 years ago[PowerPC] Fix STRICT_FRINT/STRICT_FNEARBYINT lowering
Qiu Chaofan [Wed, 9 Sep 2020 14:38:58 +0000 (22:38 +0800)]
[PowerPC] Fix STRICT_FRINT/STRICT_FNEARBYINT lowering

In standard C library, both rint and nearbyint returns rounding result
in current rounding mode. But nearbyint never raises inexact exception.
On PowerPC, x(v|s)r(d|s)pic may modify FPSCR XX, raising inexact
exception. So we can't select constrained fnearbyint into xvrdpic.

One exception here is xsrqpi, which will not raise inexact exception, so
fnearbyint f128 is okay here.

Reviewed By: uweigand

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

4 years ago[AMDGPU] Simplify S_SETREG_B32 case in EmitInstrWithCustomInserter
Jay Foad [Wed, 9 Sep 2020 13:55:48 +0000 (14:55 +0100)]
[AMDGPU] Simplify S_SETREG_B32 case in EmitInstrWithCustomInserter

NFC.

4 years ago[FLANG] Generate error for invalid selector.
compinder [Wed, 9 Sep 2020 13:32:51 +0000 (19:02 +0530)]
[FLANG] Generate error for invalid selector.

Fix of PR47339

Differential Revision: https://reviews.llvm.org/D87073/new/

4 years ago[AMDGPU][MC] Improved diagnostic messages for invalid registers
Dmitry Preobrazhensky [Wed, 9 Sep 2020 12:58:12 +0000 (15:58 +0300)]
[AMDGPU][MC] Improved diagnostic messages for invalid registers

Corrected parser to issue meaningful error messages for invalid and malformed registers.

See bug 41303: https://bugs.llvm.org/show_bug.cgi?id=41303

Reviewers: arsenm, rampitec

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

4 years ago[MachinePipeliner] Fix II_setByPragma initialization
Alon Kom [Wed, 9 Sep 2020 13:17:53 +0000 (13:17 +0000)]
[MachinePipeliner] Fix II_setByPragma initialization

II_setByPragma was not reset between 2 calls of the MachinePipleiner pass

Reviewed By: bcahoon

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

4 years ago[Statepoints] Update DAG root after emitting statepoint.
Denis Antrushin [Mon, 7 Sep 2020 15:04:07 +0000 (22:04 +0700)]
[Statepoints] Update DAG root after emitting statepoint.

Since we always generate CopyToRegs for statepoint results,
we must update DAG root after emitting statepoint, so that
these copies are scheduled before any possible local uses.
Note: getControlRoot() flushes all PendingExports, not only
those we generates for relocates. If that'll become a problem,
we can change it to flushing relocate exports only.

Reviewed By: reames

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

4 years agoCommandLine.h - use auto const reference in ValuesClass::apply for range loop. NFCI.
Simon Pilgrim [Wed, 9 Sep 2020 13:20:41 +0000 (14:20 +0100)]
CommandLine.h - use auto const reference in ValuesClass::apply for range loop. NFCI.

4 years agoRevert "[AMDGPU] Support disassembly for AMDGPU kernel descriptors"
Ronak Chauhan [Wed, 9 Sep 2020 12:31:28 +0000 (18:01 +0530)]
Revert "[AMDGPU] Support disassembly for AMDGPU kernel descriptors"

This reverts commit 487a80531006add8102d50dbcce4b6fd729ab1f6.

Tests fail on big endian machines.

4 years ago[KnownBits] Move SelectionDAG::computeKnownBits ISD::ABS handling to KnownBits::abs
Simon Pilgrim [Wed, 9 Sep 2020 12:22:39 +0000 (13:22 +0100)]
[KnownBits] Move SelectionDAG::computeKnownBits ISD::ABS handling to KnownBits::abs

Move the ISD::ABS handling to a KnownBits::abs handler, to simplify future implementations in ValueTracking/GlobalISel.

4 years agoAPInt.h - return directly from clearUnusedBits in single word cases. NFCI.
Simon Pilgrim [Wed, 9 Sep 2020 11:21:55 +0000 (12:21 +0100)]
APInt.h - return directly from clearUnusedBits in single word cases. NFCI.

Consistently use the same pattern of returning *this from the clearUnusedBits() call to allow us to early out from the isSingleWord() path and avoid an else statement.

4 years ago[elf2yaml] Fix dumping a debug section whose name is not recognized.
Xing GUO [Wed, 9 Sep 2020 12:06:00 +0000 (20:06 +0800)]
[elf2yaml] Fix dumping a debug section whose name is not recognized.

If the debug section's name isn't recognized, it should be
dumped as a raw content section.

Reviewed By: jhenderson, grimar

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

4 years ago[cmake] Use absolute paths for modules search
Diana Picus [Thu, 3 Sep 2020 11:39:29 +0000 (13:39 +0200)]
[cmake] Use absolute paths for modules search

For out of tree builds, the user generally needs to specify LLVM_DIR and
MLIR_DIR on the command line so that the correct LLVM and MLIR
installations are picked up.

If the provided paths are absolute, everything works fine, however for
buildbots it is customary to work with relative paths, and that makes it
difficult for CMake to find the right modules to include.

This patch changes CMakeLists.txt to convert LLVM_DIR and MLIR_DIR to
absolute paths before adding them to CMAKE_MODULE_PATH. The inputs are
assumed to be relative to the source directory (llvm-project/flang).

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

4 years ago[mlir][Linalg] Integration tests for convolutions added.
Jakub Lichman [Tue, 8 Sep 2020 11:26:15 +0000 (11:26 +0000)]
[mlir][Linalg] Integration tests for convolutions added.

This commit introduces end-to-end integration tests for
convolutions that test multiple ways of ConvOps lowering.

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

4 years ago[UnifyFunctionExitNodes] Fix Modified status for unreachable blocks
David Stenberg [Wed, 9 Sep 2020 08:59:41 +0000 (10:59 +0200)]
[UnifyFunctionExitNodes] Fix Modified status for unreachable blocks

If a function had at most one return block, the pass would return false
regardless if an unified unreachable block was created.

This patch fixes that by refactoring runOnFunction into two separate
helper functions for handling the unreachable blocks respectively the
return blocks, as suggested by @bjope in a review comment.

This was caught using the check introduced by D80916.

Reviewed By: serge-sans-paille

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

4 years ago[BuildLibCalls] Add more noundef to library functions
Juneyoung Lee [Wed, 9 Sep 2020 11:31:51 +0000 (20:31 +0900)]
[BuildLibCalls] Add more noundef to library functions

This patch follows D85345 and adds more noundef attributes to return values/arguments of library functions
that are mostly about accessing the file system or processes.

A few functions like `chmod` or `times` use typedef `mode_t` and `clock_t`.
They are neither struct nor union, so they cannot contain undef even if they're lowered to iN in IR. So, it is fine to add noundef to them.

- clock_t's actual type is size_t (C17, 7.27.1.3), so it isn't struct or union.

- For mode_t, either int or long is used in practice because programmers use bit manipulation. So, I think it is okay that it's never aggregate in practice.

After this patch, the remaining library functions are those that eagerly participate in optimizations: they can be removed, reordered, or
introduced by a transformation from primitive IR operations.
For them, a few testings is needed, since it may not be valid to add noundef anymore even if C standard says it's okay.

Reviewed By: jdoerfert

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

4 years ago[flang]Add Semantic Checks for OpenMP Allocate Clause
Irina Dobrescu [Wed, 9 Sep 2020 10:50:13 +0000 (11:50 +0100)]
[flang]Add Semantic Checks for OpenMP Allocate Clause

Reviewed By: kiranchandramohan, clementval, kiranktp, raghavendhra

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

4 years ago[ValueTracking] Add UndefOrPoison/Poison-only version of relevant functions
Juneyoung Lee [Tue, 8 Sep 2020 02:41:19 +0000 (11:41 +0900)]
[ValueTracking] Add UndefOrPoison/Poison-only version of relevant functions

This patch adds isGuaranteedNotToBePoison and programUndefinedIfUndefOrPoison.

isGuaranteedNotToBePoison will be used at D75808. The latter function is used at isGuaranteedNotToBePoison.

Reviewed By: nikic

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

4 years agoTrigramIndex.cpp - remove unnecessary includes. NFCI.
Simon Pilgrim [Wed, 9 Sep 2020 10:26:21 +0000 (11:26 +0100)]
TrigramIndex.cpp - remove unnecessary includes. NFCI.

TrigramIndex.h already includes most of these.

4 years agoARMTargetParser.cpp - use auto const references in for range loops. NFCI.
Simon Pilgrim [Wed, 9 Sep 2020 10:17:49 +0000 (11:17 +0100)]
ARMTargetParser.cpp - use auto const references in for range loops. NFCI.

Fix static analysis warnings about unnecessary copies.

4 years ago[APFloat] Fix uninitialized variable in IEEEFloat constructors
Simon Pilgrim [Wed, 9 Sep 2020 09:58:59 +0000 (10:58 +0100)]
[APFloat] Fix uninitialized variable in IEEEFloat constructors

Some constructors of IEEEFloat do not initialize member variable exponent.
Fix it by initializing exponent with the following values:

For NaNs, the `exponent` is `maxExponent+1`.
For Infinities, the `exponent` is `maxExponent+1`.
For Zeroes, the `exponent` is `maxExponent-1`.

Patch by: @nullptr.cpp (Yang Fan)

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

4 years ago[NFC][Asan] Fit ChunkHeader into redzone
Vitaly Buka [Wed, 9 Sep 2020 10:06:46 +0000 (03:06 -0700)]
[NFC][Asan] Fit ChunkHeader into redzone

In code as-is min redzone and ChunkHeader are 16 byte.
This patch just makes sure that redzone is calculated correctly if we
extend ChunkHeader.

4 years ago[DomTree] Use SmallVector<DomTreeNodeBase *, 4> instead of std::vector.
Florian Hahn [Wed, 9 Sep 2020 09:24:49 +0000 (10:24 +0100)]
[DomTree] Use SmallVector<DomTreeNodeBase *, 4> instead of std::vector.

Currentl DomTreeNodeBase is using std::vectot to store it's children.
Using SmallVector should be more efficient in terms of compile-time.

A size of 4 seems to be the sweet-spot in terms of compile-time,
according to

http://llvm-compile-time-tracker.com/compare.php?from=9933188c90615c9c264ebb69117f09726e909a25&to=d7a801d027648877b20f0e00e822a7a64c58d976&stat=instructions

This results in the following geomean improvements

```
                       geomean insts     max rss
O3                          -0.31 %       +0.02 %
ReleaseThinLTO              -0.35 %       -0.12 %
ReleaseLTO                  -0.28 %       -0.12 %
O0                          -0.06 %       -0.02 %
NewPM O3                    -0.36 %       +0.05 %
ReleaseThinLTO (link only)  -0.44 %       -0.10 %
ReleaseLTO-g (link only):   -0.32 %       -0.03 %
```

I am not sure if there's any other benefits of using std::vector over
SmallVector.

Reviewed By: kuhar, asbirlea

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

4 years ago[ARM] Fixup of a few test cases. NFC.
Sjoerd Meijer [Wed, 9 Sep 2020 09:40:23 +0000 (10:40 +0100)]
[ARM] Fixup of a few test cases. NFC.

After changing the semantics of get.active.lane.mask, I missed a few tests
that should use now the tripcount instead of the backedge taken count.

4 years ago[AMDGPU] Workaround for LDS Misalignment bug on GFX10
Mirko Brkusanin [Wed, 9 Sep 2020 09:28:36 +0000 (11:28 +0200)]
[AMDGPU] Workaround for LDS Misalignment bug on GFX10

Add subtarget feature check to avoid using ds_read/write_b96/128 with too
low alignment if a bug is present on that specific hardware.
Add this "feature" to GFX 10.1.1 as it is also affected.
Add global-isel test.

4 years agoRename MemRefDescriptor::getElementType() to MemRefDescriptor::getElementPtrType().
Christian Sigg [Wed, 9 Sep 2020 05:41:56 +0000 (07:41 +0200)]
Rename MemRefDescriptor::getElementType() to MemRefDescriptor::getElementPtrType().

Reviewed By: ftynse

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

4 years agoTemporairly revert "Thread safety analysis: Consider global variables in scope" ...
Roman Lebedev [Wed, 9 Sep 2020 09:08:46 +0000 (12:08 +0300)]
Temporairly revert "Thread safety analysis: Consider global variables in scope" & followup

This appears to cause false-positives because it started to warn on local non-global variables.

Repro posted to https://reviews.llvm.org/D84604#2262745

This reverts commit 9dcc82f34ea9b623d82d2577b93aaf67d36dabd2.
This reverts commit b2ce79ef66157dd752e3864ece57915e23a73f5d.