platform/upstream/llvm.git
4 years ago[DWARFYAML] Fix unintialized value Is64BitAddrSize. NFC.
Xing GUO [Tue, 4 Aug 2020 16:09:12 +0000 (00:09 +0800)]
[DWARFYAML] Fix unintialized value Is64BitAddrSize. NFC.

This patch fixes the undefined behavior that reported by ubsan.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/44524/

4 years agoAMDGPU/GlobalISel: Ensure subreg is valid when selecting G_UNMERGE_VALUES
Matt Arsenault [Tue, 4 Aug 2020 13:19:43 +0000 (09:19 -0400)]
AMDGPU/GlobalISel: Ensure subreg is valid when selecting G_UNMERGE_VALUES

Fixes verifier error with SGPR unmerges with 96-bit result types.

4 years ago[GlobalISel] Don't transform FSUB(-0, X) -> FNEG(X) in GlobalISel.
Cameron McInally [Tue, 4 Aug 2020 16:26:04 +0000 (11:26 -0500)]
[GlobalISel] Don't transform FSUB(-0, X) -> FNEG(X) in GlobalISel.

This patch stops unconditionally transforming FSUB(-0, X) into an FNEG(X) while building the MIR.

This corresponds with the SelectionDAGISel change in D84056.

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

4 years ago[lldb/Host] Upstream macOS TCC code
Jonas Devlieghere [Tue, 4 Aug 2020 16:17:56 +0000 (09:17 -0700)]
[lldb/Host] Upstream macOS TCC code

Upstream the code for dealing with TCC introduced in macOS Mojave. This
will make the debuggee instead of the debugger responsible for the
privileges it needs.

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

4 years ago[InstSimplify] refactor min/max folds with shared operand; NFC
Sanjay Patel [Tue, 4 Aug 2020 15:23:10 +0000 (11:23 -0400)]
[InstSimplify] refactor min/max folds with shared operand; NFC

4 years ago[docs] Mention LLVM_ENABLE_MODULES.
Florian Hahn [Thu, 5 Mar 2020 09:48:40 +0000 (09:48 +0000)]
[docs] Mention LLVM_ENABLE_MODULES.

4 years agoGlobalISel: Hack a test to avoid a bug introducing a verifier error
Matt Arsenault [Tue, 4 Aug 2020 13:19:30 +0000 (09:19 -0400)]
GlobalISel: Hack a test to avoid a bug introducing a verifier error

There seems to be an unrelated CSEMIRBuilder bug that was causing
expensive checks failures in this case. Hack the test to avoid this
problem for now until that's fixed.

4 years ago[llvm-symbolizer] Switch command line parsing from llvm::cl to OptTable
Fangrui Song [Tue, 4 Aug 2020 15:51:24 +0000 (08:51 -0700)]
[llvm-symbolizer] Switch command line parsing from llvm::cl to OptTable

for the advantage outlined by D83639 ([OptTable] Support grouped short options)

Some behavior changes:

* -i={0,false} is removed. Use --no-inlines instead.
* --demangle={0,false} is removed. Use --no-demangle instead
* -untag-addresses={0,false} is removed. Use --no-untag-addresses instead

Added a higher level API OptTable::parseArgs which handles optional
initial options populated from an environment variable, expands response
files recursively, and parses options.

Reviewed By: jhenderson

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

4 years ago[OpenMP] Don't use MSVC workaround with MinGW
AndreyChurbanov [Tue, 4 Aug 2020 15:48:25 +0000 (18:48 +0300)]
[OpenMP] Don't use MSVC workaround with MinGW

Patch by mati865@gmail.com

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

4 years ago[clang][BPF] support type exist/size and enum exist/value relocations
Yonghong Song [Wed, 29 Jul 2020 23:54:29 +0000 (16:54 -0700)]
[clang][BPF] support type exist/size and enum exist/value relocations

This patch added the following additional compile-once
run-everywhere (CO-RE) relocations:
  - existence/size of typedef, struct/union or enum type
  - enum value and enum value existence

These additional relocations will make CO-RE bpf programs more
adaptive for potential kernel internal data structure changes.

For existence/size relocations, the following two code patterns
are supported:
  1. uint32_t __builtin_preserve_type_info(*(<type> *)0, flag);
  2. <type> var;
     uint32_t __builtin_preserve_field_info(var, flag);
flag = 0 for existence relocation and flag = 1 for size relocation.

For enum value existence and enum value relocations, the following code
pattern is supported:
  uint64_t __builtin_preserve_enum_value(*(<enum_type> *)<enum_value>,
                                         flag);
flag = 0 means existence relocation and flag = 1 for enum value.
relocation. In the above <enum_type> can be an enum type or
a typedef to enum type. The <enum_value> needs to be an enumerator
value from the same enum type. The return type is uint64_t to
permit potential 64bit enumerator values.

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

4 years ago[PowerPC] Don't remove single swap between the load and store
Nemanja Ivanovic [Tue, 4 Aug 2020 15:37:57 +0000 (10:37 -0500)]
[PowerPC] Don't remove single swap between the load and store

The swap removal pass looks to remove swaps when a loaded value is swapped, some
number of lane-insensitive operations are performed and then the value is
swapped again and stored.

However, in a situation where we load the value, swap it and then store it
without swapping again, the pass erroneously removes the single swap. The
reason is that both checks in the same equivalence class:

- load feeds a swap
- swap feeds a store

pass. However, there is no check that the two swaps are actually a single swap.
This patch just fixes that.

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

4 years agoSeparate code-block tag with a newline to fix code snippet html output
Simon Pilgrim [Tue, 4 Aug 2020 15:35:40 +0000 (16:35 +0100)]
Separate code-block tag with a newline to fix code snippet html output

4 years agoFix sphinx "Title underline too short" warning
Simon Pilgrim [Tue, 4 Aug 2020 15:31:13 +0000 (16:31 +0100)]
Fix sphinx "Title underline too short" warning

4 years ago[PowerPC] Custom lowering for funnel shifts
Jay Foad [Thu, 16 Jul 2020 12:10:12 +0000 (13:10 +0100)]
[PowerPC] Custom lowering for funnel shifts

The custom lowering saves an instruction over the generic expansion, by
taking advantage of the fact that PowerPC shift instructions are well
defined in the shift-by-bitwidth case.

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

4 years ago[test] Use abspath instead of realpath sometimes
Jordan Rupprecht [Tue, 4 Aug 2020 00:33:37 +0000 (17:33 -0700)]
[test] Use abspath instead of realpath sometimes

In these two cases, use of `os.path.realpath` is problematic:

