platform/upstream/llvm.git
4 years agoFix boolean/bitwise operator precedence warnings. NFCI.
Simon Pilgrim [Sat, 15 Feb 2020 13:53:18 +0000 (13:53 +0000)]
Fix boolean/bitwise operator precedence warnings. NFCI.

4 years ago[APInt] byteSwap - handle any whole byte bitwidth greater than 16-bits
Simon Pilgrim [Sat, 15 Feb 2020 13:27:06 +0000 (13:27 +0000)]
[APInt] byteSwap - handle any whole byte bitwidth greater than 16-bits

As noted on D74621, the bswap intrinsic has a self imposed limitation that the type's bitwidth must be divisible by 16, but there's no reason that APInt::byteSwap must have the same limitation, given that it can already handle any byte width.

4 years ago[AArch64][FIX] Correct register live range during pseudo expansion.
Pavel Iliin [Sat, 15 Feb 2020 10:50:59 +0000 (10:50 +0000)]
[AArch64][FIX] Correct register live range during pseudo expansion.

This commit fixes the broken tests after
commit b6a9fe209992789be3ed95664d25196361cfad34
on the expensive check builder:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/2884

4 years ago[APInt] byteSwap - simplify sub 64-bits cases to match general implementation. NFCI.
Simon Pilgrim [Sat, 15 Feb 2020 12:16:14 +0000 (12:16 +0000)]
[APInt] byteSwap - simplify sub 64-bits cases to match general implementation. NFCI.

We can just byteSwap the entire uint64_t VAL and then shift down into place like we do for the multi-word case.

4 years ago[APInt] Add some procedural APInt::byteSwap unit tests
Simon Pilgrim [Sat, 15 Feb 2020 11:56:26 +0000 (11:56 +0000)]
[APInt] Add some procedural APInt::byteSwap unit tests

rGf0181cc7bac3 added specific tests up to i64, this adds a general loop to test some basic byte moves for larger APInts.

4 years ago[AArch64] Fixup kill flags on BSL generation
David Green [Sat, 15 Feb 2020 10:41:14 +0000 (10:41 +0000)]
[AArch64] Fixup kill flags on BSL generation

This hopefully fixes up the expensive checks bot.

4 years ago[gn build] unbreak win build by removing flags that only work with a sysroot
Nico Weber [Sat, 15 Feb 2020 11:25:21 +0000 (06:25 -0500)]
[gn build] unbreak win build by removing flags that only work with a sysroot

4 years ago[Debuginfo][NFC] Remove usages of WithColor::error and WithColor::warning.
Alexey Lapshin [Fri, 14 Feb 2020 15:57:21 +0000 (18:57 +0300)]
[Debuginfo][NFC] Remove usages of WithColor::error and WithColor::warning.

Summary:
This patch is extracted from D74308.

It patches all usages of WithColor::error() and WithColor::warning
in DebugInfoDWARF library.

Depends on D74481

Reviewers: jhenderson, dblaikie, probinson, aprantl, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoPR44890: Inherit explicitly-specified template arguments into base class
Richard Smith [Sat, 15 Feb 2020 10:15:26 +0000 (02:15 -0800)]
PR44890: Inherit explicitly-specified template arguments into base class
deduction.

4 years ago[cxx_status] New papers from Prague 2020 WG21 meeting.
Richard Smith [Sat, 15 Feb 2020 09:51:43 +0000 (01:51 -0800)]
[cxx_status] New papers from Prague 2020 WG21 meeting.

4 years agoFix standalone build interaction with compiler extension
serge-sans-paille [Fri, 14 Feb 2020 11:11:20 +0000 (12:11 +0100)]
Fix standalone build interaction with compiler extension

As suggested in https://github.com/llvm/llvm-project/issues/120, don't try to
generate the extension file from clang, only do the linking step.

Fixes the regression introduced in D74464 when running cmake inside the clang
directory.

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

4 years ago[Debuginfo][NFC] Create common error handlers for DWARFContext.
Alexey Lapshin [Tue, 11 Feb 2020 15:32:27 +0000 (18:32 +0300)]
[Debuginfo][NFC] Create common error handlers for DWARFContext.

Summary:
this review is extracted from D74308.

It creates two error handlers which allow to redefine error
reporting routine and should be used for all places
where errors are reported:

  std::function<void(Error)> RecoverableErrorHandler = defaultErrorHandler;
  std::function<void(Error)> WarningHandler = defaultWarningHandler;

It also creates accessors to above handlers which should be used to
report errors.

  function_ref<void(Error)> getRecoverableErrorHandler() {
    return RecoverableErrorHandler;
  }

  function_ref<void(Error)> getWarningHandler() { return WarningHandler; }

It patches all error reporting places inside DWARFContext and DWARLinker.

Reviewers: jhenderson, dblaikie, probinson, aprantl, JDevlieghere

Reviewed By: jhenderson, JDevlieghere

Subscribers: hiraditya, llvm-commits

Tags: #llvm, #debug-info

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

4 years ago[Attributor] Collect memory accesses with their respective kind and location
Johannes Doerfert [Tue, 28 Jan 2020 04:49:36 +0000 (22:49 -0600)]
[Attributor] Collect memory accesses with their respective kind and location

In addition to a single bit per memory locations, e.g., globals and
arguments, we now collect more information about the actual accesses,
e.g., what instruction caused it, was it a read/write/read+write, and
what the underlying base pointer was. Follow up patches will make
explicit use of this.

Reviewed By: uenoku

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

