platform/upstream/llvm.git
3 years ago[ARM] Extra gather scatter tailpred test. NFC
David Green [Fri, 28 Aug 2020 16:14:40 +0000 (17:14 +0100)]
[ARM] Extra gather scatter tailpred test. NFC

3 years ago[PowerPC] Implemented Vector Load with Zero and Signed Extend Builtins
Albion Fung [Fri, 28 Aug 2020 16:27:07 +0000 (11:27 -0500)]
[PowerPC] Implemented Vector Load with Zero and Signed Extend Builtins

This patch implements the builtins for Vector Load with Zero and Signed Extend Builtins (lxvr_x for b, h, w, d), and adds the appropriate test cases for these builtins. The builtins utilize the vector load instructions itnroduced with ISA 3.1.

Differential Revision:  https://reviews.llvm.org/D82502#inline-797941

3 years ago[Statepoint] Always spill base pointer.
Denis Antrushin [Thu, 27 Aug 2020 12:51:30 +0000 (19:51 +0700)]
[Statepoint] Always spill base pointer.

There is a subtle problem with new statepoint lowering scheme
when base and pointers are the same (see PR46917 for more context):

%1 = STATEPOINT ... %0, %0(tied-def 0)...

if, for some reason, register allocator desides to put two instances
of %0 into two different objects (registers or spill slots), we may
end up with

$reg3 = STATEPOINT ... $reg2, $reg1(tied-def 0)...

and nothing will prevent later passes to sink uses of $reg2 below
statepoint, which is incorrect.

As a short term solution, always put base pointers on stack during
lowering.
A longer term solution may be to rework MIR statepoint format to
avoid GC pointer duplication in statepoint argument list.

Reviewed By: reames

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

3 years ago[OpenMP] Fixed wrong test command in the test private_mapping.c
Shilei Tian [Fri, 28 Aug 2020 16:19:35 +0000 (12:19 -0400)]
[OpenMP] Fixed wrong test command in the test private_mapping.c

The test command in `private_mapping.c` was set to expect failure by mistake. It is fixed in this patch.

Reviewed By: ABataev

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

3 years ago[GlobalISel] fix a compilation error with gcc 6.3.0
Yonghong Song [Fri, 28 Aug 2020 16:07:20 +0000 (09:07 -0700)]
[GlobalISel] fix a compilation error with gcc 6.3.0

With gcc 6.3.0, I hit the following compilation error:
  ../lib/CodeGen/GlobalISel/Combiner.cpp: In member function
      ‘bool llvm::Combiner::combineMachineInstrs(llvm::MachineFunction&,
       llvm::GISelCSEInfo*)’:
  ../lib/CodeGen/GlobalISel/Combiner.cpp:156:54: error: suggest parentheses
       around ‘&&’ within ‘||’ [-Werror=parentheses]
     assert(!CSEInfo || !errorToBool(CSEInfo->verify()) &&
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
                            "CSEInfo is not consistent. Likely missing calls to "
                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            "observer on mutations");

Fix the code as suggested by the compiler.

3 years ago[DAGCombine] Don't delete the node if it has uses immediately
QingShan Zhang [Fri, 28 Aug 2020 15:21:47 +0000 (15:21 +0000)]
[DAGCombine] Don't delete the node if it has uses immediately

This is the follow up patch for https://reviews.llvm.org/D86183 as we miss to delete the node if NegX == NegY, which has use after we create the node.
```
    if (NegX && (CostX <= CostY)) {
      Cost = std::min(CostX, CostZ);
      RemoveDeadNode(NegY);
      return DAG.getNode(Opcode, DL, VT, NegX, Y, NegZ, Flags);  #<-- NegY is used here if NegY == NegX.
    }
```

Reviewed By: spatel

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

3 years agoReland "[CodeGen][AArch64] Support arm_sve_vector_bits attribute"
Cullen Rhodes [Tue, 11 Aug 2020 14:30:02 +0000 (14:30 +0000)]
Reland "[CodeGen][AArch64] Support arm_sve_vector_bits attribute"

This relands D85743 with a fix for test
CodeGen/attr-arm-sve-vector-bits-call.c that disables the new pass
manager with '-fno-experimental-new-pass-manager'. Test was failing due
to IR differences with the new pass manager which broke the Fuchsia
builder [1]. Reverted in 2e7041f.

[1] http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/10375

Original summary:

This patch implements codegen for the 'arm_sve_vector_bits' type
attribute, defined by the Arm C Language Extensions (ACLE) for SVE [1].
The purpose of this attribute is to define vector-length-specific (VLS)
versions of existing vector-length-agnostic (VLA) types.

VLSTs are represented as VectorType in the AST and fixed-length vectors
in the IR everywhere except in function args/return. Implemented in this
patch is codegen support for the following:

  * Implicit casting between VLA <-> VLS types.
  * Coercion of VLS types in function args/return.
  * Mangling of VLS types.

Casting is handled by the CK_BitCast operation, which has been extended
to support the two new vector kinds for fixed-length SVE predicate and
data vectors, where the cast is implemented through memory rather than a
bitcast which is unsupported. Implementing this as a normal bitcast
would require relaxing checks in LLVM to allow bitcasting between
scalable and fixed types. Another option was adding target-specific
intrinsics, although codegen support would need to be added for these
intrinsics. Given this, casting through memory seemed like the best
approach as it's supported today and existing optimisations may remove
unnecessary loads/stores, although there is room for improvement here.

Coercion of VLSTs in function args/return from fixed to scalable is
implemented through the AArch64 ABI in TargetInfo.

The VLA and VLS types are defined by the ACLE to map to the same
machine-level SVE vectors. VLS types are mangled in the same way as:

  __SVE_VLS<typename, unsigned>

where the first argument is the underlying variable-length type and the
second argument is the SVE vector length in bits. For example:

  #if __ARM_FEATURE_SVE_BITS==512
  // Mangled as 9__SVE_VLSIu11__SVInt32_tLj512EE
  typedef svint32_t vec __attribute__((arm_sve_vector_bits(512)));
  // Mangled as 9__SVE_VLSIu10__SVBool_tLj512EE
  typedef svbool_t pred __attribute__((arm_sve_vector_bits(512)));
  #endif

The latest ACLE specification (00bet5) does not contain details of this
mangling scheme, it will be specified in the next revision.  The
mangling scheme is otherwise defined in the appendices to the Procedure
Call Standard for the Arm Architecture, see [2] for more information.

[1] https://developer.arm.com/documentation/100987/latest
[2] https://github.com/ARM-software/abi-aa/blob/master/aapcs64/aapcs64.rst#appendix-c-mangling

