platform/upstream/llvm.git
4 years ago[X86] Move MMX_SET0 pattern into the instruction definition. NFC
Craig Topper [Sat, 30 May 2020 23:12:44 +0000 (16:12 -0700)]
[X86] Move MMX_SET0 pattern into the instruction definition. NFC

4 years ago[ELF][docs] Update supported targets
Fangrui Song [Sun, 31 May 2020 02:33:50 +0000 (19:33 -0700)]
[ELF][docs] Update supported targets

PowerPC, PowerPC64 and x86-32 have production quality.
Mention Hexagon, RISC-V and SPARC V9.

4 years ago[llvm-objdump] Delete unneeeded namespace llvm {}
Fangrui Song [Sun, 31 May 2020 01:03:43 +0000 (18:03 -0700)]
[llvm-objdump] Delete unneeeded namespace llvm {}

4 years ago[llvm-objdump] Move llvm:: to llvm::objdump:: and qualifying definitions with objdump::
Fangrui Song [Sun, 31 May 2020 01:00:14 +0000 (18:00 -0700)]
[llvm-objdump] Move llvm:: to llvm::objdump:: and qualifying definitions with objdump::

Or adding `static`.

Qualifying definitions with `objdump::` comforms to the coding standards
https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions

4 years ago[llvm-objdump] Simplify reportError() and prepend outs().flush()
Fangrui Song [Sun, 31 May 2020 00:25:18 +0000 (17:25 -0700)]
[llvm-objdump] Simplify reportError() and prepend outs().flush()

As noticed by dblaikie.

I don't know what code paths using reportError can cause stdout output
to be interleaved with stderr, so no test is added now.

Also drop an unneeded use of errs().fflush() in reportWarning().
I requested this in D64165.

4 years ago[X86] Add pseudo instructions to use MULX with a single destination when the low...
Craig Topper [Sat, 30 May 2020 22:51:56 +0000 (15:51 -0700)]
[X86] Add pseudo instructions to use MULX with a single destination when the low result isn't used.

The instruction is defined to only produce high result if both
destinations are the same. We can exploit this to avoid
unnecessarily clobbering a register.

In order to hide this from register allocation we use a pseudo
instruction and expand the result during MCInst creation.

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

4 years ago[Driver] Fix BooleanFFlag identifiers to use 'f' 'fno_' prefixes instead of suffixes
Fangrui Song [Sat, 30 May 2020 22:41:09 +0000 (15:41 -0700)]
[Driver] Fix BooleanFFlag identifiers to use 'f' 'fno_' prefixes instead of suffixes

4 years agoRemove some non-determinism from the `Darwin/duplicate_os_log_reports.cpp` test.
Dan Liew [Sat, 30 May 2020 22:17:41 +0000 (15:17 -0700)]
Remove some non-determinism from the `Darwin/duplicate_os_log_reports.cpp` test.

The test read from an uninitialized buffer which could cause the output
to be unpredictable.

The test is currently disabled so this won't actually change anything
until the test is re-enabled.

4 years ago[X86] Minor cleanups to addShuffleComments in X86MCInstPrinter.cpp. NFCI
Craig Topper [Sat, 30 May 2020 19:53:56 +0000 (12:53 -0700)]
[X86] Minor cleanups to addShuffleComments in X86MCInstPrinter.cpp. NFCI

-Replace some ifs that should be impossible with asserts.
-Use X86::AddrDisp and X86::AddrNumOperands to make code more readable
-Use X86II::isKMasked/isKMergeMasked to do some operand skipping to remove or simplify switches

4 years ago[X86] Factor constant pool comment printing out of the switch in X86AsmPrinter::emitI...
Craig Topper [Sat, 30 May 2020 07:31:21 +0000 (00:31 -0700)]
[X86] Factor constant pool comment printing out of the switch in X86AsmPrinter::emitInstruction. NFC

Pull the verbose asm check out of the cases and move it up to
the call of the new function.

4 years ago[LoopUnroll] Add a test case for rG7873376bb36b.
Whitney Tsang [Sat, 30 May 2020 20:24:10 +0000 (20:24 +0000)]
[LoopUnroll] Add a test case for rG7873376bb36b.

rG7873376bb36b fixes a build failure for allyesconfig.

The problem happened when the single exiting block doesn't dominate the
loop latch, then the immediate dominator of the exit block should not be
the exiting block after unrolling. As the exiting block of
different unrolled iteration can branch to the exit block, and the ith
exiting block doesn't dominate (i+1)th exiting block, the immediate
dominator of the exit block should not the nearest common dominator of
the exiting block and the loop latch of the same iteration.

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

4 years ago[Tests] Convert last statepoint lowering tests to bundle format
Philip Reames [Sat, 30 May 2020 19:58:41 +0000 (12:58 -0700)]
[Tests] Convert last statepoint lowering tests to bundle format

4 years ago[clang-tidy] RenamerClangTidyChecks ignore builtin and command line macros
Nathan James [Wed, 27 May 2020 14:01:17 +0000 (15:01 +0100)]
[clang-tidy] RenamerClangTidyChecks ignore builtin and command line macros

Summary: Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=42635 | readability-identifier-naming option MacroDefinitionCase should ignore macros passed as parameters. ]]

Reviewers: aaron.ballman, alexfh, gribozavr2, hokein

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

Tags: #clang

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

4 years ago[LoopUnroll] Fix build failure for allyesconfig.
Whitney Tsang [Sat, 30 May 2020 18:20:23 +0000 (18:20 +0000)]
[LoopUnroll] Fix build failure for allyesconfig.

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