4 years ago[NFC] Revert unnecessary parts of b91c267380
Johannes Doerfert [Sat, 15 Feb 2020 07:38:58 +0000 (01:38 -0600)]
[NFC] Revert unnecessary parts of b91c267380

In b91c267380 I accidentally introduced fixes that were not necessary
after 1a93285c686a. All but the `llvm_unreachable` are reverted again.

4 years ago[FIX] Order macros after D72304
Johannes Doerfert [Sat, 15 Feb 2020 07:37:23 +0000 (01:37 -0600)]
[FIX] Order macros after D72304

4 years ago[FIX] Remove warnings and UB after 1228d42ddab8
Johannes Doerfert [Sat, 15 Feb 2020 06:59:08 +0000 (00:59 -0600)]
[FIX] Remove warnings and UB after 1228d42ddab8

4 years ago[FIX] Repair clang-tidy check after D72304
Johannes Doerfert [Sat, 15 Feb 2020 06:58:42 +0000 (00:58 -0600)]
[FIX] Repair clang-tidy check after D72304

4 years ago[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.
Fady Ghanim [Sat, 15 Feb 2020 06:42:23 +0000 (00:42 -0600)]
[OpenMP][OMPIRBuilder] Add Directives (master and critical) to OMPBuilder.

Add support for Master and Critical directive in the OMPIRBuilder. Both make use of a new common interface for emitting inlined OMP regions called `emitInlinedRegion` which was added in this patch as well.

Also this patch modifies clang to use the new directives when  `-fopenmp-enable-irbuilder` commandline option is passed.

Reviewed By: jdoerfert

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

4 years ago[MCStreamer] De-capitalize EmitValue EmitIntValue{,InHex}
Fangrui Song [Sat, 15 Feb 2020 06:40:47 +0000 (22:40 -0800)]
[MCStreamer] De-capitalize EmitValue EmitIntValue{,InHex}

4 years agoNFC: add indexing operator for ArrayAttr
Uday Bondhugula [Sat, 15 Feb 2020 06:54:18 +0000 (22:54 -0800)]
NFC: add indexing operator for ArrayAttr

Summary: - add ArrayAttr::operator[](unsigned idx)

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

4 years ago[OpenMP][NFC] Update OpenMPSupport table
Johannes Doerfert [Sat, 15 Feb 2020 06:40:39 +0000 (00:40 -0600)]
[OpenMP][NFC] Update OpenMPSupport table

4 years ago[OpenMP][NFCI] Use the libFrontend DefaultKind in Clang
Atmn Patel [Sat, 15 Feb 2020 03:45:49 +0000 (21:45 -0600)]
[OpenMP][NFCI] Use the libFrontend DefaultKind in Clang

This swaps out the OpenMPDefaultClauseKind enum with a
llvm::omp::DefaultKind enum which is stored in OMPConstants.h.

This should not change any functionality.

Reviewed By: jdoerfert

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

4 years ago[Attributor] Fix -Wunused-variable for -DLLVM_ENABLE_ASSERTIONS=off builds after...
Fangrui Song [Sat, 15 Feb 2020 05:47:19 +0000 (21:47 -0800)]
[Attributor] Fix -Wunused-variable for -DLLVM_ENABLE_ASSERTIONS=off builds after b4352e43d86e

4 years ago[AsmPrinter] Omit unique ID for .stack_sizes
Fangrui Song [Sat, 15 Feb 2020 05:14:31 +0000 (21:14 -0800)]
[AsmPrinter] Omit unique ID for .stack_sizes

Follow-up for D74006.

4 years ago[AsmPrinter][XRay] Omit unique ID for xray_instr_map and xray_fn_idx
Fangrui Song [Sat, 15 Feb 2020 05:02:26 +0000 (21:02 -0800)]
[AsmPrinter][XRay] Omit unique ID for xray_instr_map and xray_fn_idx

Follow-up for D74006.

4 years ago[AArch64][FPenv] Update chain of int to fp conversion
Diogo Sampaio [Sat, 15 Feb 2020 05:05:15 +0000 (05:05 +0000)]
[AArch64][FPenv] Update chain of int to fp conversion

Summary:
When using strict fp, it is required to update the
chain when performing integer type promotion of a
operand to a integer to floating point conversion.

Reviewers: craig.topper, john.brawn

Reviewed By: craig.topper

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AsmPrinter] Omit unique ID for __patchable_function_entries sections
Fangrui Song [Sat, 15 Feb 2020 04:35:04 +0000 (20:35 -0800)]
[AsmPrinter] Omit unique ID for __patchable_function_entries sections

Follow-up for D74006.

When the integrated assembler is used, we use SHF_LINK_ORDER.  The
linked-to symbol is part of ELFSectionKey, thus we can omit the unique
ID.

4 years ago[MC] Add MCSection::NonUniqueID and delete one MCContext::getELFSection overload
Fangrui Song [Sat, 15 Feb 2020 04:15:55 +0000 (20:15 -0800)]
[MC] Add MCSection::NonUniqueID and delete one MCContext::getELFSection overload

4 years ago[MC][ELF] Make linked-to symbol name part of ELFSectionKey
Fangrui Song [Tue, 4 Feb 2020 21:52:10 +0000 (13:52 -0800)]
[MC][ELF] Make linked-to symbol name part of ELFSectionKey

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

This rule has been implemented by GNU as https://sourceware.org/ml/binutils/2020-02/msg00028.html (binutils >= 2.35)

It allows us to simplify

```
.section .foo,"o",foo,unique,0
.section .foo,"o",bar,unique,1  # different section
```

