platform/upstream/llvm.git
4 years ago[AIX] Return the correct set of callee saved regs
David Tenty [Fri, 17 Apr 2020 17:06:08 +0000 (13:06 -0400)]
[AIX] Return the correct set of callee saved regs

Summary:
r13 isn't reserved on 32-bit AIX, which is reflected in our calling
convention but not callee saved regs.

Reviewers: sfertile, ZarkoCA, cebowleratibm, jasonliu

Reviewed By: sfertile

Subscribers: lei, wuzish, nemanjai, hiraditya, kbarton, llvm-commits

Tags: #llvm

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

4 years ago[MLIR] Add AtomicRMWRegionOp.
Alexander Belyaev [Mon, 20 Apr 2020 13:16:52 +0000 (15:16 +0200)]
[MLIR] Add AtomicRMWRegionOp.

https://llvm.discourse.group/t/rfc-add-std-atomic-rmw-op/489

Differensial revision: https://reviews.llvm.org/D78352

4 years agoRevert "[ARM] Fix conditions for lowering to S[LR]I"
Petre-Ionut Tudor [Mon, 20 Apr 2020 14:43:56 +0000 (15:43 +0100)]
Revert "[ARM] Fix conditions for lowering to S[LR]I"

This reverts commit cabfcf840a9d15d92466c6774953d3aa399cde92.
The patch introduced another bug in the optimization.

4 years agoBranchFolding.h - cleanup includes and forward declarations. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 14:59:24 +0000 (15:59 +0100)]
BranchFolding.h - cleanup includes and forward declarations. NFC.
Push MBFIWrapper.h include down to BranchFolding.cpp/IfConversion.cpp

4 years agoMIRVRegNamerUtils.h - remove unnecessary includes. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 13:33:21 +0000 (14:33 +0100)]
MIRVRegNamerUtils.h - remove unnecessary includes. NFC.
Replace with forward declarations or push down to MIRVRegNamerUtils.cpp where necessary.

4 years ago[ELF] Add --warn-backrefs-exclude=<glob>
Fangrui Song [Sun, 5 Apr 2020 04:31:36 +0000 (21:31 -0700)]
[ELF] Add --warn-backrefs-exclude=<glob>

D77522 changed --warn-backrefs to not warn for linking sandwich
problems (-ldef1 -lref -ldef2). This removed lots of false positives.

However, glibc still has some problems. libc.a defines some symbols
which are normally in libm.a and libpthread.a, e.g. __isnanl/raise.

For a linking order `-lm -lpthread -lc`, I have seen:

```
// different resolutions: GNU ld/gold select libc.a(s_isnan.o) as the definition
backward reference detected: __isnanl in libc.a(printf_fp.o) refers to libm.a(m_isnanl.o)

// different resolutions: GNU ld/gold select libc.a(raise.o) as the definition
backward reference detected: raise in libc.a(abort.o) refers to libpthread.a(pt-raise.o)
```

To facilitate deployment of --warn-backrefs, add --warn-backrefs-exclude= so that
certain known issues (which may be impractical to fix) can be whitelisted.

Deliberate choices:

* Not a comma-separated list (`--warn-backrefs-exclude=liba.a,libb.a`).
  -Wl, splits the argument at commas, so we cannot use commas.
  --export-dynamic-symbol is similar.
* Not in the style of `--warn-backrefs='*' --warn-backrefs=-liba.a`.
  We just need exclusion, not inclusion. For easier build system
  integration, we should avoid order dependency. With the current
  scheme, we enable --warn-backrefs, and indivial libraries can add
  --warn-backrefs-exclude=<glob> to their LDFLAGS.

Reviewed By: psmith

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

4 years ago[Dexter][NFC] Add Debugger Controller To Dexter
Tom Weaver [Mon, 20 Apr 2020 14:46:55 +0000 (15:46 +0100)]
[Dexter][NFC] Add Debugger Controller To Dexter

  Add DebuggerControllerBase and DefaultController to Dexter
  implements a new architecture that supports new and novel ways of running
  a debugger under dexter.
  Current implementation adds the original default behaviour via the new
  architecture via the DefaultController, this should have NFC.

Reviewers: Orlando

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

4 years ago[libc++] Fix the no-exceptions build of libc++ on Apple
Louis Dionne [Mon, 20 Apr 2020 09:22:20 +0000 (05:22 -0400)]
[libc++] Fix the no-exceptions build of libc++ on Apple

We previously tried re-exporting symbols that didn't exist when
exceptions were disabled. Note that building libc++abi without
exceptions still doesn't work when linking against the default-provided
libSystem.dylib, because it transitively depends on libobjc.dylib,
and that requires __gxx_personality_v0. But building libc++abi
with exceptions and libc++ without exceptions does work.

4 years ago[lldb] Remove m_last_file_sp from SourceManager
Emre Kultursay [Mon, 20 Apr 2020 14:17:36 +0000 (16:17 +0200)]
[lldb] Remove m_last_file_sp from SourceManager

Summary:
...and replace it with m_last_file_spec instead.

When Source Cache is enabled, the value stored in m_last_file_sp is
already in the Source Cache, and caching it again in SourceManager
brings no extra benefit. All we need is to "remember" the last used
file, and FileSpec can serve the same purpose.

When Source Cache is disabled, the user explicitly requested no caching
of source files, and therefore, m_last_file_sp should NOT be used.

