platform/upstream/llvm.git
4 years ago[CVP,SCCP] Precommit test for D75055.
Florian Hahn [Mon, 24 Feb 2020 19:26:18 +0000 (19:26 +0000)]
[CVP,SCCP] Precommit test for D75055.

Test case for PR44949.

4 years agoUse 15 byte long nops on modern Intel processors
Philip Reames [Fri, 13 Mar 2020 17:49:38 +0000 (10:49 -0700)]
Use 15 byte long nops on modern Intel processors

Back in D42616, we switched our default nop length from 15 to 10 bytes because some platforms have painful decode stalls when encountering multiple instruction prefixes. (10 byte long nops come from the fact that prefixes are used to pad after 8 bytes, and some platforms have issues w/more than two prefixes.)

Based on Agner's guides, it appears to be the case that modern Intel (SandyBridge and later) can decode an arbitrary number of prefixes without issue. Intel's guide only provides up to 9 bytes; I read that as providing a safe default for all their chips. Older chips and Atom series have serious decode stalls. I can't find a conclusive reference beyond those two.

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

4 years ago[TableGen] Support combining AssemblerPredicates with ORs
Simon Cook [Fri, 13 Mar 2020 17:13:51 +0000 (17:13 +0000)]
[TableGen] Support combining AssemblerPredicates with ORs

For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).

AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.

To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.

This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html

Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.

At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.

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

4 years ago[lldb/Host] s/FindProcesses/FindProcessesImpl/ in windows/Host.cpp
Jonas Devlieghere [Fri, 13 Mar 2020 17:06:45 +0000 (10:06 -0700)]
[lldb/Host] s/FindProcesses/FindProcessesImpl/ in windows/Host.cpp

Fix the Windows build.

4 years ago[lldb/Test] Temporarily skip TestReproducerAttach on Linux
Jonas Devlieghere [Fri, 13 Mar 2020 17:03:52 +0000 (10:03 -0700)]
[lldb/Test] Temporarily skip TestReproducerAttach on Linux

The test is failing with an unexpected packet during replay. Temporarily
disabling the test while I setup and environment to investigate.

4 years agoRecommit "[SCCP] Use ValueLatticeElement instead of LatticeVal (NFCI)"
Florian Hahn [Fri, 13 Mar 2020 16:40:03 +0000 (16:40 +0000)]
Recommit "[SCCP] Use ValueLatticeElement instead of LatticeVal (NFCI)"

This patch should fix the cause of the stage2 failures and
PR45185.

This reverts the revert commit c52f839e723ee288db2a3e21860b011f6a9d707e.

4 years ago[clang-tidy] Update Abseil Duration Conversion check to find more cases.
Hyrum Wright [Tue, 3 Mar 2020 20:08:03 +0000 (15:08 -0500)]
[clang-tidy] Update Abseil Duration Conversion check to find more cases.

This change improves the check to handle cases with internal scalar
multiplication.

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

4 years ago[CostModel][X86] Improve ISD::CTTZ costs accounting for BSF/TZCNT implementations
Simon Pilgrim [Fri, 13 Mar 2020 16:50:57 +0000 (16:50 +0000)]
[CostModel][X86] Improve ISD::CTTZ costs accounting for BSF/TZCNT implementations

4 years ago[X86] Add cttz/ctlz tests for i686 with CMOV target
Simon Pilgrim [Fri, 13 Mar 2020 16:19:39 +0000 (16:19 +0000)]
[X86] Add cttz/ctlz tests for i686 with CMOV target

4 years ago[lldb/Test] Convert stdout to str by calling decode('utf-8') on it.
Jonas Devlieghere [Fri, 13 Mar 2020 16:49:00 +0000 (09:49 -0700)]
[lldb/Test] Convert stdout to str by calling decode('utf-8') on it.

Make sure both arguments to assertIn are of type str. This should fix
the following error:

TypeError: a bytes-like object is required, not 'str'.

4 years ago[SCEV] Fix usage of invalid IP with FoldingSet
Ehud Katz [Fri, 13 Mar 2020 16:31:47 +0000 (18:31 +0200)]
[SCEV] Fix usage of invalid IP with FoldingSet

Fix the use of invalid Insertion Point pointer with the UniqueSCEVs FoldingSet,
which caused memory corruption.

4 years ago[AssumeBundles] filter usefull attriutes to preserve
Tyker [Fri, 13 Mar 2020 13:35:26 +0000 (14:35 +0100)]
[AssumeBundles] filter usefull attriutes to preserve

Summary:
This patch will filter attributes to only preserve those that are usefull.
In the case of NoAlias it is filtered out not because it isn't usefull
but because it is incorrect to preserve it as it is only valdi for the
duration of the function.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: jdoerfert, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[AssumeBundles] Preserve Information in the inliner
Tyker [Fri, 13 Mar 2020 13:14:55 +0000 (14:14 +0100)]
[AssumeBundles] Preserve Information in the inliner

Summary:
during inling Create and insert an llvm.assume with attributes to preserve them.
to prevent any changes for now generation of llvm.assume is under a flag disabled by default.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Reproducers] Intercept the FindProcesses API
Jonas Devlieghere [Fri, 13 Mar 2020 15:49:15 +0000 (08:49 -0700)]
[lldb/Reproducers] Intercept the FindProcesses API

This patch extends the reproducers to intercept calls to FindProcesses.
During capture it serializes the ProcessInstanceInfoList returned by the
API. During replay, it returns the serialized data instead of querying
the host.

The motivation for this patch is supporting the process attach workflow
during replay. Without this change it would incorrectly look for the
inferior on the host during replay and failing if no matching process
was found.

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