Reviewed By: efriedma

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

3 years ago[LLD][PowerPC] Add a pc-rel based long branch thunk
Victor Huang [Fri, 28 Aug 2020 15:40:48 +0000 (10:40 -0500)]
[LLD][PowerPC] Add a pc-rel based long branch thunk

In this patch, a pc-rel based long branch thunk is added for the local
call protocol that caller and callee does not use TOC.

Reviewed By: sfertile, nemanjai

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

3 years agoFix Windows x86 compilation after a6a37a2fcd2a8048a75bd0d8280497ed89d73224
Alexandre Ganea [Fri, 28 Aug 2020 14:53:20 +0000 (10:53 -0400)]
Fix Windows x86 compilation after a6a37a2fcd2a8048a75bd0d8280497ed89d73224

3 years agoFix more build failures caused by f4257c5832aa51e960e7351929ca3d37031985b7
David Sherwood [Fri, 28 Aug 2020 14:08:46 +0000 (15:08 +0100)]
Fix more build failures caused by f4257c5832aa51e960e7351929ca3d37031985b7

MLIR build failed after ElementCount refactoring - updated code to
call isScalable() and getKnownMinValue().

3 years agoFix build failures caused by f4257c5832aa51e960e7351929ca3d37031985b7
David Sherwood [Fri, 28 Aug 2020 13:56:01 +0000 (14:56 +0100)]
Fix build failures caused by f4257c5832aa51e960e7351929ca3d37031985b7

3 years ago[SVE] Make ElementCount members private
David Sherwood [Fri, 14 Aug 2020 11:15:59 +0000 (12:15 +0100)]
[SVE] Make ElementCount members private

This patch changes ElementCount so that the Min and Scalable
members are now private and can only be accessed via the get
functions getKnownMinValue() and isScalable(). In addition I've
added some other member functions for more commonly used operations.
Hopefully this makes the class more useful and will reduce the
need for calling getKnownMinValue().

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

3 years ago[DWARFYAML] Abbrev codes in a new abbrev table should start from 1 (by default).
Xing GUO [Fri, 28 Aug 2020 10:42:19 +0000 (18:42 +0800)]
[DWARFYAML] Abbrev codes in a new abbrev table should start from 1 (by default).

The abbrev codes in a new abbrev table should start from 1 (by default),
rather than inherit the value from the code in the previous table.

Reviewed By: jhenderson

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

3 years ago[Statepoint] Turn assert into check in foldPatchpoint.
Denis Antrushin [Thu, 27 Aug 2020 14:20:25 +0000 (21:20 +0700)]
[Statepoint] Turn assert into check in foldPatchpoint.

Original D81646 had check for tied regs in foldPatchpoint().
Due to unfortunate miscommunication with review comments and
adressing some comments post commit, it turned into assertion.

We had an offline talk and agreed that with current implementation
this path is possible, so I'm changing it back to check.

Note that this is workaround until ussues described in PR46917 are
resolved.

3 years ago[ARM][LowOverheadLoops] Liveouts and reductions
Sam Parker [Fri, 28 Aug 2020 12:56:16 +0000 (13:56 +0100)]
[ARM][LowOverheadLoops] Liveouts and reductions

Remove the code that tried to look for reduction patterns, since the
vectorizer and isel can now produce predicated arithmetic instructios
within the loop body. This has required some reorganisation and fixes
around live-out and predication checks, as well as looking for cases
where an input/output is initialised to zero.

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

3 years ago[NFC][ARM] Add tail predication test
Sam Parker [Fri, 28 Aug 2020 12:45:30 +0000 (13:45 +0100)]
[NFC][ARM] Add tail predication test

3 years ago[SCCP] Use bulk-remove API to bulk-remove attributes. NFCI.
Benjamin Kramer [Fri, 28 Aug 2020 11:40:06 +0000 (13:40 +0200)]
[SCCP] Use bulk-remove API to bulk-remove attributes. NFCI.

3 years ago[SyntaxTree] Add coverage for declarators and init-declarators
Eduardo Caldas [Fri, 28 Aug 2020 09:23:13 +0000 (09:23 +0000)]
[SyntaxTree] Add coverage for declarators and init-declarators

3 years ago[SyntaxTree][NFC] Refactor function templates into functions taking base class
Eduardo Caldas [Thu, 27 Aug 2020 15:37:04 +0000 (15:37 +0000)]
[SyntaxTree][NFC] Refactor function templates into functions taking base class

The refactored functions were
* `isReponsibleForCreatingDeclaration`
* `getQualifiedNameStart`

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

3 years ago[FunctionAttrs] Bulk remove attributes. NFC.
Benjamin Kramer [Fri, 28 Aug 2020 10:55:42 +0000 (12:55 +0200)]
[FunctionAttrs] Bulk remove attributes. NFC.

3 years ago[AArch64][CodeGen] Restrict bfloat vector operations to what's actually supported
Ties Stuij [Fri, 28 Aug 2020 08:31:11 +0000 (09:31 +0100)]
[AArch64][CodeGen] Restrict bfloat vector operations to what's actually supported

Previously in addTypeForNeon, we would set the operations for bfloat vectors
like other generic types. But as bfloat is a storage-only type a number of
operations shouldn't be set. This patch fixes that.

Reviewed By: dmgreen

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

3 years ago[clang-format] Detect pointer qualifiers in cast expressions
Alex Richardson [Fri, 28 Aug 2020 10:03:10 +0000 (11:03 +0100)]
[clang-format] Detect pointer qualifiers in cast expressions

When guessing whether a closing paren is then end of a cast expression also
skip over pointer qualifiers while looking for TT_PointerOrReference.
This prevents some address-of and dereference operators from being parsed
as a binary operator.

Before:
x = (foo *const) * v;
x = (foo *const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified _Nonnull) & v;

After:
x = (foo *const)*v;
x = (foo *const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified _Nonnull)&v;

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Parse nullability attributes as a pointer qualifier
Alex Richardson [Fri, 28 Aug 2020 10:03:03 +0000 (11:03 +0100)]
[clang-format] Parse nullability attributes as a pointer qualifier

Before:
void f() { MACRO(A * _Nonnull a); }
void f() { MACRO(A * _Nullable a); }
void f() { MACRO(A * _Null_unspecified a); }

After:
void f() { MACRO(A *_Nonnull a); }
void f() { MACRO(A *_Nullable a); }
void f() { MACRO(A *_Null_unspecified a); }

Reviewed By: JakeMerdichAMD

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