Bug: llvm.org/PR45310

Depends on D76805.

Reviewers: labath, jingham

Reviewed By: jingham

Subscribers: labath, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Fix SourceManager::SourceFileCache insertion
Emre Kultursay [Mon, 20 Apr 2020 14:17:27 +0000 (16:17 +0200)]
[lldb] Fix SourceManager::SourceFileCache insertion

Summary:
Lookup and subsequent insert was done using uninitialized
FileSpec object, which caused the cache to be a no-op.

Bug: llvm.org/PR45310

Depends on D76804.

Reviewers: labath, JDevlieghere

Reviewed By: labath

Subscribers: mgorny, jingham, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Add new LLDB setting: use-source-cache
Emre Kultursay [Mon, 20 Apr 2020 14:17:17 +0000 (16:17 +0200)]
[lldb] Add new LLDB setting: use-source-cache

Summary:
LLDB memory-maps large source files, and at the same time, caches
all source files in the Source Cache.

On Windows, memory-mapped source files are not writeable, causing
bad user experience in IDEs (such as errors when saving edited files).
IDEs should have the ability to disable the Source Cache at LLDB
startup, so that users can edit source files while debugging.

Bug: llvm.org/PR45310

Reviewers: labath, JDevlieghere, jingham

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lldb] Fix gcc warnings in TypeCategory.cpp
Pavel Labath [Mon, 20 Apr 2020 14:07:16 +0000 (16:07 +0200)]
[lldb] Fix gcc warnings in TypeCategory.cpp

The cleanup in 3e3701f8a0bf left these variable unused.

4 years ago[lldb] Prefer executable files from sysroot over files from local filesystem
Yuri Per [Mon, 20 Apr 2020 14:03:42 +0000 (16:03 +0200)]
[lldb] Prefer executable files from sysroot over files from local filesystem

Summary:
In D49685 sysroot behaviour was partially fixed. But files from local filesystem with same path still has priority over files from sysroot.

This patch fixes it by removing fallback to local filesystem from RemoteAwarePlatform::GetModuleSpec(). It is not actually required because higher level code do such fallback itself. See, for example, resolver in Platform::GetSharedModule().

Reviewers: labath, clayborg, EugeneBi

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[SveEmitter] Add immediate checks for lanes and complex imms
Sander de Smalen [Mon, 20 Apr 2020 13:57:13 +0000 (14:57 +0100)]
[SveEmitter] Add immediate checks for lanes and complex imms

Adds another bunch of of intrinsics that take immediates with
varying ranges based, some being a complex rotation immediate
which are a set of allowed immediates rather than a range.

    svmla_lane:   lane immediate ranging 0..(128/(1*sizeinbits(elt)) - 1)
    svcmla_lane:  lane immediate ranging 0..(128/(2*sizeinbits(elt)) - 1)
    svdot_lane:   lane immediate ranging 0..(128/(4*sizeinbits(elt)) - 1)
    svcadd:       complex rotate immediate [90, 270]
    svcmla:
    svcmla_lane:  complex rotate immediate [0, 90, 180, 270]

Reviewers: efriedma, SjoerdMeijer, rovka

Reviewed By: efriedma

Tags: #clang

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

4 years ago[Scalarizer] Fix a non-deterministic scatter order problem
Bjorn Pettersson [Sun, 19 Apr 2020 10:56:16 +0000 (12:56 +0200)]
[Scalarizer] Fix a non-deterministic scatter order problem

Summary:
The indexing operator in Scatterer may result in building new
instructions. When using multiple such operators in a function
argument list the order in which we build instructions depend on
argument evaluation order (which is undefined in C++).
This patch avoid such problems by expanding the components using
the [] operator prior to the function call.

Problem was seen when comparing output, while builing LLVM with
different compilers (clang vs gcc).

Reviewers: foad, cameron.mcinally, uabelho

Reviewed By: foad

Subscribers: hiraditya, mgrang, llvm-commits

Tags: #llvm

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

4 years ago[SveEmitter] Add more immediate operand checks.
Sander de Smalen [Mon, 20 Apr 2020 13:41:58 +0000 (14:41 +0100)]
[SveEmitter] Add more immediate operand checks.

This patch adds a number of intrinsics that take immediates with
varying ranges based on the element size one of the operands.

    svext:   immediate ranging 0 to (2048/sizeinbits(elt) - 1)
    svasrd:  immediate ranging 1..sizeinbits(elt)
    svqshlu: immediate ranging 1..sizeinbits(elt)/2
    ftmad:   immediate ranging 0..(sizeinbits(elt) - 1)

Reviewers: efriedma, SjoerdMeijer, rovka, rengolin

Reviewed By: SjoerdMeijer

Tags: #clang

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

4 years agoX86MacroFusion.cpp - ensure X86MacroFusion.h module header is included first. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 12:55:46 +0000 (13:55 +0100)]
X86MacroFusion.cpp - ensure X86MacroFusion.h module header is included first. NFC.

4 years agoExplicitly move from llvm::json Array/Object to Value
Michael Forster [Mon, 20 Apr 2020 13:16:11 +0000 (15:16 +0200)]
Explicitly move from llvm::json Array/Object to Value