4 years ago[CodeView] Align type records on 4-bytes when emitting PDBs
Alexandre Ganea [Fri, 13 Mar 2020 16:22:09 +0000 (12:22 -0400)]
[CodeView] Align type records on 4-bytes when emitting PDBs

When emitting PDBs, the TypeStreamMerger class is used to merge .debug$T records from the input .OBJ files into the output .PDB stream.
Records in .OBJs are not required to be aligned on 4-bytes, and "The Netwide Assembler 2.14" generates non-aligned records.

When compiling with -DLLVM_ENABLE_ASSERTIONS=ON, an assert was triggered in MergingTypeTableBuilder when non-ghash merging was used.
With ghash merging there was no assert.
As a result, LLD could potentially generate a non-aligned TPI stream.

We now align records on 4-bytes when record indices are remapped, in TypeStreamMerger::remapIndices().

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

4 years ago[Attributor] Detect possibly unbounded cycles in functions
omarahmed1111 [Fri, 13 Mar 2020 15:30:36 +0000 (10:30 -0500)]
[Attributor] Detect possibly unbounded cycles in functions

This patch add mayContainUnboundedCycle helper function which checks whether a function has any cycle which we don't know if it is bounded or not.
Loops with maximum trip count are considered bounded, any other cycle not.
It also contains some fixed tests and some added tests contain bounded and
unbounded loops and non-loop cycles.

Reviewed By: jdoerfert, uenoku, baziotis

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

4 years ago[LLD][ELF][Hexagon] Support GDPLT transforms
Sid Manning [Mon, 10 Feb 2020 23:27:53 +0000 (17:27 -0600)]
[LLD][ELF][Hexagon] Support GDPLT transforms

Hexagon ABI specifies that call x@gdplt is transformed to call __tls_get_addr.

Example:
     call x@gdplt
is changed to
     call __tls_get_addr

When x is an external tls variable.

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

4 years ago[Attributor] Improve noalias preservation using reachability
Pankaj Gode [Fri, 13 Mar 2020 15:39:08 +0000 (21:09 +0530)]
[Attributor] Improve noalias preservation using reachability

Resolution for below fixme:
(ii) Check whether the value is captured in the scope using AANoCapture.
FIXME: This is conservative though, it is better to look at CFG and
             check only uses possibly executed before this callsite.

Propagates caller argument's noalias attribute to callee.

Reviewed by: jdoerfert, uenoku

Reviewers: jdoerfert, sstefan1, uenoku

Subscribers: uenoku, sstefan1, hiraditya, llvm-commits

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

4 years ago[X86] combineExtractWithShuffle - pull out repeated getSizeInBits() call. NFC.
Simon Pilgrim [Fri, 13 Mar 2020 15:35:13 +0000 (15:35 +0000)]
[X86] combineExtractWithShuffle - pull out repeated getSizeInBits() call. NFC.

4 years ago[X86] LowerEXTRACT_VECTOR_ELT - pull out repeated getOperand() calls. NFC.
Simon Pilgrim [Fri, 13 Mar 2020 14:58:16 +0000 (14:58 +0000)]
[X86] LowerEXTRACT_VECTOR_ELT - pull out repeated getOperand() calls. NFC.

Also, cleanup LowerEXTRACT_VECTOR_ELT_SSE4 comments which had references to non-constant extraction indices.

4 years ago[llvm-objdump] --syms: print 'u' for STB_GNU_UNIQUE
Fangrui Song [Sat, 7 Mar 2020 05:00:15 +0000 (21:00 -0800)]
[llvm-objdump] --syms: print 'u' for STB_GNU_UNIQUE

GCC when configured with --enable-gnu-unique (default on glibc>=2.11)
emits STB_GNU_UNIQUE for certain objects which are otherwise emitted as
STT_OBJECT, such as an inline function's static local variable or its
guard variable, and a static data member of a template.

Clang does not implement -fgnu-unique.

Implementing it as a binding is strange and the feature itself is
considered by some as a misfeature.

Reviewed By: grimar, jhenderson

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

4 years ago[llvm-objdump] --syms: print 'i' for STT_GNU_IFUNC
Fangrui Song [Sat, 7 Mar 2020 02:51:39 +0000 (18:51 -0800)]
[llvm-objdump] --syms: print 'i' for STT_GNU_IFUNC

Reviewed By: grimar, Higuoxing, jhenderson

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

4 years ago[llvm-objdump][test] Reorganize ELF --syms tests
Fangrui Song [Sat, 7 Mar 2020 04:22:59 +0000 (20:22 -0800)]
[llvm-objdump][test] Reorganize ELF --syms tests

Merge symbol-table-elf.test and common-symbol-elf.test, and add some
more tests (invalid st_type, STT_COMMON, STT_GNU_IFUNC, STT_HIOS, STT_LOPROC, SHN_UNDEF, SHN_ABS, SHN_COMMON, STB_GNU_UNIQUE, invalid binding, etc) to test/llvm-objdump/ELF/symbol-table.test

The naming follows test/llvm-{readobj,objcopy}/ELF .

Some discrepancy from GNU objdump:

* STT_COMMON: can be produced with `ld.bfd -r -z common`, but it almost never exists in practice
* STT_GNU_IFUNC: will be fixed by D75793
* STB_GNU_UNIQUE: will be fixed by D75797
* STT_TLS: GNU objdump does not print 'O'
* unknown binding: GNU objdump does not print 'g'. This probably does not matter.
* A reserved symbol index is displayed as *ABS* in GNU objdump. It is not clear what we should print.

Reviewed By: grimar

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

4 years ago[CMake] Explicitly specify paths to libc++abi in CrossWinToARMLinux.cmake
Sergej Jaskiewicz [Fri, 13 Mar 2020 14:55:18 +0000 (17:55 +0300)]
[CMake] Explicitly specify paths to libc++abi in CrossWinToARMLinux.cmake