4 years ago[DSE] Remove noop stores in MSSA.
zoecarver [Sat, 30 May 2020 16:56:04 +0000 (09:56 -0700)]
[DSE] Remove noop stores in MSSA.

Adds a simple fast-path check for the pattern:
v = load ptr
store v to ptr

I took the tests from the bugzilla post, I can add more if needed (but I think these should be sufficent).

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

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

4 years ago[lldb] Pass -fPIC flag even when DYLIB_ONLY is set
Raphael Isemann [Fri, 29 May 2020 15:08:28 +0000 (17:08 +0200)]
[lldb] Pass -fPIC flag even when DYLIB_ONLY is set

Summary:
It seems that when we rewrite a few rules to only build a dylib (i.e., when DYLIB_ONLY is set),
the rule for setting the CFLAGS for the dylib's object file compilation will no longer work. From what I can
see this is because in DYLIB_ONLY mode we pretend to compile the main executable so
the DYLIB_OBJECTS scope is actually never used.

This patch makes `-fPIC` unstopped if DYLIB_ONLY is set so that -fPIC actually ends up in the
CFLAGS for the dylib object file compilation.

The test for this is D80798 which only compiles on Linux with this patch.

Reviewers: friss, labath

Reviewed By: friss

Subscribers: JDevlieghere

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

4 years ago[BasicAA] Use known lower bounds for index values for size based check.
Florian Hahn [Sat, 30 May 2020 15:20:42 +0000 (16:20 +0100)]
[BasicAA] Use known lower bounds for index values for size based check.

Currently, BasicAA does not exploit information about value ranges of
indexes. For example, consider the 2 pointers %a = %base and
%b = %base + %stride below, assuming they are used to access 4 elements.

If we know that %stride >= 4, we know the accesses do not alias. If
%stride is a constant, BasicAA currently gets that. But if the >= 4
constraint is encoded using an assume, it misses the NoAlias.

This patch extends DecomposedGEP to include an additional MinOtherOffset
field, which tracks the constant offset similar to the existing
OtherOffset, which the difference that it also includes non-negative
lower bounds on the range of the index value. When checking if the
distance between 2 accesses exceeds the access size, we can use this
improved bound.

For now this is limited to using non-negative lower bounds for indices,
as this conveniently skips cases where we do not have a useful lower
bound (because it is not constrained). We potential miss out in cases
where the lower bound is constrained but negative, but that can be
exploited in the future.

Reviewers: sanjoy, hfinkel, reames, asbirlea

Reviewed By: asbirlea

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

4 years agoSafeStackColoring.h - reduce Instructions.h include to forward declaration. NFC.
Simon Pilgrim [Sat, 30 May 2020 13:38:02 +0000 (14:38 +0100)]
SafeStackColoring.h - reduce Instructions.h include to forward declaration. NFC.

SafeStackColoring.cpp - remove includes directly defined in SafeStackColoring.h header. NFC.

4 years agoCriticalAntiDepBreaker.cpp - remove includes directly defined in CriticalAntiDepBreak...
Simon Pilgrim [Sat, 30 May 2020 13:32:36 +0000 (14:32 +0100)]
CriticalAntiDepBreaker.cpp - remove includes directly defined in CriticalAntiDepBreaker.h header. NFC.

4 years agoSafeStackLayout.cpp - remove includes directly defined in SafeStackLayout.h module...
Simon Pilgrim [Sat, 30 May 2020 13:30:19 +0000 (14:30 +0100)]
SafeStackLayout.cpp - remove includes directly defined in SafeStackLayout.h module header. NFC.

4 years ago[TargetLowering] SimplifyDemandedBits - remove shift amount clamps from getValidShift...
Simon Pilgrim [Sat, 30 May 2020 13:04:55 +0000 (14:04 +0100)]
[TargetLowering] SimplifyDemandedBits - remove shift amount clamps from getValidShiftAmountConstant calls. NFC.

getValidShiftAmountConstant only returns a value if the shift amount is in range, so we don't need to check it again.

4 years ago[SelectionDAG] ComputeNumSignBits - use Valid Min/Max shift amount helpers directly...
Simon Pilgrim [Sat, 30 May 2020 13:02:14 +0000 (14:02 +0100)]
[SelectionDAG] ComputeNumSignBits - use Valid Min/Max shift amount helpers directly. NFCI.

We are calling getValidShiftAmountConstant first followed by getValidMinimumShiftAmountConstant/getValidMaximumShiftAmountConstant if that failed. But both are used in the same way in ComputeNumSignBits and the Min/Max variants call getValidShiftAmountConstant internally anyhow.

4 years agoPackedVersion.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Sat, 30 May 2020 12:17:19 +0000 (13:17 +0100)]
PackedVersion.h - reduce includes to forward declarations. NFC.

4 years ago[clang-format] [PR46130] When editing a file with unbalance {} the namespace comment...
mydeveloperday [Sat, 30 May 2020 12:00:35 +0000 (13:00 +0100)]
[clang-format] [PR46130] When editing a file with unbalance {} the namespace comment fixer can incorrectly comment the wrong closing brace

Summary:
https://bugs.llvm.org/show_bug.cgi?id=46130   from Twitter https://twitter.com/ikautak/status/1265998988232159232

I have seen this myself many times.. if you have format on save and you work in an editor where you are constantly saving (:w muscle memory)

If you are in the middle of editing and somehow you've missed a { or } in your code, somewhere, often way below where you are at the bottom of your file the namespace comment fixer will have put the namespace on the previous closing brace.

This leads to you having to fix up the bottom of the file.