Summary: The implicit conversion fails under Clang 3.8.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[gn build] Port 12030494fce
LLVM GN Syncbot [Mon, 20 Apr 2020 13:10:45 +0000 (13:10 +0000)]
[gn build] Port 12030494fce

4 years ago[GlobalISel] Introduce InlineAsmLowering class
Konstantin Schwarz [Wed, 8 Apr 2020 12:40:43 +0000 (14:40 +0200)]
[GlobalISel] Introduce InlineAsmLowering class

Summary:
Similar to the CallLowering class used for lowering LLVM IR calls to MIR calls,
we introduce a separate class for lowering LLVM IR inline asm to MIR INLINEASM.

There is no functional change yet, all existing tests should pass.

Reviewers: arsenm, dsanders, aemerson, volkan, t.p.northover, paquette

Reviewed By: aemerson

Subscribers: gargaroff, wdng, mgorny, rovka, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[LLD][ELF][ARM] Convert ADR/LDR to .inst .reloc
Peter Smith [Mon, 20 Apr 2020 12:55:01 +0000 (13:55 +0100)]
[LLD][ELF][ARM] Convert ADR/LDR to .inst .reloc

After D78301 MC no longer emits a relocation for this case. Change to use
.inst and .reloc to synthesize the same instruction and relocation.

4 years ago[nfc] Cleanup extension header generation
serge-sans-paille [Mon, 20 Apr 2020 12:43:21 +0000 (14:43 +0200)]
[nfc] Cleanup extension header generation

4 years ago[analyzer] GenericTaint: Don't expect CallEvent to always have a Decl.
Artem Dergachev [Mon, 20 Apr 2020 12:30:30 +0000 (15:30 +0300)]
[analyzer] GenericTaint: Don't expect CallEvent to always have a Decl.

This isn't the case when the callee is completely unknown,
eg. when it is a symbolic function pointer.

4 years agoRevert 3ce0ad1b336e67a76d78ae7ff7d66fe127586620 Die to breakage in check-lld.
Mark Murray [Mon, 20 Apr 2020 12:01:36 +0000 (13:01 +0100)]
Revert 3ce0ad1b336e67a76d78ae7ff7d66fe127586620 Die to breakage in check-lld.

Requested-by: Nico Weber
4 years ago[AVR] Do not place functions in .progmem.data
Ayke van Laethem [Wed, 15 Apr 2020 15:30:47 +0000 (17:30 +0200)]
[AVR] Do not place functions in .progmem.data

Previously, the AVR backend would put functions in .progmem.data. This
is probably a regression from when functions still lived in address
space 0. With this change, only global constants are placed in
.progmem.data.

This is not complete: avr-gcc additionally respects -fdata-sections for
progmem global constants, which LLVM doesn't yet do. But fixing that is
a bit more complicated (and I believe other backends such as RISC-V
might also have similar issues).

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

4 years ago[AVR] Do not use divmod calls for bigger integers
Ayke van Laethem [Sat, 18 Apr 2020 21:42:48 +0000 (23:42 +0200)]
[AVR] Do not use divmod calls for bigger integers

The avr-libc provides *divmodqi4, *divmodhi4, and *divmodsi4 functions,
but does not provide a *divmoddi4. Instead it provides regular *divdi3
and *moddi3 functions.

Note that avr-libc doesn't support *divti3 or *modti3 for 128-bit
integer manipulation.

Source:
https://github.com/gcc-mirror/gcc/blob/releases/gcc-5.4.0/libgcc/config/avr/lib1funcs.S

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

4 years ago[FileCheck] - Refactor the code related to string arrays. NFCI.
Georgii Rymar [Wed, 15 Apr 2020 12:30:21 +0000 (15:30 +0300)]
[FileCheck] - Refactor the code related to string arrays. NFCI.

There are few `std::vector<std::string>` members in
`FileCheckRequest`. This patch changes these arrays to `std::vector<StringRef>`
and refactors the code related to cleanup/improve/simplify it.

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

4 years ago[obj2yaml] - Teach obj2yaml to dump SHT_NOBITS sections when dumping program headers.
Georgii Rymar [Tue, 7 Apr 2020 15:20:51 +0000 (18:20 +0300)]
[obj2yaml] - Teach obj2yaml to dump SHT_NOBITS sections when dumping program headers.

SHT_NOBITS are a bit special because occupy no physical space.
This patch adds support for them.

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

4 years ago[llvm-readobj] - Fix crashes and misbehaviors when reading strings from broken string...
Georgii Rymar [Wed, 1 Apr 2020 13:40:25 +0000 (16:40 +0300)]
[llvm-readobj] - Fix crashes and misbehaviors when reading strings from broken string tables.

There are cases when we either might print garbage or crash when
reading strings for dumping dynamic tags.

For example when a string table is not null-terminated or goes past the EOF.
This patch fixes issues mentioned.

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

4 years agoX86Subtarget.h - remove unused includes. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 11:10:25 +0000 (12:10 +0100)]
X86Subtarget.h - remove unused includes. NFC.
Replace with forward declarations.

4 years ago[MC][DWARF] Corrected handling of is_stmt flag in .loc directives
Dmitry Preobrazhensky [Mon, 20 Apr 2020 10:53:15 +0000 (13:53 +0300)]
[MC][DWARF] Corrected handling of is_stmt flag in .loc directives

According to DWARF standard, is_stmt is a global flag; when set or cleared it should affect subsequent .loc directives.