- The name of the compiler is significant [1] . For testing purposes, we might
  provide a compiler called "clang" which is actually a symlink to some build
  script (which does some flag processing before invoking the real clang). The
  destination the symlink may not be called "clang", but we still want it to be
  treated as such.
- When using a build system that puts build artifacts in an arbitrary build
  location, and later creates a symlink for it (e.g. creates a
  "<lldb root>/lldbsuite/test/dotest.py" symlinks that points to
  "/build/artifact/<hash>/dotest.py"), looking at the realpath will not match
  the "test" convention required here.

[1] See `Makefile.rules` in the lldb tree, e.g. we use different flags if the compiler is named "clang"

Reviewed By: JDevlieghere

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

4 years ago[AMDGPU] Use fma for lowering frem
Jay Foad [Fri, 24 Jul 2020 10:41:57 +0000 (11:41 +0100)]
[AMDGPU] Use fma for lowering frem

This gives shorter f64 code and perhaps better accuracy.

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

4 years ago[AMDGPU] Generate frem test checks
Jay Foad [Fri, 24 Jul 2020 10:41:30 +0000 (11:41 +0100)]
[AMDGPU] Generate frem test checks

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

4 years agoFix sphinx indentation warning to stop newline in byref section html output.
Simon Pilgrim [Tue, 4 Aug 2020 15:12:50 +0000 (16:12 +0100)]
Fix sphinx indentation warning to stop newline in byref section html output.

4 years ago[X86] getFauxShuffleMask - drop unnecessary computeKnownBits OR(X,Y) shuffle decoding.
Simon Pilgrim [Tue, 4 Aug 2020 14:57:31 +0000 (15:57 +0100)]
[X86] getFauxShuffleMask - drop unnecessary computeKnownBits OR(X,Y) shuffle decoding.

Now that rG47cea9e82dda941e lets us aggressively decode multi-use shuffles for the OR(SHUFFLE(),SHUFFLE()) case we don't need the computeKnownBits variant any more.

4 years agoFix sphinx indentation warning.
Simon Pilgrim [Tue, 4 Aug 2020 14:52:09 +0000 (15:52 +0100)]
Fix sphinx indentation warning.

Don't double indent and make it clear we're referting to the latency mode.

4 years agoPermit nowthrow and nonnull with multiversioning.
Erich Keane [Tue, 4 Aug 2020 13:28:29 +0000 (06:28 -0700)]
Permit nowthrow and nonnull with multiversioning.

Some shipped versions of stdlib.h use nonnull and nothrow with function
multiversioning.  Support these, as they are generally harmless.

4 years agoImprove diagnostics for disallowed attributes used with multiversioning
Erich Keane [Mon, 3 Aug 2020 17:54:50 +0000 (10:54 -0700)]
Improve diagnostics for disallowed attributes used with multiversioning

Since we permit using SOME attributes (at the moment, just 1) with
multiversioning, we should improve the message as it still implies that
no attributes should be combined with multiversioning.

4 years ago[SyntaxTree] Fix crash on pointer to member function
Eduardo Caldas [Mon, 3 Aug 2020 18:29:12 +0000 (18:29 +0000)]
[SyntaxTree] Fix crash on pointer to member function

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

4 years ago[mlir][Vector] Relax condition for `splitFullAndPartialTransferPrecondition`
Nicolas Vasilache [Tue, 4 Aug 2020 13:49:32 +0000 (09:49 -0400)]
[mlir][Vector] Relax condition for `splitFullAndPartialTransferPrecondition`

The `splitFullAndPartialTransferPrecondition` has a restrictive condition to
prevent the pattern to be applied recursively if it is nested under an scf.IfOp.
Relaxing the condition to the immediate parent op must not be an scf.IfOp lets
the pattern be applied more generally while still preventing recursion.

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

4 years ago[SyntaxTree] Add support for `LiteralExpression`
Eduardo Caldas [Thu, 23 Jul 2020 09:20:06 +0000 (09:20 +0000)]
[SyntaxTree] Add support for `LiteralExpression`

We use inheritance to model the grammar's disjunction rule:
literal:
  integer-literal
  character-literal
  floating-point-literal
  string-literal
  boolean-literal
  pointer-literal
  user-defined-literal

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

4 years ago[Support][PPC] Fix bot failures due to cd53ded557c3
Nemanja Ivanovic [Tue, 4 Aug 2020 13:30:51 +0000 (08:30 -0500)]
[Support][PPC] Fix bot failures due to cd53ded557c3

Commit https://reviews.llvm.org/rGcd53ded557c3 attempts to fix the
computation in computeHostNumPhysicalCores() to respect Affinity.
However, the GLIBC wrapper of the affinity system call fails with
a default size of cpu_set_t on systems that have more than 1024 CPUs.
This just fixes the computation on such large machines.

4 years ago[Concepts] Include the found concept decl when dumping the ConceptSpecializationExpr
Haojian Wu [Tue, 4 Aug 2020 13:58:12 +0000 (15:58 +0200)]
[Concepts] Include the found concept decl when dumping the ConceptSpecializationExpr

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

4 years ago[X86] Remove unused canScaleShuffleElements helper
Simon Pilgrim [Tue, 4 Aug 2020 13:51:23 +0000 (14:51 +0100)]
[X86] Remove unused canScaleShuffleElements helper

The only use was removed at rG36750ba5bd0e9e72

Thanks to @nemanjai for the heads up

4 years ago[X86][AVX] isHorizontalBinOp - relax lane-crossing limits for AVX1-only targets.
Simon Pilgrim [Tue, 4 Aug 2020 11:35:46 +0000 (12:35 +0100)]
[X86][AVX] isHorizontalBinOp - relax lane-crossing limits for AVX1-only targets.

Permit lane-crossing post shuffles on AVX1 targets as long as every element comes from the same source lane, which for v8f32/v4f64 cases can be efficiently lowered with the LowerShuffleAsLanePermuteAnd* style methods.

4 years ago[lit] Add --time-trace-output to lit
Russell Gallop [Tue, 4 Aug 2020 09:14:31 +0000 (10:14 +0100)]
[lit] Add --time-trace-output to lit

This produces a chrome://tracing compatible trace file in the same way
as -ftime-trace.

This can be useful in optimising test time where one long test is causing
long overall test time on a wide machine.