to

```
.section .foo,"o",foo
.section .foo,"o",bar  # different section
```

We consider the two `.foo` different even if the linked-to symbols foo and bar
are defined in the same section.  This is a deliberate choice so that we don't
need to know the section where foo and bar are defined beforehand.

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

4 years ago[Attributor][FIX] Ensure abstract attributes are existing before manifest
Johannes Doerfert [Fri, 14 Feb 2020 16:34:31 +0000 (10:34 -0600)]
[Attributor][FIX] Ensure abstract attributes are existing before manifest

While the function return updateImpl did only look at call sites the
manifest method looked at return values. If we don't do this during the
updateImpl we might create new abstract attributes during manifest. This
is a problem when it comes to liveness information.

4 years ago[Attributor] Manifest simplified (return) values properly
Johannes Doerfert [Sat, 15 Feb 2020 02:11:22 +0000 (20:11 -0600)]
[Attributor] Manifest simplified (return) values properly

If we simplify a function return value we have to modify the return
instructions.

4 years ago[Attributor][FIX] Collapse `undef` to a proper value
Johannes Doerfert [Sat, 15 Feb 2020 02:08:20 +0000 (20:08 -0600)]
[Attributor][FIX] Collapse `undef` to a proper value

If we see an undef we cannot assume it's the same as "no value". For now
we just collapse it to 0.

4 years ago[Attributor][FIX] Restrict cross-SCC call deletion
Johannes Doerfert [Sat, 15 Feb 2020 02:06:34 +0000 (20:06 -0600)]
[Attributor][FIX] Restrict cross-SCC call deletion

If we know a call was not needed we might have ended up deleting it even
if it was in a different SCC. This prevents us from doing so.

4 years ago[Attributor][NFC] Add check lines for tests
Johannes Doerfert [Sat, 15 Feb 2020 01:27:41 +0000 (19:27 -0600)]
[Attributor][NFC] Add check lines for tests

4 years ago[Attributor][FIX] Carefully strip casts in AANoAlias
Johannes Doerfert [Sat, 15 Feb 2020 01:23:21 +0000 (19:23 -0600)]
[Attributor][FIX] Carefully strip casts in AANoAlias

We can strip casts in AANoAlias but that might cause us to end up with a
non-pointer type. We do properly handle that case now.

4 years ago[Attributor][FIX] Do not RAUW void values
Johannes Doerfert [Fri, 14 Feb 2020 02:10:59 +0000 (20:10 -0600)]
[Attributor][FIX] Do not RAUW void values

This caused an error when passes iterated over cached assumptions in the
tracker and assumed them to be `null` or an instruction. I failed to
create a test case so far.

4 years ago[llvm-ranlib][test] Fix rwx- after a4f3847f3d5742cfab7acdc614e7ca54643e0c85
Fangrui Song [Sat, 15 Feb 2020 03:41:05 +0000 (19:41 -0800)]
[llvm-ranlib][test] Fix rwx- after a4f3847f3d5742cfab7acdc614e7ca54643e0c85

4 years agoAMDGPU/GlobalISel: Fix missing impdef of scc on boolean bit ops
Matt Arsenault [Sat, 15 Feb 2020 03:02:31 +0000 (22:02 -0500)]
AMDGPU/GlobalISel: Fix missing impdef of scc on boolean bit ops

4 years ago[MC] De-capitalize another set of MCStreamer::Emit* functions
Fangrui Song [Sat, 15 Feb 2020 03:21:58 +0000 (19:21 -0800)]
[MC] De-capitalize another set of MCStreamer::Emit* functions

Emit{ValueTo,Code}Alignment Emit{DTP,TP,GP}* EmitSymbolValue etc

4 years ago[MC] De-capitalize some MCStreamer::Emit* functions
Fangrui Song [Sat, 15 Feb 2020 02:16:24 +0000 (18:16 -0800)]
[MC] De-capitalize some MCStreamer::Emit* functions

4 years ago[gn build] Make build locally deterministic
Nico Weber [Sat, 15 Feb 2020 02:55:33 +0000 (21:55 -0500)]
[gn build] Make build locally deterministic

This follows http://blog.llvm.org/2019/11/deterministic-builds-with-clang-and-lld.html
to make the GN build locally deterministic.

With this, I've built lld at two different build paths on my Windows box and got
identical binaries. (I'd expect the same to happen on Linux, and with other
binaries.)

This doesn't have the bits to get universal determinism yet.

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

4 years agoRemove 'process launch failed:' message prefix in Target::Launch
Jason Molenda [Sat, 15 Feb 2020 02:42:38 +0000 (18:42 -0800)]
Remove 'process launch failed:' message prefix in Target::Launch

SB API clients can describe the failure message in a more natural
way for their UI, this doesn't add information for them.

Differential Revision: https://reviews.llvm.org/D74585
<rdar://problem/49953304>

4 years ago[RISCV] Correct the CallPreservedMask for the function call in an interrupt handler
Shiva Chen [Fri, 14 Feb 2020 07:57:11 +0000 (15:57 +0800)]
[RISCV] Correct the CallPreservedMask for the function call in an interrupt handler

CallPreservedMask is used to describe the register liveness after a
function call. The function call in an interrupt handler should use the same
CallPreservedMask as normal functions. So that only callee save registers
can live through the function call.

4 years ago[Attributor] Derive memory location attributes (argmemonly, ...)
Johannes Doerfert [Sun, 26 Jan 2020 08:51:57 +0000 (02:51 -0600)]
[Attributor] Derive memory location attributes (argmemonly, ...)