However llvm assembler handled is_stmt differently: it forced all locations to have is_stmt=1 unless is_stmt was specified explicitly as 0.

The fix utilizes current DWARF state flags to compute correct is_stmt values.

See https://bugs.llvm.org/show_bug.cgi?id=45529 for a detailed issue description.

Reviewers: arsenm, probinson, enderby

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

4 years agoX86Subtarget.cpp - sort includes. NFC
Simon Pilgrim [Mon, 20 Apr 2020 10:54:04 +0000 (11:54 +0100)]
X86Subtarget.cpp - sort includes. NFC
Ensure X86Subtarget.h module header is at the top, and sort the remaining includes.

4 years agoX86MCTargetDesc.h - remove unnecessary MCStreamer.h include. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 10:39:21 +0000 (11:39 +0100)]
X86MCTargetDesc.h - remove unnecessary MCStreamer.h include. NFC.
We don't need all of MCStreamer.h, just FormattedStream.h. The rest can be replaced with forward declarations.
X86WinAllocaExpander.cpp had an implicit dependency on MapVector.h which I've added locally.

4 years agoX86MCAsmInfo.h - remove unnecessary MCAsmInfo.h include. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 10:22:26 +0000 (11:22 +0100)]
X86MCAsmInfo.h - remove unnecessary MCAsmInfo.h include. NFC.
We only use the COFF/Darwin/ELF classes directly.

4 years agoX86InstrFoldTables.h - remove unnecessary include. NFC.
Simon Pilgrim [Mon, 20 Apr 2020 10:20:22 +0000 (11:20 +0100)]
X86InstrFoldTables.h - remove unnecessary include. NFC.
We don't need the limits defines, just the sized integer types so use cstdint system header directly.

4 years ago[AArch64][SVE] Remove LD1/ST1 dependency on llvm.masked.load/store
Kerry McLaughlin [Mon, 20 Apr 2020 10:07:48 +0000 (11:07 +0100)]
[AArch64][SVE] Remove LD1/ST1 dependency on llvm.masked.load/store

Summary:
The SVE masked load and store intrinsics introduced in D76688 rely on
common llvm.masked.load/store nodes. This patch creates new ISD nodes
for LD1(S) & ST1 to remove this dependency.

Additionally, this adds support for sign & zero extending
loads and truncating stores.

Reviewers: sdesmalen, efriedma, cameron.mcinally, c-rhodes, rengolin

Reviewed By: efriedma

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

Tags: #llvm

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

4 years ago[analyzer] Do not report CFError null dereference for nonnull params.
Valeriy Savchenko [Mon, 20 Apr 2020 08:08:57 +0000 (11:08 +0300)]
[analyzer] Do not report CFError null dereference for nonnull params.

We want to trust user type annotations and stop assuming pointers declared
as nonnull still can be null. This functionality is implemented as part
of NonNullParamChecker because it already checks parameter attributes.
Whenever we start analyzing a new function, we assume that all parameters
with 'nonnull' attribute are indeed non-null.

Patch by Valeriy Savchenko!

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

4 years ago[analyzer] Do not report NSError null dereference for _Nonnull params.
Valeriy Savchenko [Wed, 8 Apr 2020 15:58:40 +0000 (18:58 +0300)]
[analyzer] Do not report NSError null dereference for _Nonnull params.

We want to trust user type annotations and stop assuming pointers declared
as _Nonnull still can be null. This functionality is implemented as part
of NullabilityChecker as it already tracks non-null types.

Patch by Valeriy Savchenko!

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

4 years ago[VPlan] Clean up tryToCreate(Widen)Recipe. (NFC)
Florian Hahn [Mon, 20 Apr 2020 08:42:02 +0000 (09:42 +0100)]
[VPlan] Clean up tryToCreate(Widen)Recipe. (NFC)

This patch includes some clean-ups to tryToCreateRecipe, suggested in
D77973.

It includes:
  * Renaming tryToCreateRecipe to tryToCreateWidenRecipe.
  * Move VPBB insertion logic to caller of tryToCreateWidenRecipe.
  * Hoists instruction checks to tryToCreateWidenRecipe, making it
    clearer which instructions are handled by which recipe, simplifying
    the checks by using early exits.
  * Split up handling of induction PHIs and truncates using inductions.

Reviewers: gilr, rengolin, Ayal, hsaito

Reviewed By: Ayal

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

4 years ago[ARM][MVE] Add patterns for VRHADD
Sam Parker [Wed, 15 Apr 2020 10:10:09 +0000 (11:10 +0100)]
[ARM][MVE] Add patterns for VRHADD

Add patterns which use standard add nodes along with arm vshr imm
nodes.

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

4 years ago[ARM][MC][Thumb] Revert relocation for some pc-relative fixups.
Mark Murray [Thu, 16 Apr 2020 14:17:34 +0000 (15:17 +0100)]
[ARM][MC][Thumb] Revert relocation for some pc-relative fixups.

Summary:
This commit reverts https://reviews.llvm.org/D75039. Concensus appears to
be in favour of assembly-time resolution of these ADR and LDR relocations,
in line with GNU.

Reviewers: psmith

Subscribers: kristof.beyls, hiraditya, danielkiss, llvm-commits

Tags: #llvm

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