This also helped in finding tests which have side effects on others
(e.g. https://reviews.llvm.org/D84885).

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

4 years ago[mlir][Vector] Add linalg.copy-based pattern for splitting vector.transfer_read into...
Nicolas Vasilache [Mon, 3 Aug 2020 09:34:07 +0000 (05:34 -0400)]
[mlir][Vector] Add linalg.copy-based pattern for splitting vector.transfer_read into full and partial copies.

This revision adds a transformation and a pattern that rewrites a "maybe masked" `vector.transfer_read %view[...], %pad `into a pattern resembling:

```
   %1:3 = scf.if (%inBounds) {
      scf.yield %view : memref<A...>, index, index
    } else {
      %2 = linalg.fill(%extra_alloc, %pad)
      %3 = subview %view [...][...][...]
      linalg.copy(%3, %alloc)
      memref_cast %extra_alloc: memref<B...> to memref<A...>
      scf.yield %4 : memref<A...>, index, index
   }
   %res= vector.transfer_read %1#0[%1#1, %1#2] {masked = [false ... false]}
```
where `extra_alloc` is a top of the function alloca'ed buffer of one vector.

This rewrite makes it possible to realize the "always full tile" abstraction where vector.transfer_read operations are guaranteed to read from a padded full buffer.
The extra work only occurs on the boundary tiles.

4 years ago[InstSimplify] fold nested min/max intrinsics with constant operands
Sanjay Patel [Tue, 4 Aug 2020 12:28:44 +0000 (08:28 -0400)]
[InstSimplify] fold nested min/max intrinsics with constant operands

This is based on the existing code for the non-intrinsic idioms
in InstCombine.

The vector constant constraint is non-obvious: undefs should be
ok in the outer call, but they can't propagate safely from the
inner call in all cases. Example:

https://alive2.llvm.org/ce/z/-2bVbM
  define <2 x i8> @src(<2 x i8> %x) {
  %0:
    %m = umin <2 x i8> %x, { 7, undef }
    %m2 = umin <2 x i8> { 9, 9 }, %m
    ret <2 x i8> %m2
  }
  =>
  define <2 x i8> @tgt(<2 x i8> %x) {
  %0:
    %m = umin <2 x i8> %x, { 7, undef }
    ret <2 x i8> %m
  }
  Transformation doesn't verify!
  ERROR: Value mismatch

  Example:
  <2 x i8> %x = < undef, undef >

  Source:
  <2 x i8> %m = < #x00 (0) [based on undef value], #x00 (0) >
  <2 x i8> %m2 = < #x00 (0), #x00 (0) >

  Target:
  <2 x i8> %m = < #x07 (7), #x10 (16) >
  Source value: < #x00 (0), #x00 (0) >
  Target value: < #x07 (7), #x10 (16) >

4 years ago[mlir] Fix GCC5 compilation problem in MLIR->LLVM type translation
Alex Zinenko [Tue, 4 Aug 2020 12:42:17 +0000 (14:42 +0200)]
[mlir] Fix GCC5 compilation problem in MLIR->LLVM type translation

GCC5 seems to dislike generic lambdas calling a method of the class
containing the lambda without explicit `this`.

4 years ago[mlir] switch the modeling of LLVM types to use the new mechanism
Alex Zinenko [Tue, 4 Aug 2020 09:37:50 +0000 (11:37 +0200)]
[mlir] switch the modeling of LLVM types to use the new mechanism

A new first-party modeling for LLVM IR types in the LLVM dialect has been
developed in parallel to the existing modeling based on wrapping LLVM `Type *`
instances. It resolves the long-standing problem of modeling identified
structure types, including recursive structures, and enables future removal of
LLVMContext and related locking mechanisms from LLVMDialect.

This commit only switches the modeling by (a) renaming LLVMTypeNew to LLVMType,
(b) removing the old implementaiton of LLVMType, and (c) updating the tests. It
is intentionally minimal. Separate commits will remove the infrastructure built
for the transition and update API uses where appropriate.

Depends On D85020

Reviewed By: rriddle

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

4 years ago[InstSimplify] add tests for min/max with constants; NFC
Sanjay Patel [Mon, 3 Aug 2020 20:51:05 +0000 (16:51 -0400)]
[InstSimplify] add tests for min/max with constants; NFC

4 years ago[InstSimplify] reduce code for min/max analysis; NFC
Sanjay Patel [Mon, 3 Aug 2020 19:31:24 +0000 (15:31 -0400)]
[InstSimplify] reduce code for min/max analysis; NFC

This should probably be moved up to some common area eventually
when there's another user.

4 years ago[mlir] provide same APIs as existing LLVMType in the new LLVM type modeling
Alex Zinenko [Tue, 4 Aug 2020 09:37:31 +0000 (11:37 +0200)]
[mlir] provide same APIs as existing LLVMType in the new LLVM type modeling

These are intended to smoothen the transition and may be removed in the future
in favor of more MLIR-compatible APIs. They intentionally have the same
semantics as the existing functions, which must remain stable until the
transition is complete.

Depends On D85019

Reviewed By: nicolasvasilache

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

4 years ago[mlir] translate types between MLIR LLVM dialect and LLVM IR
Alex Zinenko [Tue, 4 Aug 2020 09:37:25 +0000 (11:37 +0200)]
[mlir] translate types between MLIR LLVM dialect and LLVM IR

With new LLVM dialect type modeling, the dialect types no longer wrap LLVM IR
types. Therefore, they need to be translated to and from LLVM IR during export
and import. Introduce the relevant functionality for translating types. It is
currently exercised by an ad-hoc type translation roundtripping test that will
be subsumed by the actual translation test when the type system transition is
complete.

Depends On D84339

Reviewed By: herhut

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

4 years ago[mlir] Fix adding wrong operand value in `promoteMemRefDescriptors`.
Alexander Belyaev [Tue, 4 Aug 2020 11:34:47 +0000 (13:34 +0200)]
[mlir] Fix adding wrong operand value in `promoteMemRefDescriptors`.

The bug was not noticed because we didn't have a lot of custom type conversions
directly to LLVM dialect.

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

4 years ago[MLIR][SPIRVToLLVM] Indentation and style fix in tests
George Mitenkov [Tue, 4 Aug 2020 09:45:18 +0000 (12:45 +0300)]
[MLIR][SPIRVToLLVM] Indentation and style fix in tests

This is a first patch that sweeps over tests to fix
indentation (tabs to spaces). It also adds label checks and
removes redundant matching of `%{{.*}} = `.

The following tests have been fixed:
- arithmetic-ops-to-llvm
- bitwise-ops-to-llvm
- cast-ops-to-llvm
- comparison-ops-to-llvm
- logical-ops-to-llvm (renamed to match the rest)

Reviewed By: ftynse

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

4 years ago[JumpThreading] Update test freeze.ll; NFC
Juneyoung Lee [Tue, 4 Aug 2020 11:27:26 +0000 (20:27 +0900)]
[JumpThreading] Update test freeze.ll; NFC

4 years ago[AArch64][SVE] Add missing unwind info for SVE registers.
Sander de Smalen [Tue, 4 Aug 2020 10:10:32 +0000 (11:10 +0100)]
[AArch64][SVE] Add missing unwind info for SVE registers.

This patch adds a CFI entry for each SVE callee saved register
that needs unwind info at an offset from the CFA. The offset is
a DWARF expression because the offset is partly scalable.

The CFI entries only cover a subset of the SVE callee-saves and
only encodes the lower 64-bits, thus implementing the lowest
common denominator ABI. Existing unwinders may support VG but
only restore the lower 64-bits.

Reviewed By: efriedma

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

4 years ago[AArch64][SVE] Fix CFA calculation in presence of SVE objects.
Sander de Smalen [Tue, 4 Aug 2020 09:58:47 +0000 (10:58 +0100)]
[AArch64][SVE] Fix CFA calculation in presence of SVE objects.

The CFA is calculated as (SP/FP + offset), but when there are
SVE objects on the stack the SP offset is partly scalable and
should instead be expressed as the DWARF expression:

     SP + offset + scalable_offset * VG

where VG is the Vector Granule register, containing the
number of 64bits 'granules' in a scalable vector.

Reviewed By: efriedma

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

4 years ago[YAMLTraits] Fix mapping <none> value that followed by comments.
Xing GUO [Tue, 4 Aug 2020 08:47:38 +0000 (16:47 +0800)]
[YAMLTraits] Fix mapping <none> value that followed by comments.

When mapping an optional value, if the value is <none> and followed
by comments, there will be a parsing error. This patch helps fix this
issue.

e.g.,

When mapping the following YAML,

```
Sections:
  - Name:  blah
    Type:  SHT_foo
    Flags: [[FLAGS=<none>]] ## some comments.
```

the raw value of `ScalarNode` is "<none> " rather than "<none>". We need
to remove the spaces.

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

4 years ago[SVE] Replace remaining _MERGE_OP1 nodes with _PRED variants.
Paul Walker [Tue, 4 Aug 2020 10:19:17 +0000 (11:19 +0100)]
[SVE] Replace remaining _MERGE_OP1 nodes with _PRED variants.

This is the final bit of work to relax the register allocation
requirements when code generating normal LLVM IR, which rarely
care about the result of inactive lanes. By using _PRED nodes
we can make better use of SVE's reversed instructions.

Also removes a redundant parameter from the min/max tests.

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

4 years ago[JumpThreading] Remove cast's constraint
Juneyoung Lee [Tue, 4 Aug 2020 09:26:56 +0000 (18:26 +0900)]
[JumpThreading] Remove cast's constraint

As discussed in D84949, this removes the constraint to cast since it does not
cause compile time degradation.

Reviewed By: lebedev.ri

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

4 years ago[JumpThreading] Add a test for simplification of cast of any op; NFC
Juneyoung Lee [Tue, 4 Aug 2020 09:15:00 +0000 (18:15 +0900)]
[JumpThreading] Add a test for simplification of cast of any op; NFC

4 years ago[lldb] fix typo
Luboš Luňák [Tue, 4 Aug 2020 09:58:37 +0000 (11:58 +0200)]
[lldb] fix typo

4 years ago[llvm-readobj] - A third attempt to fix BB.
Georgii Rymar [Tue, 4 Aug 2020 09:40:10 +0000 (12:40 +0300)]
[llvm-readobj] - A third attempt to fix BB.

http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/15718/steps/build%20stage%201/logs/stdio:

FAILED: /usr/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/llvm-readobj -I/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj -Iinclude -I/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/include -march=broadwell -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3     -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o -MF tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o.d -o tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o -c /home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp: In function â€˜llvm::Expected<const llvm::object::Elf_Mips_Options<ELFT>*> readMipsOptions(const uint8_t*, llvm::ArrayRef<unsigned char>&, bool&)’:
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3374:12: error: parse error in template argument list
     if (O->size < ExpectedSize)

Note: I played with godbolt.org and was able to catch the similar "error in template argument list" error when used gcc 4.9.0 with this code.
Fix: try to introduce a variable to store `O->size`, it helped to me in godbolt.

4 years ago[BasicAA] Enable -basic-aa-recphi by default
David Green [Tue, 4 Aug 2020 09:43:42 +0000 (10:43 +0100)]
[BasicAA] Enable -basic-aa-recphi by default

This option was added a while back, to help improve AA around pointer
phi loops. It looks for phi(gep(phi, const), x) loops, checking if x can
then prove more precise aliasing info.

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

4 years ago[ARM] Generated SSAT and USAT instructions with shift
Meera Nakrani [Tue, 4 Aug 2020 09:38:17 +0000 (09:38 +0000)]
[ARM] Generated SSAT and USAT instructions with shift

Added patterns so that both SSAT and USAT instructions are generated with shifts. Added corresponding regression tests.

Differential Review: https://reviews.llvm.org/D85120

4 years agoRevert rG66e7dce714fab "Revert "[X86][SSE] Shuffle combine blends to OR(X,Y) if the...
Simon Pilgrim [Tue, 4 Aug 2020 09:32:27 +0000 (10:32 +0100)]
Revert rG66e7dce714fab "Revert "[X86][SSE] Shuffle combine blends to OR(X,Y) if the relevant elements are known zero.""

[X86][SSE] Shuffle combine blends to OR(X,Y) if the relevant elements are known zero (REAPPLIED)

This allows us to remove the (depth violating) code in getFauxShuffleMask where we were combining the OR(SHUFFLE,SHUFFLE) shuffle inputs as well, and not just the OR().

This is a minor step toward being able to shuffle combine from/to SELECT/BLENDV as a faux shuffle.

Reapplied with fixed signed/unsigned comparisons.

4 years ago[AArch64] Consider instruction-level contract FMFs in combiner patterns.
Florian Hahn [Tue, 4 Aug 2020 09:25:16 +0000 (10:25 +0100)]
[AArch64] Consider instruction-level contract FMFs in combiner patterns.

Currently, instruction level fast math flags are not considered when
generating patterns for the machine combiner.

This currently leads to some missed opportunities to generate FMAs in
combination with `#pragma clang fp contract (fast)`.

For example, when building the example below with -O3 for AArch64, no
FMADD is generated. If built with -O2 and the DAGCombiner is used
instead of the MachineCombiner for FMAs, an FMADD is generated.

With this patch, the same code is generated in both cases.

    float madd_contract(float a, float b, float c) {
    #pragma clang fp contract (fast)
      return (a * b) + c;
    }

Reviewed By: dmgreen

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

4 years ago[SCEV] Consolidate some smin/smax folding tests into single test file.
Florian Hahn [Tue, 4 Aug 2020 08:55:38 +0000 (09:55 +0100)]
[SCEV] Consolidate some smin/smax folding tests into single test file.

This patch moves a few spread out smin/smax tests to smin-smax-folds.ll
and adds additional test cases that expose further potential for
folds.

4 years agoPartially revert "[cmake] Make MSVC generate appropriate __cplusplus macro definition"
Tatyana Krasnukha [Mon, 3 Aug 2020 11:30:12 +0000 (14:30 +0300)]
Partially revert "[cmake] Make MSVC generate appropriate __cplusplus macro definition"

The /Zc:__cplusplus option fixes GTEST_LANG_CXX11 value but not GTEST_HAS_TR1_TUPLE,
so we still need to force the latter off.

Still pass the option since it is required by https://reviews.llvm.org/D78186 too.

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

4 years ago[X86][AVX] Add v8f32 'reverse' HADD(SHUFFLE,SHUFFLE) test coverage
Simon Pilgrim [Tue, 4 Aug 2020 09:16:20 +0000 (10:16 +0100)]
[X86][AVX] Add v8f32 'reverse' HADD(SHUFFLE,SHUFFLE) test coverage

Shows missed opportunity for HADD on AVX1 targets with a relatively simple lane crossing post shuffle

4 years ago[llvm-readobj] - A second attempt to fix BB.
Georgii Rymar [Tue, 4 Aug 2020 09:13:43 +0000 (12:13 +0300)]
[llvm-readobj] - A second attempt to fix BB.

The failure is:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/15711/steps/build%20stage%201/logs/stdio

FAILED: /usr/bin/c++  -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/llvm-readobj -I/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj -Iinclude -I/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/include -march=broadwell -fPIC -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -fdiagnostics-color -ffunction-sections -fdata-sections -O3     -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o -MF tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o.d -o tools/llvm-readobj/CMakeFiles/llvm-readobj.dir/ELFDumper.cpp.o -c /home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp: In function â€˜llvm::Expected<const llvm::object::Elf_Mips_Options<ELFT>*> readMipsOptions(const uint8_t*, llvm::ArrayRef<unsigned char>&, bool&)’:
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3373:12: error: parse error in template argument list
     if (O->size < ExpectedSize)
            ^
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp: In instantiation of â€˜llvm::Expected<const llvm::object::Elf_Mips_Options<ELFT>*> readMipsOptions(const uint8_t*, llvm::ArrayRef<unsigned char>&, bool&) [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, true>; uint8_t = unsigned char]’:
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3400:30:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printMipsOptions() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, true>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:2878:21:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printArchSpecificInfo() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, true>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:6999:1:   required from here
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3373:5: error: â€˜size’ is not a member template function
     if (O->size < ExpectedSize)
     ^
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp: In instantiation of â€˜llvm::Expected<const llvm::object::Elf_Mips_Options<ELFT>*> readMipsOptions(const uint8_t*, llvm::ArrayRef<unsigned char>&, bool&) [with ELFT = llvm::object::ELFType<(llvm::support::endianness)1u, true>; uint8_t = unsigned char]’:
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3400:30:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printMipsOptions() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)1u, true>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:2878:21:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printArchSpecificInfo() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)1u, true>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:6999:1:   required from here
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3373:5: error: â€˜size’ is not a member template function
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp: In instantiation of â€˜llvm::Expected<const llvm::object::Elf_Mips_Options<ELFT>*> readMipsOptions(const uint8_t*, llvm::ArrayRef<unsigned char>&, bool&) [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, false>; uint8_t = unsigned char]’:
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3400:30:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printMipsOptions() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, false>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:2878:21:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printArchSpecificInfo() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, false>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:6999:1:   required from here
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3373:5: error: â€˜size’ is not a member template function
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp: In instantiation of â€˜llvm::Expected<const llvm::object::Elf_Mips_Options<ELFT>*> readMipsOptions(const uint8_t*, llvm::ArrayRef<unsigned char>&, bool&) [with ELFT = llvm::object::ELFType<(llvm::support::endianness)1u, false>; uint8_t = unsigned char]’:
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3400:30:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printMipsOptions() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)1u, false>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:2878:21:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printArchSpecificInfo() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)1u, false>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:6999:1:   required from here
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3373:5: error: â€˜size’ is not a member template function
ninja: build stopped: subcommand failed.