Summary:
D69169, which was necessary for running libc++ tests on remote host, got reverted. I couldn't think of a less invasive way to achieve this behavior but specify libc++abi paths in our cache file.

Reviewers: vvereschaka, aorlov, andreil99, EricWF

Reviewed By: vvereschaka

Subscribers: mgorny, kristof.beyls, ldionne, cfe-commits

Tags: #clang

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

4 years ago[OPENMP]Reduce number of captured global vars.
Alexey Bataev [Thu, 12 Mar 2020 16:52:02 +0000 (12:52 -0400)]
[OPENMP]Reduce number of captured global vars.

Try to reduce the number of global vars captured in the OpenMP regions
by capturing them only the regions, which mark them as not-shared.

4 years agoTableGen: Fix typo
Matt Arsenault [Fri, 14 Feb 2020 02:57:20 +0000 (21:57 -0500)]
TableGen: Fix typo

4 years ago[SimplifyCFG] convert if-else chain to switch; NFC
Sanjay Patel [Fri, 13 Mar 2020 14:27:02 +0000 (10:27 -0400)]
[SimplifyCFG] convert if-else chain to switch; NFC

Fix formatting of related function names while changing the code.

4 years agoRevert "[ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't"
Nico Weber [Fri, 13 Mar 2020 14:06:29 +0000 (10:06 -0400)]
Revert "[ObjC][ARC] Don't remove autoreleaseRV/retainRV pairs if the call isn't"

This reverts commit 1f5b471b8bf4c6d22fb13d8e24bc31c75245b0d0.
Causes asserts when building code with arc. See
https://bugs.chromium.org/p/chromium/issues/detail?id=1061289#c2
for a full repro. Will post a creduced repro once creduce is done
running.

4 years ago[gn build] Port 512767eb3fe
LLVM GN Syncbot [Fri, 13 Mar 2020 14:09:37 +0000 (14:09 +0000)]
[gn build] Port 512767eb3fe

4 years ago[ExpandMemCmp][NFC] Add more tests.
Clement Courbet [Fri, 13 Mar 2020 13:49:54 +0000 (14:49 +0100)]
[ExpandMemCmp][NFC] Add more tests.

4 years agoAdd CppCoreGuidelines I.2 "Avoid non-const global variables" check
Kim Viggedal [Fri, 13 Mar 2020 14:05:13 +0000 (10:05 -0400)]
Add CppCoreGuidelines I.2 "Avoid non-const global variables" check

Cpp Core Guideline I.2, a.k.a "Avoid non-const global variables"
For detailed documentation, see:
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#i2-avoid-non-const-global-variables

4 years ago[SCEV] Add missing cache queries
Ehud Katz [Fri, 13 Mar 2020 13:32:43 +0000 (15:32 +0200)]
[SCEV] Add missing cache queries

Calculating SCEVs can be cumbersome, and may take very long time (even
hours, for very long expressions). To prevent recalculating expressions
over and over again, we cache them.
This change add cache queries to key positions, to prevent recalculation
of the expressions.

Fix PR43571.

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

4 years ago[AArch64][SVE] Add the @llvm.aarch64.sve.dup.x intrinsic
Andrzej Warzynski [Tue, 10 Mar 2020 09:40:49 +0000 (09:40 +0000)]
[AArch64][SVE] Add the @llvm.aarch64.sve.dup.x intrinsic

Summary:
This intrinsic implements the unpredicated duplication of scalar values
and is mapped to (through ISD::SPLAT_VECTOR):
  * DUP <Zd>.<T>, #<imm>
  * DUP <Zd>.<T>, <R><n|SP>

Reviewed by: sdesmalen

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