4 years ago[PredicateInfo] Use new Instruction::comesBefore instead of OI (NFC).
Florian Hahn [Mon, 20 Apr 2020 08:11:32 +0000 (09:11 +0100)]
[PredicateInfo] Use new Instruction::comesBefore instead of OI (NFC).

The recently added Instruction::comesBefore can be used instead of
OrderedInstructions.

Reviewers: rnk, nikic, efriedma

Reviewed By: nikic

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

4 years ago[MLIR] Add #include "llvm/ADT/SmallPtrSet.h" back to LoopUtils.h.
Alexander Belyaev [Mon, 20 Apr 2020 08:16:52 +0000 (10:16 +0200)]
[MLIR] Add #include "llvm/ADT/SmallPtrSet.h" back to LoopUtils.h.

4 years ago[NFC][TTI] Explicit use of VectorType
Sam Parker [Fri, 17 Apr 2020 12:29:31 +0000 (13:29 +0100)]
[NFC][TTI] Explicit use of VectorType

The API for shuffles and reductions uses generic Type parameters,
instead of VectorType, and so assertions and casts are used a lot.
This patch makes those types explicit, which means that the clients
can't be lazy, but results in less ambiguity, and that can only be a
good thing.

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

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

4 years ago[CodeGen] Support freeze expand for ppc_fp128
Kang Zhang [Mon, 20 Apr 2020 07:27:41 +0000 (07:27 +0000)]
[CodeGen] Support freeze expand for ppc_fp128

Summary:
The patch D29014 has added the new ISD::FREEZE and can deal with the
integer.
The patch D76980 has added SoftenFloatRes_FREEZE for float point.
But we still lack of expand for ppc_fp128, this will cause assertion for
some cases.
This patch is to support freeze expand for ppc_fp128.

Reviewed By: efriedma

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

4 years ago[MLIR] Move `replaceAllUsesExcept` from LoopUtil.h to Value.h.
Alexander Belyaev [Mon, 20 Apr 2020 07:17:45 +0000 (09:17 +0200)]
[MLIR] Move `replaceAllUsesExcept` from LoopUtil.h to Value.h.

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

4 years ago[CallSite removal][SCCP] Use CallBase instead of CallSite. NFC
Craig Topper [Mon, 20 Apr 2020 07:05:18 +0000 (00:05 -0700)]
[CallSite removal][SCCP] Use CallBase instead of CallSite. NFC

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

4 years ago[clangd][test] Make sed git bash compliant
Kadir Cetinkaya [Mon, 20 Apr 2020 06:27:15 +0000 (08:27 +0200)]
[clangd][test] Make sed git bash compliant

4 years ago[CallSite removal][Analysis] Use CallBase instead of CallSite in SparsePropagation...
Craig Topper [Mon, 20 Apr 2020 05:39:24 +0000 (22:39 -0700)]
[CallSite removal][Analysis] Use CallBase instead of CallSite in SparsePropagation unit test. NFC

4 years ago[CallSite removal][CalledValuePropagation] Use CallBase instead of CallSite. NFC
Craig Topper [Mon, 20 Apr 2020 04:54:38 +0000 (21:54 -0700)]
[CallSite removal][CalledValuePropagation] Use CallBase instead of CallSite. NFC

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

4 years agollvm-dwarfdump: Fix UB (unsequenced writes) introduced in e0fd87cc64d5
David Blaikie [Mon, 20 Apr 2020 04:32:33 +0000 (21:32 -0700)]
llvm-dwarfdump: Fix UB (unsequenced writes) introduced in e0fd87cc64d5

Unsequenced write due to "x &= f()" where 'f()' modifies 'x'.

Detected by the llvm-clang-x86_64-expensive-checks-win buildbot.
Investigated/identified by Galina - thanks!

4 years ago[Test] Fix test failure: platform-dependent printout
Max Kazantsev [Mon, 20 Apr 2020 03:26:15 +0000 (10:26 +0700)]
[Test] Fix test failure: platform-dependent printout

4 years agoHandle CET for -exception-model sjlj
Xiang1 Zhang [Mon, 20 Apr 2020 02:17:34 +0000 (10:17 +0800)]
Handle CET for -exception-model sjlj

Summary:
In SjLj exception mode, the old landingpad BB will create a new landingpad BB and use indirect branch jump to the old landingpad BB in lowering.
So we should add 2 endbr for this exception model.

Reviewers: hjl.tools, craig.topper, annita.zhang, LuoYuanke, pengfei, efriedma

Reviewed By: LuoYuanke

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Object] Use BFD name for little-endian PowerPC64
Bill Wendling [Mon, 20 Apr 2020 03:08:30 +0000 (20:08 -0700)]
[Object] Use BFD name for little-endian PowerPC64

Summary:
Little-endian PowerPC object files should report "elf64-powerpcle" instead of
"elf64-powerpc".

Reviewers: jhenderson, MaskRay, espindola, alexshap, rupprecht, #powerpc

Reviewed By: MaskRay

Subscribers: wuzish, emaste, nemanjai, shchenz, steven.zhang, llvm-commits

Tags: #llvm, #powerpc

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

4 years ago[Test] Add a test showing how CFG analyses are invalidated after LV
Max Kazantsev [Mon, 20 Apr 2020 02:37:30 +0000 (09:37 +0700)]
[Test] Add a test showing how CFG analyses are invalidated after LV