In addition to memory behavior attributes (readonly/writeonly) we now
derive memory location attributes (argmemonly/inaccessiblememonly/...).
The former is part of AAMemoryBehavior and the latter part of
AAMemoryLocation. While they are similar in nature it got messy when
they were put in a single AA. Location attributes for arguments and
floating values will follow later.

Note that both memory attributes kinds can derive readnone. If there are
no accesses AAMemoryBehavior will derive readnone. If there are accesses
but only to stack (=local) locations AAMemoryLocation will derive
readnone.

Reviewed By: uenoku

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

4 years agoAMDGPU: Don't preserve analyses with div64 IR expansion
Matt Arsenault [Sat, 15 Feb 2020 00:57:38 +0000 (19:57 -0500)]
AMDGPU: Don't preserve analyses with div64 IR expansion

The dominator tree needs to be updated, but that isn't handled now.

4 years agoFix 01b02a73de78 to use correct macro spelling and fix unit tests.
Amy Huang [Fri, 14 Feb 2020 23:31:45 +0000 (15:31 -0800)]
Fix 01b02a73de78 to use correct macro spelling and fix unit tests.

4 years agoAMDGPU/GlobalISel: Fix G_EXTRACT of 96-bit results
Matt Arsenault [Fri, 7 Feb 2020 20:18:58 +0000 (15:18 -0500)]
AMDGPU/GlobalISel: Fix G_EXTRACT of 96-bit results

This would assert on an unhandled size in getRegSplitParts.

4 years agoAMDGPU: Use generated checks for memcpy expansion
Matt Arsenault [Fri, 14 Feb 2020 20:13:53 +0000 (15:13 -0500)]
AMDGPU: Use generated checks for memcpy expansion

4 years agoAMDGPU/GlobalISel: Improve 16-bit bswap
Matt Arsenault [Fri, 14 Feb 2020 15:56:46 +0000 (10:56 -0500)]
AMDGPU/GlobalISel: Improve 16-bit bswap

Match the new DAG behavior and use v_perm_b32 when available. Also
does better on SI/CI by expanding 16-bit swaps. Also fix
non-power-of-2 cases.

4 years agoGlobalISel: Remove unused function argument
Matt Arsenault [Fri, 7 Feb 2020 20:51:04 +0000 (15:51 -0500)]
GlobalISel: Remove unused function argument

4 years ago[TBLGEN] Allow to override RC weight
Stanislav Mekhanoshin [Wed, 12 Feb 2020 22:45:21 +0000 (14:45 -0800)]
[TBLGEN] Allow to override RC weight

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

4 years ago[WebAssembly] Add section names for some DWARF5 sections
Derek Schuff [Fri, 14 Feb 2020 23:29:32 +0000 (15:29 -0800)]
[WebAssembly] Add section names for some DWARF5 sections

Summary:
Addresses PR44728 but no tests because I've not yet made any attempt to verify
correctness of the debug info.

Reviewers: sbc100, aardappel

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

4 years agoFix -Wstring-compare warnings in new OpenMP code
Reid Kleckner [Fri, 14 Feb 2020 23:23:42 +0000 (15:23 -0800)]
Fix -Wstring-compare warnings in new OpenMP code

4 years ago[FIX] Add missing InGroup to warning introduced as part of D71830
Johannes Doerfert [Fri, 14 Feb 2020 23:21:13 +0000 (17:21 -0600)]
[FIX] Add missing InGroup to warning introduced as part of D71830

4 years ago[Attributor][FIX] Validate the type for AAValueConstantRange as needed
Johannes Doerfert [Thu, 13 Feb 2020 20:22:26 +0000 (14:22 -0600)]
[Attributor][FIX] Validate the type for AAValueConstantRange as needed

Due to the genericValueTraversal we might visit values for which we did
not create an AAValueConstantRange object, e.g., as they are behind a
PHI or select or call with `returned` argument. As a consequence we need
to validate the types as we are about to query AAValueConstantRange for
operands.

4 years agoDon't call computeHostNumPhysicalCores when LLVM_ENABLE_THREADS is off
Amy Huang [Fri, 14 Feb 2020 22:52:25 +0000 (14:52 -0800)]
Don't call computeHostNumPhysicalCores when LLVM_ENABLE_THREADS is off

Summary:
Fix change from 8404aeb56a73 to avoid calling
computeHostNumPhysicalCores if LLVM_ENABLE_THREADS is off.

Reviewers: rnk, aganea

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lli] Add a '-dlopen <library-path>' option to lli.
Lang Hames [Fri, 14 Feb 2020 22:22:59 +0000 (14:22 -0800)]
[lli] Add a '-dlopen <library-path>' option to lli.

Passing '-dlopen <library-path>' to lli will cause the specified library to be
loaded (via llvm::sys::DynamicLibrary::LoadLibraryPermanently) before JIT'd code
is executed, making the library's symbols accessible to JIT'd code.

4 years ago[OpenMP][Part 2] Use reusable OpenMP context/traits handling
Johannes Doerfert [Fri, 20 Dec 2019 02:42:12 +0000 (20:42 -0600)]
[OpenMP][Part 2] Use reusable OpenMP context/traits handling

This patch implements an almost complete handling of OpenMP
contexts/traits such that we can reuse most of the logic in Flang
through the OMPContext.{h,cpp} in llvm/Frontend/OpenMP.