4 years ago[Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a compiler...
Alexandre Ganea [Fri, 13 Mar 2020 12:15:20 +0000 (08:15 -0400)]
[Clang][Driver] In -fintegrated-cc1 mode, avoid crashing on exit after a compiler crash

After a crash catched by the CrashRecoveryContext, this patch prevents from accessing dangling pointers in TimerGroup structures before the clang tool exits. Previously, the default TimerGroup had internal linked lists which were still pointing to old Timer or TimerGroup instances, which lived in stack frames released by the CrashRecoveryContext.

Fixes PR45164.

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

4 years ago[HIP] Mark kernels with uniform-work-group-size=true
Yaxun (Sam) Liu [Thu, 12 Mar 2020 16:49:26 +0000 (12:49 -0400)]
[HIP] Mark kernels with uniform-work-group-size=true

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

4 years agoAdded 'const' as suggested by ClangTidy llvm-qualified-auto
Dmitri Gribenko [Fri, 13 Mar 2020 10:49:23 +0000 (11:49 +0100)]
Added 'const' as suggested by ClangTidy llvm-qualified-auto

4 years ago[ARM] Optimise ASRL/LSRL to smaller shifts using demand bits.
David Green [Fri, 13 Mar 2020 09:04:50 +0000 (09:04 +0000)]
[ARM] Optimise ASRL/LSRL to smaller shifts using demand bits.

The ASRL/LSRL long shifts are generated from 64bit shifts. Once we have
them, it might turn out that enough of the 64bit result was not required
that we can use a smaller shift to perform the same result. As the
smaller shift can in general be folded in more way, such as into add
instructions in one of the test cases here, we can use the demand bit
analysis to prefer the smaller shifts where we can.

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

4 years ago[gn build] (manually) port ce79c4246
Nico Weber [Fri, 13 Mar 2020 10:08:16 +0000 (06:08 -0400)]
[gn build] (manually) port ce79c4246

4 years ago[yaml2obj][obj2yaml][test] - Add base tests for relocation addends.
Georgii Rymar [Mon, 2 Mar 2020 16:59:11 +0000 (19:59 +0300)]
[yaml2obj][obj2yaml][test] - Add base tests for relocation addends.

We had no test for `Addend` field of a relocation. Though the
current behavior is not ideal and might need to be fixed.

This patch adds 2 test cases to document the current
behavior and add a few FIXMEs. These FIXME are fixed in the
follow-up: https://reviews.llvm.org/D75527

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

4 years agoRefactor SourceLocationTest to `using namespace`
Marcel Hlopko [Fri, 13 Mar 2020 09:54:18 +0000 (10:54 +0100)]
Refactor SourceLocationTest to `using namespace`

Summary: Only for the readability reasons.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[Sema] Fix location of star ('*') inside MemberPointerTypeLoc
Marcel Hlopko [Fri, 13 Mar 2020 09:47:37 +0000 (10:47 +0100)]
[Sema] Fix location of star ('*') inside MemberPointerTypeLoc

Summary: Copy of https://reviews.llvm.org/D72073?id=235842, submitting with ilya-biryukov's permission.

Reviewers: gribozavr, gribozavr2

Reviewed By: gribozavr2

Subscribers: mgorny, gribozavr2, cfe-commits

Tags: #clang

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

4 years agoModernize DeclTest
Marcel Hlopko [Fri, 13 Mar 2020 09:37:35 +0000 (10:37 +0100)]
Modernize DeclTest

Summary:
This patch removes a call to the old ASTUnit::findFileRegionDecls and
replaces it with ast matchers.

Reviewers: gribozavr, gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[ARM] Constant long shift combines
David Green [Thu, 12 Mar 2020 19:40:27 +0000 (19:40 +0000)]
[ARM] Constant long shift combines

This changes the way that asrl and lsrl intrinsics are lowered, going
via a the ISEL ASRL and LSLL nodes instead of straight to machine nodes.
On top of that, it adds some constant folds for long shifts, in case it
turns out that the shift amount was either constant or 0.

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

4 years ago[clangd] Populate PreambleData::CompileCommand and make use of it inside buildPreamble
Kadir Cetinkaya [Wed, 11 Mar 2020 15:34:01 +0000 (16:34 +0100)]
[clangd] Populate PreambleData::CompileCommand and make use of it inside buildPreamble

Reviewers: sammccall

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[CodeGenPrepare] Expand freeze conversion to support fcmp and icmp with null
Juneyoung Lee [Thu, 12 Mar 2020 07:34:43 +0000 (16:34 +0900)]
[CodeGenPrepare] Expand freeze conversion to support fcmp and icmp with null

Summary:
This is a simple patch that expands https://reviews.llvm.org/D75859 to pointer comparison and fcmp

Checked with Alive2

Reviewers: reames, jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libunwind] Silence warnings when __mips_hard_float is not defined
Mikael Holmen [Fri, 13 Mar 2020 08:18:33 +0000 (09:18 +0100)]
[libunwind] Silence warnings when __mips_hard_float is not defined

The warnings started showing up for me with c53c2058ffb8 which builds
Registers.hpp.

4 years agoAdd tests to Transforms/CodeGenPrepare/X86/freeze-cmp.ll before commiting D76048
Juneyoung Lee [Fri, 13 Mar 2020 08:18:42 +0000 (17:18 +0900)]
Add tests to Transforms/CodeGenPrepare/X86/freeze-cmp.ll before commiting D76048

4 years ago[PowerPC] Replace the PPCISD:: SExtVElems with ISD::SIGN_EXTEND_INREG to leverage...
QingShan Zhang [Fri, 13 Mar 2020 07:25:55 +0000 (07:25 +0000)]
[PowerPC] Replace the PPCISD:: SExtVElems with ISD::SIGN_EXTEND_INREG to leverage the combine rules

The PPCISD::SExtVElems was added by commit https://reviews.llvm.org/D34009. However,
we have another ISD node ISD::SIGN_EXTEND_INREG that perfectly match the semantics
of SExtVElems. And the DAGCombiner has some combine rules for SIGN_EXTEND_INREG
that produce better code.

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

4 years ago[X86] Add isel patterns for X86VBroadcast with i16 truncates from i16->i64 zextload...
Craig Topper [Fri, 13 Mar 2020 06:40:04 +0000 (23:40 -0700)]
[X86] Add isel patterns for X86VBroadcast with i16 truncates from i16->i64 zextload/extload.

We can form vpbroadcastw with a folded load.

We had patterns for i16->i32 zextload/extload, but nothing prevents
i64 from occuring.

I'd like to move this all to DAG combine to fix more cases, but
this is trivial fix to minimize test diffs when moving to a combine.

4 years ago[X86] Add test cases for failures to form vbroadcastw due to isTypeDesirableForOp...
Craig Topper [Fri, 13 Mar 2020 06:07:06 +0000 (23:07 -0700)]
[X86] Add test cases for failures to form vbroadcastw due to isTypeDesirableForOp preventing load shrinking to i16.

These are based on existing test cases but use i64 instead of i32.
Some of these end up with i64 zextload/extloads from i16 that we
don't have isel patterns for.

Some of the other cases fail because isTypeDesirableForOp prevents
shrinking the (trunc (i64 (srl (load)))) directly. So we try
to shrink based on the (i64 (srl (load))) but we need 64 - shift_amount
to be a power of 2 to do that shrink.

4 years ago[Attributor] IPO across definition boundary of a function marked alwaysinline
Johannes Doerfert [Fri, 13 Mar 2020 05:32:38 +0000 (00:32 -0500)]
[Attributor] IPO across definition boundary of a function marked alwaysinline