It demonstrates that, even if LV does no actual vectorization and only
forms LCSSA, CFG analyses get dropped.

4 years ago[X86][MC][NFC] Reduce the parameters of functions in X86MCCodeEmitter(Part III)
Shengchen Kan [Sat, 18 Apr 2020 08:52:50 +0000 (16:52 +0800)]
[X86][MC][NFC] Reduce the parameters of functions in X86MCCodeEmitter(Part III)

Summary:
When we encode an instruction, we need to know the number of bytes being
emitted to determine the fixups in `X86MCCodeEmitter::emitImmediate`.
There are only two callers for `emitImmediate`: `emitMemModRMByte` and
`encodeInstruction`.

Before this patch, we kept track of the current byte being emitted
by passing a reference parameter `CurByte` across all the `emit*`
funtions, which is ugly and unnecessary. For example, we don't have any
fixups when emitting prefixes, so we don't need to track this value.

In this patch, we use `StartByte` to record the initial status of the
streamer, and use `OS.tell()` to get the current status of the streamer
when we need to know the number of bytes being emitted. On one hand,
this eliminates the parameter `CurByte` for most `emit*` functions, on
the other hand, this make things clear: Only pass the parameter when we
really need it.

Reviewers: craig.topper, pengfei, MaskRay

Reviewed By: craig.topper, MaskRay

Subscribers: hiraditya, llvm-commits, annita.zhang

Tags: #llvm

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

4 years ago[CallSite removal][WebAssembly] Replace CallSite with CallBase in WebAssemblyOptimize...
Craig Topper [Mon, 20 Apr 2020 01:32:20 +0000 (18:32 -0700)]
[CallSite removal][WebAssembly] Replace CallSite with CallBase in WebAssemblyOptimizeReturned.

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

4 years ago[CallSite removal][Analysis] Replace CallSite with CallBase in MemoryBuiltins. NFC
Craig Topper [Mon, 20 Apr 2020 01:32:03 +0000 (18:32 -0700)]
[CallSite removal][Analysis] Replace CallSite with CallBase in MemoryBuiltins. NFC

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

4 years ago[CallSite removal][Lint] Replace visitCallSite with visitCallBase. NFC
Craig Topper [Mon, 20 Apr 2020 01:31:42 +0000 (18:31 -0700)]
[CallSite removal][Lint] Replace visitCallSite with visitCallBase. NFC

Drop visitCallInst/visitInvokeInst since the generic implementation
will delegate to visitCallBase. They appear to be from a time
before visitCallSite existed in the InstVisitor system.

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

4 years ago[X86] Add X86ISD nodes for PDEP and PEXT.
Craig Topper [Sun, 19 Apr 2020 23:13:22 +0000 (16:13 -0700)]
[X86] Add X86ISD nodes for PDEP and PEXT.

This will allow use to add DAG combines for these instructions.

4 years ago[CallSite removal][AMDGPU] Use CallBase instead of CallSite in AMDGPUFixFunctionBitca...
Craig Topper [Sun, 19 Apr 2020 07:41:43 +0000 (00:41 -0700)]
[CallSite removal][AMDGPU] Use CallBase instead of CallSite in AMDGPUFixFunctionBitcasts. NFC

4 years agoX86CallLowering.h - remove unnecessary ArrayRef.h include. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 20:24:25 +0000 (21:24 +0100)]
X86CallLowering.h - remove unnecessary ArrayRef.h include. NFC.

4 years agoSectionMemoryManager.h - remove unnecessary StringRef.h include. NFC.
Simon Pilgrim [Sat, 18 Apr 2020 17:52:07 +0000 (18:52 +0100)]
SectionMemoryManager.h - remove unnecessary StringRef.h include. NFC.

4 years ago[LVI] Use Optional instead of out parameter (NFC)
Nikita Popov [Thu, 9 Apr 2020 19:13:03 +0000 (21:13 +0200)]
[LVI] Use Optional instead of out parameter (NFC)

As suggested on D76788, this switches the LVI implementation to
return Optional<ValueLatticeElement> from various methods, instead
of passing in a ValueLatticeElement reference and returning a boolean.

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

4 years ago[TTI] Clean up includes (NFC).
Florian Hahn [Sun, 19 Apr 2020 19:02:45 +0000 (20:02 +0100)]
[TTI] Clean up includes (NFC).

Remove some unnecessary includes, replace some with forward
declarations.

This also exposed a few places that were missing some includes.

4 years ago[IVDescriptors] Clean up includes.
Florian Hahn [Sun, 19 Apr 2020 18:39:55 +0000 (19:39 +0100)]
[IVDescriptors] Clean up includes.

Some includes are not required and forward declarations can be used
instead. This also exposed a few places that were not directly including
required files.

4 years ago[LoopUtils] Clean up includes, use forward decls if appropriate (NFC).
Florian Hahn [Sun, 19 Apr 2020 17:17:20 +0000 (18:17 +0100)]
[LoopUtils] Clean up includes, use forward decls if appropriate (NFC).

Most of the includes in LoopUtils.h are not required in the header and
they can be replaced by forward declarations.

Unfortunately includes of TargetTransformInfo.h and IVDescriptors.h pull
in a bunch of additional things, but there is no easy way to get rid of
them at the moment I think.