This revision prevents that happening by performing an initial pass of the tokens and simply counting the number of `{` and `}`  and ensuring they balance.

If they don't balance we don't do any namespace fixing as it will likely be unstable and incorrect.

Reviewed By: curdeius

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

4 years agoTBEHandler.h - remove unnecessary VersionTuple forward declaration. NFC.
Simon Pilgrim [Sat, 30 May 2020 12:07:57 +0000 (13:07 +0100)]
TBEHandler.h - remove unnecessary VersionTuple forward declaration. NFC.

We already have to include VersionTuple.h

4 years agoArchitectureSet.h - add missing <tuple> include.
Simon Pilgrim [Sat, 30 May 2020 11:48:46 +0000 (12:48 +0100)]
ArchitectureSet.h - add missing <tuple> include.

MSVC seems to implicitly include this from <utility> but other toolchains don't

4 years agoArchitectureSet.h - reduce raw_ostream.h include to forward declaration. NFC.
Simon Pilgrim [Sat, 30 May 2020 11:36:16 +0000 (12:36 +0100)]
ArchitectureSet.h - reduce raw_ostream.h include to forward declaration. NFC.

Move raw_ostream.h include to ArchitectureSet.cpp.

4 years agoArchitecture.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Sat, 30 May 2020 11:17:13 +0000 (12:17 +0100)]
Architecture.h - reduce includes to forward declarations. NFC.

Move includes to Architecture.cpp.

4 years agoIPDBRawSymbol.h - remove already declared forward declarations. NFC.
Simon Pilgrim [Sat, 30 May 2020 11:00:17 +0000 (12:00 +0100)]
IPDBRawSymbol.h - remove already declared forward declarations. NFC.

PDBTypes.h holds most PDB forward declarations already, move IPDBSession in there as well.

4 years agoIPDBRawSymbol.h - reduce StringRef.h include to forward declaration. NFC.
Simon Pilgrim [Sat, 30 May 2020 10:29:17 +0000 (11:29 +0100)]
IPDBRawSymbol.h - reduce StringRef.h include to forward declaration. NFC.

4 years ago[libcxx testing] Stop using arbitrary timeouts in one test
David Zarzycki [Sat, 30 May 2020 10:06:43 +0000 (06:06 -0400)]
[libcxx testing] Stop using arbitrary timeouts in one test

On a busy and/or slow system, 100ms might not be long enough. Instead,
we now use atomic variables to communicate between threads.

4 years ago[OpenMP][SYCL] Do not crash on attempt to diagnose unsupported type use
Mariya Podchishchaeva [Sat, 30 May 2020 09:27:47 +0000 (12:27 +0300)]
[OpenMP][SYCL] Do not crash on attempt to diagnose unsupported type use

Summary:
Do not ask size of type if it is dependent. ASTContext doesn't seem expecting
this.

Reviewers: jdoerfert, ABataev, bader

Reviewed By: ABataev

Subscribers: yaxunl, guansong, ebevhan, Anastasia, sstefan1, cfe-commits

Tags: #clang

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

4 years ago[SelectionDAG] Remove repeated getOperand() call. NFC.
Simon Pilgrim [Sat, 30 May 2020 09:21:36 +0000 (10:21 +0100)]
[SelectionDAG] Remove repeated getOperand() call. NFC.

4 years ago[lldb/CMake] Fix typo that prevented regenerating the bindings
Jonas Devlieghere [Sat, 30 May 2020 06:50:26 +0000 (23:50 -0700)]
[lldb/CMake] Fix typo that prevented regenerating the bindings

A typo in the GLOB patter prevented us from detecting changes in the
interface files and trigger SWIG to regenerate the bindings.

4 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Sat, 30 May 2020 05:46:57 +0000 (22:46 -0700)]
[X86] Autogenerate complete checks. NFC

4 years ago[test] Regenerate checks in aarch64_win64cc_vararg.ll with update_llc_test_checks...
Martin Storsjö [Fri, 29 May 2020 22:20:14 +0000 (01:20 +0300)]
[test] Regenerate checks in aarch64_win64cc_vararg.ll with update_llc_test_checks.py. NFC.

4 years ago[AArch64] Treat x18 as callee-saved in functions with windows calling convention...
Martin Storsjö [Tue, 30 Apr 2019 08:50:09 +0000 (11:50 +0300)]
[AArch64] Treat x18 as callee-saved in functions with windows calling convention on non-windows OSes

Treat it as callee-saved, and always back it up. When windows code calls
entry points in unix code, marked with the windows calling convention,
that unix code can call other functions that isn't compiled with
-ffixed-x18 which may clobber x18 freely. By backing it up and restoring
it on return, we preserve the register across the function call,
fulfilling this part of the windows calling convention on another OS.

This isn't enough for making sure that x18 is preseved when non-windows
code does a callback to windows code, but is a clear improvement over
the current status quo. Additionally, wine is nowadays building many
modules as PE DLLs, which avoids the callback issue altogether for those
DLLs.

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

4 years ago[lldb/Test] use GetLoadAddress from scripted thread plan
Jonas Devlieghere [Sat, 30 May 2020 06:01:09 +0000 (23:01 -0700)]
[lldb/Test] use GetLoadAddress from scripted thread plan

Commit 0800529fe605 adds a runtime error which triggers when using
SBAddress properties that use the current process/target from a
non-interactive session. TestThreadPlanCommands.py was doing exactly
this and this patch fixes that by use GetLoadAddress instead.

4 years ago[DWARF5] Added support for emission of .debug_macro.dwo section
Sourabh Singh Tomar [Sat, 30 May 2020 05:41:09 +0000 (11:11 +0530)]
[DWARF5] Added support for emission of .debug_macro.dwo section