Reviewed By: jdoerfert

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

4 years agoRevert "[Attributor] Enable test with update check lines"
Johannes Doerfert [Fri, 13 Mar 2020 05:59:02 +0000 (00:59 -0500)]
Revert "[Attributor] Enable test with update check lines"

This reverts commit 13def55b3f86543871cc6f5c2ec893dc3e0b45fa.

This broke a buildbot, will investigate.

4 years ago[ELF] Correct error message when OUTPUT_FORMAT is used
Shoaib Meenai [Thu, 12 Mar 2020 22:25:36 +0000 (15:25 -0700)]
[ELF] Correct error message when OUTPUT_FORMAT is used

Any OUTPUT_FORMAT in a linker script overrides the emulation passed on
the command line, so record the passed bfdname and use that in the error
message about incompatible input files.

This prevents confusing error messages. For example, if you explicitly
pass `-m elf_x86_64` to LLD but accidentally include a linker script
which sets `OUTPUT_FORMAT(elf32-i386)`, LLD would previously complain
about your input files being compatible with elf_x86_64, which isn't the
actual issue, and is confusing because the input files are in fact
x86-64 ELF files.

Interestingly enough, this also prevents a segfault! When we don't pass
`-m` and we have an object file which is incompatible with the
`OUTPUT_FORMAT` set by a linker script, the object file is checked for
compatibility before it's added to the objectFiles vector.
config->emulation, objectFiles, and sharedFiles will all be empty, so
we'll attempt to access bitcodeFiles[0], but bitcodeFiles is also empty,
so we'll segfault. This commit prevents the segfault by adding
OUTPUT_FORMAT as a possible source of machine configuration, and it also
adds an llvm_unreachable to diagnose similar issues in the future.

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

4 years ago[PowerPC][NFC] Rename instruction formats in PPCInstrPrefix.td
Amy Kwan [Fri, 13 Mar 2020 05:23:59 +0000 (00:23 -0500)]
[PowerPC][NFC] Rename instruction formats in PPCInstrPrefix.td

This patch renames some of the instruction formats within PPCInstrPrefix.td to
adopt a more uniform naming convention. It also adds the naming convention
extension, `_MEM` to indicate instruction formats for memory ops.

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

4 years agoincorporate feedback from River.
Chris Lattner [Fri, 13 Mar 2020 05:26:44 +0000 (22:26 -0700)]
incorporate feedback from River.

4 years agoTeach the MLIR AsmPrinter to correctly escape asm names that use invalid characters.
Chris Lattner [Tue, 10 Mar 2020 13:24:11 +0000 (06:24 -0700)]
Teach the MLIR AsmPrinter to correctly escape asm names that use invalid characters.

Reviewers: rriddle!

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

Tags: #llvm

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

4 years ago[OpenMP][Opt][NFC] Add test case for known runtime function attributes
Johannes Doerfert [Fri, 13 Mar 2020 05:27:46 +0000 (00:27 -0500)]
[OpenMP][Opt][NFC] Add test case for known runtime function attributes

This test somehow did not make it in before.

4 years agoFix compiler warning when compiling without asserts
rathod-sahaab [Fri, 13 Mar 2020 05:24:38 +0000 (00:24 -0500)]
Fix compiler warning when compiling without asserts

This patch aims to prevent warning-as-error failures in release build.
As suggested in this comment
https://reviews.llvm.org/D69930#1910922

Reviewed By: jdoerfert

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

4 years ago[AVR] Include AVR by default in LLVM builds
Dylan McKay [Thu, 12 Mar 2020 06:07:01 +0000 (19:07 +1300)]
[AVR] Include AVR by default in LLVM builds

This was initially committed and promptly reverted in 9059056e273ccc3a236751609e498b4c401eb6ff
after a MSan failure was found by the sanitizer bots.

These have since been fixed.

Summary:
This patch makes the AVR backend an official target of LLVM, serving
as a request for comments for moving the AVR backend out of
experimental.

A future patch will move the LLVM AVR buildbot (llvm-avr-linux) from the
staging buildmaster to the production buildmaster, so error emails will
start to go out.

Summary of the backend
----------------------

  - 16-bit little endian
  - AsmParser based assembly parser
  - uses the MC library for generating AVR ELFs
  - most logic driven from standard TableGen-erated tables like other
    backends
  - passes all of the test suite under `check-all`, including generic
    CodeGen and DebugInfo tests
  - Used in two frontends
  - Limited, but functional support for DebugInfo and LLVM DWARF dumping
  - Binary compatible with AVR-GCC and avr-{libc,libgcc} for the most part
  - Cannot lower 32-bit shifts due to a bug, can lower shifts larger or
    smaller
  - Supports assembly/MC for all the entire AVR ISA, generally generates poorly
    optimized machine instructions, with most focus thus far on correctness

I've added reviewers and subscribers from previous patches where backends were made official,
and those who participated in the recent thread on llvm-dev, please add anybody I've missed.