Fix: stop using `auto` for `O` variable.

4 years ago[analyzer] Model iterator random incrementation symmetrically
Endre Fülöp [Tue, 21 Jul 2020 07:31:42 +0000 (09:31 +0200)]
[analyzer] Model iterator random incrementation symmetrically

Summary:
In case a pointer iterator is incremented in a binary plus expression
(operator+), where the iterator is on the RHS, IteratorModeling should
now detect, and track the resulting value.

Reviewers: Szelethus, baloghadamsoftware

Reviewed By: baloghadamsoftware

Subscribers: rnkovacs, whisperity, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, steakhal, martong, ASDenysPetrov, cfe-commits

Tags: #clang

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

4 years ago[llvm-readobj] - An attempt to fix BB.
Georgii Rymar [Tue, 4 Aug 2020 08:56:58 +0000 (11:56 +0300)]
[llvm-readobj] - An attempt to fix BB.

http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/15710/steps/build%20stage%201/logs/stdio
fails with:

/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp: In function â€˜llvm::Expected<const llvm::object::Elf_Mips_Options<ELFT>*> readMipsOptions(const uint8_t*, llvm::ArrayRef<unsigned char>&, bool&)’:
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3373:19: error: the value of â€˜ExpectedSize’ is not usable in a constant expression
     if (O->size < ExpectedSize)
                   ^
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3369:10: note: â€˜size_t ExpectedSize’ is not const
   size_t ExpectedSize =
          ^
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3373:12: error: parse error in template argument list
     if (O->size < ExpectedSize)
            ^
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp: In instantiation of â€˜llvm::Expected<const llvm::object::Elf_Mips_Options<ELFT>*> readMipsOptions(const uint8_t*, llvm::ArrayRef<unsigned char>&, bool&) [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, true>; uint8_t = unsigned char]’:
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3400:30:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printMipsOptions() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, true>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:2878:21:   required from â€˜void {anonymous}::ELFDumper<ELFT>::printArchSpecificInfo() [with ELFT = llvm::object::ELFType<(llvm::support::endianness)0u, true>]’
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:6999:1:   required from here
/home/ssglocal/clang-cmake-x86_64-avx2-linux/clang-cmake-x86_64-avx2-linux/llvm/llvm/tools/llvm-readobj/ELFDumper.cpp:3373:5: error: â€˜size’ is not a member template function