3 years ago[clang-format] Parse __attribute((foo)) as a pointer qualifier
Alex Richardson [Fri, 28 Aug 2020 10:03:00 +0000 (11:03 +0100)]
[clang-format] Parse __attribute((foo)) as a pointer qualifier

Before: void f() { MACRO(A * __attribute((foo)) a); }
After:  void f() { MACRO(A *__attribute((foo)) a); }

Also check that the __attribute__ alias is handled.

Reviewed By: MyDeveloperDay

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

3 years ago[clang-format] Parse restrict as a pointer qualifier
Alex Richardson [Fri, 28 Aug 2020 10:02:56 +0000 (11:02 +0100)]
[clang-format] Parse restrict as a pointer qualifier

Before: void f() { MACRO(A * restrict a); }
After:  void f() { MACRO(A *restrict a); }

Also check that the __restrict and __restrict__ aliases are handled.

Reviewed By: JakeMerdichAMD

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

3 years ago[clang-format] Parse volatile as a pointer qualifier
Alex Richardson [Fri, 28 Aug 2020 10:02:51 +0000 (11:02 +0100)]
[clang-format] Parse volatile as a pointer qualifier

Before: void f() { MACRO(A * volatile a); }
After:  void f() { MACRO(A *volatile a); }

Also check that the __volatile and __volatile__ aliases are handled.

Reviewed By: JakeMerdichAMD

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

3 years ago[DSE,MemorySSA] Check if Current is valid for elimination first.
Florian Hahn [Fri, 28 Aug 2020 09:31:30 +0000 (10:31 +0100)]
[DSE,MemorySSA] Check if Current is valid for elimination first.

This changes getDomMemoryDef to check if a Current is a valid
candidate for elimination before checking for reads. Before the change,
we were spending a lot of compile-time in checking for read accesses for
Current that might not even be removable.

This patch flips the logic, so we skip Current if they cannot be
removed before checking all their uses. This is much more efficient in
practice.

It also adds a more aggressive limit for checking partially overlapping
stores. The main problem with overlapping stores is that we do not know
if they will lead to elimination until seeing all of them. This patch
limits adds a new limit for overlapping store candidates, which keeps
the number of modified overlapping stores roughly the same.

This is another substantial compile-time improvement (while also
increasing the number of stores eliminated). Geomean -O3 -0.67%,
ReleaseThinLTO -0.97%.

http://llvm-compile-time-tracker.com/compare.php?from=0a929b6978a068af8ddb02d0d4714a2843dd8ba9&to=2e630629b43f64b60b282e90f0d96082fde2dacc&stat=instructions

Reviewed By: asbirlea

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

3 years ago[lldb/Utility] Polish the Scalar class
Pavel Labath [Mon, 24 Aug 2020 12:20:09 +0000 (14:20 +0200)]
[lldb/Utility] Polish the Scalar class

This patch is mostly about removing the "Category" enum, which was
very useful when the Type enum contained a large number of types, but
now the two are completely identical.

It also removes some other artifacts like unused typedefs and macros.

3 years ago[lldb] Reduce intentation in SymbolFileDWARF::ParseVariableDIE
Pavel Labath [Thu, 27 Aug 2020 13:30:12 +0000 (15:30 +0200)]
[lldb] Reduce intentation in SymbolFileDWARF::ParseVariableDIE

using early exits. NFC.

3 years ago[doxygen] Fix bad doxygen results for BugReporterVisitors.h
Ella Ma [Fri, 28 Aug 2020 09:37:55 +0000 (12:37 +0300)]
[doxygen] Fix bad doxygen results for BugReporterVisitors.h

`{@code xxxxx}` triggers a Doxygen bug. The bug may be matching the
close brace with the open brace of the namespace
declaration (`namespace clang {` or `namespace ento {`).

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

3 years ago[cmake] Don't build with -O3 -fPIC on Solaris/sparcv9
Rainer Orth [Fri, 28 Aug 2020 09:40:34 +0000 (11:40 +0200)]
[cmake] Don't build with -O3 -fPIC on Solaris/sparcv9

Tests on Solaris/sparcv9 currently show about 250 failures when building
with gcc, most of them like the following:

  FAIL: LLVM-Unit :: Support/./SupportTests/TaskQueueTest.UnOrderedFutures (4269 of 67884)
  ******************** TEST 'LLVM-Unit :: Support/./SupportTests/TaskQueueTest.UnOrderedFutures' FAILED ********************
  Note: Google Test filter = TaskQueueTest.UnOrderedFutures
  [==========] Running 1 test from 1 test case.
  [----------] Global test environment set-up.
  [----------] 1 test from TaskQueueTest
  [ RUN      ] TaskQueueTest.UnOrderedFutures
  0  SupportTests        0x0000000100753b20 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 32
  1  SupportTests        0x0000000100752974 llvm::sys::RunSignalHandlers() + 68
  2  SupportTests        0x0000000100752b18 SignalHandler(int) + 372
  3  libc.so.1           0xffffffff7eedc800 __sighndlr + 12
  4  libc.so.1           0xffffffff7eecf23c call_user_handler + 852
  5  libc.so.1           0xffffffff7eecf594 sigacthandler + 84
  6  SupportTests        0x00000001006f8cb8 std::thread::_State_impl<std::thread::_Invoker<std::tuple<llvm::ThreadPool::ThreadPool(llvm::ThreadPoolStrategy)::'lambda'()> > >::_M_run() + 512
  7  libstdc++.so.6.0.28 0xfffffffc628117cc execute_native_thread_routine + 16
  8  libc.so.1           0xffffffff7eedc6a0 _lwp_start + 0

Since it's effectively impossible to debug such a `SEGV` in a `Release`
build, I tried a `Debug` build instead, only to find that the failures had
gone away.

Further investigation revealed that most of the issue centers around
`llvm/lib/Support/ThreadPool.cpp`.  That file is built with `-O3 -fPIC` in
a `Release` build.  The failure vanishes if

- compiling without `-fPIC`
- compiling with `-O -fPIC`
- linking with GNU `ld` instead of Solaris `ld`

It has meanwhile been determined that `gcc` doesn't correctly heed some TLS
code sequences.  To make things worse, Solaris `ld` doesn't properly
validate its assumptions against the input, generating wrong code.

`gld` like `gcc` is more liberal here and correctly deals with the code it
gets fed from `gcc`.

There's PR target/96607: GCC feeds SPARC/Solaris linker with unrecognized
TLS sequences <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96607> now.