All but construct SIMD specifiers, e.g., inbranch, and the device ISA
selector are define in `llvm/lib/Frontend/OpenMP/OMPKinds.def`. From
these definitions we generate the enum classes `TraitSet`,
`TraitSelector`, and `TraitProperty` as well as conversion and helper
functions in `llvm/lib/Frontend/OpenMP/OMPContext.{h,cpp}`.

The above enum classes are used in the parser, sema, and the AST
attribute. The latter is not a collection of multiple primitive variant
arguments that contain encodings via numbers and strings but instead a
tree that mirrors the `match` clause (see `struct OpenMPTraitInfo`).

The changes to the parser make it more forgiving when wrong syntax is
read and they also resulted in more specialized diagnostics. The tests
are updated and the core issues are detected as before. Here and
elsewhere this patch tries to be generic, thus we do not distinguish
what selector set, selector, or property is parsed except if they do
behave exceptionally, as for example `user={condition(EXPR)}` does.

The sema logic changed in two ways: First, the OMPDeclareVariantAttr
representation changed, as mentioned above, and the sema was adjusted to
work with the new `OpenMPTraitInfo`. Second, the matching and scoring
logic moved into `OMPContext.{h,cpp}`. It is implemented on a flat
representation of the `match` clause that is not tied to clang.
`OpenMPTraitInfo` provides a method to generate this flat structure (see
`struct VariantMatchInfo`) by computing integer score values and boolean
user conditions from the `clang::Expr` we keep for them.

The OpenMP context is now an explicit object (see `struct OMPContext`).
This is in anticipation of construct traits that need to be tracked. The
OpenMP context, as well as the `VariantMatchInfo`, are basically made up
of a set of active or respectively required traits, e.g., 'host', and an
ordered container of constructs which allows duplication. Matching and
scoring is kept as generic as possible to allow easy extension in the
future.

---

Test changes:

The messages checked in `OpenMP/declare_variant_messages.{c,cpp}` have
been auto generated to match the new warnings and notes of the parser.
The "subset" checks were reversed causing the wrong version to be
picked. The tests have been adjusted to correct this.
We do not print scores if the user did not provide one.
We print spaces to make lists in the `match` clause more legible.

Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim

Subscribers: merge_guards_bot, rampitec, mgorny, hiraditya, aheejin, fedor.sergeev, simoncook, bollu, guansong, dexonsmith, jfb, s.egerton, llvm-commits, cfe-commits

Tags: #clang, #llvm

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

4 years ago[lldb/Editline] Fix mistake in HistoryOperation mapping
Jonas Devlieghere [Fri, 14 Feb 2020 21:21:00 +0000 (13:21 -0800)]
[lldb/Editline] Fix mistake in HistoryOperation mapping

In 0e9b0b6d11e882efec8505d97c4b65e1562e6715 I introduced the
HistoryOperation enum to navigate the history. While this fixed the
behavior of HistoryOperation::Older and HistoryOperation::Newer, it
confused the mapping for HistoryOperation::Oldest and
HistoryOperation::Newest.

I tried to write a PExpect test to make sure this doesn't regress, but
I'm unable to prime the history in such a way that it recalls a known
element. I suspect this is an LLDB bug, but the  most recent entry
doesn't get update with entries from the current session. I considered
spoofing the home directory but that needs to happen before libLLDB is
loaded and you'll need to account for the widechar support. If anyone
has another suggestion I'd love to hear it.

4 years ago[NFC][llvm-exegesis] CombinationGenerator::performGeneration(): pull put state increm...
Roman Lebedev [Fri, 14 Feb 2020 21:47:13 +0000 (00:47 +0300)]
[NFC][llvm-exegesis] CombinationGenerator::performGeneration(): pull put state increment into lambda

This avoids questionable code such as taking address of current
range-based for variable and comparing it with vector begin iterator.
While this may not be a problem in itself, it can be written more consice.
This was initially suggested by @aaronpuchert.

4 years ago[compiler-rt] Make various Apple lit substitutions work correctly for other Apple...
Dan Liew [Fri, 14 Feb 2020 21:27:51 +0000 (13:27 -0800)]
[compiler-rt] Make various Apple lit substitutions work correctly for other Apple platforms.

This change makes the following lit substitutions expand to the correct
thing for macOS, iOS, tvOS, and watchOS.

%darwin_min_target_with_full_runtime_arc_support
%macos_min_target_10_11

rdar://problem/59463146

4 years ago[compiler-rt] Disable building LibFuzzer for WatchOS and the corresponding simulator.
Dan Liew [Fri, 14 Feb 2020 19:43:35 +0000 (11:43 -0800)]
[compiler-rt] Disable building LibFuzzer for WatchOS and the corresponding simulator.

rdar://problem/59466685

4 years ago[compiler-rt] Provide a lit config variable that defines the minimum deployment OS...
Dan Liew [Fri, 14 Feb 2020 19:35:06 +0000 (11:35 -0800)]
[compiler-rt] Provide a lit config variable that defines the minimum deployment OS version flag appropriate for the configured OS.

This patch defines `config.apple_platform_min_deployment_target_flag`
in the ASan, LibFuzzer, TSan, and UBSan lit test configs.

rdar://problem/59463146

4 years ago[compiler-rt] Add `DARWIN_osx_MIN_VER_FLAG` variable to match the other Apple platforms.
Dan Liew [Fri, 14 Feb 2020 19:01:02 +0000 (11:01 -0800)]
[compiler-rt] Add `DARWIN_osx_MIN_VER_FLAG` variable to match the other Apple platforms.

rdar://problem/59463146