Fix: add 2 `const` words to variables.

4 years ago[llvm-readobj/readelf] - Refine the implementation of printMipsOptions().
Georgii Rymar [Wed, 29 Jul 2020 14:06:44 +0000 (17:06 +0300)]
[llvm-readobj/readelf] - Refine the implementation of printMipsOptions().

`printMipsOptions()` and the test related has the following issues currently:

1) It does not check the value of Elf_Mips_Options<ELFT>::size field.
2) For ODK_REGINFO options it is possible to read past the end of buffer,
   because there is no check against the `sizeof(Elf_Mips_RegInfo<ELFT>)`.
3) The error about the broken size is just printed to the standard output.
4) The binary input is used for the test.
5) There is no testing for multiple options in the .MIPS.options section,
   though the code supports it.
6) Only llvm-readobj is tested, but not llvm-readelf.
7) "Unsupported MIPS options tag" message does not reveal the tag ID/name.

This patch fixes all of these points.

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

4 years ago[DebugInfo][unittest] Use YAML to generate the .debug_loclists section.
Xing GUO [Tue, 4 Aug 2020 08:37:20 +0000 (16:37 +0800)]
[DebugInfo][unittest] Use YAML to generate the .debug_loclists section.

DWARFYAML supports generating the .debug_loclists section. We can use it
to simplify tests.