An attempt to build with `-DLLVM_ENABLE_PIC=Off` initially failed since
neither `libRemarks.so` (D85626 <https://reviews.llvm.org/D85626>) nor
`LLVMPolly.so` (D85627 <https://reviews.llvm.org/D85627>) heed that option.
Even with that fixed, a few codegen failures remain.

Next I tried to build just `ThreadPool.cpp` with `-O -fPIC`.  While that
fixed the vast majority of the failures, 16 `LLVM :: CodeGen/X86` failures
remained.

Given that that solution was both incomplete and fragile, I went for
building the whole tree with `-O -fPIC` for `Release` and `RelWithDebInfo`
builds.

As detailed in Bug 47304, 2-stage builds also show large numbers of
failures when building with `-O3` or `-O2`, which are likewise worked
around by building with `-O` until they are sufficiently analyzed and
fixed.

This way, all failures relative to a `Debug` build go away.

Tested on `sparcv9-sun-solaris2.11`.

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

3 years ago[MemLoc] Support memcmp in MemoryLocation::getForArgument.
Florian Hahn [Fri, 28 Aug 2020 09:07:56 +0000 (10:07 +0100)]
[MemLoc] Support memcmp in MemoryLocation::getForArgument.

This patch adds support for memcmp in MemoryLocation::getForArgument.
memcmp reads from the first 2 arguments up to the number of bytes of the
third argument.

Reviewed By: efriedma

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

3 years ago[BasicAA] Add first libfunc tests with memcmp.
Florian Hahn [Thu, 27 Aug 2020 16:27:32 +0000 (17:27 +0100)]
[BasicAA] Add first libfunc tests with memcmp.

3 years ago[DSE,MemorySSA] Add memcmp test case.
Florian Hahn [Thu, 27 Aug 2020 16:27:07 +0000 (17:27 +0100)]
[DSE,MemorySSA] Add memcmp test case.

3 years ago[NFC][asan] Don't unwind stack before pool check
Vitaly Buka [Fri, 28 Aug 2020 08:59:27 +0000 (01:59 -0700)]
[NFC][asan] Don't unwind stack before pool check

3 years ago[mlir][Linalg] Enhance Linalg fusion on generic op and tensor_reshape op.
Hanhan Wang [Fri, 28 Aug 2020 08:53:59 +0000 (01:53 -0700)]
[mlir][Linalg] Enhance Linalg fusion on generic op and tensor_reshape op.

The tensor_reshape op was only fusible only if it is a collapsing case. Now we
propagate the op to all the operands so there is a further chance to fuse it
with generic op. The pre-conditions are:

1) The producer is not an indexed_generic op.
2) All the shapes of the operands are the same.
3) All the indexing maps are identity.
4) All the loops are parallel loops.
5) The producer has a single user.

It is possible to fuse the ops if the producer is an indexed_generic op. We
still can compute the original indices. E.g., if the reshape op collapses the d0
and d1, we can use DimOp to get the width of d1, and calculate the index
`d0 * width + d1`. Then replace all the uses with it. However, this pattern is
not implemented in the patch.

Reviewed By: mravishankar

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

3 years ago[BuildLibCalls] Add argmemonly to more lib calls.
Florian Hahn [Fri, 28 Aug 2020 08:37:01 +0000 (09:37 +0100)]
[BuildLibCalls] Add argmemonly to more lib calls.

strspn, strncmp, strcspn, strcasecmp, strncasecmp, memcmp, memchr,
memrchr, memcpy, memmove, memcpy, mempcpy, strchr, strrchr, bcmp
should all only access memory through their arguments.

I broke out strcoll, strcasecmp, strncasecmp because the result
depends on the locale, which might get accessed through memory.

Reviewed By: jdoerfert

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

3 years ago[llvm-readobj] - Simplify the code that creates dumpers. NFCI.
Georgii Rymar [Thu, 27 Aug 2020 15:20:13 +0000 (18:20 +0300)]
[llvm-readobj] - Simplify the code that creates dumpers. NFCI.

We have a few helper functions like the following:
```
std::error_code create*Dumper(...)
```

In fact we do not need or want to use `std::error_code` and the code
can be simpler if we just return `std::unique_ptr<ObjDumper>`.

This patch does this change and refines the signature of `createDumper`
as well.

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

3 years ago[llvm-readobj][test] - Test "Format" values.
Georgii Rymar [Fri, 21 Aug 2020 14:08:25 +0000 (17:08 +0300)]
[llvm-readobj][test] - Test "Format" values.

This adds testing for the "Format" field printed with `--file-headers`.

llvm-readelf doesn't use them, so only llvm-readobj needs to be tested.

All possible values are defined and tested in `ELFObjectFile<ELFT>::getFileFormatName()`.
Here we test just a few arbitrary ones.

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

3 years ago[unittests/Object] - Add testing for missing ELF formats.
Georgii Rymar [Wed, 26 Aug 2020 14:48:23 +0000 (17:48 +0300)]
[unittests/Object] - Add testing for missing ELF formats.

This adds all missing format values that are defined in
ELFObjectFile<ELFT>::getFileFormatName().

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

3 years ago[llvm-reduce] Skip chunks that lead to broken modules.
Florian Hahn [Fri, 28 Aug 2020 07:40:40 +0000 (08:40 +0100)]
[llvm-reduce] Skip chunks that lead to broken modules.

Some reduction passes may create invalid IR. I am not aware of any use
case where we would like to proceed reducing invalid IR. Various utils
used here, including CloneModule, assume the module to clone is valid
and crash otherwise.

Ideally, no reduction pass would create invalid IR, but some currently
do. ReduceInstructions can be fixed relatively easily (D86210), but
others are harder. For example, ReduceBasicBlocks may remove result in
invalid PHI nodes.

For now, skip the chunks. If we get to the point where all reduction
passes result in valid IR, we may want to turn this into an assertion.

Reviewed By: lebedev.ri

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

3 years ago[ValueTracking] Remove a stray semicolon. NFC.
Martin Storsjö [Fri, 28 Aug 2020 06:23:57 +0000 (09:23 +0300)]
[ValueTracking] Remove a stray semicolon. NFC.

This silences warnings when built with GCC at least.

3 years ago[MC] [Win64EH] Avoid producing malformed xdata records
Martin Storsjö [Thu, 20 Aug 2020 07:38:17 +0000 (10:38 +0300)]
[MC] [Win64EH] Avoid producing malformed xdata records

If there's no unwinding opcodes, omit writing the xdata/pdata records.

Previously, this generated truncated xdata records, and llvm-readobj
would error out when trying to print them.

If writing of an xdata record is forced via the .seh_handlerdata
directive, skip it if there's no info to make a sensible unwind
info structure out of, and clearly error out if such info appeared
later in the process.

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