4 years ago[compiler-rt] Use the correct minimum version flag for simulators on Apple
Dan Liew [Fri, 14 Feb 2020 18:28:05 +0000 (10:28 -0800)]
[compiler-rt] Use the correct minimum version flag for simulators on Apple
platforms.

For the simulators this changes the following compilation flags (
used both for building the runtime and lit tests).

iOS simulator: `-miphoneos-version-min` -> `-mios-simulator-version-min`
watchOS simulator: `-mwatchos-version-min` -> `-mwatchos-simulator-version-min`
tvOS simulator: `-mtvos-version-min` -> `-mtvos-simulator-version-min`

rdar://problem/59463146

4 years ago[llvm-exegesis] Rename range based for loop variable in a unit test so its different...
Craig Topper [Fri, 14 Feb 2020 21:41:50 +0000 (13:41 -0800)]
[llvm-exegesis] Rename range based for loop variable in a unit test so its different than the container being iterated over. NFC

It seems like gcc 5.5 wants to iterate over the new variable instead
of the container that lives outside the loop. But of course this
new container is empty.

Plus using a different variable names makes the code more readable.

4 years ago[Hexagon] Add an explicit makeArrayRef to pacify gcc 5.5
Craig Topper [Fri, 14 Feb 2020 21:38:50 +0000 (13:38 -0800)]
[Hexagon] Add an explicit makeArrayRef to pacify gcc 5.5

The array seemed to have decayed to a pointer before the ArrayRef
constructor got called so there was no size information available.

4 years ago[mlir] Add MemRef filter to affine data copy optimization
Diego Caballero [Fri, 14 Feb 2020 21:41:01 +0000 (13:41 -0800)]
[mlir] Add MemRef filter to affine data copy optimization

This patch extends affine data copy optimization utility with an
optional memref filter argument. When the memref filter is used, data
copy optimization will only generate copies for such a memref.

Note: this patch is just porting the memref filter feature from Uday's
'hop' branch: https://github.com/bondhugula/llvm-project/tree/hop.

Reviewed By: bondhugula

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

4 years ago[scudo][standalone] Allow setting release to OS
Christopher Ferris [Fri, 14 Feb 2020 20:24:03 +0000 (12:24 -0800)]
[scudo][standalone] Allow setting release to OS

Summary:
Add a method to set the release to OS value as the system runs,
and allow this to be set differently in the primary and the secondary.
Also, add a default value to use for primary and secondary. This
allows Android to have a default that is different for
primary/secondary.

Update mallopt to support setting the release to OS value.

Reviewers: pcc, cryptoad

Reviewed By: cryptoad

Subscribers: cryptoad, jfb, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[AsmPrinter] Use the McASMInfo to determine if we need descriptors.
Sean Fertile [Fri, 14 Feb 2020 16:15:26 +0000 (11:15 -0500)]
[AsmPrinter] Use the McASMInfo to determine if we need descriptors.

In https://reviews.llvm.org/rG8b737688c21a9755cae14cb9343930e0882164ab I
switched the condition gating the creation of the descriptor symbol from
checking the MCAsmInfo if we need to support descriptors, to if the OS
was AIX. Technically the 2 should be interchangeable: if we are
targeting AIX then we need to emit XCOFF object files, and the MCAsmInfo
must return true for needing function descriptors.

This doesn't account for lit test with runsteps that only set the arch.
Eg: test/CodeGen/XCore/section-name.ll
which when run natively on AIX we end up with a target xcore-ibm-aix and
needFunctionDescriptors is false.

This patch reverts to using the MCAsmInfo and adds an assert that the
target OS must be AIX since that is the only target using the descriptor
hook.

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

4 years agofix some comment typos to cycle bots
Nico Weber [Fri, 14 Feb 2020 20:18:50 +0000 (15:18 -0500)]
fix some comment typos to cycle bots

4 years ago[windows] Add /Gw to compiler flags
Nico Weber [Fri, 14 Feb 2020 20:15:00 +0000 (15:15 -0500)]
[windows] Add /Gw to compiler flags

This is like -fdata-sections, and it's not part of /O2 by default for some reason.

In the cmake build, reduces the size of clang.exe from 70,358,016 bytes to 69,982,720 bytes.

clang-format.exe goes from 3,703,296 bytes to 3,331,072 bytes.

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

4 years ago[AMDGPU] Always enable XNACK feature when support is explicitly requested
Austin Kerbow [Fri, 14 Feb 2020 17:22:33 +0000 (09:22 -0800)]
[AMDGPU] Always enable XNACK feature when support is explicitly requested

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

4 years ago[docs] Add note on using cmake to perform the build
Evandro Menezes [Fri, 14 Feb 2020 19:41:42 +0000 (13:41 -0600)]
[docs] Add note on using cmake to perform the build

Repeat the build instructions from the top level README in the Getting
Started guide.

4 years agoAMDGPU: Add option to disable CGP division expansion
Matt Arsenault [Tue, 11 Feb 2020 22:00:11 +0000 (17:00 -0500)]
AMDGPU: Add option to disable CGP division expansion

The division expansions in AMDGPUCodeGenPrepare can't be relied on for
correctness, since they punt to later optimization and possibly
legalization in some cases. We still need a way to be able to write
tests for the legalizer versions of the expansion. This is mostly for
GlobalISel, since the expected optimzations is expecting aren't
implemented.

The interaction with the flag to expand 64-bit division in the IR is
pretty confusing, but these flags have different purposes.

4 years ago[x86] remove stray test assertions; NFC
Sanjay Patel [Fri, 14 Feb 2020 19:28:50 +0000 (14:28 -0500)]
[x86] remove stray test assertions; NFC

