platform/upstream/llvm.git
4 years agoFix integration of pass plugins with llvm dylib
serge-sans-paille [Wed, 12 Feb 2020 07:57:19 +0000 (08:57 +0100)]
Fix integration of pass plugins with llvm dylib

Call llvm_process_pass_plugin from clang when in standalone mode.

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

4 years agoRework go bindings so that validation works fine
serge-sans-paille [Thu, 13 Feb 2020 11:03:33 +0000 (12:03 +0100)]
Rework go bindings so that validation works fine

Basically change the layout to please `go build` and remove references to
`llvm-go`.

Update llvm/test/Bindings/Go/ to use the system go compiler

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

4 years ago[PowerPC] Exploit VSX rounding instrs for rint
Qiu Chaofan [Thu, 13 Feb 2020 12:59:50 +0000 (20:59 +0800)]
[PowerPC] Exploit VSX rounding instrs for rint

Exploit native VSX rounding instruction, x(v|s)r(d|s)pic, which does
rounding using current rounding mode.

According to C standard library, rint may raise INEXACT exception while
nearbyint won't.

Reviewed By: lkail

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

4 years ago[analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax
Gabor Marton [Thu, 13 Feb 2020 11:11:24 +0000 (12:11 +0100)]
[analyzer] StdLibraryFunctionsChecker: Use platform dependent EOF and UCharMax

Summary:
Both EOF and the max value of unsigned char is platform dependent. In this
patch we try our best to deduce the value of EOF from the Preprocessor,
if we can't we fall back to -1.

Reviewers: Szelethus, NoQ

Subscribers: whisperity, xazax.hun, kristof.beyls, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalh

Tags: #clang

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

4 years ago[debuginfo-tests] Fix Dexter process creation failure on Windows
Jeremy Morse [Thu, 13 Feb 2020 12:43:28 +0000 (12:43 +0000)]
[debuginfo-tests] Fix Dexter process creation failure on Windows

When writing the Windows dbgeng driver for Dexter, I couldn't work out why it
would either launch a process and leave it free running, or if I started the
process suspended, never do anything with it. The result was a hack to create
and attach processes manually. This has been flaking out on Reids Windows
buildbot, and clearly wasn't a good solution.

Digging into this, it turns out that the "normal" cdb / windbg behaviour of
breaking whenever we attach to a process is not the default: it has to be
explicitly requested from the debug engine. This patch does so (by setting
DEBUG_ENGOPT_INITIAL_BREAK in the engine options), after which we can simply
call "CreateProcessAndAttach2" and everything automagically works.

No test for this behaviour: everything was just broken before.

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

4 years ago[clangd] Print the Spelled RefKind.
Haojian Wu [Thu, 13 Feb 2020 12:26:42 +0000 (13:26 +0100)]
[clangd] Print the Spelled RefKind.

4 years agoRe-revert: Recover debug intrinsics when killing duplicated/empty blocks
stozer [Thu, 13 Feb 2020 10:40:51 +0000 (10:40 +0000)]
Re-revert: Recover debug intrinsics when killing duplicated/empty blocks

This reverts commit 61b35e4111160fe834a00c33d040e01150b576ac.

This commit causes a timeout in chromium builds; likely to have a
similar cause to the previous timeout issue caused by this commit (see
6ded69f294a9 for more details). It is possible that there is no way to
fix this bug that will not cause this issue; further investigations as
to the efficiency of handling large amounts of debug info will be
necessary.

4 years agoFix the mac buildbot failure.
Haojian Wu [Thu, 13 Feb 2020 11:38:47 +0000 (12:38 +0100)]
Fix the mac buildbot failure.

4 years ago[clang] stop baremetal driver to append .a to lib
Christof Douma [Thu, 13 Feb 2020 11:08:46 +0000 (11:08 +0000)]
[clang] stop baremetal driver to append .a to lib

When the clang baremetal driver selects the rt.builtins static library
it prefix with "-l" and appends ".a". The result is a nonsense option
which lld refuses to accept.

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

Change-Id: Ic753b6104e259fbbdc059b68fccd9b933092d828

4 years ago[AArch64] Fix BTI landing pad generation.
Daniel Kiss [Thu, 13 Feb 2020 10:42:39 +0000 (10:42 +0000)]
[AArch64] Fix BTI landing pad generation.

In some cases BTI landing pad is inserted even compatible instruction
was there already. Meta instruction does not count in this case
therefore skip them in the check for first instructions in the function.

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

4 years ago[AArch64][SVE] Add mul/mla/mls lane & dup intrinsics
Kerry McLaughlin [Thu, 13 Feb 2020 10:11:22 +0000 (10:11 +0000)]
[AArch64][SVE] Add mul/mla/mls lane & dup intrinsics

Summary:
Implements the following intrinsics:
 - @llvm.aarch64.sve.dup
 - @llvm.aarch64.sve.mul.lane
 - @llvm.aarch64.sve.mla.lane
 - @llvm.aarch64.sve.mls.lane

Reviewers: c-rhodes, sdesmalen, dancgr, efriedma, rengolin

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #llvm

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

4 years agoFix unneeded semi column
Guillaume Chatelet [Thu, 13 Feb 2020 10:18:28 +0000 (11:18 +0100)]
Fix unneeded semi column

4 years ago[ARM] Fix ReconstructShuffle for bigendian
David Green [Wed, 12 Feb 2020 20:51:39 +0000 (20:51 +0000)]
[ARM] Fix ReconstructShuffle for bigendian

Simon pointed out that this function is doing a bitcast, which can be
incorrect for big endian. That makes the lowering of VMOVN in MVE
wrong, but the function is shared between Neon and MVE so both can
be incorrect.

This attempts to fix things by using the newly added VECTOR_REG_CAST
instead of the BITCAST. As it may now be used on Neon, I've added the
relevant patterns for it there too. I've also added a quick dag combine
for it to remove them where possible.

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

4 years ago[ARM] Extra vmovn tests to show BE differences. NFC
David Green [Wed, 12 Feb 2020 18:18:23 +0000 (18:18 +0000)]
[ARM] Extra vmovn tests to show BE differences. NFC

4 years ago[NFC][llvm-exegesis] Docs/help: opcode-index=-1 means measure everything
Roman Lebedev [Thu, 13 Feb 2020 09:45:15 +0000 (12:45 +0300)]
[NFC][llvm-exegesis] Docs/help: opcode-index=-1 means measure everything

4 years ago[LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols.
Peter Smith [Thu, 13 Feb 2020 08:42:17 +0000 (08:42 +0000)]
[LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols.

Recommit of 0b4a047bfbd11fe1f5abda8da0e2391c1918162a
(reverted in c29003813ab9bd6ea7b6de40ea8f1fe21979f13f) to incorporate
subsequent fix and add a warning when LLD's interworking behavior has
changed.

D73474 disabled the generation of interworking thunks for branch
relocations to non STT_FUNC symbols. This patch handles the case of BL and
BLX instructions to non STT_FUNC symbols. LLD would normally look at the
state of the caller and the callee and write a BL if the states are the
same and a BLX if the states are different.

This patch disables BL/BLX substitution when the destination symbol does
not have type STT_FUNC. This brings our behavior in line with GNU ld which
may prevent difficult to diagnose runtime errors when switching to lld.

This change does change how LLD handles interworking of symbols that do not
have type STT_FUNC from previous versions including the 10.0 release. This
brings LLD in line with ld.bfd but there may be programs that have not been
linked with ld.bfd that depend on LLD's previous behavior. We emit a warning
when the behavior changes.

A summary of the difference between 10.0 and 11.0 is that for symbols
that do not have a type of STT_FUNC LLD will not change a BL to a BLX or
vice versa. The table below enumerates the changes
| relocation     | STT_FUNC | bit(0) | in  | 10.0- out | 11.0+ out |
| R_ARM_CALL     | no       | 1      | BL  | BLX       | BL        |
| R_ARM_CALL     | no       | 0      | BLX | BL        | BLX       |
| R_ARM_THM_CALL | no       | 1      | BLX | BL        | BLX       |
| R_ARM_THM_CALL | no       | 0      | BL  | BLX       | BL        |

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

4 years ago[lldb] Clean up ProcessGDBRemote::DidLaunchOrAttach
Pavel Labath [Thu, 13 Feb 2020 09:26:58 +0000 (10:26 +0100)]
[lldb] Clean up ProcessGDBRemote::DidLaunchOrAttach

- reduce indentation by removing the defensive
  GetID()!=INVALID_PROCESS_ID check -- this function is only called when
  an attach or launch succeeds
- replace LLDB_LOGF with LLDB_LOG

4 years ago[clangd] Query constructors in the index during rename.
Haojian Wu [Tue, 11 Feb 2020 15:37:37 +0000 (16:37 +0100)]
[clangd] Query constructors in the index during rename.

Summary:
Though this is not needed when using clangd's own index, other indexes
(e.g. kythe) need it, as classes and their constructors are different
symbols, otherwise we will miss renaming constructors.

Reviewers: kbobyrev

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years agoDon't call memcpy(p, 0, 0).
Richard Smith [Thu, 13 Feb 2020 08:35:27 +0000 (00:35 -0800)]
Don't call memcpy(p, 0, 0).

Found by UBSan, reported by Kostya. Thanks!

4 years ago[DebugInfo] Fix dumping CIE ID in .eh_frame sections.
Igor Kudrin [Wed, 29 Jan 2020 14:28:46 +0000 (21:28 +0700)]
[DebugInfo] Fix dumping CIE ID in .eh_frame sections.

We do not keep the actual value of the CIE ID field, because it is
predefined, and use a constant when dumping a CIE record. The issue
was that the predefined value is different for .debug_frame and
.eh_frame sections, but we always printed the one which corresponds
to .debug_frame. The patch fixes that by choosing an appropriate
constant to print.

See the following for more information about .eh_frame sections:
https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html

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

4 years ago[mlir] Add elementAttr to TypedArrayAttrBase.
Abdurrahman Akkas [Thu, 13 Feb 2020 08:23:37 +0000 (09:23 +0100)]
[mlir] Add elementAttr to TypedArrayAttrBase.

In code generators, one can automate the translation of typed ArrayAttrs
if element attribute translators are already implemented. However, the
type of the element attribute is lost at the construction of
TypedArrayAttrBase. With this change one can inspect the element type
and generate the translation logic automatically, which will reduce the
code repetition.

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

4 years ago[NFC][mlir] Adding some helpful EDSC intrinsics
Kern Handa [Thu, 13 Feb 2020 08:20:50 +0000 (09:20 +0100)]
[NFC][mlir] Adding some helpful EDSC intrinsics

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

4 years ago[lldb] Make gdbremote.py utility py2and3 compatible
Pavel Labath [Thu, 13 Feb 2020 08:18:10 +0000 (09:18 +0100)]
[lldb] Make gdbremote.py utility py2and3 compatible

4 years ago[mlir][DeclarativeParser] Move operand type resolution into a functor to
River Riddle [Thu, 13 Feb 2020 07:56:07 +0000 (23:56 -0800)]
[mlir][DeclarativeParser] Move operand type resolution into a functor to
share code.

This reduces the duplication for the two different cases.

4 years ago[mlir][ODS][NFC] Mark OpaqueType as a buildable type.
River Riddle [Thu, 13 Feb 2020 07:51:38 +0000 (23:51 -0800)]
[mlir][ODS][NFC] Mark OpaqueType as a buildable type.

This allows for using it in the declarative assembly form, among other
things.

4 years ago[OpenMP][FIX] Collect blocks to be outlined after finalization
Johannes Doerfert [Thu, 13 Feb 2020 06:39:55 +0000 (00:39 -0600)]
[OpenMP][FIX] Collect blocks to be outlined after finalization

Finalization can introduce new blocks we need to outline as well so it
makes sense to identify the blocks that need to be outlined after
finalization happened. There was also a minor unit test adjustment to
account for the fact that we have a single outlined exit block now.

4 years ago[ELF][test] Change -o %t to -o /dev/null if the output is not needed
Fangrui Song [Thu, 13 Feb 2020 05:48:45 +0000 (21:48 -0800)]
[ELF][test] Change -o %t to -o /dev/null if the output is not needed

4 years agoExplicitly state the output file.
Sterling Augustine [Thu, 13 Feb 2020 05:22:34 +0000 (21:22 -0800)]
Explicitly state the output file.

Summary:
Even though this test is a check for failure, lld still attempts
to open the final output file, which fails when the default "a.out"
file is used and the current directory is read-only. Specifying an
output file works around this problem.

Reviewers: espindola

Subscribers: emaste, MaskRay, llvm-commits

Tags: #llvm

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

4 years agoRevert "Replace std::foo with std::foo_t in LLVM."
Vladimir Vereschaka [Thu, 13 Feb 2020 04:51:05 +0000 (20:51 -0800)]
Revert "Replace std::foo with std::foo_t in LLVM."

This reverts commit a4384c756bd8a819051009b5b273b2a34be8261b.

These changes break LLVM build on Windows builders.

See https://reviews.llvm.org/rGa4384c756bd8a819051009b5b273b2a34be8261b
for details.

4 years ago[X86] Add test RUN lines to show cases where we use 512-bit vcmppd/ps with garbage...
Craig Topper [Thu, 13 Feb 2020 04:39:30 +0000 (20:39 -0800)]
[X86] Add test RUN lines to show cases where we use 512-bit vcmppd/ps with garbage upper bits for 128/256-bit strict_fsetcc

On KNL targets, we widen 128/256-bit strict_fsetcc nodes to
512-bits without forcing the upper bits to zero. This can cause
spurious exceptions due to garbage upper bits. This behavior was
inherited from the non-strict case where the spurious exception
isn't a problem.

4 years ago[BPF] explicit warning of not supporting dynamic stack allocation
Yonghong Song [Thu, 13 Feb 2020 04:00:20 +0000 (20:00 -0800)]
[BPF] explicit warning of not supporting dynamic stack allocation

Currently, BPF does not support dynamic static allocation.
For a program like below:
  extern void bar(int *);
  void foo(int n) {
    int a[n];
    bar(a);
  }

The current error message looks like:
  unimplemented operand
  UNREACHABLE executed at /.../llvm/lib/Target/BPF/BPFISelLowering.cpp:199!

Let us make error message explicit so it will be clear to the user
what is the problem. With this patch, the error message looks like:
  fatal error: error in backend: Unsupported dynamic stack allocation
  ...

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

4 years agoReapply "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"
Johannes Doerfert [Thu, 13 Feb 2020 02:52:23 +0000 (20:52 -0600)]
Reapply "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

Reapply 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f with minor fixes.

The problem was that cancellation can cause new edges to the parallel
region exit block which is not outlined. The CodeExtractor will encode
the information which "exit" was taken as a return value. The fix is to
ensure we do not return any value from the outlined function, to prevent
control to value conversion we ensure a single exit block for the
outlined region.

This reverts commit 3aac953afa34885a72df96f2b703b65f85cbb149.

4 years ago[Statepoint] Remove redundant clear of call target on register
Serguei Katkov [Wed, 12 Feb 2020 07:28:25 +0000 (14:28 +0700)]
[Statepoint] Remove redundant clear of call target on register

Patchable statepoint is lowered into sequence of nops, so zeroed call target
should not be on register. It is better to use getTargetConstant instead
of getConstant to select zero constant for call target.

Reviewers: reames
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D74465

4 years ago[AMDGPU][GlobalISel] Handle 64byte EltSIze in getRegSplitParts
Austin Kerbow [Wed, 12 Feb 2020 22:52:48 +0000 (14:52 -0800)]
[AMDGPU][GlobalISel] Handle 64byte EltSIze in getRegSplitParts

Reviewers: arsenm

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix regression due to reviews.llvm.org/D74436 by adding option ffp-contract=off to...
Melanie Blower [Thu, 13 Feb 2020 03:05:18 +0000 (19:05 -0800)]
Fix regression due to reviews.llvm.org/D74436 by adding option ffp-contract=off to RUN line

4 years agoFix ReST syntax on link to "Bisecting LLVM code" page
Nico Weber [Thu, 13 Feb 2020 02:18:25 +0000 (21:18 -0500)]
Fix ReST syntax on link to "Bisecting LLVM code" page

Patch from nicolas17 (Nicolás Alvarez)!

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

4 years ago[MLIR][Affine] Add affine.parallel op
Frank Laub [Thu, 13 Feb 2020 01:59:57 +0000 (17:59 -0800)]
[MLIR][Affine] Add affine.parallel op

Summary:
As discussed in https://llvm.discourse.group/t/rfc-add-affine-parallel/350, this is the first in a series of patches to bring in support for the `affine.parallel` operation.

This first patch adds the IR representation along with custom printer/parser implementations.

Reviewers: bondhugula, herhut, mehdi_amini, nicolasvasilache, rriddle, earhart, jbruestle

Reviewed By: bondhugula, nicolasvasilache, rriddle, earhart, jbruestle

Subscribers: jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[AsmPrinter][ELF] Emit local alias for ExternalLinkage dso_local GlobalAlias
Fangrui Song [Wed, 12 Feb 2020 00:07:06 +0000 (16:07 -0800)]
[AsmPrinter][ELF] Emit local alias for ExternalLinkage dso_local GlobalAlias

4 years agoRevert "[X86][SSE] lowerShuffleAsBitRotate - lower to vXi8 shuffles to ROTL on pre...
Amy Huang [Thu, 13 Feb 2020 00:59:17 +0000 (16:59 -0800)]
Revert "[X86][SSE] lowerShuffleAsBitRotate - lower to vXi8 shuffles to ROTL on pre-SSSE3 targets"

This reverts commit 11c16e71598d51f15b4cfd0f719c4dabcc0bebf7 because it
causes a crash in chromium code. See
https://reviews.llvm.org/rG11c16e71598d51f15b4cfd0f719c4dabcc0bebf7.

4 years agoRevert "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"
Johannes Doerfert [Thu, 13 Feb 2020 00:50:22 +0000 (18:50 -0600)]
Revert "[OpenMP][IRBuilder] Perform finalization (incl. outlining) late"

This reverts commit 8a56d64d7620b3764f10f03f3a1e307fcdd72c2f.

Will be recommitted once the clang test problem is addressed.

4 years agoAMDGPU/GlobalISel: Select G_CTTZ_ZERO_UNDEF
Matt Arsenault [Fri, 7 Feb 2020 16:08:52 +0000 (11:08 -0500)]
AMDGPU/GlobalISel: Select G_CTTZ_ZERO_UNDEF

Directly select this rather than going through the intermediate
instruction, which may provide some combine value in the future.

4 years agoAMDGPU/GlobalISel: Select G_CTLZ_ZERO_UNDEF
Matt Arsenault [Fri, 7 Feb 2020 02:54:41 +0000 (21:54 -0500)]
AMDGPU/GlobalISel: Select G_CTLZ_ZERO_UNDEF

Directly select this rather than going through the intermediate
instruction, which may provide some combine value in the future.

4 years agoAMDGPU/GlobalISel: Fix mapping G_ICMP with constrained result
Matt Arsenault [Thu, 6 Feb 2020 21:11:45 +0000 (16:11 -0500)]
AMDGPU/GlobalISel: Fix mapping G_ICMP with constrained result

When SI_IF is inserted, it constrains the source register with a
register class, which was quite likely a G_ICMP. This was incorrectly
treating it as a scalar, and then applyMappingImpl would end up
producing invalid MIR since this was unexpected.

Also fix not using all VGPR sources for vcc outputs.

4 years agoPPC: Prepare tests for switch of default denormal-fp-math
Matt Arsenault [Fri, 8 Nov 2019 02:26:17 +0000 (18:26 -0800)]
PPC: Prepare tests for switch of default denormal-fp-math

These tests fail when the default is switched to assume IEEE denormal
handling. I'm not sure if PPC really has a way to control the denormal
input handling.

4 years agoReplace std::foo with std::foo_t in LLVM.
Caroline Lebar [Thu, 13 Feb 2020 00:14:30 +0000 (16:14 -0800)]
Replace std::foo with std::foo_t in LLVM.

This patch is replacements missed in my last change doing this across LLVM.

No functional change, although I think there was a missing typename
in struct conjunction that is now fixed.

4 years ago[GWP-ASan] [NFC] Change enum from ANDROID->BIONIC.
Mitch Phillips [Thu, 13 Feb 2020 00:06:42 +0000 (16:06 -0800)]
[GWP-ASan] [NFC] Change enum from ANDROID->BIONIC.

4 years ago[Fuzzer] Rename ExecuteCommandWithPopen to ExecuteCommandNon-Fushsia target will...
Yuanfang Chen [Wed, 12 Feb 2020 23:43:44 +0000 (15:43 -0800)]
[Fuzzer] Rename ExecuteCommandWithPopen to ExecuteCommandNon-Fushsia target will keep using popen/pclose implementation. OnFuchsia, Two-args version of `ExecuteCommand` is a simple wrapper of theone-arg version. (Hopefully) Fix D73329 build on Fuchsia.

4 years ago[OpenMP][IRBuilder] Perform finalization (incl. outlining) late
Johannes Doerfert [Mon, 10 Feb 2020 20:28:47 +0000 (14:28 -0600)]
[OpenMP][IRBuilder] Perform finalization (incl. outlining) late

In order to fix PR44560 and to prepare for loop transformations we now
finalize a function late, which will also do the outlining late. The
logic is as before but the actual outlining step happens now after the
function was fully constructed. Once we have loop transformations we
can apply them in the finalize step before the outlining.

Reviewed By: JonChesterfield

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

4 years agoFix a reentrance bug with deserializing ObjC type parameters.
John McCall [Wed, 12 Feb 2020 23:40:00 +0000 (18:40 -0500)]
Fix a reentrance bug with deserializing ObjC type parameters.

This is a longstanding bug that seems to have been hidden by
a combination of (1) the normal flow being to deserialize the
interface before deserializing its parameter and (2) a precise
ordering of work that was apparently recently disturbed,
perhaps by my abstract-serialization work or Bruno's ObjC
module merging work.

Fixes rdar://59153545.

4 years ago[Attributor] Use fine-grained liveness in all helpers
Johannes Doerfert [Sun, 12 Jan 2020 07:09:22 +0000 (01:09 -0600)]
[Attributor] Use fine-grained liveness in all helpers

We used coarse-grained liveness before, thus we looked if the
instruction was executed, but we did not use fine-grained liveness,
hence if the instruction was needed or could be deleted even if the
surrounding ones are live. This patches introduces this level of
liveness checks together with other liveness queries, e.g., for uses.

For more control we enforce that all liveness queries go through the
Attributor.

Test have been adjusted to reflect the changes or augmented to prevent
deletion of the parts we want to check.

Reviewed By: sstefan1

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

4 years ago[Attributor] Ignore uses if a value is simplified
Johannes Doerfert [Thu, 23 Jan 2020 23:12:56 +0000 (17:12 -0600)]
[Attributor] Ignore uses if a value is simplified

If we have a replacement for a value, via AAValueSimplify, the original
value will lose all its uses. Thus, as long as a value is simplified we
can skip the uses in checkForAllUses, given that these uses are
transitive uses for the simplified version and will therefore affect the
simplified version as necessary.

Since this allowed us to remove calls without side-effects and a known
return value, we need to make sure not to eliminate `musttail` calls.
Those we keep around, or later remove the entire `musttail` call chain.

4 years ago[Attributor] Use assumed information to determine side-effects
Johannes Doerfert [Sun, 12 Jan 2020 06:34:38 +0000 (00:34 -0600)]
[Attributor] Use assumed information to determine side-effects

We relied on wouldInstructionBeTriviallyDead before but that functions
does not take assumed information, especially for calls, into account.
The replacement, AAIsDead::isAssumeSideEffectFree, does.

This change makes AAIsDeadCallSiteReturn more complex as we can have
a dead call or only dead users.

The test have been modified to include a side effect where there was
none in order to keep the coverage.

Reviewed By: sstefan1

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

4 years agoChanged omp_get_max_threads() implementation to more closely match spec description.
Ethan Stewart [Wed, 12 Feb 2020 23:29:10 +0000 (23:29 +0000)]
Changed omp_get_max_threads() implementation to more closely match spec description.

Summary: The 5.0 spec states, "The omp_get_max_threads routine returns an upper bound on the number of threads that could be used to form a new team if a parallel construct without a num_threads clause were encountered after execution returns from this routine." The attached test shows Max Threads: 96, Num Threads: 128 without the proposed change. The number of threads should not exceed the (max) nthreads ICV, hence we should return the higher SPMD thread number even when omp_get_max_threads() is called in a generic kernel. This change does fail the api test, max_threads.c, because now it would return 64 instead of 32.

Reviewers: jdoerfert, ABataev, grokos, JonChesterfield

Reviewed By: jdoerfert

Subscribers: openmp-commits

Tags: #openmp

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

4 years ago[libomptarget][nfc] Change enum values to match those in cuda/rtl
JonChesterfield [Wed, 12 Feb 2020 23:25:33 +0000 (23:25 +0000)]
[libomptarget][nfc] Change enum values to match those in cuda/rtl

Summary:
[libomptarget][nfc] Change enum values to match those in cuda/rtl

support.h and cuda/rtl.cpp (and downsteam hsa/rtl.cpp) have enums for execution
mode. These are actually independent - the numbers that used within support, or
within the plugin, are never passed across the boundary.

Nevertheless, trying to work out why the values are different between the two
has generated a reasonable amount of confusion. This patch changes support to
match the values in plugin, on the basis that the plugin also has some comments
which I'd have to update if I changed that one instead. Credit to Ron for
working through this in our own fork. See rocm-developer-tools/aomp/issues/7
for that earlier diagnostic write up.

Also happy with generic = 0, spmd = 1 - provided it's the same in both places.

Reviewers: jdoerfert, grokos, ABataev, ronlieb

Reviewed By: grokos

Subscribers: openmp-commits

Tags: #openmp

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

4 years ago[GWP-ASan] Update alignment on Android.
Mitch Phillips [Wed, 12 Feb 2020 23:24:55 +0000 (15:24 -0800)]
[GWP-ASan] Update alignment on Android.

Summary:
Android has different alignment requirements. You can read more about
them here
(https://cs.android.com/android/platform/superproject/+/master:bionic/tests/malloc_test.cpp;l=808),
but the general gist is that for malloc(x <= 8), we do malloc(8), and
for everything else, we do 16-byte alignment.

Reviewers: eugenis, morehouse, cferris

Reviewed By: eugenis, morehouse

Subscribers: #sanitizers, llvm-commits, pcc

Tags: #sanitizers, #llvm

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

4 years ago[MBP] Partial tail duplication into hot predecessors
Guozhi Wei [Wed, 12 Feb 2020 23:22:33 +0000 (15:22 -0800)]
[MBP] Partial tail duplication into hot predecessors

Current tail duplication embedded in MBP duplicates a BB into all or none of its predecessors without too much cost analysis. So sometimes it is duplicated into cold predecessors, and in other cases it may miss the duplication into hot predecessors.

This patch improves tail duplication in 3 aspects:

  A successor can be duplicated into part of its predecessors.
  A more fine-grained benefit analysis, combined with 1, now a successor is duplicated into hot predecessors only.
  If a successor can't be duplicated into one predecessor, it doesn't impact the duplication into other predecessors.

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

4 years ago[CMake][Fuchsia] Enable in-process cc1
Petr Hosek [Wed, 12 Feb 2020 22:04:11 +0000 (14:04 -0800)]
[CMake][Fuchsia] Enable in-process cc1

This is now supported by Goma so we can re-enable it.

4 years ago[Clang] Limit -fintegrated-cc1 to only one TU
Alexandre Ganea [Wed, 12 Feb 2020 22:01:55 +0000 (17:01 -0500)]
[Clang] Limit -fintegrated-cc1 to only one TU

As discussed in https://reviews.llvm.org/D74447, this patch disables integrated-cc1 behavior if there's more than one job to be executed. This is meant to limit memory bloating, given that currently jobs don't clean up after execution (-disable-free is always active in cc1 mode).

I see this behavior as temporary until release 10.0 ships (to ease merging of this patch), then we'll reevaluate the situation, see if D74447 makes more sense on the long term.

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

4 years ago[Clang] When -ftime-trace is used, clean CompilerInstance::OutputFiles before exiting...
Alexandre Ganea [Wed, 12 Feb 2020 18:02:51 +0000 (13:02 -0500)]
[Clang] When -ftime-trace is used, clean CompilerInstance::OutputFiles before exiting cc_main()

This fixes cc1 execution when '-disable-free' is not used (currently not the case, that flag is always used for cc1).

4 years ago[mlir][Linalg] Fix build warnings
Nicolas Vasilache [Wed, 12 Feb 2020 21:43:33 +0000 (16:43 -0500)]
[mlir][Linalg] Fix build warnings

4 years ago[lldb/Plugins] Move DynamicLoaderMacOS into DynamicLoaderMacOSXDYLD (NFCI)
Jonas Devlieghere [Wed, 12 Feb 2020 21:44:05 +0000 (13:44 -0800)]
[lldb/Plugins] Move DynamicLoaderMacOS into DynamicLoaderMacOSXDYLD (NFCI)

Move the logic for initialization and termination for DynamicLoaderMacOS
into DynamicLoaderMacOSXDYLD so that there's one initializer for the
DynamicLoaderMacOSXDYLD plugin.

4 years ago[mlir] support creating memref descriptors from static shape with non-zero offset
Tobias Gysi [Wed, 12 Feb 2020 21:36:21 +0000 (22:36 +0100)]
[mlir] support creating memref descriptors from static shape with non-zero offset

This patch adapts the method MemRefDescriptor::fromStaticShape to
support static non-zero offsets. The updated method uses the
getStridesAndOffset method to extract strides and offset. The patch also
adapts the test cases since sizes and strides are now set in forward
instead of reverse order.

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

4 years ago[MLIR] Fix wrong header for mlir-cuda-runner
Valentin Clement [Wed, 12 Feb 2020 21:35:02 +0000 (22:35 +0100)]
[MLIR] Fix wrong header for mlir-cuda-runner

Just updated the wrong header probably copied from the mlir-cpu-runner

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

4 years agoFix type-dependency of bitfields in templates
Elizabeth Andrews [Wed, 12 Feb 2020 19:30:02 +0000 (11:30 -0800)]
Fix type-dependency of bitfields in templates

This patch is a follow up to 878a24ee244a24. Name of bitfields
with value-dependent width should be set as type-dependent. This
patch adds the required value-dependency check and sets the
type-dependency accordingly.

Patch fixes PR44886

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

4 years ago[TBLGEN] Fix subreg value overflow in DAGISelMatcher
Stanislav Mekhanoshin [Mon, 10 Feb 2020 21:37:00 +0000 (13:37 -0800)]
[TBLGEN] Fix subreg value overflow in DAGISelMatcher

Tablegen's DAGISelMatcher emits integers in a VBR format,
so if an integer is below 128 it can fit into a single
byte, otherwise high bit is set, next byte is used etc.
MatcherTable is essentially an unsigned char table. When
SelectionDAGISel parses the table it does a reverse translation.

In a situation when numeric value of an integer to emit is
unknown it can be emitted not as OPC_EmitInteger but as
OPC_EmitStringInteger using a symbolic name of the value.
In this situation the value should not exceed 127.

One of the situations when OPC_EmitStringInteger is used is
if we need to emit a subreg into a matcher table. However,
number of subregs can exceed 127. Currently last defined subreg
for AMDGPU is 192. That results in a silent bug in the ISel
with matcher reading from an invalid offset.

Fixed this bug to emit actual VBR encoded value for a subregs
which value exceeds 127.

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

4 years ago[docs] Minor updates to DeveloperPolicy due to svn to git
Jinsong Ji [Wed, 12 Feb 2020 21:07:40 +0000 (21:07 +0000)]
[docs] Minor updates to DeveloperPolicy due to svn to git

Reviewed By: efriedma

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

4 years ago[README] Add note on using cmake to perform the build
Evandro Menezes [Wed, 12 Feb 2020 20:21:02 +0000 (14:21 -0600)]
[README] Add note on using cmake to perform the build

Also, some spelling fixes.  Test commit.

4 years ago[OpenMP] update strings output of libomp.so [NFC]
Kelvin Li [Wed, 12 Feb 2020 20:38:54 +0000 (15:38 -0500)]
[OpenMP] update strings output of libomp.so [NFC]

Change the string from "Intel(R) OMP" to "LLVM OMP" in libomp.so

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

4 years ago[LoopExtractor] Fix legacy pass dependencies
Ehud Katz [Wed, 12 Feb 2020 20:39:21 +0000 (22:39 +0200)]
[LoopExtractor] Fix legacy pass dependencies

Fixes a memory leak of allocating `LoopInfoWrapperPass` and `DominatorTreeWrapperPass`.

4 years ago[llvm-exegesis] CombinationGenerator: don't store function_ref
Roman Lebedev [Wed, 12 Feb 2020 20:30:22 +0000 (23:30 +0300)]
[llvm-exegesis] CombinationGenerator: don't store function_ref

function_ref is non-owning, so if we get it as a parameter in constructor,
our reference goes out-of-scope as soon as constructor returns.
Instead, let's just take it as a parameter to the actual `generate()` call

4 years agoRevert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"
Erik Pilkington [Wed, 12 Feb 2020 20:02:58 +0000 (12:02 -0800)]
Revert "[IRGen] Emit lifetime intrinsics around temporary aggregate argument allocas"

This reverts commit fafc6e4fdf3673dcf557d6c8ae0c0a4bb3184402.

Should fix ppc stage2 failure: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/23546

Conflicts:
clang/lib/CodeGen/CGCall.cpp

4 years ago[mlir][Linalg] Refactor in preparation for automatic Linalg "named" ops.
Nicolas Vasilache [Wed, 12 Feb 2020 19:41:11 +0000 (14:41 -0500)]
[mlir][Linalg] Refactor in preparation for automatic Linalg "named" ops.

This revision prepares the ground for declaratively defining Linalg "named" ops.
Such named ops form the backbone of operations that are ubiquitous in the ML
application domain.

This revision closely related to the definition of a "Tensor Computation
Primitives Dialect" and demonstrates that ops can be expressed as declarative
configurations of the `linalg.generic` op.

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

4 years ago[lldb/Plugins] Move SymbolFileDWARFDebugMap into SymbolFileDWARF (NFCI)
Jonas Devlieghere [Wed, 12 Feb 2020 19:01:43 +0000 (11:01 -0800)]
[lldb/Plugins] Move SymbolFileDWARFDebugMap into SymbolFileDWARF (NFCI)

Move the logic for initialization and termination for
SymbolFileDWARFDebugMap into SymbolFileDWARF so that there's one
initializer for the SymbolFileDWARF plugin.

4 years ago[lldb/LibCxx] Have ExtractLibcxxStringInfo return an Optional result, NFC
Vedant Kumar [Wed, 5 Feb 2020 17:46:51 +0000 (09:46 -0800)]
[lldb/LibCxx] Have ExtractLibcxxStringInfo return an Optional result, NFC

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

4 years ago[lldb/StringPrinter] Avoid reading garbage in uninitialized strings
Vedant Kumar [Sat, 1 Feb 2020 07:18:17 +0000 (23:18 -0800)]
[lldb/StringPrinter] Avoid reading garbage in uninitialized strings

This patch fixes a few related out-of-bounds read bugs in the
string data formatters. These issues have to do with mishandling of un-
initialized strings. These manifest as ASan exceptions when debugging a
clang binary.

The first issue was that the std::string formatter treated strings in
"short mode" with length greater than the size of the inline buffer as
valid.

The second issue was that the StringPrinter facility did not check that
a full utf8 codepoint sequence can be read from the buffer (i.e. there
are some missing range checks). I took the opportunity here to delete
some untested code that was meant to deal with invalid input and replace
it with fail-on-invalid logic ([1][2][3]). This means we'll give up on
formatting an invalid string instead of guessing our way through it.

The third issue is that StringPrinter did not check that a utf8 sequence
could actually be fully read from the string payload. This one is especially
tricky as we may overflow the buffer pointer while reading the sequence.

I also noticed that the std::string formatter would spew the raw version of
the underlying ValueObject when garbage is detected. I've changed this to
just print "Summary Unavailable" instead, as we do elsewhere.

I've added regression tests for these issues to
test/functionalities/data-formatter/data-formatter-stl/libcxx/string.

[1]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L136
[2]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L163
[3]
http://lab.llvm.org:8080/coverage/coverage-reports/coverage/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/DataFormatters/StringPrinter.cpp.html#L357

rdar://59080026

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

4 years ago[lldb/TypeSystemClang] Supply trivial TypeSourceInfo to NonTypeTemplateParmDecl:...
Vedant Kumar [Wed, 22 Jan 2020 22:32:20 +0000 (14:32 -0800)]
[lldb/TypeSystemClang] Supply trivial TypeSourceInfo to NonTypeTemplateParmDecl::Create

This fixes a UBSan error seen while debugging clang:

Member call on null pointer of type 'clang::TypeSourceInfo'

rdar://58783517

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

4 years ago[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare
Vedant Kumar [Tue, 11 Feb 2020 00:22:27 +0000 (16:22 -0800)]
[AddressSanitizer] Ensure only AllocaInst is passed to dbg.declare

Various parts of the LLVM code generator assume that the address
argument of a dbg.declare is not a `ptrtoint`-of-alloca. ASan breaks
this assumption, and this results in local variables sometimes being
unavailable at -O0.

GlobalISel, SelectionDAG, and FastISel all do not appear to expect
dbg.declares to have a `ptrtoint` as an operand. This means that they do
not place entry block allocas in the usual side table reserved for local
variables available in the whole function scope. This isn't always a
problem, as LLVM can try to lower the dbg.declare to a DBG_VALUE, but
those DBG_VALUEs can get dropped for all the usual reasons DBG_VALUEs
get dropped. In the ObjC test case I'm looking at, the cause happens to
be that `replaceDbgDeclare` has hoisted dbg.declares into the entry
block, causing LiveDebugValues to "kill" the DBG_VALUEs because the
lexical dominance check fails.

To address this, I propose:

1) Have ASan (always) pass an alloca to dbg.declares (this patch). This
   is a narrow bugfix for -O0 debugging.

2) Make replaceDbgDeclare not move dbg.declares around. This should be a
   generic improvement for optimized debug info, as it would prevent the
   lexical dominance check in LiveDebugValues from killing as many
   variables.

   This means reverting llvm/r227544, which fixed an assertion failure
   (llvm.org/PR22386) but no longer seems to be necessary. I was able to
   complete a stage2 build with the revert in place.

rdar://54688991

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

4 years ago[KnownBits] Introduce anyext instead of passing a flag into zext
Jay Foad [Wed, 12 Feb 2020 13:27:28 +0000 (13:27 +0000)]
[KnownBits] Introduce anyext instead of passing a flag into zext

Summary:
This was a very odd API, where you had to pass a flag into a zext
function to say whether the extended bits really were zero or not. All
callers passed in a literal true or false.

I think it's much clearer to make the function name reflect the
operation being performed on the value we're tracking (rather than on
the KnownBits Zero and One fields), so zext means the value is being
zero extended and new function anyext means the value is being extended
with unknown bits.

NFC.

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir][EDSC][Linalg] Compose linalg_matmul and vector.contract
Nicolas Vasilache [Wed, 12 Feb 2020 18:43:10 +0000 (13:43 -0500)]
[mlir][EDSC][Linalg] Compose linalg_matmul and vector.contract

Summary:
This revision allows model builder to create a linalg_matmul whose body
is a vector.contract. This shows the abstractions compose nicely.

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

4 years ago[gn build] Port 6030fe01f4e
LLVM GN Syncbot [Wed, 12 Feb 2020 18:34:39 +0000 (18:34 +0000)]
[gn build] Port 6030fe01f4e

4 years ago[llvm-exegesis] Exploring X86::OperandType::OPERAND_COND_CODE
Roman Lebedev [Wed, 12 Feb 2020 17:54:39 +0000 (20:54 +0300)]
[llvm-exegesis] Exploring X86::OperandType::OPERAND_COND_CODE

Summary:
Currently, we only have nice exploration for LEA instruction,
while for the rest, we rely on `randomizeUnsetVariables()`
to sometimes generate something interesting.
While that works, it isn't very reliable in coverage :)

Here, i'm making an assumption that while we may want to explore
multi-instruction configs, we are most interested in the
characteristics of the main instruction we were asked about.

Which we can do, by taking the existing `randomizeMCOperand()`,
and turning it on it's head - instead of relying on it to randomly fill
one of the interesting values, let's pregenerate all the possible interesting
values for the variable, and then generate as much `InstructionTemplate`
combinations of these possible values for variables as needed/possible.

Of course, that requires invasive changes to no longer pass just the
naked `Instruction`, but sometimes partially filled `InstructionTemplate`.

As it can be seen from the test, this allows us to explore
`X86::OperandType::OPERAND_COND_CODE` for instructions
that take such an operand.
I'm hoping this will greatly simplify exploration.

Reviewers: courbet, gchatelet

Reviewed By: gchatelet

Subscribers: orodley, mgorny, sdardis, tschuett, jrtc27, atanasyan, mstojanovic, andreadb, RKSimon, llvm-commits

Tags: #llvm

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

4 years agoCompletely ignore strict FP model and denormal-fp-math interaction
Matt Arsenault [Wed, 12 Feb 2020 18:26:04 +0000 (13:26 -0500)]
Completely ignore strict FP model and denormal-fp-math interaction

No behavior is going to make sense here until the default is IEEE.

4 years ago[ConstantFold][SVE] Fix constant fold for FoldReinterpretLoadFromConstPtr.
Huihui Zhang [Wed, 12 Feb 2020 18:19:03 +0000 (10:19 -0800)]
[ConstantFold][SVE] Fix constant fold for FoldReinterpretLoadFromConstPtr.

Summary:
Bail out early for scalable vectors. As global variables are not expected
to be scalable.

Use explicit call of getFixedSize() to assert on places where scalable size
doesn't make sense.

Reviewers: sdesmalen, efriedma, apazos, huntergr, willlovett

Reviewed By: sdesmalen

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years agoFix fp-model flag test failure on linux
Matt Arsenault [Wed, 12 Feb 2020 18:12:50 +0000 (10:12 -0800)]
Fix fp-model flag test failure on linux

We're still in the awkward state where IEEE is not the default
denormal mode.

4 years ago[ARCMT][NFC] Reduce #include dependencies
Nicolás Alvarez [Wed, 12 Feb 2020 15:36:29 +0000 (16:36 +0100)]
[ARCMT][NFC] Reduce #include dependencies

Replace some #includes in ARCMigrate source files with more specific includes
and forward declarations. This reduces the number of files that need to be
rebuilt when a header changes (and saves like 1 second of build time). For
example, several files no longer need to be rebuilt when the list of static
analyzer checkers(!) changes.

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

4 years agoRecommit "[SCCP] Remove forcedconstant, go to overdefined instead"
Florian Hahn [Wed, 12 Feb 2020 14:22:20 +0000 (14:22 +0000)]
Recommit "[SCCP] Remove forcedconstant, go to overdefined instead"

This version includes a fix for a set of crashes caused by marking
values depending on a yet unknown & tracked call as overdefined.

In some cases, we would later discover that the call has a constant
result and try to mark a user of it as constant, although it was already
marked as overdefined. Most instruction handlers bail out early if the
instruction is already overdefined. But that is not necessary for
CastInsts for example. By skipping values that depend on skipped
calls, we resolve the crashes and also improve the precision in some
cases (see resolvedundefsin-tracked-fn.ll).

Note that we may not skip PHI nodes that may depend on a skipped call,
but they can be safely marked as overdefined, as we bail out early if
the PHI node is overdefined.

This reverts the revert commit
a74b31a3e9cd844c7ce2087978568e3f5ec8519.

4 years ago[ARM] Extra vecreduce add with accumulate tests. NFC
David Green [Wed, 12 Feb 2020 12:24:26 +0000 (12:24 +0000)]
[ARM] Extra vecreduce add with accumulate tests. NFC

4 years ago[NFC] Remove extra headers included in Loop Unroll and LoopUnrollAndJam files
Anh Tuyen Tran [Wed, 12 Feb 2020 17:57:56 +0000 (17:57 +0000)]
[NFC] Remove extra headers included in Loop Unroll and LoopUnrollAndJam files

Summary:
This refactor patch removes some header files which are not needed and also add some to meet IWYU principles.

Reviewers: rnk (Reid Kleckner), Meinersbur (Michael Kruse), dmgreen (Dave Green)

Reviewed By: dmgreen (Dave Green), rnk (Reid Kleckner), Meinersbur (Michael Kruse)

Subscribers: dmgreen (Dave Green), Whitney (Whitney Tsang), hiraditya (Aditya Kumar), zzheng (Z. Zheng), llvm-commits, LLVM

Tag: LLVM

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

4 years ago[mlir] Allow constructing a ValueRange from an ArrayRef<BlockArgument>
River Riddle [Wed, 12 Feb 2020 17:46:21 +0000 (09:46 -0800)]
[mlir] Allow constructing a ValueRange from an ArrayRef<BlockArgument>

Summary: This was a missed case when ValueRange was originally added, and allows for constructing a ValueRange from the arguments of a block.

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

4 years ago[runtimes] Add umbrella targets for runtimes
Shoaib Meenai [Wed, 12 Feb 2020 02:24:57 +0000 (18:24 -0800)]
[runtimes] Add umbrella targets for runtimes

This will create e.g. a compiler-rt target that'll build compiler-rt for
all configured targets, similar to how the runtimes umbrella target
builds all the runtimes for all configured targets.

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

4 years agoFix `-Wunused-variable` warning. NFC.
Michael Liao [Wed, 12 Feb 2020 17:43:51 +0000 (12:43 -0500)]
Fix `-Wunused-variable` warning. NFC.

4 years ago[AArch64][GlobalISel] Properly implement widening for TB(N)Z
Jessica Paquette [Tue, 11 Feb 2020 18:22:38 +0000 (10:22 -0800)]
[AArch64][GlobalISel] Properly implement widening for TB(N)Z

When we have to widen to a 64-bit register, we have to emit a SUBREG_TO_REG.

Add a general-purpose widening helpe  which emits the correct SUBREG_TO_REG
instruction based off of a desired size and add a testcase.

Also remove some asserts which are technically incorrect in `emitTestBit`.

- p0 doesn't count as a scalar type, so we need to check `!Ty.isVector()`
instead

- Whenever we have a s1, the Size/Bit checks are too conservative, so just
remove them

Replace these asserts with less conservative ones where applicable.

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

4 years agoCompute ORE, BPI, BFI in Loop passes.
Alina Sbirlea [Thu, 16 Jan 2020 23:32:30 +0000 (15:32 -0800)]
Compute ORE, BPI, BFI in Loop passes.

Summary:
Passes ORE, BPI, BFI are not being preserved by Loop passes, hence it
is incorrect to retrieve these passes as cached.
This patch makes the loop passes in question compute a new instance.

In some of these cases, however, it may be beneficial to change the Loop pass to
a Function pass instead, similar to the change for LoopUnrollAndJam.

Reviewers: chandlerc, dmgreen, jdoerfert, reames

Subscribers: mehdi_amini, hiraditya, zzheng, steven_wu, dexonsmith, Whitney, llvm-commits

Tags: #llvm

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

4 years agoclang: Guess at some platform FTZ/DAZ default settings
Matt Arsenault [Fri, 8 Nov 2019 01:14:51 +0000 (17:14 -0800)]
clang: Guess at some platform FTZ/DAZ default settings

This is to avoid performance regressions when the default attribute
behavior is fixed to assume ieee.

I tested the default on x86_64 ubuntu, which seems to default to
FTZ/DAZ, but am guessing for x86 and PS4.

4 years ago[VectorCombine] add tests for extract-binop; NFC
Sanjay Patel [Wed, 12 Feb 2020 16:33:21 +0000 (11:33 -0500)]
[VectorCombine] add tests for extract-binop; NFC

4 years agoFix SFINAE in llvm::bit_cast.
Justin Lebar [Tue, 11 Feb 2020 03:34:44 +0000 (19:34 -0800)]
Fix SFINAE in llvm::bit_cast.

Summary:
As far as I can tell, the SFINAE was broken; there is no such thing as
std::is_trivially_constructible<T>::type.

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

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

4 years agoFix compilation of Any.h header.
Justin Lebar [Wed, 12 Feb 2020 16:05:00 +0000 (08:05 -0800)]
Fix compilation of Any.h header.

In a previous patch I changed `std::decay<T>::type` to `std::decay<T>`
rather than `std::decay_t<T>`.  This seems to have broken the build
*only for clang-cl*.  I don't know why.

Submitting with post-commit review because this is an obvious fix for a
build breakage and we've verified that it fixes the breakage.

4 years ago[ELF] Support INSERT [AFTER|BEFORE] for orphan sections
Fangrui Song [Mon, 10 Feb 2020 23:58:29 +0000 (15:58 -0800)]
[ELF] Support INSERT [AFTER|BEFORE] for orphan sections

D43468+D44380 added INSERT [AFTER|BEFORE] for non-orphan sections. This patch
makes INSERT work for orphan sections as well.

`SECTIONS {...} INSERT [AFTER|BEFORE] .foo` does not set `hasSectionCommands`, so the result
will be similar to a regular link without a linker script. The differences when `hasSectionCommands` is set include:

* image base is different
* -z noseparate-code/-z noseparate-loadable-segments are unavailable
* some special symbols such as `_end _etext _edata` are not defined

The behavior is similar to GNU ld:
INSERT is not considered an external linker script.

This feature makes the section layout more flexible. It can be used to:

* Place .nv_fatbin before other readonly SHT_PROGBITS sections to mitigate relocation overflows.
* Disturb the layout to expose address sensitive application bugs.

Reviewed By: grimar

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

4 years ago[ELF] Start a new PT_LOAD if LMA region is different
Fangrui Song [Sun, 9 Feb 2020 06:04:06 +0000 (22:04 -0800)]
[ELF] Start a new PT_LOAD if LMA region is different

GNU ld has a counterintuitive lang_propagate_lma_regions rule.

```
// .foo's LMA region is propagated to .bar because their VMA region is the same,
// and .bar does not have an explicit output section address (addr_tree).
.foo : { *(.foo) } >RAM AT> FLASH
.bar : { *(.bar) } >RAM

// An explicit output section address disables propagation.
.foo : { *(.foo) } >RAM AT> FLASH
.bar . : { *(.bar) } >RAM
```

In both cases, lld thinks .foo's LMA region is propagated and
places .bar in the same PT_LOAD, so lld diverges from GNU ld w.r.t. the
second case (lma-align.test).

This patch changes Writer<ELFT>::createPhdrs to disable propagation
(start a new PT_LOAD). A user of the first case can make linker scripts
portable by explicitly specifying `AT>`. By contrast, there was no
workaround for the old behavior.

This change uncovers another LMA related bug in assignOffsets() where
`ctx->lmaOffset = 0;` was omitted. It caused a spurious "load address
range overlaps" error for at2.test

The new PT_LOAD rule is complex. For convenience, I listed the origins of some subexpressions:

* rL323449: `sec->memRegion == load->firstSec->memRegion`; linkerscript/at3.test
* D43284: `load->lastSec == Out::programHeaders` (don't start a new PT_LOAD after program headers); linkerscript/at4.test
* D58892: `sec != relroEnd` (start a new PT_LOAD after PT_GNU_RELRO)

Reviewed By: psmith

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

4 years ago[ELF] Respect output section alignment for AT> (non-null lmaRegion)
Fangrui Song [Sat, 8 Feb 2020 19:07:03 +0000 (11:07 -0800)]
[ELF] Respect output section alignment for AT> (non-null lmaRegion)

When lmaRegion is non-null, respect `sec->alignment`
This rule is analogous to `switchTo(sec)` which advances sh_addr (VMA).

This fixes the p_paddr misalignment issue as reported by
https://android-review.googlesource.com/c/trusty/external/trusted-firmware-a/+/1230058

Note, `sec->alignment` is the maximum of ALIGN and input section alignments. We may overalign LMA than GNU ld.

linkerscript/align-lma.s has a FIXME that demonstrates another bug:
`.bss ... >RAM` should be placed in a different PT_LOAD (GNU ld
behavior) because its lmaRegion (nullptr) is different from the previous
section's lmaRegion (ROM).

Reviewed By: psmith

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