4 years agoFix one more link for a Rationale doc moved under Rationale/
Mehdi Amini [Sun, 19 Apr 2020 17:03:01 +0000 (17:03 +0000)]
Fix one more link for a Rationale doc moved under Rationale/

4 years agoDependenceGraphBuilder.h - remove unused includes. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 16:52:35 +0000 (17:52 +0100)]
DependenceGraphBuilder.h - remove unused includes. NFC.
Replace with forward declarations.

4 years agoFix documentation link to MlirSpirvAbi
Mehdi Amini [Fri, 17 Apr 2020 19:23:57 +0000 (19:23 +0000)]
Fix documentation link to MlirSpirvAbi

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

4 years agoFix one more doc links after moving the document under Tutorials
Mehdi Amini [Sun, 19 Apr 2020 16:52:05 +0000 (16:52 +0000)]
Fix one more doc links after moving the document under Tutorials

4 years agoFix more broken doc links after some moved under the Rationale category
Mehdi Amini [Sun, 19 Apr 2020 16:49:30 +0000 (16:49 +0000)]
Fix more broken doc links after some moved under the Rationale category

4 years agoX86MachineFunctionInfo.h - remove unused include. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 15:52:26 +0000 (16:52 +0100)]
X86MachineFunctionInfo.h - remove unused include. NFC.

4 years agoX86InstrInfo.h - remove unused forward declarations. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 13:44:19 +0000 (14:44 +0100)]
X86InstrInfo.h - remove unused forward declarations. NFC.

4 years agoX86DisassemblerDecoder.h - remove unused forward declaration. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 13:41:25 +0000 (14:41 +0100)]
X86DisassemblerDecoder.h - remove unused forward declaration. NFC.

4 years ago[CMake] Delete HAVE_SCHED_GETAFFINITY and HAVE_CPU_COUNT
Fangrui Song [Sun, 19 Apr 2020 15:46:47 +0000 (08:46 -0700)]
[CMake] Delete HAVE_SCHED_GETAFFINITY and HAVE_CPU_COUNT

sched_getaffinity (Linux specific) has been available

* in glibc since 2002-08-08 (commit 972e719e8154eec5f543b027e2a08dfa285d55d5)
* in musl since the initial check-in.

4 years ago[InstSimplify] add tests for logic+icmp folds for nullptr; NFC
Sanjay Patel [Sun, 19 Apr 2020 14:42:08 +0000 (10:42 -0400)]
[InstSimplify] add tests for logic+icmp folds for nullptr; NFC

See discussion in D78430.

4 years ago[x86] avoid build warning for enum mismatch; NFC
Sanjay Patel [Sun, 19 Apr 2020 14:19:37 +0000 (10:19 -0400)]
[x86] avoid build warning for enum mismatch; NFC

gcc may warn here because X86ISD::NodeType is specified as "unsigned",
but ISD::NodeType is a naked C enum (although passed as an "unsigned"
throughout SDAG).

4 years ago[LAA] Remove unnecessary includes (NFC).
Florian Hahn [Sun, 19 Apr 2020 14:11:25 +0000 (15:11 +0100)]
[LAA] Remove unnecessary includes (NFC).

4 years agoX86MCTargetDesc.h - remove unnecessary includes and forward declarations. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 13:29:35 +0000 (14:29 +0100)]
X86MCTargetDesc.h - remove unnecessary includes and forward declarations. NFC.

4 years agoX86.h - remove unused forward declarations. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 13:28:52 +0000 (14:28 +0100)]
X86.h - remove unused forward declarations. NFC.

4 years agoX86SelectionDAGInfo.h - remove unnecessary includes and forward declarations. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 13:20:53 +0000 (14:20 +0100)]
X86SelectionDAGInfo.h - remove unnecessary includes and forward declarations. NFC.

4 years agoX86TargetTransformInfo.h - remove unnecessary includes. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 13:03:29 +0000 (14:03 +0100)]
X86TargetTransformInfo.h - remove unnecessary includes. NFC.

4 years ago[ARM] Regenerate tests. NFC
David Green [Sun, 19 Apr 2020 12:21:01 +0000 (13:21 +0100)]
[ARM] Regenerate tests. NFC

4 years ago[X86][SSE] getFauxShuffle - don't combine shuffles with small truncated scalars ...
Simon Pilgrim [Sun, 19 Apr 2020 12:34:58 +0000 (13:34 +0100)]
[X86][SSE] getFauxShuffle - don't combine shuffles with small truncated scalars (PR45604)

getFauxShuffle attempts to combine INSERT_VECTOR_ELT(TRUNCATE/EXTEND(EXTRACT_VECTOR_ELT(x))) patterns into a target shuffle chain.

PR45604 identified an issue where the scalar was truncated to a size smaller than the destination vector element and then zero extended back, which requires the upper bits to be zero'd which we don't currently do.

To avoid the bug I've added an early out in these truncation cases, a future commit should allow us to handle this by inserting the necessary SM_SentinelZero padding.

4 years ago[clangd] Add index export to dexp
Sam McCall [Sun, 19 Apr 2020 12:33:00 +0000 (14:33 +0200)]
[clangd] Add index export to dexp

Summary: Add a command to dexp that exports index data in chosen format (e.g. YAML).

Reviewers: sammccall

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

Tags: #clang-tools-extra, #clang

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