3 years ago[gn build] Port b1f4e5979b7
LLVM GN Syncbot [Fri, 28 Aug 2020 05:56:49 +0000 (05:56 +0000)]
[gn build] Port b1f4e5979b7

3 years ago(Expensive) Check for Loop, SCC and Region pass return status
serge-sans-paille [Thu, 27 Aug 2020 15:31:54 +0000 (17:31 +0200)]
(Expensive) Check for Loop, SCC and Region pass return status

This generalizes the logic introduced in https://reviews.llvm.org/D80916 to
other passes.

It's needed by https://reviews.llvm.org/D86442 to assert passes correctly report
their status.

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

3 years agoAdd a global flag to disable the global dialect registry "process wise"
Mehdi Amini [Fri, 28 Aug 2020 02:26:27 +0000 (02:26 +0000)]
Add a global flag to disable the global dialect registry "process wise"

This is intended to ease the transition for client with a lot of
dependencies. It'll be removed in the coming weeks.

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

3 years agoAdd an unsigned shift base sanitizer
JF Bastien [Fri, 14 Aug 2020 21:05:57 +0000 (14:05 -0700)]
Add an unsigned shift base sanitizer

It's not undefined behavior for an unsigned left shift to overflow (i.e. to
shift bits out), but it has been the source of bugs and exploits in certain
codebases in the past. As we do in other parts of UBSan, this patch adds a
dynamic checker which acts beyond UBSan and checks other sources of errors. The
option is enabled as part of -fsanitize=integer.

The flag is named: -fsanitize=unsigned-shift-base
This matches shift-base and shift-exponent flags.

<rdar://problem/46129047>

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

3 years ago[flang][openacc] Fix gang-argument parsing and add validity tests for !$acc loop
Valentin Clement [Fri, 28 Aug 2020 02:32:29 +0000 (22:32 -0400)]
[flang][openacc] Fix gang-argument parsing and add validity tests for !$acc loop

This patch fix the prasing for the gang-arg values for the gang clause. It also adds
some clause validity tests for the loop construct.

Reviewed By: klausler

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

3 years ago[MSAN] Add fiber switching APIs
Justin Cady [Fri, 28 Aug 2020 02:21:59 +0000 (19:21 -0700)]
[MSAN] Add fiber switching APIs

Add functions exposed via the MSAN interface to enable MSAN within
binaries that perform manual stack switching (e.g. through using fibers
or coroutines).

This functionality is analogous to the fiber APIs available for ASAN and TSAN.

Fixes google/sanitizers#1232

Reviewed By: vitalybuka

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

3 years ago[flang][openacc] Add check for tile clause restriction
Valentin Clement [Fri, 28 Aug 2020 02:13:29 +0000 (22:13 -0400)]
[flang][openacc] Add check for tile clause restriction

The tile clause in OpenACC 3.0 imposes some restriction. Element in the tile size list are either * or a
constant positive integer expression. If there are n tile sizes in the list, the loop construct must be immediately
followed by n tightly-nested loops.
This patch implement these restrictions and add some tests.

Reviewed By: klausler

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

3 years ago[PowerPC] PPCBoolRetToInt: Don't translate Constant's operands
Kai Luo [Fri, 28 Aug 2020 01:56:12 +0000 (01:56 +0000)]
[PowerPC] PPCBoolRetToInt: Don't translate Constant's operands

When collecting `i1` values via `findAllDefs`, ignore Constant's
operands, since Constant's operands might not be `i1`.