Reviewed By: jhenderson, grimar

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

4 years ago[MLIR] Add an integration test for 2 D vector.transfer_read
Nicolas Vasilache [Tue, 4 Aug 2020 08:28:11 +0000 (04:28 -0400)]
[MLIR] Add an integration test for 2 D vector.transfer_read

Added a "clone" of the 1D vector's test_transfer_read and added a second dimensionality. The test is not as generic as I would like it to be, because more generic versions appear to break the compiler or the runtime at this stage. As bug are fixed, I will be happy to add another more complete test.

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

4 years ago[clang-tidy] Fix regression in RenamerClangTidy
Nathan James [Tue, 4 Aug 2020 08:27:01 +0000 (09:27 +0100)]
[clang-tidy] Fix regression in RenamerClangTidy

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

4 years ago[llvm-readobj] - Simplify findSectionByName(). NFCI.
Georgii Rymar [Mon, 3 Aug 2020 14:21:58 +0000 (17:21 +0300)]
[llvm-readobj] - Simplify findSectionByName(). NFCI.

It turns out that findSectionByName can return
const Elf_Shdr * instead of Expected<>, because its
code never returns an error currently (it reports warnings instead).

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

4 years ago[JumpThreading] Merge/rename thread-two-bbsN.ll tests; NFC
Juneyoung Lee [Tue, 4 Aug 2020 08:07:28 +0000 (17:07 +0900)]
[JumpThreading] Merge/rename thread-two-bbsN.ll tests; NFC

4 years ago[NFC] [PowerPC] Refactor fp/int conversion lowering
Qiu Chaofan [Tue, 4 Aug 2020 07:48:16 +0000 (15:48 +0800)]
[NFC] [PowerPC] Refactor fp/int conversion lowering

For FP_TO_INT and INT_TO_FP lowering, we have direct-move and
non-direct-move methods. But they share some conversion logic, so we can
reduce redundant code by introducing new methods.

Reviewed By: steven.zhang

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

4 years ago[JumpThreading] Don't limit the type of an operand
Juneyoung Lee [Thu, 30 Jul 2020 14:46:26 +0000 (23:46 +0900)]
[JumpThreading] Don't limit the type of an operand

Compared to the optimized code with branch conditions never frozen,
limiting the type of freeze's operand causes generation of suboptimal code in
some cases.
I would like to suggest removing the constraint, as this patch does.
If the number of freeze instructions becomes significant, this can be revisited.

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

4 years ago[mlir][Linalg] Conv ops lowering to std calls added.
Jakub Lichman [Mon, 3 Aug 2020 07:57:06 +0000 (07:57 +0000)]
[mlir][Linalg] Conv ops lowering to std calls added.

Lowering of newly defined Conv ops in TC syntax to standard
dialect is not supported and therefore this commit adds support
for it.

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

4 years ago[clang] Include trailing-requires-clause in FunctionDecl's source range
Nathan Ridge [Mon, 3 Aug 2020 07:21:01 +0000 (03:21 -0400)]
[clang] Include trailing-requires-clause in FunctionDecl's source range

Fixes https://github.com/clangd/clangd/issues/476

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

4 years ago[YAMLParser] Fix a typo: iff -> if. NFC.
Xing GUO [Tue, 4 Aug 2020 04:42:09 +0000 (12:42 +0800)]
[YAMLParser] Fix a typo: iff -> if. NFC.

4 years ago[PGO] Use multiple comdat groups for COFF
Fangrui Song [Tue, 4 Aug 2020 04:32:44 +0000 (21:32 -0700)]
[PGO] Use multiple comdat groups for COFF

D84723 caused multiple definition issues (related to comdat) on Windows:
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/67465

4 years ago[X86][AVX512] Fix build fail after D81548
Wang, Pengfei [Tue, 4 Aug 2020 03:39:21 +0000 (11:39 +0800)]
[X86][AVX512] Fix build fail after D81548

Test function mask_cmp_128 failed during ISEL
LLVM ERROR: Cannot select: t37: v8i1 = X86ISD::KSHIFTL t48, TargetConstant:i8<4>
due to v8i1 only available under AVX512DQ.

Reviewed By: RKSimon

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

4 years ago[PowerPC] mark r+i as legal address mode for vector type after pwr9
Chen Zheng [Tue, 4 Aug 2020 03:46:52 +0000 (23:46 -0400)]
[PowerPC] mark r+i as legal address mode for vector type after pwr9

Reviewed By: steven.zhang

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

4 years ago[AMDGPU] Make GCNRegBankReassign assign based on subreg banks
Carl Ritson [Tue, 4 Aug 2020 03:20:12 +0000 (12:20 +0900)]
[AMDGPU] Make GCNRegBankReassign assign based on subreg banks