The most recent discussion on this topic can be found in the llvm-dev thread [Moving the AVR backend out of experimental](https://lists.llvm.org/pipermail/llvm-dev/2020-February/139158.html)

Reviewers: chandlerc, lattner, rengolin, tstellar, arsenm, thakis, simoll, asb

Reviewed By: rengolin, thakis

Subscribers: CryZe, wdng, mgorny, aprantl, Jim, hans, aykevl, llvm-commits

Tags: #llvm

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

4 years agoopenmp: fix memcpy memory leak
Tom Scogland [Thu, 12 Mar 2020 22:43:57 +0000 (17:43 -0500)]
openmp: fix memcpy memory leak

Reviewed By: jdoerfert

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

4 years ago[Attributor] Enable test with update check lines
Johannes Doerfert [Fri, 21 Feb 2020 23:09:40 +0000 (15:09 -0800)]
[Attributor] Enable test with update check lines

The test disabled in 528a6a1d4cceda58d57c28a75a524dcdd8d35f3e is enabled
again with the check lines for 9708279c725a515c69c41130aaaa36dc6a0b34d8.

4 years ago[mlir][spirv] Remove unnecessary friend class declaration
Lei Zhang [Fri, 13 Mar 2020 02:52:16 +0000 (22:52 -0400)]
[mlir][spirv] Remove unnecessary friend class declaration

4 years ago[NFC][DAGCombine] Move the fold of a*b-c and a-b*c into lambda function
QingShan Zhang [Fri, 13 Mar 2020 02:30:08 +0000 (02:30 +0000)]
[NFC][DAGCombine] Move the fold of a*b-c and a-b*c into lambda function

This will help the review of https://reviews.llvm.org/D75982. It is
a simple code refactor.

4 years agoAdd support for XFAILing a test based on a setting.
Adrian Prantl [Fri, 13 Mar 2020 02:25:38 +0000 (19:25 -0700)]
Add support for XFAILing a test based on a setting.

This is analogous to the skipping mechanism introduced in
https://reviews.llvm.org/D75864

4 years ago[mlir][NFC] Removed unnecessary StandardOp includes
Rob Suderman [Fri, 13 Mar 2020 01:26:40 +0000 (18:26 -0700)]
[mlir][NFC] Removed unnecessary StandardOp includes

Summary: A number of transform import StandardOps despite not being dependent on it. Cleaned it up to better understand what dialects each of these transforms depend on.

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

4 years agoOnly run frameheader_cache_test.pass.cpp on x86_64.
Sterling Augustine [Fri, 13 Mar 2020 01:12:52 +0000 (18:12 -0700)]
Only run frameheader_cache_test.pass.cpp on x86_64.

Although there is nothing architecturally specific, the
ifdef chains are too complicated otherwise.

4 years agoRevert "Update system_error tests for more platforms."
Dan Albert [Fri, 13 Mar 2020 01:09:44 +0000 (18:09 -0700)]
Revert "Update system_error tests for more platforms."

Can't use std::string::starts_with in tests.

This reverts commit a9740ff1585a10b9df4296a735512df3e0ff9df5.

4 years agoConvert settings list into a tuple so it can be matched by the decorator.
Adrian Prantl [Fri, 13 Mar 2020 00:47:27 +0000 (17:47 -0700)]
Convert settings list into a tuple so it can be matched by the decorator.

4 years agoUpdate system_error tests for more platforms.
Dan Albert [Fri, 13 Mar 2020 00:34:55 +0000 (17:34 -0700)]
Update system_error tests for more platforms.

Reviewers: EricWF, mclow.lists, #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, libcxx-commits, cfe-commits

Tags: #libc

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

4 years ago[msan] Fix srcaddr handling in recvfrom interceptor.
Evgenii Stepanov [Fri, 13 Mar 2020 00:26:56 +0000 (17:26 -0700)]
[msan] Fix srcaddr handling in recvfrom interceptor.

Recvfrom may receive a 0 byte packet with a non-empty source address.

4 years agoMove more tests to globalMemCounter and reset.
Dan Albert [Thu, 12 Mar 2020 23:55:13 +0000 (16:55 -0700)]
Move more tests to globalMemCounter and reset.

Summary:
Android's libc uses new/delete internally and these are counted, so
the counter needs to be reset to zero at the start of the test.

Reviewers: EricWF, mclow.lists, #libc, ldionne

Reviewed By: #libc, ldionne

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

4 years ago[ELF] --gdb-index: fix memory usage regression after D74773
Fangrui Song [Thu, 12 Mar 2020 23:44:47 +0000 (16:44 -0700)]
[ELF] --gdb-index: fix memory usage regression after D74773

On an internal target,

* Before D74773: time -f '%M' => 18275680
* After D74773:  time -f '%M' => 22088964

This patch restores to the status before D74773.

4 years ago[lldb] Remove unused and too strict error_msg parameter from expect_expr
Raphael Isemann [Thu, 12 Mar 2020 23:39:32 +0000 (00:39 +0100)]
[lldb] Remove unused and too strict error_msg parameter from expect_expr

Directly matching the error message is nearly never useful. We can re-add
error-checking once we have a plan to properly implement this.

4 years agoAdd a test triple to avoid failure under MS ABI.
Richard Smith [Thu, 12 Mar 2020 23:43:01 +0000 (16:43 -0700)]
Add a test triple to avoid failure under MS ABI.

MS ABI has slightly different rules for when destructors are implicitly
defined and when the 'delete this' is checked that are out of scope for
the intent of this test.

4 years ago[mlir][spirv] Support querying type extension/capability requirements
Lei Zhang [Wed, 11 Mar 2020 20:06:07 +0000 (16:06 -0400)]
[mlir][spirv] Support querying type extension/capability requirements

Previously we only consider the version/capability/extension requirements
on ops themselves. Some types in SPIR-V also require special extensions
or capabilities to be used. For example, non-32-bit integers/floats
will require different capabilities and/or extensions depending on
where they are used because it may mean special hardware abilities.

This commit adds query methods to SPIR-V type class hierarchy to support
querying extensions and capabilities. We don't go through ODS for
auto-generating such information given that we don't have them in
SPIR-V machine readable grammar and there are just a few types.

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

4 years ago[mlir][spirv] Use SmallVector<ArrayRef> for availability queries
Lei Zhang [Wed, 11 Mar 2020 20:05:21 +0000 (16:05 -0400)]
[mlir][spirv] Use SmallVector<ArrayRef> for availability queries

Previously extensions and capabilities requirements are returned as
SmallVector<SmallVector>. It's an anti-pattern; this commit improves
a bit by returning as SmallVector<ArrayRef>. This is possible because
the internal sequence is always known statically (from the spec)
so that we can use a static constant array for it and get an ArrayRef.

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

4 years ago[mlir][spirv] Use spv.vce in spv.module and wire up (de)serialization
Lei Zhang [Wed, 11 Mar 2020 20:04:25 +0000 (16:04 -0400)]
[mlir][spirv] Use spv.vce in spv.module and wire up (de)serialization

This commits changes the definition of spv.module to use the #spv.vce
attribute for specifying (version, capabilities, extensions) triple
so that we can have better API and custom assembly form. Since now
we have proper modelling of the triple, (de)serialization is wired up
to use them.

With the new UpdateVCEPass, we don't need to manually specify the
required extensions and capabilities anymore when creating a spv.module.
One just need to call UpdateVCEPass before serialization to get the
needed version/extensions/capabilities.

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

4 years ago[mlir][spirv] NFC: put SPIR-V attributes in separate files
Lei Zhang [Wed, 11 Mar 2020 20:03:43 +0000 (16:03 -0400)]
[mlir][spirv] NFC: put SPIR-V attributes in separate files

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

4 years ago[mlir][spirv] Add a pass to deduce version/extension/capability
Lei Zhang [Wed, 11 Mar 2020 20:03:20 +0000 (16:03 -0400)]
[mlir][spirv] Add a pass to deduce version/extension/capability

Creates an operation pass that deduces and attaches the minimal version/
capabilities/extensions requirements for spv.module ops.

For each spv.module op, this pass requires a `spv.target_env` attribute on
it or an enclosing module-like op to drive the deduction. The reason is
that an op can be enabled by multiple extensions/capabilities. So we need
to know which one to pick. `spv.target_env` gives the hard limit as for
what the target environment can support; this pass deduces what are
actually needed for a specific spv.module op.

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

4 years ago[mlir][spirv] Use larger range for target environment lookup function
Lei Zhang [Wed, 11 Mar 2020 20:02:56 +0000 (16:02 -0400)]
[mlir][spirv] Use larger range for target environment lookup function

Previously we only look at the directly passed-in op for a potential
spv.target_env attribute. This commit switches to use a larger range
and recursively check enclosing symbol tables.

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

4 years ago[mlir][spirv] Use separate attribute for (version, capabilities, extensions)
Lei Zhang [Wed, 11 Mar 2020 20:02:46 +0000 (16:02 -0400)]
[mlir][spirv] Use separate attribute for (version, capabilities, extensions)

We also need the (version, capabilities, extensions) triple on the
spv.module op. Thus far we have been using separate 'extensions'
and 'capabilities' attributes there and 'version' is missing. Creating
a separate attribute for the trip allows us to reuse the assembly
form and verification.

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

4 years ago[mlir] Remove unused generator
Jacques Pienaar [Thu, 12 Mar 2020 23:32:21 +0000 (16:32 -0700)]
[mlir] Remove unused generator

This was a previous experiment that didn't pan out and needs to be
replaced, given no current use or tests, deleting instead and can start
new version fresh.

4 years agoAdd support for SHA256 source file checksums in debug info
Arlo Siemsen [Thu, 12 Mar 2020 23:25:01 +0000 (16:25 -0700)]
Add support for SHA256 source file checksums in debug info

LLVM currently supports CSK_MD5 and CSK_SHA1 source file checksums in
debug info. This change adds support for CSK_SHA256 checksums.

The SHA256 checksums are supported by the CodeView debug format.

Reviewed By: aprantl

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

4 years ago[gn build] (manually) port eb41cc619866e
Nico Weber [Thu, 12 Mar 2020 23:29:09 +0000 (19:29 -0400)]
[gn build] (manually) port eb41cc619866e

4 years agoCFGDiff: Fix one place where I'd left BasicBlock* hardcoded
David Blaikie [Thu, 12 Mar 2020 23:17:43 +0000 (16:17 -0700)]
CFGDiff: Fix one place where I'd left BasicBlock* hardcoded

4 years ago[ConstantFold][SVE] Fix constant folding for scalable vector compare instruction.
Huihui Zhang [Thu, 12 Mar 2020 22:59:14 +0000 (15:59 -0700)]
[ConstantFold][SVE] Fix constant folding for scalable vector compare instruction.

Summary:
Do not iterate on scalable vector. Also do not return constant scalable vector
from ConstantInt::get().
Fix result type by using getElementCount() instead of getNumElements().

Reviewers: sdesmalen, efriedma, apazos, huntergr, willlovett

Reviewed By: efriedma

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

Tags: #llvm

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

4 years agoAMDGPU: Directly annotate functions if they have calls
Matt Arsenault [Wed, 11 Mar 2020 21:12:20 +0000 (17:12 -0400)]
AMDGPU: Directly annotate functions if they have calls

Currently we infer whether the flat-scratch-init kernel input should
be enabled based on calls. Move this handling, so we can decide if the
full set of ABI inputs is needed in kernels. Ideally we would have an
analysis of some sort, rather than the function attributes.

4 years agoCodeGen: Add constexpr to Register constructors
Matt Arsenault [Wed, 11 Mar 2020 22:20:00 +0000 (18:20 -0400)]
CodeGen: Add constexpr to Register constructors

4 years ago[ORC] Enable exception handling in JIT'd code when using LLJIT on Darwin.
Lang Hames [Thu, 12 Mar 2020 21:44:53 +0000 (14:44 -0700)]
[ORC] Enable exception handling in JIT'd code when using LLJIT on Darwin.

This patch enables exception handling in code added to LLJIT on Darwin by
adding an orc::EHFrameRegistrationPlugin instance to the ObjectLinkingLayer
(which is currently used on Darwin only).

4 years ago[ORC] Add a mutex to guard EHFrameRegistrationPlugin data structures.
Lang Hames [Thu, 12 Mar 2020 22:08:30 +0000 (15:08 -0700)]
[ORC] Add a mutex to guard EHFrameRegistrationPlugin data structures.

These may be accessed from multiple threads if concurrent materialization is
enabled in ORC.

Testcase coming in a follow-up patch that enables eh-frame registration for
LLJIT.

4 years ago[lldb/Host] Fix the Windows build
Jonas Devlieghere [Thu, 12 Mar 2020 22:30:34 +0000 (15:30 -0700)]
[lldb/Host] Fix the Windows build

Update use of ProcessInstanceInfoList which is now a std::vector.

4 years ago[libc++abi] NFC: Move AtomicInt to cxa_guard_impl.h
Louis Dionne [Tue, 10 Mar 2020 17:44:33 +0000 (13:44 -0400)]
[libc++abi] NFC: Move AtomicInt to cxa_guard_impl.h

Since the atomic_support.h header of libc++abi is considered technical
debt (since we should use libc++'s), it's better not to add new
definitions to it, which makes it diverge from the original libc++
header even more.

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

4 years ago[clang][Parse] properly parse asm-qualifiers, asm inline
Nick Desaulniers [Thu, 12 Mar 2020 22:13:55 +0000 (15:13 -0700)]
[clang][Parse] properly parse asm-qualifiers, asm inline

Summary:
The parsing of GNU C extended asm statements was a little brittle and
had a few issues:
- It was using Parse::ParseTypeQualifierListOpt to parse the `volatile`
  qualifier.  That parser is really meant for TypeQualifiers; an asm
  statement doesn't really have a type qualifier. This is still maybe
  nice to have, but not necessary. We now can check for the `volatile`
  token by properly expanding the grammer, rather than abusing
  Parse::ParseTypeQualifierListOpt.
- The parsing of `goto` was position dependent, so `asm goto volatile`
  wouldn't parse. The qualifiers should be position independent to one
  another. Now they are.
- We would warn on duplicate `volatile`, but the parse error for
  duplicate `goto` was a generic parse error and wasn't clear.
- We need to add support for the recent GNU C extension `asm inline`.
  Adding support to the parser with the above issues highlighted the
  need for this refactoring.

Link: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: aheejin, jfb, nathanchance, cfe-commits, echristo, efriedma, rsmith, chandlerc, craig.topper, erichkeane, jyu2, void, srhines

Tags: #clang

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

4 years ago[AMDGPU] Simplify exec copies
Stanislav Mekhanoshin [Thu, 12 Mar 2020 18:09:45 +0000 (11:09 -0700)]
[AMDGPU] Simplify exec copies

The patch removes late endcf handling and only leaves the
related portion with redundant exec mask copy elimination.

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

4 years ago[lldb] Add YAML traits for ArchSpec and ProcessInstanceInfo
Jonas Devlieghere [Thu, 12 Mar 2020 21:34:44 +0000 (14:34 -0700)]
[lldb] Add YAML traits for ArchSpec and ProcessInstanceInfo

Add YAML traits for ArchSpec and ProcessInstanceInfo so they can be
serialized for the reproducers.

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

4 years ago[mlir] Use llvm::ElementCount when constructing an llvm splat vector.
River Riddle [Thu, 12 Mar 2020 21:22:00 +0000 (14:22 -0700)]
[mlir] Use llvm::ElementCount when constructing an llvm splat vector.

This fixes a breakage after the LLVM API changed.

4 years ago[mlir][SideEffects] Replace HasNoSideEffect with the memory effect interfaces.
River Riddle [Thu, 12 Mar 2020 21:06:41 +0000 (14:06 -0700)]
[mlir][SideEffects] Replace HasNoSideEffect with the memory effect interfaces.

HasNoSideEffect can now be implemented using the MemoryEffectInterface, removing the need to check multiple things for the same information. This also removes an easy foot-gun for users as 'Operation::hasNoSideEffect' would ignore operations that dynamically, or recursively, have no side effects. This also leads to an immediate improvement in some of the existing users, such as DCE, now that they have access to more information.

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

4 years ago[mlir] Add a new `ConstantLike` trait to better identify operations that represent...
River Riddle [Thu, 12 Mar 2020 21:06:14 +0000 (14:06 -0700)]
[mlir] Add a new `ConstantLike` trait to better identify operations that represent a "constant".

The current mechanism for identifying is a bit hacky and extremely adhoc, i.e. we explicit check 1-result, 0-operand, no side-effect, and always foldable and then assume that this is a constant. Adding a trait adds structure to this, and makes checking for a constant much more efficient as we can guarantee that all of these things have already been verified.

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

4 years ago[mlir][NFC] Move the definition of AffineApplyOp to ODS
River Riddle [Thu, 12 Mar 2020 21:06:01 +0000 (14:06 -0700)]
[mlir][NFC] Move the definition of AffineApplyOp to ODS

This has been a long standing cleanup TODO.

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

4 years ago[mlir][SideEffects][NFC] Move the .td definitions for NoSideEffect/RecursiveSideEffec...
River Riddle [Thu, 12 Mar 2020 21:05:41 +0000 (14:05 -0700)]
[mlir][SideEffects][NFC] Move the .td definitions for NoSideEffect/RecursiveSideEffect to SideEffects.td

This matches the location of these traits within the source files.

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