4 years ago[x86] use vector instructions to lower more FP->int->FP casts
Sanjay Patel [Sun, 19 Apr 2020 12:32:02 +0000 (08:32 -0400)]
[x86] use vector instructions to lower more FP->int->FP casts

This is an enhancement to D77895 to avoid another
round-trip from XMM->GPR->XMM. This time we handle
the case of starting/ending with an f64 and casting
to signed i32 as the intermediate value.

It's a bit more involved than I initially assumed
because we need to use target-specific opcodes to
represent the non-standard cast ops.

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

4 years ago[clangd] Extend YAML Serialization
Sam McCall [Sun, 19 Apr 2020 12:22:23 +0000 (14:22 +0200)]
[clangd] Extend YAML Serialization

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang-tools-extra, #clang

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

4 years ago[VectorCombine] transform bitcasted shuffle to wider elements
Sanjay Patel [Sun, 19 Apr 2020 12:06:17 +0000 (08:06 -0400)]
[VectorCombine] transform bitcasted shuffle to wider elements

bitcast (shuf V, MaskC) --> shuf (bitcast V), MaskC'

This is the widen shuffle elements enhancement to D76727.
It builds on the analysis and simplifications in
D77881 and rG6a7e958a423e.

The phase ordering tests show that we can simplify inverse
shuffles across a binop in both directions (widen/narrow or
narrow/widen) now.

There's another potential transform visible in some of the
remaining TODOs - move a bitcasted operand of a shuffle
after the shuffle.

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

4 years ago[InstSimplify] add tests for logic-of-icmp with min/max constant; NFC
Sanjay Patel [Fri, 17 Apr 2020 18:05:04 +0000 (14:05 -0400)]
[InstSimplify] add tests for logic-of-icmp with min/max constant; NFC

See PR45510:
https://bugs.llvm.org/show_bug.cgi?id=45510

We had partial coverage for some of these patterns, so removing duplicate tests
with the complete set in the new test file.

4 years ago[X86][SSE] Add test case for PR45604
Simon Pilgrim [Sun, 19 Apr 2020 12:13:54 +0000 (13:13 +0100)]
[X86][SSE] Add test case for PR45604

4 years agoSelectionDAGBuilder.h - remove unused includes + forward declarations. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 11:38:41 +0000 (12:38 +0100)]
SelectionDAGBuilder.h - remove unused includes + forward declarations. NFC.
Replace SelectionDAG.h include with SelectionDAG forward declaration.

4 years agoX86InstrFMA3Info.h - remove unnecessary includes. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 11:17:56 +0000 (12:17 +0100)]
X86InstrFMA3Info.h - remove unnecessary includes. NFC.
There were a number of cpp files explicitly relying on X86InstrFMA3Info.h to include the X86.h header - so I've had to add it locally.

4 years agoInstrEmitter.h - reduce SelectionDAG.h include to SelectionDAGNodes.h include.
Simon Pilgrim [Sun, 19 Apr 2020 10:52:31 +0000 (11:52 +0100)]
InstrEmitter.h - reduce SelectionDAG.h include to SelectionDAGNodes.h include.
Add SDDbgLabel/TargetLowering forward declarations.
Add the full SelectionDAG.h include to InstrEmitter.cpp.

4 years agoX86AsmPrinter.h - cleanup includes and forward declarations. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 10:38:50 +0000 (11:38 +0100)]
X86AsmPrinter.h - cleanup includes and forward declarations. NFC.
Reduce X86Subtarget.h/MCCodeEmitter.h/TargetMachine.h includes to forward declarations
Add explicit X86Subtarget.h/TargetMachine.h includes to X86AsmPrinter.cpp/X86MCInstLower.cpp
Remove unused MCSymbol forward declaration

4 years agoDebugHandlerBase.h - reduce MachineInstr.h include to DebugLoc.h include.
Simon Pilgrim [Sun, 19 Apr 2020 10:13:26 +0000 (11:13 +0100)]
DebugHandlerBase.h - reduce MachineInstr.h include to DebugLoc.h include.

We were only including MachineInstr.h for DebugLoc.h. This exposes an implicit include dependency in BTFDebug.h where I've had to add the MachineInstr.h include.

4 years agoBuildLibCalls.h - remove unnecessary TargetLibraryInfo forward declaration. NFC
Simon Pilgrim [Sun, 19 Apr 2020 10:00:30 +0000 (11:00 +0100)]
BuildLibCalls.h - remove unnecessary TargetLibraryInfo forward declaration. NFC

We already have to include the TargetLibraryInfo.h header.

4 years agoTypeBasedAliasAnalysis.h - replace InstrTypes.h include with forward declaration...
Simon Pilgrim [Sun, 19 Apr 2020 09:55:23 +0000 (10:55 +0100)]
TypeBasedAliasAnalysis.h - replace InstrTypes.h include with forward declaration. NFC.

4 years agoRemove remaining callers of CreateShuffleVector with unsigned indices and mark it...
Benjamin Kramer [Sun, 19 Apr 2020 09:48:28 +0000 (11:48 +0200)]
Remove remaining callers of CreateShuffleVector with unsigned indices and mark it as deprecated

No functionality change intended.

4 years agoOMPConstants.h - replace StringRef.h include with forward declaration. NFC.
Simon Pilgrim [Sun, 19 Apr 2020 09:29:38 +0000 (10:29 +0100)]
OMPConstants.h - replace StringRef.h include with forward declaration. NFC.