When scavenging consider the sub-register of the source operand
to determine the bank of a candidate register (not just sub0).
Without this it is possible to introduce an infinite loop,
e.g. $sgpr15_sgpr16_sgpr17 can be assigned for a conflict between
$sgpr0 and SGPR_96:sub1.

Reviewed By: rampitec

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

4 years agoAdd test utility 'split-file'
Fangrui Song [Mon, 3 Aug 2020 17:17:55 +0000 (10:17 -0700)]
Add test utility 'split-file'

See https://lists.llvm.org/pipermail/llvm-dev/2020-July/143373.html
"[llvm-dev] Multiple documents in one test file" for some discussions.

This patch has explored several alternatives. The current semantics are similar to
what @dblaikie proposed.
`split-file filename output` splits the input file into multiple parts separated by
regex `^(.|//)--- filename` and write each part to the file `output/filename`
(`filename` can include path separators).

Use case A (organizing input of different formats (e.g. linker
script+assembly) in one file).

```
# RUN: split-file %s %t
# RUN: llvm-mc %t/asm -o %t.o
# RUN: ld.lld -T %t/lds %t.o -o %t
This is sometimes better than the %S/Inputs/ approach because the user
can see the auxiliary files immediately and don't have to open another file.

# asm
...
# lds
...
```

Use case B (for utilities which don't have built-in input splitting
feature):

```
// RUN: split-file %s %t
// RUN: llc < %t/1.ll | FileCheck %s --check-prefix=CASE1
// RUN: llc < %t/2.ll | FileCheck %s --check-prefix=CASE2
Combing tests prudently can improve readability.
For example, when testing parsing errors if the recovery mechanism isn't possible,
grouping the tests in one file can more readily see test coverage/strategy.

//--- 1.ll
...
//--- 2.ll
...
```

Since this is a new utility, there is no git history concerns for
UpperCase variable names. I use lowerCase variable names like mlir/lld.

Reviewed By: jhenderson, lattner

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

4 years ago[PGO] Move __profc_ and __profvp_ from their own comdat groups to __profd_'s comdat...
Fangrui Song [Tue, 4 Aug 2020 03:35:50 +0000 (20:35 -0700)]
[PGO] Move __profc_ and __profvp_ from their own comdat groups to __profd_'s comdat group

D68041 placed `__profc_`,  `__profd_` and (if exists) `__profvp_` in different comdat groups.
There are some issues:

* Cost: one or two additional section headers (`.group` section(s)): 64 or 128 bytes on ELF64.
* `__profc_`,  `__profd_` and (if exists) `__profvp_` should be retained or
  discarded. Placing them into separate comdat groups is conceptually inferior.
* If the prevailing group does not include `__profvp_` (value profiling not
  used) but a non-prevailing group from another translation unit has `__profvp_`
  (the function is inlined into another and triggers value profiling), there
  will be a stray `__profvp_` if --gc-sections is not enabled.
  This has been fixed by 3d6f53018f845e893ad34f64ff2851a2e5c3ba1d.

Actually, we can reuse an existing symbol (we choose `__profd_`) as the group
signature to avoid a string in the string table (the sole reason that D68041
could improve code size is that `__profv_` was an otherwise unused symbol which
wasted string table space). This saves one or two section headers.

For a -DCMAKE_BUILD_TYPE=Release -DLLVM_BUILD_INSTRUMENTED=IR build, `ninja
clang lld`, the patch has saved 10.5MiB (2.2%) for the total .o size.

Reviewed By: davidxl

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

4 years ago[SimpleLoopUnswitch][NFC] Add option to always drop make.implicit metadata in non...
Max Kazantsev [Tue, 4 Aug 2020 03:16:40 +0000 (10:16 +0700)]
[SimpleLoopUnswitch][NFC] Add option to always drop make.implicit metadata in non-trivial unswitching and save compile time

We might want this if we find out that using of MustExecute analysis is too expensive.
By default we do the analysis because its complexity does not exceed the complexity
of whole loop copying in unswitching. Follow-up for D84925.

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

4 years ago[lldb/Test] Fix skipTestIfFn for fucntions that return a value
Jonas Devlieghere [Tue, 4 Aug 2020 02:56:10 +0000 (19:56 -0700)]
[lldb/Test] Fix skipTestIfFn for fucntions that return a value

Sometimes the decorator is used on a common function rather than the
test method, which can return a value. This fails with decorators that
use skipTestIfFn under the hood.

4 years agoTemporarily revert "[test] Exit with an error if no tests are run."
Jordan Rupprecht [Tue, 4 Aug 2020 01:37:50 +0000 (18:37 -0700)]
Temporarily revert "[test] Exit with an error if no tests are run."

This reverts commit adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d. It surprisingly fails on a windows build bot: http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/18009

Will reland after some investigation and/or after adding some extra logging to help debug the issue.

4 years ago[SCEVExpander][PowerPC]clear scev rewriter before deleting instructions.
Chen Zheng [Mon, 3 Aug 2020 12:37:52 +0000 (08:37 -0400)]
[SCEVExpander][PowerPC]clear scev rewriter before deleting instructions.

Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D85130

4 years ago[flang] Implement runtime support for INQUIRE statements
peter klausler [Mon, 3 Aug 2020 18:35:29 +0000 (11:35 -0700)]
[flang] Implement runtime support for INQUIRE statements

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

4 years ago[Attributor][NFC] Clang format
Shinji Okumura [Mon, 3 Aug 2020 23:59:23 +0000 (08:59 +0900)]
[Attributor][NFC] Clang format

4 years agoOpenMP: Fix typo variabls -> variables
David Blaikie [Mon, 3 Aug 2020 23:37:25 +0000 (16:37 -0700)]
OpenMP: Fix typo variabls -> variables

4 years ago[ELF] Add --dependency-file option
Petr Hosek [Wed, 24 Jun 2020 03:00:04 +0000 (20:00 -0700)]
[ELF] Add --dependency-file option

Clang and GCC have a feature (-MD flag) to create a dependency file
in a format that build systems such as Make or Ninja can read, which
specifies all the additional inputs such .h files.

This change introduces the same functionality to lld bringing it to
feature parity with ld and gold which gained this feature recently.
See https://sourceware.org/bugzilla/show_bug.cgi?id=22843 for more
details and discussion.

The implementation corresponds to -MD -MP compiler flag where the
generated dependency file also includes phony targets which works
around the errors where the dependency is removed. This matches the
format used by ld and gold.

Fixes PR42806

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

4 years agoFix use-after-scope in 7209f83112db caught by the sanitizer bots
Daniel Sanders [Mon, 3 Aug 2020 23:53:41 +0000 (16:53 -0700)]
Fix use-after-scope in 7209f83112db caught by the sanitizer bots