This patch adds support for emission of following DWARFv5 macro
forms in .debug_macro.dwo section:

- DW_MACRO_start_file
- DW_MACRO_end_file
- DW_MACRO_define_strx
- DW_MACRO_undef_strx

Reviewed By: dblaikie

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

4 years ago[lldb/Bindings] Raise exception when using properties that rely on lldb.target
Jonas Devlieghere [Sat, 30 May 2020 05:10:05 +0000 (22:10 -0700)]
[lldb/Bindings] Raise exception when using properties that rely on lldb.target

Several SBAddress properties use the lldb.target or lldb.process
convenience variables which are only set under the interactive script
interpreter. Unfortunately, users have been using these properties in
Python script and commands. This patch raises a Python exception to
force users to use GetLoadAddress instead.

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

4 years agoUse .empty() instead of .size() == 0 (NFC)
Mehdi Amini [Sat, 30 May 2020 03:36:22 +0000 (03:36 +0000)]
Use .empty() instead of .size() == 0 (NFC)

Cleanup / Fix a clang-tidy warning

4 years agoNFC: Simplify O1 pass pipeline construction.
Eric Christopher [Tue, 5 May 2020 01:33:49 +0000 (18:33 -0700)]
NFC: Simplify O1 pass pipeline construction.

Pull O1 pass pipeline out into a separate function and simplify
buildFunctionSimplificationPipeline accordingly.

4 years agoFix full unrolling with new pass manager.
Eric Christopher [Mon, 4 May 2020 20:48:56 +0000 (13:48 -0700)]
Fix full unrolling with new pass manager.

Last we looked at this and couldn't come up with a reason to change
it, but with a pragma for full loop unrolling we bypass every other
loop unroll and then fail to fully unroll a loop when the pragma is set.

Move the OnlyWhenForced out of the check and into the initialization
of the full unroll pass in the new pass manager. This doesn't show up
with the old pass manager.

Add a new option to opt so that we can turn off loop unrolling
manually since this is a difference between clang and opt.

Tested with check-clang and check-llvm.

4 years ago[ValueLattice] Fix uninitialized-value after D79036
Fangrui Song [Sat, 30 May 2020 02:48:33 +0000 (19:48 -0700)]
[ValueLattice] Fix uninitialized-value after D79036

Many check-clang-codegen tests failed.

4 years ago[AMDGPU] Remove assertion on S1024 SGPR to VGPR spill
Carl Ritson [Sat, 30 May 2020 02:15:39 +0000 (11:15 +0900)]
[AMDGPU] Remove assertion on S1024 SGPR to VGPR spill

Summary:
Replace an assertion that blocks S1024 SGPR to VGPR spill.
The assertion pre-dates S1024 and is not wave size dependent.

Reviewers: arsenm, sameerds, rampitec

Reviewed By: arsenm

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

Tags: #llvm

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

4 years agoAMDGPU: Optimize s_setreg_b32 to s_denorm_mode/s_round_mode
Matt Arsenault [Fri, 29 May 2020 00:55:45 +0000 (20:55 -0400)]
AMDGPU: Optimize s_setreg_b32 to s_denorm_mode/s_round_mode

This is a custom inserter because it was less work than teaching
tablegen a way to indicate that it is sometimes OK to have a no side
effect instruction in the output of a side effecting pattern.

The asm is needed to look like a read of the mode register to prevent
it from being deleted. However, there seems to be a bug where the mode
register def instructions are moved across the asm sideeffect by the
post-RA scheduler.

Another oddity is the immediate is formatted differently between
s_denorm_mode and s_round_mode.

4 years agoAMDGPU: Add new baseline tests for setreg handling
Matt Arsenault [Fri, 29 May 2020 20:11:58 +0000 (16:11 -0400)]
AMDGPU: Add new baseline tests for setreg handling

Most of these should be identical and use a common prefix, but
update_llc_test_checks is failing to generate shared checks for some
reason.