I updated the prefix and forgot to manually remove the old names
as part of rG6071fc57a45.f

4 years ago[x86] regenerate complete test checks for sqrt{est}; NFC
Sanjay Patel [Fri, 14 Feb 2020 19:06:00 +0000 (14:06 -0500)]
[x86] regenerate complete test checks for sqrt{est}; NFC

The existing checks were trying to test both CPU-specific
codegen and generic codegen with explicit attributes for
the various sqrt estimate possibilities, but that was hard
to decipher and update (D69989).

Instead generate the complete results for various CPUs,
and that makes it clear which models have slow/fast sqrt
attributes along with all of the other potential diffs
(FMA, AVX2, scheduling).

Also, explicitly add the function attributes corresponding
to whether DAZ/FTZ denorm settings are expected.

4 years agoAMDGPU: Add option to expand 64-bit integer division in IR
Matt Arsenault [Sun, 19 Jan 2020 03:41:36 +0000 (22:41 -0500)]
AMDGPU: Add option to expand 64-bit integer division in IR

I didn't realize we were already expanding 24/32-bit division here
already. Use the available IntegerDivision utilities. This uses loops,
so produces significantly smaller code than the inline DAG expansion.

This now requires width reductions of 64-bit divisions before
introducing the expanded loops.

This helps work around missing legalization in GlobalISel for
division, which are the only remaining core instructions that didn't
work at all.

I think this is plausibly a better implementation than exists in the
DAG, although turning it on by default misses out on the constant
value optimizations and also needs benchmarking.

4 years ago[X86] Use ZERO_EXTEND instead of SIGN_EXTEND in the fast isel handling of convert_fro...
Craig Topper [Fri, 14 Feb 2020 18:37:06 +0000 (10:37 -0800)]
[X86] Use ZERO_EXTEND instead of SIGN_EXTEND in the fast isel handling of convert_from_fp16.

4 years ago[X86] Add AVX512 support to the fast isel code for Intrinsic::convert_from_fp16/conve...
Craig Topper [Fri, 14 Feb 2020 18:26:14 +0000 (10:26 -0800)]
[X86] Add AVX512 support to the fast isel code for Intrinsic::convert_from_fp16/convert_to_fp16.

4 years ago[LoopRotate] Get and update MSSA only if available in legacy pass manager.
Alina Sbirlea [Thu, 13 Feb 2020 18:49:44 +0000 (10:49 -0800)]
[LoopRotate] Get and update MSSA only if available in legacy pass manager.

Summary:
Potential fix for: https://bugs.llvm.org/show_bug.cgi?id=44889 and https://bugs.llvm.org/show_bug.cgi?id=44408

In the legacy pass manager, loop rotate need not compute MemorySSA when not being in the same loop pass manager with other loop passes.
There isn't currently a way to differentiate between the two cases, so this attempts to limit the usage in LoopRotate to only update MemorySSA when the analysis is already available.
The side-effect of this is that it will split the Loop pipeline.

This issue does not apply to the new pass manager, where we have a flag specifying if all loop passes in that loop pass manager preserve MemorySSA.

Reviewers: dmgreen, fedor.sergeev, nikic

Subscribers: Prazek, hiraditya, george.burgess.iv, llvm-commits

Tags: #llvm

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

4 years agoGlobalISel: Lower s64->s16 G_FPTRUNC
Matt Arsenault [Sat, 18 Jan 2020 15:08:11 +0000 (10:08 -0500)]
GlobalISel: Lower s64->s16 G_FPTRUNC

This is more or less directly ported from the AMDGPU custom lowering
for FP_TO_FP16. I made a few minor fixups (using G_UNMERGE_VALUES
instead of creating shift/trunc to extract the two halves, and zexting
an inverted compare instead of select_cc).

This also does not include the fast math expansion the DAG which
converts to f32 and then to f16. I think that belongs in a
pre-legalize combine instead.

4 years ago[GlobalISel] LegalizationArtifactCombiner: Fix a bug in tryCombineMerges
Volkan Keles [Fri, 14 Feb 2020 18:43:12 +0000 (10:43 -0800)]
[GlobalISel] LegalizationArtifactCombiner: Fix a bug in tryCombineMerges

Like COPY instructions explained in D70616, we don't check the constraints
when combining G_UNMERGE_VALUES. Use the same logic used in D70616 to check
if registers can be replaced, or a COPY instruction needs to be built.

https://reviews.llvm.org/D70564

4 years ago[Hexagon] v67+ HVX register pairs should support either direction
Brian Cain [Tue, 14 Aug 2018 21:17:46 +0000 (16:17 -0500)]
[Hexagon] v67+ HVX register pairs should support either direction

Assembler now permits pairs like 'v0:1', which are encoded
differently from the odd-first pairs like 'v1:0'.

The compiler will require more work to leverage these new register
pairs.

4 years agoFix tests after previous commit
Aaron Puchert [Fri, 14 Feb 2020 18:41:01 +0000 (19:41 +0100)]
Fix tests after previous commit

We don't want to test for this warning, so we just fix it.

4 years agoWarn about zero-parameter K&R definitions in -Wstrict-prototypes
Aaron Puchert [Fri, 14 Feb 2020 17:42:44 +0000 (18:42 +0100)]
Warn about zero-parameter K&R definitions in -Wstrict-prototypes

Summary:
Zero-parameter K&R definitions specify that the function has no
parameters, but they are still not prototypes, so calling the function
with the wrong number of parameters is just a warning, not an error.