4 years ago[flang] Defer "next input record" processing until handlers established
peter klausler [Mon, 3 Aug 2020 18:31:13 +0000 (11:31 -0700)]
[flang] Defer "next input record" processing until handlers established

External input was detecting "end of file" conditions in
BeginExternal...Input() and BeginUnformattedInput() routines
before EnableHandlers() could have been called.  Defer the
"start next record" processing to the input data item
handlers (and EndIoStatement() for when there are no data
items).

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

4 years ago[flang] Acquire file accessibility, size, positioning
peter klausler [Mon, 3 Aug 2020 18:29:15 +0000 (11:29 -0700)]
[flang] Acquire file accessibility, size, positioning

Extend the raw file wrapper to get accessibility, positioning,
and size information.  This is needed for INQUIRE (to follow).

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

4 years ago[SVE] Remove bad calls to VectorType::getNumElements() from X86
Christopher Tetreault [Mon, 3 Aug 2020 23:15:45 +0000 (16:15 -0700)]
[SVE] Remove bad calls to VectorType::getNumElements() from X86

Reviewed By: RKSimon

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

4 years ago[test] Exit with an error if no tests are run.
Jordan Rupprecht [Mon, 3 Aug 2020 23:30:41 +0000 (16:30 -0700)]
[test] Exit with an error if no tests are run.

If the test suite is misconfigured when it's run (a bad regexp, wrong test directory, etc.), the test suite may not discover any tests. When this happens, the test runner exits happily because no tests failed:

```
Ran 0 tests in 0.000s
RESULT: PASSED (0 passes, 0 failures, 0 errors, 0 skipped, 0 expected failures, 0 unexpected successes)
```

Change this to return an error so the misconfiguration can be more easily detected. Verified that `lldb-dotest -p TestDoesNotExist.py` successfully fails.

Reviewed By: JDevlieghere

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

4 years ago[clang-tidy][NFC] Use correct size call for reserve
Nathan James [Mon, 3 Aug 2020 23:31:19 +0000 (00:31 +0100)]
[clang-tidy][NFC] Use correct size call for reserve

4 years agoRemove unneeded RoundDefault enumerator, and fix spelling in comments
peter klausler [Mon, 3 Aug 2020 18:11:39 +0000 (11:11 -0700)]
Remove unneeded RoundDefault enumerator, and fix spelling in comments

4 years ago[flang] Handle spaces (more) correctly in REAL input
peter klausler [Mon, 3 Aug 2020 18:20:35 +0000 (11:20 -0700)]
[flang] Handle spaces (more) correctly in REAL input

Fixes problems in FCVS test fm110.f.
Add more comments, too.

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

4 years ago[MC] Fix memory leak when allocating MCInst with bump allocator
hgreving [Wed, 29 Jul 2020 23:48:03 +0000 (16:48 -0700)]
[MC] Fix memory leak when allocating MCInst with bump allocator

Adds the function createMCInst() to MCContext that creates a MCInst using
a typed bump alloctor.

MCInst contains a SmallVector<MCOperand, 8>. The SmallVector is POD only
for <= 8 operands. The default untyped bump pointer allocator of MCContext
does not delete the MCInst, so if the SmallVector grows, it's a leak.

This fixes https://bugs.llvm.org/show_bug.cgi?id=46900.

4 years ago[VE] Extend integer arguments and return values smaller than 64 bits
Kazushi (Jam) Marukawa [Sat, 25 Jul 2020 07:31:07 +0000 (16:31 +0900)]
[VE] Extend integer arguments and return values smaller than 64 bits

In order to follow NEC Aurora SX VE ABI correctly, change to sign/zero
extend integer arguments and return values smaller than 64 bits in clang.
Also update regression test.

Reviewed By: simoll

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

4 years ago[SVE] Remove bad call to VectorType::getNumElements() from AMDGPU
Christopher Tetreault [Mon, 3 Aug 2020 22:42:13 +0000 (15:42 -0700)]
[SVE] Remove bad call to VectorType::getNumElements() from AMDGPU

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

4 years ago[SVE] Remove bad call to VectorType::getNumElements() from ARM
Christopher Tetreault [Mon, 3 Aug 2020 22:16:16 +0000 (15:16 -0700)]
[SVE] Remove bad call to VectorType::getNumElements() from ARM

Reviewed By: dmgreen

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

4 years ago[UBSan] Increase robustness of tests
Julian Lettner [Mon, 3 Aug 2020 20:21:08 +0000 (13:21 -0700)]
[UBSan] Increase robustness of tests

These UBSan tests assert the absence of runtime errors via `count 0`,
which means "expect no output".  This fails the test unnecessarily in
some environments (e.g., iOS simulator in our case).  Alter the test to
be a bit more specific and "expect no error" instead of "expect no
output".

rdar://65503408

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

4 years ago[NFC][ARM] Silence unused variable in release builds
Jordan Rupprecht [Mon, 3 Aug 2020 22:21:44 +0000 (15:21 -0700)]
[NFC][ARM] Silence unused variable in release builds

4 years ago[SVE] Remove bad calls to VectorType::getNumElements() from PowerPC
Christopher Tetreault [Mon, 3 Aug 2020 20:35:49 +0000 (13:35 -0700)]
[SVE] Remove bad calls to VectorType::getNumElements() from PowerPC

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

4 years agoReland D61689 Change -gz and -Wa,--compress-debug-sections to use gABI compression...
Fangrui Song [Mon, 3 Aug 2020 22:11:28 +0000 (15:11 -0700)]
Reland D61689 Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED) with integrated assembler

This fixes an inconsistency: clang -c -gz -fno-integrated-as means SHF_COMPRESSED
while clang -c -gz -fintegrated-as means zlib-gnu.

---

Since July 15, 2015 (binutils-gdb commit
19a7fe52ae3d0971e67a134bcb1648899e21ae1c, included in 2.26), gas
--compress-debug-sections=zlib (gcc -gz) means zlib-gabi:
SHF_COMPRESSED. Before that GCC/binutils used zlib-gnu (.zdebug).

clang's -gz was introduced in rC306115 (Jun 2017) to indicate zlib-gnu. It
is 2020 now and it is not unreasonable to assume users of the new
feature to have new linkers (ld.bfd/gold >= 2.26, lld >= rLLD273661).

Change clang's default accordingly to improve standard conformance.
zlib-gnu becomes out of fashion and gets poorer toolchain support.
Its mangled names confuse tools and are more likely to cause problems.

Reviewed By: compnerd

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