Fixes https://bugs.llvm.org/show_bug.cgi?id=46923 which causes ICE
```
llvm-project/llvm/lib/IR/Constants.cpp:1924: static llvm::Constant *llvm::ConstantExpr::getZExt(llvm::Constant *, llvm::Type *, bool): Assertion `C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&& "SrcTy must be smaller than DestTy for ZExt!"' failed.
```

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

3 years ago[MemorySSA] Assert defining access is not a MemoryUse.
Alina Sbirlea [Thu, 27 Aug 2020 23:39:53 +0000 (16:39 -0700)]
[MemorySSA] Assert defining access is not a MemoryUse.

3 years agoRevert "Use find_library for ncurses"
Harmen Stoppels [Fri, 28 Aug 2020 00:57:26 +0000 (17:57 -0700)]
Revert "Use find_library for ncurses"

The introduction of find_library for ncurses caused more issues than it solved problems. The current open issue is it makes the static build of LLVM fail. It is better to revert for now, and get back to it later.

Revert "[CMake] Fix an issue where get_system_libname creates an empty regex capture on windows"
This reverts commit 1ed1e16ab83f55d85c90ae43a05cbe08a00c20e0.

Revert "Fix msan build"
This reverts commit 34fe9613dda3c7d8665b609136a8c12deb122382.

Revert "[CMake] Always mark terminfo as unavailable on Windows"
This reverts commit 76bf26236f6fd453343666c3cd91de8f74ffd89d.

Revert "[CMake] Fix OCaml build failure because of absolute path in system libs"
This reverts commit 8e4acb82f71ad4effec8895b8fc957189ce95933.

Revert "[CMake] Don't look for terminfo libs when LLVM_ENABLE_TERMINFO=OFF"
This reverts commit 495f91fd33d492941c39424a32cf24bcfe192f35.

Revert "Use find_library for ncurses"
This reverts commit a52173a3e56553d7b795bcf3cdadcf6433117107.

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

3 years ago[lld-macho][NFC] Define isHidden() in LinkEditSection
Jez Ng [Fri, 28 Aug 2020 00:43:19 +0000 (17:43 -0700)]
[lld-macho][NFC] Define isHidden() in LinkEditSection

Since it's always true

Reviewed By: #lld-macho, smeenai

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

3 years ago[lld-macho] Weak locals should be relaxed too
Jez Ng [Fri, 28 Aug 2020 00:43:16 +0000 (17:43 -0700)]
[lld-macho] Weak locals should be relaxed too

Reviewed By: #lld-macho, smeenai

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

3 years ago[lld-macho] Support GOT relocations to __dso_handle
Jez Ng [Thu, 27 Aug 2020 22:59:48 +0000 (15:59 -0700)]
[lld-macho] Support GOT relocations to __dso_handle

Found such a relocation while testing some real world programs.

Reviewed By: #lld-macho, smeenai

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

3 years ago[lld-macho] Implement GOT_LOAD relaxation
Jez Ng [Thu, 27 Aug 2020 22:59:45 +0000 (15:59 -0700)]
[lld-macho] Implement GOT_LOAD relaxation

We can have GOT_LOAD relocations that reference `__dso_handle`.
However, our binding opcode encoder doesn't support binding to the DSOHandle
symbol. Instead of adding support for that, I decided it would be cleaner to
implement GOT_LOAD relaxation since `__dso_handle`'s location is always
statically known.

Reviewed By: #lld-macho, smeenai

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

3 years ago[lld-macho] Emit binding opcodes for defined symbols that override weak dysyms
Jez Ng [Thu, 27 Aug 2020 22:59:30 +0000 (15:59 -0700)]
[lld-macho] Emit binding opcodes for defined symbols that override weak dysyms

These opcodes tell dyld to coalesce the overridden weak dysyms to this
particular symbol definition.

Reviewed By: #lld-macho, smeenai

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

3 years ago[lld-macho] Emit the right header flags for weak bindings/symbols
Jez Ng [Thu, 27 Aug 2020 22:59:15 +0000 (15:59 -0700)]
[lld-macho] Emit the right header flags for weak bindings/symbols

Reviewed By: #lld-macho, smeenai

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

3 years ago[lld-macho] Implement weak binding for branch relocations
Jez Ng [Thu, 27 Aug 2020 22:54:42 +0000 (15:54 -0700)]
[lld-macho] Implement weak binding for branch relocations

Since there is no "weak lazy" lookup, function calls to weak symbols are
always non-lazily bound. We emit both regular non-lazy bindings as well
as weak bindings, in order that the weak bindings may overwrite the
non-lazy bindings if an appropriate symbol is found at runtime. However,
the bound addresses will still be written (non-lazily) into the
LazyPointerSection.

Reviewed By: #lld-macho, smeenai

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

3 years ago[lldb] Fix "no matching std::pair constructor" on Ubuntu 16.04 (NFC)
Jonas Devlieghere [Fri, 28 Aug 2020 00:20:50 +0000 (17:20 -0700)]
[lldb] Fix "no matching std::pair constructor" on Ubuntu 16.04 (NFC)

Fixes error: no matching constructor for initialization of
'std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
with older toolchain (clang/libcxx) on Ubuntu 16.04. The issue is the
StringRef-to-std::string conversion.

3 years ago[clang-query][NFC] Silence a few lint warnings
Nathan James [Fri, 28 Aug 2020 00:06:46 +0000 (01:06 +0100)]
[clang-query][NFC] Silence a few lint warnings

3 years agoGlobalISel: Implement computeNumSignBits for G_SEXT_INREG
Matt Arsenault [Thu, 27 Aug 2020 18:58:39 +0000 (14:58 -0400)]
GlobalISel: Implement computeNumSignBits for G_SEXT_INREG

3 years agoAMDGPU/GlobalISel: Implement computeKnownBits for groupstaticsize
Matt Arsenault [Thu, 27 Aug 2020 21:21:41 +0000 (17:21 -0400)]
AMDGPU/GlobalISel: Implement computeKnownBits for groupstaticsize

3 years agoAMDGPU: Fix broken switch braces
Matt Arsenault [Thu, 27 Aug 2020 21:17:50 +0000 (17:17 -0400)]
AMDGPU: Fix broken switch braces

3 years agoCorrectly revert "GlobalISel: Use & operator on KnownBits"
Matt Arsenault [Thu, 27 Aug 2020 23:02:34 +0000 (19:02 -0400)]
Correctly revert "GlobalISel: Use & operator on KnownBits"

I mis-resolved the revert through moving the code to another function.

3 years agoRevert "GlobalISel: Use & operator on KnownBits"
Matt Arsenault [Thu, 27 Aug 2020 22:41:02 +0000 (18:41 -0400)]
Revert "GlobalISel: Use & operator on KnownBits"

This reverts commit e53b799779b079a70f600e5cad2ab7267d66b1b7.

Confusingly, this does not simply and the two sets of known bits, but
implements known bits for the and operator.

3 years agoRecommit "[libFuzzer] Fix arguments of InsertPartOf/CopyPartOf calls in CrossOver...
Dokyung Song [Wed, 5 Aug 2020 23:12:19 +0000 (23:12 +0000)]
Recommit "[libFuzzer] Fix arguments of InsertPartOf/CopyPartOf calls in CrossOver mutator."

The CrossOver mutator is meant to cross over two given buffers (referred to as
the first/second buffer henceforth). Previously InsertPartOf/CopyPartOf calls
used in the CrossOver mutator incorrectly inserted/copied part of the second
buffer into a "scratch buffer" (MutateInPlaceHere of the size
CurrentMaxMutationLen), rather than the first buffer. This is not intended
behavior, because the scratch buffer does not always (i) contain the content of
the first buffer, and (ii) have the same size as the first buffer;
CurrentMaxMutationLen is typically a lot larger than the size of the first
buffer. This patch fixes the issue by using the first buffer instead of the
scratch buffer in InsertPartOf/CopyPartOf calls.

A FuzzBench experiment was run to make sure that this change does not
inadvertently degrade the performance. The performance is largely the same; more
details can be found at:
https://storage.googleapis.com/fuzzer-test-suite-public/fixcrossover-report/index.html

This patch also adds two new tests, namely "cross_over_insert" and
"cross_over_copy", which specifically target InsertPartOf and CopyPartOf,
respectively.

- cross_over_insert.test checks if the fuzzer can use InsertPartOf to trigger
  the crash.

- cross_over_copy.test checks if the fuzzer can use CopyPartOf to trigger the
  crash.

These newly added tests were designed to pass with the current patch, but not
without the it (with 790878f291fa5dc58a1c560cb6cc76fd1bfd1c5a these tests do not
pass). To achieve this, -max_len was intentionally given a high value. Without
this patch, InsertPartOf/CopyPartOf will generate larger inputs, possibly with
unpredictable data in it, thereby failing to trigger the crash.

The test pass condition for these new tests is narrowed down by (i) limiting
mutation depth to 1 (i.e., a single CrossOver mutation should be able to trigger
the crash) and (ii) checking whether the mutation sequence of "CrossOver-" leads
to the crash.

Also note that these newly added tests and an existing test (cross_over.test)
all use "-reduce_inputs=0" flags to prevent reducing inputs; it's easier to
force the fuzzer to keep original input string this way than tweaking
cov-instrumented basic blocks in the source code of the fuzzer executable.

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

3 years ago[ValueTracking] Replace recursion with Worklist
Vitaly Buka [Thu, 27 Aug 2020 20:38:29 +0000 (13:38 -0700)]
[ValueTracking] Replace recursion with Worklist

Now findAllocaForValue can handle nontrivial phi cycles.

3 years agoRevert "[CodeGen][AArch64] Support arm_sve_vector_bits attribute"
Cullen Rhodes [Thu, 27 Aug 2020 21:13:23 +0000 (21:13 +0000)]
Revert "[CodeGen][AArch64] Support arm_sve_vector_bits attribute"

Test CodeGen/attr-arm-sve-vector-bits-call.c is failing on some builders
[1][2]. Reverting whilst I investigate.

[1] http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/10375
[2] https://luci-milo.appspot.com/p/fuchsia/builders/ci/clang-linux-x64/b8870800848452818112

This reverts commit 42587345a3afc52c03c6e6095db773358a1b03e9.

3 years ago[SSP] Restore setting the visibility of __guard_local to hidden for better code gener...
Brad Smith [Thu, 27 Aug 2020 21:17:38 +0000 (17:17 -0400)]
[SSP] Restore setting the visibility of __guard_local to hidden for better code generation.

Patch by: Philip Guenther

3 years ago[OPENMP]Do not crash for globals in inner regions with outer target
Alexey Bataev [Thu, 27 Aug 2020 20:06:28 +0000 (16:06 -0400)]
[OPENMP]Do not crash for globals in inner regions with outer target
region.

If the global variable is used in the target region,it is always
captured, if not marked as declare target.

3 years ago[Driver][XRay][test] Update the macOS support check
Azharuddin Mohammed [Thu, 27 Aug 2020 20:57:07 +0000 (13:57 -0700)]
[Driver][XRay][test] Update the macOS support check

For macOS, the code says, the XRay flag is only supported on x86_64.
Updating the test and making that check explicit.

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

3 years ago[Attributor] Do not manifest noundef for dead positions
Shinji Okumura [Thu, 27 Aug 2020 20:54:01 +0000 (05:54 +0900)]
[Attributor] Do not manifest noundef for dead positions

Even if noundef is deduced for a position, we should not manifest it when the position is dead.
This is because the associated values with dead positions are replaced with undef values by AAIsDead.

Reviewed By: jdoerfert

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

3 years ago[OpenMP] Fix a failing test after D85214
Saiyedul Islam [Thu, 27 Aug 2020 20:54:42 +0000 (20:54 +0000)]
[OpenMP] Fix a failing test after D85214

Removed version 45 testing from a failing test for now.

3 years agoGlobalISel: Implement known bits for min/max
Matt Arsenault [Thu, 27 Aug 2020 16:40:03 +0000 (12:40 -0400)]
GlobalISel: Implement known bits for min/max

3 years agoAArch64/GlobalISel: Fix missing function begin marker in test
Matt Arsenault [Thu, 27 Aug 2020 17:25:12 +0000 (13:25 -0400)]
AArch64/GlobalISel: Fix missing function begin marker in test

3 years agoMIR: Infer not-SSA for subregister defs
Matt Arsenault [Sun, 28 Jun 2020 15:34:42 +0000 (11:34 -0400)]
MIR: Infer not-SSA for subregister defs

It's possible to have a single virtual register def with a subreg
index that would pass the previous check, but it's not possible to
have a subregister def in SSA.

This is in preparation for adding stricter checks for SSA MIR.

3 years ago[StackSafety] Ignore allocas with partial lifetime markers
Vitaly Buka [Thu, 27 Aug 2020 20:53:28 +0000 (13:53 -0700)]
[StackSafety] Ignore allocas with partial lifetime markers

Reviewed By: eugenis

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

3 years ago[NFC][ValueTracking] Add OffsetZero into findAllocaForValue
Vitaly Buka [Thu, 27 Aug 2020 20:45:39 +0000 (13:45 -0700)]
[NFC][ValueTracking] Add OffsetZero into findAllocaForValue

For StackLifetime after finding alloca we need to check that
values ponting to the begining of alloca.

Reviewed By: eugenis

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

3 years agoAMDGPU: Use caller subtarget, not intrinsic declaration
Matt Arsenault [Thu, 27 Aug 2020 15:14:59 +0000 (11:14 -0400)]
AMDGPU: Use caller subtarget, not intrinsic declaration

Intrinsic declarations use the default subtarget, but this should be
using the subtarget for the calling function. I haven't been able to
come up with a case where it matters though.

3 years agoGlobalISel: Add and_trivial_mask to all_combines
Matt Arsenault [Thu, 27 Aug 2020 17:15:46 +0000 (13:15 -0400)]
GlobalISel: Add and_trivial_mask to all_combines

Also make up a new category of combines.

3 years ago[Hexagon] Emit better 32-bit multiplication sequence for HVXv62+
Krzysztof Parzyszek [Thu, 27 Aug 2020 20:16:39 +0000 (15:16 -0500)]
[Hexagon] Emit better 32-bit multiplication sequence for HVXv62+

3 years ago[RegisterScavenging] Delete dead function unprocess().
Eli Friedman [Thu, 27 Aug 2020 20:17:47 +0000 (13:17 -0700)]
[RegisterScavenging] Delete dead function unprocess().

3 years ago[Attributor] Do not add AA to dependency graph after the update stage
Shinji Okumura [Thu, 27 Aug 2020 20:16:18 +0000 (05:16 +0900)]
[Attributor] Do not add AA to dependency graph after the update stage

If an AA is registered to the dependency graph in the manifest stage, Attributor aborts in `::manifestAttributes()`.
This patch prevents such termination.

Reviewed By: jdoerfert

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

3 years ago[CodeGen] Use an AttrBuilder to bulk remove 'target-cpu', 'target-features', and...
Craig Topper [Thu, 27 Aug 2020 19:32:17 +0000 (12:32 -0700)]
[CodeGen] Use an AttrBuilder to bulk remove 'target-cpu', 'target-features', and 'tune-cpu' before re-adding in CodeGenModule::setNonAliasAttributes.

I think the removeAttributes interface should be faster than
calling removeAttribute 3 times.

3 years ago[OpenMP] Ensure testing for versions 4.5 and default - Part 3
Saiyedul Islam [Thu, 27 Aug 2020 19:35:36 +0000 (19:35 +0000)]
[OpenMP] Ensure testing for versions 4.5 and default - Part 3

This third patch in the series removes version 5.0 string from
test cases making them check for default version. It also add test
cases for version 4.5.

Reviewed By: ABataev

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

3 years ago[InstSimplify] SimplifyPHINode(): check that instruction is in basic block first
Roman Lebedev [Thu, 27 Aug 2020 19:31:40 +0000 (22:31 +0300)]
[InstSimplify] SimplifyPHINode(): check that instruction is in basic block first

As pointed out in post-commit review, this can legally be called
on instructions that are not inserted into basic blocks,
so don't blindly assume that there is basic block.

3 years ago[SVE] Remove bad call to VectorType::getNumElements() from HeapProfiler
Christopher Tetreault [Thu, 27 Aug 2020 19:04:39 +0000 (12:04 -0700)]
[SVE] Remove bad call to VectorType::getNumElements() from HeapProfiler

Reviewed By: tejohnson

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

3 years ago[analyzer] NFC: Fix wrong parameter name in printFormattedEntry.
Yang Fan [Thu, 27 Aug 2020 19:09:17 +0000 (12:09 -0700)]
[analyzer] NFC: Fix wrong parameter name in printFormattedEntry.

Parameters were in a different order in the header and in the implementation.

Fix surrounding comments a bit.

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

3 years ago[analyzer] Fix the debug print about debug egraph dumps requiring asserts.
Yang Fan [Thu, 27 Aug 2020 18:45:12 +0000 (11:45 -0700)]
[analyzer] Fix the debug print about debug egraph dumps requiring asserts.

There's no need to remind people about that when clang *is* built with asserts.

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

3 years ago[analyzer] pr47037: CastValueChecker: Support for the new variadic isa<>.
Adam Balogh [Thu, 27 Aug 2020 15:06:10 +0000 (08:06 -0700)]
[analyzer] pr47037: CastValueChecker: Support for the new variadic isa<>.

llvm::isa<>() and llvm::isa_and_not_null<>() template functions recently became
variadic. Unfortunately this causes crashes in case of isa_and_not_null<>()
and incorrect behavior in isa<>(). This patch fixes this issue.

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

3 years ago[analyzer] NFC: Store the pointee/referenced type for dynamic type tracking.
Adam Balogh [Thu, 27 Aug 2020 15:01:43 +0000 (08:01 -0700)]
[analyzer] NFC: Store the pointee/referenced type for dynamic type tracking.

The successfulness of a dynamic cast depends only on the C++ class, not the pointer or reference. Thus if *A is a *B, then &A is a &B,
const *A is a const *B etc. This patch changes DynamicCastInfo to store
and check the cast between the unqualified pointed/referenced types.
It also removes e.g. SubstTemplateTypeParmType from both the pointer
and the pointed type.

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

3 years agoRecommit "[libFuzzer] Fix value-profile-load test."
Dokyung Song [Wed, 19 Aug 2020 20:21:05 +0000 (20:21 +0000)]
Recommit "[libFuzzer] Fix value-profile-load test."

value-profile-load.test needs adjustment with a mutator change in
bb54bcf84970c04c9748004f3a4cf59b0c1832a7, which reverted as of now, but will be
recommitted after landing this patch.

This patch makes value-profile-load.test more friendly to (and aware of) the
current value profiling strategy, which is based on the hamming as well as the
absolute distance. To this end, this patch adjusts the set of input values that
trigger an expected crash. More specifically, this patch now uses a single value
0x01effffe as a crashing input, because this value is close to values like
{0x1ffffff, 0xffffff, ...}, which are very likely to be added to the corpus per
the current hamming- and absolute-distance-based value profiling strategy. Note
that previously the crashing input values were {1234567 * {1, 2, ...}, s.t. <
INT_MAX}.

Every byte in the chosen value 0x01effeef is intentionally different; this was
to make it harder to find the value without the intermediate inputs added to the
corpus by the value profiling strategy.

Also note that LoadTest.cpp now uses a narrower condition (Size != 8) for
initial pruning of inputs, effectively preventing libFuzzer from generating
inputs longer than necessary and spending time on mutating such long inputs in
the corpus - a functionality not meant to be tested by this specific test.

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

3 years ago[libcxx] Fix the broken test after D82657.
Haojian Wu [Thu, 27 Aug 2020 18:43:20 +0000 (20:43 +0200)]
[libcxx] Fix the broken test after D82657.

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

3 years ago[Attributor] Guarantee getAAFor not to update AA in the manifestation stage
Shinji Okumura [Thu, 27 Aug 2020 18:29:39 +0000 (03:29 +0900)]
[Attributor] Guarantee getAAFor not to update AA in the manifestation stage

If we query an AA with `Attributor::getAAFor` in `AbstractAttribute::manifest`, the AA may be updated.
This patch makes use of the phase flag in Attributor, and handle `getAAFor` behavior according to the flag.

Reviewed By: jdoerfert

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

3 years ago[MLIR] Fixed missing constraint append when adding an AffineIfOp domain
Vincent Zhao [Thu, 27 Aug 2020 18:57:36 +0000 (00:27 +0530)]
[MLIR] Fixed missing constraint append when adding an AffineIfOp domain

The prior diff that introduced `addAffineIfOpDomain` missed appending
constraints from the ifOp domain. This revision fixes this problem.

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

3 years ago[SVE] Remove calls to VectorType::getNumElements from Transforms/Vectorize
Christopher Tetreault [Thu, 27 Aug 2020 18:19:46 +0000 (11:19 -0700)]
[SVE] Remove calls to VectorType::getNumElements from Transforms/Vectorize

Reviewed By: spatel

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

3 years ago[OpenMP] Ensure testing for versions 4.5 and default - Part 2
Saiyedul Islam [Thu, 27 Aug 2020 18:50:34 +0000 (18:50 +0000)]
[OpenMP] Ensure testing for versions 4.5 and default - Part 2

Many OpenMP Clang tests do not RUN for version 4.5 and the default
version. This second patch in the series handles test cases which
require updation in CHECK lines along with adding RUN lines for
the default version. It involves updating line number of pragmas.

Reviewed By: ABataev

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

3 years ago[OpenMP][MLIR] Conversion pattern for OpenMP to LLVM
Kiran Chandramohan [Thu, 13 Aug 2020 08:03:04 +0000 (09:03 +0100)]
[OpenMP][MLIR] Conversion pattern for OpenMP to LLVM

Adding a conversion pattern for the parallel Operation. This will
help the conversion of parallel operation with standard dialect to
parallel operation with llvm dialect. The type conversion of the block
arguments in a parallel region are controlled by the pattern for the
parallel Operation. Without this pattern, a parallel Operation with
block arguments cannot be converted from standard to LLVM dialect.
Other OpenMP operations without regions are marked as legal. When
translation of OpenMP operations with regions are added then patterns
for these operations can also be added.
Also uses all the standard to llvm patterns. Patterns of other dialects
can be added later if needed.

Reviewed By: rriddle

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