The C11 standard doesn't seem to directly define what a prototype is,
but it can be inferred from 6.9.1p7: "If the declarator includes a
parameter type list, the list also specifies the types of all the
parameters; such a declarator also serves as a function prototype
for later calls to the same function in the same translation unit."
This refers to 6.7.6.3p5: "If, in the declaration “T D1”, D1 has
the form
    D(parameter-type-list)
or
    D(identifier-list_opt)
[...]". Later in 6.11.7 it also refers only to the parameter-type-list
variant as prototype: "The use of function definitions with separate
parameter identifier and declaration lists (not prototype-format
parameter type and identifier declarators) is an obsolescent feature."

We already correctly treat an empty parameter list as non-prototype
declaration, so we can just take that information.

GCC also warns about this with -Wstrict-prototypes.

This shouldn't affect C++, because there all FunctionType's are
FunctionProtoTypes. I added a simple test for that.

Reviewed By: aaron.ballman

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

4 years ago[APInt] Add some basic APInt::byteSwap unit tests
Simon Pilgrim [Fri, 14 Feb 2020 18:15:02 +0000 (18:15 +0000)]
[APInt] Add some basic APInt::byteSwap unit tests

As noted on D74621 we currently have no test coverage

4 years agoTTI: Fix vectorization cost for bswap
Matt Arsenault [Fri, 14 Feb 2020 15:32:02 +0000 (10:32 -0500)]
TTI: Fix vectorization cost for bswap

4 years ago[lldb/Plugin] s/LLDB_PLUGIN/LLDB_PLUGIN_DEFINE/ (NFC)
Jonas Devlieghere [Fri, 14 Feb 2020 17:46:02 +0000 (09:46 -0800)]
[lldb/Plugin] s/LLDB_PLUGIN/LLDB_PLUGIN_DEFINE/ (NFC)

Rename LLDB_PLUGIN to LLDB_PLUGIN_DEFINE as Pavel suggested in D73067 to
avoid name conflict.

4 years ago[libc++] Add missing include for is_same in test
Eric Fiselier [Fri, 14 Feb 2020 17:55:02 +0000 (18:55 +0100)]
[libc++] Add missing include for is_same in test

4 years agoAMDGPU: Improve i16/v2i16 bswap
Matt Arsenault [Fri, 14 Feb 2020 15:31:38 +0000 (10:31 -0500)]
AMDGPU: Improve i16/v2i16 bswap

4 years ago[X86] Fix copy/paste mistake in comment. NFC
Craig Topper [Thu, 13 Feb 2020 22:49:07 +0000 (14:49 -0800)]
[X86] Fix copy/paste mistake in comment. NFC

4 years agoAMDGPU: Add baseline tests for 16-bit bswap
Matt Arsenault [Fri, 14 Feb 2020 15:15:20 +0000 (10:15 -0500)]
AMDGPU: Add baseline tests for 16-bit bswap

4 years agoAMDGPU/GlobalISel: Handle G_BSWAP
Matt Arsenault [Thu, 13 Feb 2020 02:09:09 +0000 (21:09 -0500)]
AMDGPU/GlobalISel: Handle G_BSWAP

4 years ago[libc++] Remove cycle between <type_traits> and <cstddef>
Eric Fiselier [Fri, 14 Feb 2020 16:34:46 +0000 (17:34 +0100)]
[libc++] Remove cycle between <type_traits> and <cstddef>

This was caused by byte depending on traits. This patch moves
the minimal amount of meta-programming into <cstddef> to break the cycle.

4 years agoFix compilation breakage introduced by 8404aeb56a73ab24f9b295111de3b37a37f0b841.
Alexandre Ganea [Fri, 14 Feb 2020 16:16:32 +0000 (11:16 -0500)]
Fix compilation breakage introduced by 8404aeb56a73ab24f9b295111de3b37a37f0b841.

Also fix BitVector unittest failure when DLLVM_ENABLE_ASSERTIONS are OFF, introduced by d110c3a9f5253c4d94c10299c61fbbb33edab7db.

4 years ago[Driver] Rename AddGoldPlugin to addLTOOptions. NFC
Fangrui Song [Fri, 14 Feb 2020 06:35:18 +0000 (22:35 -0800)]
[Driver] Rename AddGoldPlugin to addLTOOptions. NFC

AddGoldPlugin does more than adding `-plugin path/to/LLVMgold.so`.
It works with lld and GNU ld, and adds other LTO options.
So AddGoldPlugin is no longer a suitable name.

Reviewed By: tejohnson

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

4 years agoReverting D73027 [DependenceAnalysis] Dependecies for loads marked with "ivnariant...
Evgeniy Brevnov [Fri, 14 Feb 2020 15:55:13 +0000 (22:55 +0700)]
Reverting D73027 [DependenceAnalysis] Dependecies for loads marked with "ivnariant.load" should not be shared with general accesses(PR42151).

4 years agoadd type_traits include as required for std::integral_constant
Eric Fiselier [Fri, 14 Feb 2020 15:38:16 +0000 (16:38 +0100)]
add type_traits include as required for std::integral_constant

4 years agoRevert "Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract...
Melanie Blower [Fri, 14 Feb 2020 14:44:20 +0000 (06:44 -0800)]
Revert "Reland D74436 "Change clang option -ffp-model=precise to select ffp-contract=on""

This reverts commit 0a1123eb43f945593b26dd037490e0c909fa3c4f.
Want to revert this because it's causing trouble for PowerPC
I also fixed test fp-model.c which was looking for an incorrect error message