4 years agoAMDGPU: Move MIMG MMO check to verifier
Matt Arsenault [Fri, 29 May 2020 00:38:16 +0000 (20:38 -0400)]
AMDGPU: Move MIMG MMO check to verifier

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from AMDGPU
Christopher Tetreault [Sat, 30 May 2020 00:44:51 +0000 (17:44 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from AMDGPU

Reviewers: efriedma, david-arm, fpetrogalli, arsenm

Reviewed By: david-arm

Subscribers: arsenm, kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, tschuett, hiraditya, rkruppe, psnobl, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[jitlink] R_X86_64_PC32 support for the elf x86 jitlinker
Jared Wyles [Fri, 29 May 2020 23:11:42 +0000 (09:11 +1000)]
[jitlink] R_X86_64_PC32 support for the elf x86 jitlinker

Summary:

Adding in our first relocation type, and all the required plumbing to support the rest in following patches

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

Reviewer: lhames

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from Linker
Christopher Tetreault [Fri, 29 May 2020 23:17:40 +0000 (16:17 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from Linker

Reviewers: efriedma, tejohnson, sdesmalen, c-rhodes

Reviewed By: efriedma

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

Tags: #llvm

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

4 years ago[gn build] Port cf6cc662eee
LLVM GN Syncbot [Fri, 29 May 2020 23:53:23 +0000 (23:53 +0000)]
[gn build] Port cf6cc662eee

4 years ago[gn build] Port 34cfed24ebd
LLVM GN Syncbot [Fri, 29 May 2020 23:53:22 +0000 (23:53 +0000)]
[gn build] Port 34cfed24ebd

4 years ago[AMDGPU] Add loaded code object path URI definition to AMDGPUUsage
Tony [Fri, 29 May 2020 23:03:50 +0000 (19:03 -0400)]
[AMDGPU] Add loaded code object path URI definition to AMDGPUUsage

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

4 years ago[gn build] (manually) port 0e265e31578
Nico Weber [Fri, 29 May 2020 23:49:11 +0000 (19:49 -0400)]
[gn build] (manually) port 0e265e31578

4 years ago[flang][NFC] Remove link-time dependency of Evaluate on Semantics
Tim Keith [Fri, 29 May 2020 23:39:13 +0000 (16:39 -0700)]
[flang][NFC] Remove link-time dependency of Evaluate on Semantics

Summary:
Some Symbol-related functions used in Evaluate were moved to
Evaluate/tools.h. This includes changing some member functions that were
replaced by non-member functions `IsDummy`, `GetUsedModule`, and
`CountLenParameters`.

Some member functions were made inline in `Scope`, `Symbol`,
`ArraySpec`, and `DeclTypeSpec`. The definitions were preceded by a
comment explaining why they are inline.

`IsConstantShape` was expanded inline in `IsDescriptor` because it isn't
used anywhere else

After this change, at least when compiling with clang on macos,
`libFortranEvaluate.a` has no undefined symbols that are satisfied by
`libFortranSemantics.a`.

Reviewers: klausler, PeteSteinfeld, sscalpone, jdoerfert, DavidTruby

Reviewed By: PeteSteinfeld

Subscribers: llvm-commits

Tags: #flang, #llvm

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

4 years ago[mlir][spirv] Clean up coop matrix assembly declaration.
Thomas Raoux [Fri, 29 May 2020 23:34:56 +0000 (16:34 -0700)]
[mlir][spirv] Clean up coop matrix assembly declaration.

Address code review feedback and use declarative assembly format.

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

4 years ago[libc++] Fix issues with the triviality of std::array
Louis Dionne [Fri, 29 May 2020 23:32:55 +0000 (16:32 -0700)]
[libc++] Fix issues with the triviality of std::array

The Standard is currently unimplementable. We have to pick between:

1. Not implementing constexpr support properly in std::array<T, 0>
2. Making std::array<T, 0> non-trivial even when T is trivial
3. Returning nullptr from std::array<T, 0>::begin()

Libc++ initially picked (1). In 77b9abfc8e89, we started implementing constexpr properly, but lost the guarantee of triviality. Since it seems like both (1) and (2) are really important, it seems like (3) is the only viable option for libc++, after all. This is also what other implementations are doing.

This patch moves libc++ from (1) to (3).

It also:
- Improves the test coverage for the various ways of initializing std::array
- Adds tests for the triviality of std::array
- Adds tests for the aggregate-ness of std::array

Reviewed By: #libc, miscco, EricWF, zoecarver

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

4 years ago[diagtool] Install diagtool when LLVM_INSTALL_TOOLCHAIN_ONLY is ON.
Volodymyr Sapsai [Fri, 29 May 2020 00:06:33 +0000 (17:06 -0700)]
[diagtool] Install diagtool when LLVM_INSTALL_TOOLCHAIN_ONLY is ON.

Not sure about other platforms but `install-xcode-toolchain` was already
including diagtool in the toolchain. This change makes it possible to
install diagtool during Apple's 2-stage build.

Instead of dropping `if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)` conditional
I've switched to `add_clang_tool` which handles install targets. Also a
few other clang tools like clang-format, clang-scan-deps are using this
macro, so it is good to be consistent.

rdar://problem/15386909

Reviewed By: JDevlieghere

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

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from X86
Christopher Tetreault [Fri, 29 May 2020 22:52:33 +0000 (15:52 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from X86

Reviewers: efriedma, sdesmalen, c-rhodes, craig.topper

Reviewed By: craig.topper

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

Tags: #llvm

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

4 years ago[libFuzzer] Fixed description of fuzzer merge control file.
Adrian Herrera [Fri, 29 May 2020 22:59:58 +0000 (15:59 -0700)]
[libFuzzer] Fixed description of fuzzer merge control file.

Summary:
The description of the fuzzer merge control file appears to be incorrect/out of date.
No "DONE" line appears in the control file. Rather, FT and COV are the markers that appear
following the STARTED line.

Reviewers: metzman, kcc

Reviewed By: kcc

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[mlir] Fix Windows build
Nicolas Vasilache [Fri, 29 May 2020 21:29:35 +0000 (17:29 -0400)]
[mlir] Fix Windows build

Summary:
MSVC does not seem to like certain forward declarations.

https://reviews.llvm.org/D80728 introduces an error where
seemingly unrelated .cpp files that include the .h
(but do not otherwise use the class that depends on the forward declaration).

Instead of forward declaration, include the full vector ops definition.

Subscribers: mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, frgossen, Kayjukh, jurahul, llvm-commits

Tags: #llvm

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

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from AggressiveInstCombine
Christopher Tetreault [Fri, 29 May 2020 22:41:06 +0000 (15:41 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from AggressiveInstCombine

Reviewers: efriedma, aymanmus, c-rhodes, david-arm

Reviewed By: david-arm

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

Tags: #llvm

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

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from AArch64
Christopher Tetreault [Fri, 29 May 2020 22:32:36 +0000 (15:32 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from AArch64

Reviewers: efriedma, c-rhodes, david-arm, mcrosier, t.p.northover

Reviewed By: efriedma

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

Tags: #llvm

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

4 years ago[SLP] Apply external to vectorizable tree users cost adjustment for
Valery N Dmitriev [Fri, 29 May 2020 01:24:03 +0000 (18:24 -0700)]
[SLP] Apply external to vectorizable tree users cost adjustment for
relevant aggregate build instructions only (UserCost).
Users are detected with findBuildAggregate routine and the trick is
that following SLP vectorization may end up vectorizing entire list
with smaller chunks. Cost adjustment then is applied for individual
chunks and these adjustments obviously have to be smaller than the
entire aggregate build cost.

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

4 years ago[mlir] NFC - Add debug information for Linalg transformations.
Nicolas Vasilache [Fri, 29 May 2020 22:07:39 +0000 (18:07 -0400)]
[mlir] NFC - Add debug information for Linalg transformations.

Address post-commit review of https://reviews.llvm.org/D79518

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from InstCombine
Christopher Tetreault [Fri, 29 May 2020 22:24:15 +0000 (15:24 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from InstCombine

Reviewers: efriedma, david-arm, fpetrogalli, spatel

Reviewed By: david-arm

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

Tags: #llvm

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

4 years ago[flang] Batch together the changes to the PFT intermediate data
Eric Schweitz [Fri, 22 May 2020 17:18:26 +0000 (10:18 -0700)]
[flang] Batch together the changes to the PFT intermediate data
structure for upstreaming to llvm-project.

These files have had many changes since they were originally upstreamed.
Some of the changes are cosmetic.  Most of the functional changes were
done to support the lowering of control-flow syntax from the front-end
parse trees to the FIR dialect.

This patch is meant to be a reviewable size. The functionality it
provides will be used by code yet to be upstreamed in lowering.

review comments:

[review D80449][NFC] make PFT ParentVariant a ReferenceVariant

ReferenceVariant had to be slightly updated to also support
non constant references (which is required for ParentType).

[review D80449] extend Variable implementation beyond a comment

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from Instrumentation
Christopher Tetreault [Fri, 29 May 2020 22:14:48 +0000 (15:14 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from Instrumentation

Reviewers: efriedma, fpetrogalli, kmclaughlin

Reviewed By: fpetrogalli

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

Tags: #llvm

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

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from Utils
Christopher Tetreault [Fri, 29 May 2020 21:34:56 +0000 (14:34 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from Utils

Reviewers: efriedma, c-rhodes, sdesmalen, xbolva00

Reviewed By: c-rhodes

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

Tags: #llvm

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

4 years ago[mlir][Affine] Minor clean-up of D79829
Diego Caballero [Fri, 29 May 2020 21:31:03 +0000 (14:31 -0700)]
[mlir][Affine] Minor clean-up of D79829

Addressing D79829 post-commit comments. Minor changes.

Reviewed By: rriddle

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

4 years ago[ELF] Add -z rel and -z rela
Fangrui Song [Fri, 29 May 2020 21:22:03 +0000 (14:22 -0700)]
[ELF] Add -z rel and -z rela

LLD supports both REL and RELA for static relocations, but emits either
of REL and RELA for dynamic relocations. The relocation entry format is
specified by each psABI.

musl ld.so supports both REL and RELA. For such ld.so implementations,
REL (.rel.dyn .rel.plt) has size benefits even if the psABI chooses RELA:
sizeof(Elf64_Rel)=16 < sizeof(Elf64_Rela)=24.

* COPY, GLOB_DAT and J[U]MP_SLOT always have 0 addend. A ld.so
  implementation does not need to read the implicit addend.
  REL is strictly better.
* A RELATIVE has a non-zero addend. Such relocations can be packed
  compactly with the RELR relocation entry format, which is out of scope
  of this patch.
* For other dynamic relocation types (e.g. symbolic relocation R_X86_64_64),
  a ld.so implementation needs to read the implicit addend. REL may have
  minor performance impact, because reading implicit addends forces
  random access reads instead of being able to blast out a bunch of
  writes while chasing the relocation array.

This patch adds -z rel and -z rela to change the relocation entry format
for dynamic relocations. I have tested that a -z rel produced x86-64
executable works with musl ld.so

-z rela may be useful for debugging purposes on processors whose psABIs
specify REL as the canonical format: addends can be easily read by a tool.

Reviewed By: grimar, mcgrathr

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

4 years ago[CMake] Change target 'check' from 'check-llvm' to 'check-all'
Fangrui Song [Fri, 29 May 2020 18:16:23 +0000 (11:16 -0700)]
[CMake] Change target 'check' from 'check-llvm' to 'check-all'

Reviewed By: echristo, mehdi_amini

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

4 years ago[lldb/Test] Don't leak forked processes on Darwin
Jonas Devlieghere [Fri, 29 May 2020 20:56:44 +0000 (13:56 -0700)]
[lldb/Test] Don't leak forked processes on Darwin

We are leaking forked processes on macOS because the cleanup function
was checking the existence of /proc/pid which does not exist on macOS.
I've changed the code to be platform agnostic.

4 years agoRevert "Process gep (phi ptr1, ptr2) in SROA"
Stanislav Mekhanoshin [Fri, 29 May 2020 20:49:38 +0000 (13:49 -0700)]
Revert "Process gep (phi ptr1, ptr2) in SROA"

This reverts commit f66a43c11a7899d5c578b80d7f154abcea3b8d8e.

4 years agoAMDGPU/GlobalISel: Add boilerplate for inline asm lowering
Matt Arsenault [Fri, 29 May 2020 20:28:22 +0000 (16:28 -0400)]
AMDGPU/GlobalISel: Add boilerplate for inline asm lowering

Test mostly from minor adjustments to the AArch64 one.

4 years ago[DebugInfo][DAG] Don't reuse debug location on COPY if width changes.
Tobias Bosch [Thu, 28 May 2020 22:40:43 +0000 (15:40 -0700)]
[DebugInfo][DAG] Don't reuse debug location on COPY if width changes.

Summary:
This caused incorrect debug information for parameters:
Previously, after a COPY of a parameter that changes the width,
we would emit a DBG_VALUE that continues to be associated to that
parameter, even though it now used a different width.
This made the LiveDebugValues pass assume the parameter value
got clobbered and it stopped tracking the parameter entry
value, leading to incorrect debug information.

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

Subscribers: aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years agoProcess gep (phi ptr1, ptr2) in SROA
Stanislav Mekhanoshin [Thu, 30 Apr 2020 23:53:13 +0000 (16:53 -0700)]
Process gep (phi ptr1, ptr2) in SROA

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

4 years ago[Matrix] Implement + and - operators for MatrixType.
Florian Hahn [Fri, 29 May 2020 19:42:22 +0000 (20:42 +0100)]
[Matrix] Implement + and - operators for MatrixType.

This patch implements the + and - binary operators for values of
MatrixType. It adds support for matrix +/- matrix, scalar +/- matrix and
matrix +/- scalar.

For the matrix, matrix case, the types must initially be structurally
equivalent. For the scalar,matrix variants, the element type of the
matrix must match the scalar type.

Reviewers: rjmccall, anemet, Bigcheese, rsmith, martong

Reviewed By: rjmccall

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

4 years ago[ASTMatchers] Matchers related to C++ inheritance
Jan Korous [Wed, 29 Apr 2020 03:00:49 +0000 (20:00 -0700)]
[ASTMatchers] Matchers related to C++ inheritance

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

4 years agoAdd NoMerge MIFlag to avoid MIR branch folding
Zequan Wu [Fri, 29 May 2020 19:15:07 +0000 (12:15 -0700)]
Add NoMerge MIFlag to avoid MIR branch folding

Let the codegen recognized the nomerge attribute and disable branch folding when the attribute is given

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

4 years ago[clang-format] Create a python documentation tool to generate a summary of the clang...
paul_hoad [Fri, 29 May 2020 19:25:12 +0000 (20:25 +0100)]
[clang-format] Create a python documentation tool to generate a summary of the clang-format status for the whole of the LLVM project

Summary:
Any change to clang-format is tested with the unit tests, However sometimes the better approach is to run it over a very large fully formatted source tree and then inspect the differences. This seems to be a source of many of the regressions found by @krasimir  and by @sylvestre.ledru and @Abpostelnicu who run it over the Mozilla sources, but often these regressions are only found after changes have been committed.

LLVM itself would be a good dog-fooding candidate for similar tests except such a large proportion of the tree is not 100% clang formatted, as such you are never aware if the change comes from a change to clang-format or  just because the tree has not been formatted first.

The following review is for a small python tool which scans the whole of the LLVM source tree and counts the number of files which have one or more clang-format violations.

This revision contains the tool and the output from the initial run of the tool and the generated documentation which looks like the following

Reviewers: krasimir, JakeMerdichAMD, sammccall, curdeius, bollu, alexshap, jdoerfert, DavidTruby, sscalpone

Reviewed By: curdeius

Subscribers: dschuff, aheejin, fedor.sergeev, ilya-biryukov, simoncook, cryptoad, arphaman, jfb, kadircet, mstorsjo, s.egerton, usaxena95, aartbik, phosek, sstefan1, cfe-commits, sylvestre.ledru, Abpostelnicu, krasimir

Tags: #clang, #clang-format

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

4 years ago[lldb/CMake] Set both the BUILD and INSTALL RPATH on macOS (2/2)
Jonas Devlieghere [Fri, 29 May 2020 17:26:38 +0000 (10:26 -0700)]
[lldb/CMake] Set both the BUILD and INSTALL RPATH on macOS (2/2)

This is also needed for lldb-test.

4 years agoAMDGPU: Remove fp-exceptions feature
Matt Arsenault [Fri, 29 May 2020 18:58:20 +0000 (14:58 -0400)]
AMDGPU: Remove fp-exceptions feature

This was never used, and the only thing it changed was removed in
284472be6da3353d81dfd25b1ac4218e852d1e5f. The floating point mode is
also not a property of the subtarget.

4 years ago[tests] Fix AMDGPU test
Ehud Katz [Fri, 29 May 2020 19:15:26 +0000 (22:15 +0300)]
[tests] Fix AMDGPU test

Fix naming issue in test due to change D80399.

4 years ago[AMDGPU] Regenrated urem/udiv global isel tests. NFC.
Stanislav Mekhanoshin [Fri, 29 May 2020 19:08:47 +0000 (12:08 -0700)]
[AMDGPU] Regenrated urem/udiv global isel tests. NFC.

4 years ago[mlir][Linalg] Make contraction vectorization use vector transfers
Nicolas Vasilache [Fri, 29 May 2020 17:09:55 +0000 (13:09 -0400)]
[mlir][Linalg] Make contraction vectorization use vector transfers

This revision replaces the load + vector.type_cast by appropriate vector transfer
operations. These play more nicely with other vector abstractions and canonicalization
patterns and lower to load/store with or without masks when appropriate.

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

4 years ago[DWARF5] Replace emission of strp with stx forms in debug_macro section
Sourabh Singh Tomar [Fri, 29 May 2020 18:52:40 +0000 (00:22 +0530)]
[DWARF5] Replace emission of strp with stx forms in debug_macro section

DW_MACRO_define_strx forms are supported now in llvm-dwarfdump and these
forms can be used in both debug_macro[.dwo] sections. An added advantage
for using strx forms over strp forms is that it uses indices
approach instead of a relocation to debug_str section.

This patch unify the emission for debug_macro section.

Reviewed by: dblaikie, ikudrin

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

4 years ago[DWARF5] Added support for .debug_macro.dwo section in llvm-dwarfdump
Sourabh Singh Tomar [Fri, 29 May 2020 18:27:35 +0000 (23:57 +0530)]
[DWARF5] Added support for .debug_macro.dwo section in llvm-dwarfdump

This patch extends the parsing and dumping support of llvm-dwarfdump
for debug_macro.dwo section.

Following forms are supported:

 - DW_MACRO_define
 - DW_MACRO_undef
 - DW_MACRO_start_file
 - DW_MACRO_end_file
 - DW_MACRO_define_strx
 - DW_MACRO_undef_strx
 - DW_MACRO_define_strp
 - DW_MACRO_undef_strp

Reviewed by: ikudrin, dblaikie

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

4 years ago[SVE] Eliminate calls to default-false VectorType::get() from Vectorize
Christopher Tetreault [Fri, 29 May 2020 17:06:26 +0000 (10:06 -0700)]
[SVE] Eliminate calls to default-false VectorType::get() from Vectorize

Reviewers: efriedma, c-rhodes, david-arm, fhahn

Reviewed By: david-arm

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

Tags: #llvm

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

4 years ago[Local] Prevent `invertCondition` from creating a redundant instruction
Ehud Katz [Fri, 29 May 2020 18:07:48 +0000 (21:07 +0300)]
[Local] Prevent `invertCondition` from creating a redundant instruction

Prevent `invertCondition` from creating the inversion instruction, in
case the given value is an argument which has already been inverted.
Note that this approach has already been taken in case the given value
is an instruction (and not an argument).

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

4 years agoAdd support for Overloaded Binary Operators in SyntaxTree
Eduardo Caldas [Fri, 29 May 2020 18:03:58 +0000 (20:03 +0200)]
Add support for Overloaded Binary Operators in SyntaxTree

Reviewers: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[WebAssembly] Add placeholders for R_WASM_TABLE_INDEX_REL_SLEB relocations
Sam Clegg [Fri, 29 May 2020 01:39:27 +0000 (18:39 -0700)]
[WebAssembly] Add placeholders for R_WASM_TABLE_INDEX_REL_SLEB relocations

Previously in the object format we punted on this and simply wrote
zeros (and didn't include the function in the elem segment).  With
this change we write a meaningful value which is the segment
relative table index of the associated function.

This matches the that wasm-ld produces in `-r` mode.  This inconsistency
between the output the MC object writer and the wasm-ld object
writer could cause warnings to be emitted when reading back in the
output of `wasm-ld -r`.  See:
https://github.com/emscripten-core/emscripten/issues/11217

This only applies to this one relocation type which is only generated
when compiling in PIC mode.

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

4 years ago[SLP] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 29 May 2020 17:44:52 +0000 (13:44 -0400)]
[SLP] auto-generate complete test checks; NFC

4 years ago[X86] Ignore large code model in X86FastISel::X86MaterializeFP in 32-bit mode
Craig Topper [Fri, 29 May 2020 17:38:21 +0000 (10:38 -0700)]
[X86] Ignore large code model in X86FastISel::X86MaterializeFP in 32-bit mode

Large code model doesn't mean anything to 32-bit mode. But nothing
prevents it from being set. Ignore to avoid generating 64-bit mode
only instructions.

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

4 years ago[SVE] Replace deprecated call in changeVectorElementTypeToInteger
Anna Bulanova [Fri, 29 May 2020 17:09:52 +0000 (13:09 -0400)]
[SVE] Replace deprecated call in changeVectorElementTypeToInteger

Summary:
Replace getVectorNumElements with getVectorElementCount;
gets rid of the warnings in several tests

Reviewers: sdesmalen, kmclaughlin, dancgr, efriedma, each, andwar, rengolin

Reviewed By: efriedma

Subscribers: tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[X86] Remove isel pattern for MMX_X86movdq2q+simple_load. Replace with DAG combine...
Craig Topper [Fri, 29 May 2020 07:15:09 +0000 (00:15 -0700)]
[X86] Remove isel pattern for MMX_X86movdq2q+simple_load. Replace with DAG combine to to loadmmx.

Only 64-bit bits will be loaded, not the whole 128 bits. We can
just combine it to plain mmx load. This has the side effect of
enabling isel load folding for it.

This part of my desire to get rid of isel patterns that shrink loads.

4 years ago[MLIR][OpenMP] Defined master operation in OpenMP Dialect
Anchu Rajendran [Thu, 28 May 2020 05:46:04 +0000 (11:16 +0530)]
[MLIR][OpenMP] Defined master operation in OpenMP Dialect

Summary:
Implemented the basic changes for defining master operation in OpenMP.
It uses the generic parser and printer.

Reviewed By: kiranchandramohan, ftynse

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

4 years ago[PrintSCC] Fix printing a basic-block without a name
Ehud Katz [Fri, 29 May 2020 17:12:44 +0000 (20:12 +0300)]
[PrintSCC] Fix printing a basic-block without a name

Print a basic-block as an operand to handle the case where it has no
name.

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

4 years ago[LoopVectorize] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 29 May 2020 17:13:27 +0000 (13:13 -0400)]
[LoopVectorize] auto-generate complete test checks; NFC