platform/upstream/llvm.git
4 years agoRevert "[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruc...
Rong Xu [Sat, 25 Jul 2020 00:35:44 +0000 (17:35 -0700)]
Revert "[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction"

This reverts commit 6fdc6f6c7d34af60c45c405f448370a684ef6f2a.

4 years agoRevert "[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruc...
Rong Xu [Sat, 25 Jul 2020 00:33:49 +0000 (17:33 -0700)]
Revert "[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction"

This reverts commit 867ef4472d8e57384c929e4f06b74d1ac8883a99.

4 years ago[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction
Rong Xu [Sat, 25 Jul 2020 00:16:25 +0000 (17:16 -0700)]
[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction

Forgot including the tests in the commit 6fdc6f6c7d34af60c4.

4 years ago[PowerPC] Implement Truncate and Store VSX Vector Builtins
Amy Kwan [Fri, 24 Jul 2020 22:41:50 +0000 (17:41 -0500)]
[PowerPC] Implement Truncate and Store VSX Vector Builtins

This patch implements the `vec_xst_trunc` function in altivec.h in  order to
utilize the Store VSX Vector Rightmost [byte | half | word | doubleword] Indexed
instructions introduced in Power10.

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

4 years ago[AArch64][GlobalISel] Use wzr/xzr for 16 and 32 bit stores of zero
Jessica Paquette [Fri, 24 Jul 2020 23:57:37 +0000 (16:57 -0700)]
[AArch64][GlobalISel] Use wzr/xzr for 16 and 32 bit stores of zero

We weren't performing this optimization on 16 and 32 bit stores. SDAG happily
does this though.

e.g. https://godbolt.org/z/cWocKr

This saves about 0.2% in code size on CTMark at -O3.

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

4 years ago[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction
Rong Xu [Sat, 25 Jul 2020 00:13:58 +0000 (17:13 -0700)]
[PGO][InstrProf] Do not promote count if the exit blocks contains ret instruction

Skip profile count promotion if any of the ExitBlocks contains a ret
instruction. This is to prevent dumping of incomplete profile -- if the
the loop is a long running loop and dump is called in the middle
of the loop, the result profile is incomplete.

ExitBlocks containing a ret instruction is an indication of a long running
loop -- early exit to error handling code.

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

4 years agoGlobalISel: Define mulfix/divfix opcodes
Matt Arsenault [Sun, 19 Jul 2020 17:09:48 +0000 (13:09 -0400)]
GlobalISel: Define mulfix/divfix opcodes

The full expansion involves the funnel shifts, which depend on another
patch to expand those.

4 years ago[AArch64][GlobalISel] Promote G_UITOFP vector operands to same elt size as result.
Amara Emerson [Fri, 24 Jul 2020 23:43:55 +0000 (16:43 -0700)]
[AArch64][GlobalISel] Promote G_UITOFP vector operands to same elt size as result.

Fixes legalization failures.

4 years ago[lldb] Have LanguageRuntime and SystemRuntime share a base class (NFC)
Jonas Devlieghere [Fri, 24 Jul 2020 23:20:55 +0000 (16:20 -0700)]
[lldb] Have LanguageRuntime and SystemRuntime share a base class (NFC)

LangaugeRuntime and SystemRuntime now both inherit from Runtime.

4 years ago[lldb] Don't wrap and release raw pointer in unique_ptr (NFC)
Jonas Devlieghere [Fri, 24 Jul 2020 22:10:05 +0000 (15:10 -0700)]
[lldb] Don't wrap and release raw pointer in unique_ptr (NFC)

4 years ago[lld-macho] Ignore -dependency_info and its argument
Jez Ng [Fri, 24 Jul 2020 22:55:14 +0000 (15:55 -0700)]
[lld-macho] Ignore -dependency_info and its argument

XCode passes in this flag, which we do not yet implement. Skip
over the argument for now so we can at least successfully parse the
linker invocation.

Reviewed By: #lld-macho, compnerd

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

4 years ago[lld-macho] Partial support for weak definitions
Jez Ng [Fri, 24 Jul 2020 22:55:25 +0000 (15:55 -0700)]
[lld-macho] Partial support for weak definitions

This diff adds support for weak definitions, though it doesn't handle weak
symbols in dylibs quite correctly -- we need to emit binding opcodes for them
in the weak binding section rather than the lazy binding section.

What *is* covered in this diff:

1. Reading the weak flag from symbol table / export trie, and writing it to the
   export trie
2. Refining the symbol table's rules for choosing one symbol definition over
   another. Wrote a few dozen test cases to make sure we were matching ld64's
   behavior.

We can now link basic C++ programs.

Reviewed By: #lld-macho, compnerd

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

4 years agoReapply "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."
Alina Sbirlea [Fri, 10 Apr 2020 01:29:40 +0000 (18:29 -0700)]
Reapply "[DomTree] Replace ChildrenGetter with GraphTraits over GraphDiff."

This is the part of the patch that's moving the Updates to a CFGDiff
object. Splitting off from the clean-up work merging the two branches when BUI is null.

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

4 years ago[compiler-rt][CMake] Remove unused -stdlib when passing -nostdinc++
Jinsong Ji [Fri, 24 Jul 2020 20:55:52 +0000 (20:55 +0000)]
[compiler-rt][CMake] Remove unused -stdlib when passing -nostdinc++

We added -nostdinc++ to clang_rt.profile in https://reviews.llvm.org/D84205.
This will cause warnings when building with LLVM_ENABLE_LIBCXX,
and failure if with Werror on.

This patch is to fix it by removing unused -stdlib,
similar to what we have done in https://reviews.llvm.org/D42238.

Reviewed By: phosek

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

4 years ago[compiler-rt][fuzzer] Disable bcmp.test on darwin
Jon Roelofs [Fri, 24 Jul 2020 20:54:17 +0000 (14:54 -0600)]
[compiler-rt][fuzzer] Disable bcmp.test on darwin

It broke one of the buildbots:

http://lab.llvm.org:8080/green/job/clang-stage1-RA/13026/console

4 years agoAMDGPU: Skip other terminators before inserting s_cbranch_exec[n]z
Matt Arsenault [Thu, 23 Jul 2020 01:24:21 +0000 (21:24 -0400)]
AMDGPU: Skip other terminators before inserting s_cbranch_exec[n]z

PHIElimination/createPHISourceCopy inserts non-branch terminators
after the control flow pseudo if a successor phi reads a register
defined by the control flow pseudo. If this happens, we need to split
the expansion of the control flow pseudo to ensure all the branches
are after all of the other mask management instructions.

GlobalISel hit this in testscases that happened to be tail
duplicated. The original testcase still does not work, since the same
problem appears to be present in a later pass.

4 years ago[CMake] Find zlib when building lldb as standalone
Petr Hosek [Fri, 24 Jul 2020 20:36:13 +0000 (13:36 -0700)]
[CMake] Find zlib when building lldb as standalone

This addresses the issue introduced by 10b1b4a.

4 years agoAdd Debug Info Size to Symbol Status
Yifan Shen [Fri, 24 Jul 2020 20:30:04 +0000 (13:30 -0700)]
Add Debug Info Size to Symbol Status

If a module has debug info, the size of debug symbol will be displayed after the Symbols Loaded Message for each module in the VScode modules view.{F12335461}

Reviewed By: wallace, clayborg

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

4 years agoRevert "Add Debug Info Size to Symbol Status"
Walter Erquinigo [Fri, 24 Jul 2020 20:28:29 +0000 (13:28 -0700)]
Revert "Add Debug Info Size to Symbol Status"

This reverts commit 986e3af53bfe591e88a1ae4f82ea1cc0a15819a3.

It incorrectly deleted clang/tools/clang-format/git-clang-format

4 years agoAdd Debug Info Size to Symbol Status
Yifan Shen [Fri, 24 Jul 2020 19:45:41 +0000 (12:45 -0700)]
Add Debug Info Size to Symbol Status

Summary: If a module has debug info, the size of debug symbol will be displayed after the Symbols Loaded Message for each module in the VScode modules view.{F12335461}

Reviewers: wallace, clayborg

Reviewed By: wallace, clayborg

Subscribers: cfe-commits, aprantl, lldb-commits

Tags: #lldb, #clang

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

4 years ago[AArch64][SVE] Add "fast" fcmp operations.
Eli Friedman [Thu, 23 Jul 2020 19:52:46 +0000 (12:52 -0700)]
[AArch64][SVE] Add "fast" fcmp operations.

dacf8d3 added support for most fcmp operations, but there are some extra
variations I hadn't considered: SelectionDAG supports float comparisons
that are neither ordered nor unordered. Add support for the missing
operations.

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

4 years ago[SROA] Teach promote to register about droppable instructions
Johannes Doerfert [Fri, 24 Jul 2020 19:06:27 +0000 (14:06 -0500)]
[SROA] Teach promote to register about droppable instructions

This is the second of two patches to address PR46753. We basically allow
SROA to promote allocas that are used in doppable instructions, for
now that means `llvm.assume`. The (transitive) uses are replaced by
`undef` in the droppable instructions.

See also D83976.

Reviewed By: Tyker

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

4 years ago[Mem2Reg] Teach promote to register about droppable instructions
Johannes Doerfert [Fri, 24 Jul 2020 18:11:19 +0000 (13:11 -0500)]
[Mem2Reg] Teach promote to register about droppable instructions

This is the first of two patches to address PR46753. We basically allow
mem2reg to promote allocas that are used in doppable instructions, for
now that means `llvm.assume`. The uses of the alloca (or a bitcast or
zero offset GEP from there) are replaced by `undef` in the droppable
instructions.

Reviewed By: Tyker

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

4 years ago[SROA][Mem2Reg] Do not crash on alloca + addrspacecast
Johannes Doerfert [Fri, 24 Jul 2020 18:10:55 +0000 (13:10 -0500)]
[SROA][Mem2Reg] Do not crash on alloca + addrspacecast

SROA knows that it can look through addrspacecast but
PromoteMemoryToRegister did not handle them. This caused an assertion
error for the test case, exposed while running
`Transforms/PhaseOrdering/inlining-alignment-assumptions.ll` with D83978
applied.

Reviewed By: arsenm

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

4 years ago[OpenMP] Use `abort` not `error` for fatal runtime exceptions
Johannes Doerfert [Thu, 16 Jul 2020 21:55:09 +0000 (16:55 -0500)]
[OpenMP] Use `abort` not `error` for fatal runtime exceptions

See PR46515 for the rational but generally, we want to *really* abort
not gracefully shut down.

Reviewed By: grokos, ABataev

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

4 years ago[mlir][shape] Fix missing dependency
Jacques Pienaar [Fri, 24 Jul 2020 20:15:53 +0000 (13:15 -0700)]
[mlir][shape] Fix missing dependency

4 years ago[ASTImporter] Modify ImportDefiniton for ObjCInterfaceDecl so that we always the...
shafik [Fri, 24 Jul 2020 20:11:59 +0000 (13:11 -0700)]
[ASTImporter] Modify ImportDefiniton for ObjCInterfaceDecl so that we always the ImportDeclContext one we start the definition

Once we start the definition of an ObjCInterfaceDecl we won't attempt to ImportDeclContext
later on. Unlike RecordDecl case which uses DefinitionCompleter to force completeDefinition
we don't seem to have a similar mechanism for ObjCInterfaceDecl.

This fix was needed due to a bug we see in LLDB expression parsing where an initial expression
cause an ObjCInterfaceDecl to be defined and subsequent expressions during import do not call
ImportDeclContext and we can end up in a situation where ivars are imported out of order and not all ivars are imported.

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

4 years ago[MSAN] Allow inserting array checks
Gui Andrade [Fri, 24 Jul 2020 20:00:02 +0000 (20:00 +0000)]
[MSAN] Allow inserting array checks

Flattens arrays by ORing together all their elements.

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

4 years ago[libc] [Obvious] Place entrypoints, specs alphabetically.
cgyurgyik [Fri, 24 Jul 2020 19:40:19 +0000 (15:40 -0400)]
[libc] [Obvious] Place entrypoints, specs alphabetically.

4 years agoMake hip math headers easier to use from C
Jon Chesterfield [Fri, 24 Jul 2020 19:50:25 +0000 (20:50 +0100)]
Make hip math headers easier to use from C

Summary:
Make hip math headers easier to use from C

Motivation is a step towards using the hip math headers to implement math.h
for openmp, which needs to work with C as well as C++. NFC for C++ code.

Reviewers: yaxunl, jdoerfert

Reviewed By: yaxunl

Subscribers: sstefan1, cfe-commits

Tags: #clang

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

4 years ago[PowerPC] Fix computation of offset for load-and-splat for permuted loads
Nemanja Ivanovic [Fri, 24 Jul 2020 19:38:27 +0000 (15:38 -0400)]
[PowerPC] Fix computation of offset for load-and-splat for permuted loads

Unfortunately this is another regression from my canonicalization patch
(1fed131660b2). The patch contained two implicit assumptions:
1. That we would have a permuted load only if we are loading a partial vector
2. That a partial vector load would necessarily be as wide as the splat

However, assumption 2 is not correct since it is possible to do a wider
load and only splat a half of it. This patch corrects this assumption by
simply checking if the load is permuted and adjusting the offset if it is.

4 years ago[analyzer] Revert the accidental commit of D82122
Kirstóf Umann [Fri, 24 Jul 2020 17:10:50 +0000 (19:10 +0200)]
[analyzer] Revert the accidental commit of D82122

Was accidentally squished into
rGb6cbe6cb0399d4671e5384dcc326af56bc6bd122. The assert fires on the code
snippet included in this commit.

More discussion can be found in https://reviews.llvm.org/D82598.

4 years ago[MC] [COFF] Make sure that weak external symbols are undefined symbols
Martin Storsjö [Tue, 21 Jul 2020 20:39:37 +0000 (23:39 +0300)]
[MC] [COFF] Make sure that weak external symbols are undefined symbols

For comdats (e.g. caused by -ffunction-sections), Section is already
set here; make sure it's null, for the weak external symbol to be undefined.

This fixes PR46779.

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

4 years ago[llvm-lib] Support adding short import library objects with llvm-lib
Martin Storsjö [Thu, 23 Jul 2020 21:05:55 +0000 (00:05 +0300)]
[llvm-lib] Support adding short import library objects with llvm-lib

This fixes PR 42837.

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

4 years agoRename scoped-noalias -> scoped-noalias-aa
Arthur Eubanks [Fri, 24 Jul 2020 18:54:13 +0000 (11:54 -0700)]
Rename scoped-noalias -> scoped-noalias-aa

Summary: To match NewPM name. Also the new name is clearer and more consistent.

Subscribers: jvesely, nhaehnle, hiraditya, asbirlea, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Inform every language runtime of the modified modules
Jonas Devlieghere [Fri, 24 Jul 2020 19:09:36 +0000 (12:09 -0700)]
[lldb] Inform every language runtime of the modified modules

When a process is notified that modules got loaded, currently only
existing language runtimes are given a chance to deal with that. This
means that if the runtime for a given language wasn't needed before it
won't be informed of the module chance.

This is wrong because the module change might be what triggers the need
for a certain runtime. Instead, we should give the language runtime for
every supported language a chance to deal with the modified modules.

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

4 years ago[openmp] Clean up OMPKinds.def remove OMP_DIRECTIVE
Valentin Clement [Fri, 24 Jul 2020 19:06:30 +0000 (15:06 -0400)]
[openmp] Clean up OMPKinds.def remove OMP_DIRECTIVE

This patch removes the OMP_DIRECTIVE definition from OMPKinds.def since they
are now defined in OMP.td and OMP_DIRECTIVE is not used anymore in the code.

Reviewed By: jdenny

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

4 years ago[libc] Adds implementation for memrchr.
cgyurgyik [Fri, 24 Jul 2020 18:31:27 +0000 (14:31 -0400)]
[libc] Adds implementation for memrchr.

Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D84469

4 years ago[AMDGPU] Fix incorrect arch assert while setting up FlatScratchInit
madhur13490 [Thu, 23 Jul 2020 09:48:03 +0000 (09:48 +0000)]
[AMDGPU] Fix incorrect arch assert while setting up FlatScratchInit

Reviewers: arsenm, foad, rampitec, scott.linder

Reviewed By: arsenm

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

Tags: #llvm

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

4 years ago[X86] Move the implicit enabling of sse2 for 64-bit mode from X86Subtarget::initSubta...
Craig Topper [Fri, 24 Jul 2020 18:10:28 +0000 (11:10 -0700)]
[X86] Move the implicit enabling of sse2 for 64-bit mode from X86Subtarget::initSubtargetFeatures to X86_MC::ParseX86Triple.

ParseX86Triple already checks for 64-bit mode and produces a
static string. We can just add +sse2 to the end of that static
string. This avoids a potential reallocation when appending it
to the std::string at runtime.

This is a slight change to the behavior of tools that only use
MC layer which weren't implicitly enabling sse2 before, but will
now. I don't think we check for sse2 explicitly in any MC layer
components so this shouldn't matter in practice. And if it did
matter the new behavior is more correct.

4 years ago[llvm][sve] Reg + Imm addressing mode for ld1ro.
Francesco Petrogalli [Tue, 7 Jul 2020 19:03:13 +0000 (19:03 +0000)]
[llvm][sve] Reg + Imm addressing mode for ld1ro.

Reviewers: kmclaughlin, efriedma, sdesmalen

Subscribers: tschuett, hiraditya, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[X86] Use X86_MC::ParseX86Triple to add mode features to feature string in X86Subtarg...
Craig Topper [Fri, 24 Jul 2020 17:47:46 +0000 (10:47 -0700)]
[X86] Use X86_MC::ParseX86Triple to add mode features to feature string in X86Subtarget::initSubtargetFeatures.

Remove mode flags from constructor and remove calls to
ToggleFeature for the mode bits.

By adding them to the feature string we handle initializing the
mode member variables in X86Subtarget and the feature bits in
MCSubtargetInfo in one shot.

4 years ago[ARM] Added additional patterns to VABD instruction
Meera Nakrani [Fri, 24 Jul 2020 17:46:25 +0000 (17:46 +0000)]
[ARM] Added additional patterns to VABD instruction

Added extra patterns to VABD instruction so it is selected in place of VSUB and VABS. Added corresponding regression test too.

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

4 years ago[scudo][standalone] Change the release loop for efficiency purposes
Kostya Kortchinsky [Thu, 16 Jul 2020 23:13:04 +0000 (16:13 -0700)]
[scudo][standalone] Change the release loop for efficiency purposes

Summary:
On 32-b, the release algo loops multiple times over the freelist for a size
class, which lead to a decrease in performance when there were a lot of free
blocks.

This changes the release functions to loop only once over the freelist, at the
cost of using a little bit more memory for the release process: instead of
working on one region at a time, we pass the whole memory area covered by all
the regions for a given size class, and work on sub-areas of `RegionSize` in
this large area. For 64-b, we just have 1 sub-area encompassing the whole
region. Of course, not all the sub-areas within that large memory area will
belong to the class id we are working on, but those will just be left untouched
(which will not add to the RSS during the release process).

Reviewers: pcc, cferris, hctim, eugenis

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

4 years ago[NFC][GVN] Improve loadpre-missed-opportunity.ll test again thanks to @fhahn
Roman Lebedev [Fri, 24 Jul 2020 17:31:35 +0000 (20:31 +0300)]
[NFC][GVN] Improve loadpre-missed-opportunity.ll test again thanks to @fhahn

4 years agoTest Commit
Meera Nakrani [Fri, 24 Jul 2020 17:22:56 +0000 (17:22 +0000)]
Test Commit

Test commit - added whitespace in ARMInstrMVE.td

4 years ago[test commit] Add my name to the CREDITS.TXT
biplmish [Fri, 24 Jul 2020 09:30:04 +0000 (04:30 -0500)]
[test commit] Add my name to the CREDITS.TXT

Add my name to the CREDITS.TXT

This is my test commit. (NFC)

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

4 years agodebugserver: Support ios simulator load command disambiguation in qProcessInfo
Adrian Prantl [Fri, 24 Jul 2020 16:43:15 +0000 (09:43 -0700)]
debugserver: Support ios simulator load command disambiguation in qProcessInfo

This patch basically moves the disambiguation code from a place where
it was complicated to implement straight to where the load command is
parsed, which has the neat side affect of actually supporting all call
sites!

rdar://problem/66011909

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

4 years ago[libFuzzer] Disable noasan-memcmp64.test and bcmp.test on Windows.
Dokyung Song [Fri, 24 Jul 2020 16:14:42 +0000 (16:14 +0000)]
[libFuzzer] Disable noasan-memcmp64.test and bcmp.test on Windows.

Summary: This patch disables (i) noasan-memcmp64.test on Windows as libFuzzer's interceptors are only supported on Linux for now, and (ii) bcmp.test as on Windows bcmp is not available in strings.h.

Reviewers: morehouse, hctim, kcc

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[ValueTracking] Check for ConstantExpr before using recursive helpers.
Florian Hahn [Fri, 24 Jul 2020 16:28:01 +0000 (17:28 +0100)]
[ValueTracking] Check for ConstantExpr before using recursive helpers.

Make sure we do not call
constainsConstantExpression/containsUndefElement on ConstantExpression,
which is not supported.

In particular, containsUndefElement/constainsConstantExpression are only
supported on constants which are supported by getAggregateElement.

Unfortunately there's no convenient way to check if a constant supports
getAggregateElement, so just check for non-constantexpressions with
vector type. Other users of those functions do so too.

Reviewers: spatel, nikic, craig.topper, lebedev.ri, jdoerfert, aqjune

Reviewed By: jdoerfert

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

4 years ago[lldb/ObjectFileMachO] Correctly account for resolver symbols
Fred Riss [Sat, 18 Jul 2020 00:59:15 +0000 (17:59 -0700)]
[lldb/ObjectFileMachO] Correctly account for resolver symbols

Summary:
The resolver addresses stored in the dyld trie are relative to the base
of the __TEXT segment. This is usually 0 in a dylib, so this was never
noticed, but it is not 0 for most dylibs integrated in the shared cache.
As we started using the shared cache images recently as symbol source,
this causes LLDB to fail to resolve symbols which go through a runtime
resolver.

Reviewers: jasonmolenda, jingham

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoMachineBasicBlock: add printName method
Nicolai Hähnle [Fri, 24 Jul 2020 16:18:09 +0000 (18:18 +0200)]
MachineBasicBlock: add printName method

Common up some existing MBB name printing logic into a single place.
Note that basic block dumping now prints the same set of attributes as
the MIRPrinter.

Change-Id: I8f022bbd922e831bc96d63143d7472c03282530b

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

4 years ago[AIX] remove -u from the clang when invoke aix as assembler
diggerlin [Fri, 24 Jul 2020 15:28:17 +0000 (11:28 -0400)]
[AIX] remove -u from the clang when invoke aix as assembler

SUMMARY:

since we add .extern directive for external symbol, the -u option for aix as do not need any more.

Reviewers:  Jason liu

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

4 years ago[OPENMP] Fix PR46730: Fix compiler crash on taskloop over constructible loop counters.
Alexey Bataev [Wed, 15 Jul 2020 21:32:02 +0000 (17:32 -0400)]
[OPENMP] Fix PR46730: Fix compiler crash on taskloop over constructible loop counters.

Summary:
If the variable is constrcutible, its copy is created by calling a
constructor. Such variables are duplicated and thus, must be captured.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, cfe-commits, sstefan1, caomhin

Tags: #clang

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

4 years ago[libTooling] Add an `EditGenerator` that applies a rule throughout a bound node.
Yitzhak Mandelbaum [Fri, 24 Jul 2020 13:27:51 +0000 (13:27 +0000)]
[libTooling] Add an `EditGenerator` that applies a rule throughout a bound node.

The new combinator, `rewriteDescendants`, applies a rewrite rule to all
descendants of a specified bound node.  That rewrite rule can refer to nodes
bound by the parent, both in the matcher and in the edits.

Reviewed By: gribozavr2

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

4 years ago[flang] Run non-gtest unit tests with lit.
David Truby [Thu, 16 Jul 2020 13:15:07 +0000 (14:15 +0100)]
[flang] Run non-gtest unit tests with lit.

Summary:
As a corrollary, these tests are now run as part of the check-flang
target.

Reviewers: sscalpone

Subscribers: mgorny, delcypher, llvm-commits

Tags: #llvm

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

4 years ago[AMDGPU][MC] Added support of SP3 syntax for MTBUF format modifier
Dmitry Preobrazhensky [Fri, 24 Jul 2020 13:39:42 +0000 (16:39 +0300)]
[AMDGPU][MC] Added support of SP3 syntax for MTBUF format modifier

Currently supported LLVM MTBUF syntax is shown below. It is not compatible with SP3.

    op     dst, addr, rsrc, FORMAT, soffset

This change adds support for SP3 syntax:

    op     dst, addr, rsrc, soffset SP3FORMAT

In addition to being compatible with SP3, this syntax allows using symbolic names for data, numeric and unified formats. Below is a list of added syntax variants.

format:<expression>
format:[<numeric-format-name>,<data-format-name>]
format:[<data-format-name>,<numeric-format-name>]
format:[<data-format-name>]
format:[<numeric-format-name>]
format:[<unified-format-name>]

The last syntax variant is supported for GFX10 only.

See llvm bug 37738

Reviewers: arsenm, rampitec, vpykhtin

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

4 years ago[openmp] Don't copy exports into the source folder by default.
David Truby [Mon, 20 Jul 2020 11:11:26 +0000 (12:11 +0100)]
[openmp] Don't copy exports into the source folder by default.

Additionally fix the copy if enabled on multi-config targets.

Summary:
This changes the copy command for libomp.so to use the output of the target as
the source of the copy, rather than trying to find it based on
${LIBOMP_LIBRARY_DIR}, which appears to be incorrect in multi-config generator
builds.

Reviewers: jdoerfert

Subscribers: mgorny, yaxunl, guansong, sstefan1, openmp-commits

Tags: #openmp

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

4 years ago[MLIR][SPIRVToLLVM] Conversion of load and store SPIR-V ops
George Mitenkov [Fri, 24 Jul 2020 12:55:07 +0000 (15:55 +0300)]
[MLIR][SPIRVToLLVM] Conversion of load and store SPIR-V ops

This patch introduces conversion pattern for `spv.Store` and `spv.Load`.
Only op with `Function` Storage Class is supported at the moment
because `spv.GlobalVariable` has not been introduced yet. If the op
has memory access attribute, then there are the following cases.
If the access is `Aligned`, add alignment to the op builder. Otherwise
the conversion fails as other cases are not supported yet because they
require additional attributes for `llvm.store`/`llvm.load` ops: e.g.
`volatile` and `nontemporal`.

Reviewed By: antiagainst

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

4 years ago[MLIR][Shape] Fold `shape.mul`
Frederik Gossen [Fri, 24 Jul 2020 13:29:51 +0000 (13:29 +0000)]
[MLIR][Shape] Fold `shape.mul`

Implement constant folding for `shape.mul`.

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

4 years ago[MLIR][Shape] Allow `shape.mul` to operate in indices
Frederik Gossen [Fri, 24 Jul 2020 13:24:23 +0000 (13:24 +0000)]
[MLIR][Shape] Allow `shape.mul` to operate in indices

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

4 years ago[libTooling] Add assorted `EditGenerator` combinators.
Yitzhak Mandelbaum [Tue, 21 Jul 2020 20:09:49 +0000 (20:09 +0000)]
[libTooling] Add assorted `EditGenerator` combinators.

Summary:
This patch adds various combinators that help in constructing `EditGenerator`s:
   * `noEdits`
   * `ifBound`, specialized to `ASTEdit`
   * `flatten` and `flattenVector` which allow for easy construction from a set
     of sub edits.
   * `shrinkTo`, which generates edits to shrink a given range to another that
     it encloses.

Reviewers: asoffer, gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[MLIR][SPIRVToLLVM] Conversion of SPIR-V variable op
George Mitenkov [Fri, 24 Jul 2020 12:01:08 +0000 (15:01 +0300)]
[MLIR][SPIRVToLLVM] Conversion of SPIR-V variable op

The patch introduces the conversion pattern for function-level
`spv.Variable`. It is modelled as `llvm.alloca` op. If initialized, then
additional store instruction is used. Note that there is no initialization
for arrays and structs since constants of these types are not supported in
LLVM dialect yet. Also, at the moment initialisation is only possible via
`spv.constant` (since `spv.GlobalVariable` conversion is not implemented
yet).

The input code has some scoping is not taken into account and will be
addressed in a different patch.

Reviewed By: ftynse

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

4 years ago[gn build] (manually) port 10b1b4a23 more
Nico Weber [Fri, 24 Jul 2020 12:48:14 +0000 (08:48 -0400)]
[gn build] (manually) port 10b1b4a23 more

4 years ago[gn build] (manually) port 10b1b4a23
Nico Weber [Fri, 24 Jul 2020 12:37:47 +0000 (08:37 -0400)]
[gn build] (manually) port 10b1b4a23

4 years ago[DWARF][EntryValues] Emit GNU extensions in the case of DWARF 4 + SCE
Djordje Todorovic [Fri, 24 Jul 2020 12:32:25 +0000 (14:32 +0200)]
[DWARF][EntryValues] Emit GNU extensions in the case of DWARF 4 + SCE

Emit DWARF 5 call-site symbols even though DWARF 4 is set,
only in the case of LLDB tuning.

This patch addresses PR46643.

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

4 years ago[gn build] (manually) port 228f8d89
Nico Weber [Fri, 24 Jul 2020 12:29:36 +0000 (08:29 -0400)]
[gn build] (manually) port 228f8d89

4 years agoRevert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h...
Simon Pilgrim [Fri, 24 Jul 2020 12:02:33 +0000 (13:02 +0100)]
Revert rG5dd566b7c7b78bd- "PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI."

This reverts commit 5dd566b7c7b78bd385418c72d63c79895be9ae97.

Causing some buildbot failures that I'm not seeing on MSVC builds.

4 years agoPassManager.h - remove unnecessary Function.h/Module.h includes. NFCI.
Simon Pilgrim [Fri, 24 Jul 2020 11:40:34 +0000 (12:40 +0100)]
PassManager.h - remove unnecessary Function.h/Module.h includes. NFCI.

PassManager.h is one of the top headers in the ClangBuildAnalyzer frontend worst offenders list.

This exposes a large number of implicit dependencies on various forward declarations/includes in other headers that need addressing.

4 years ago[DWARF] Avoid entry_values production for SCE
Djordje Todorovic [Fri, 24 Jul 2020 11:31:36 +0000 (13:31 +0200)]
[DWARF] Avoid entry_values production for SCE

SONY debugger does not prefer debug entry values feature, so
the plan is to avoid production of the entry values
by default when the tuning is SCE debugger.

The feature still can be enabled with the -debug-entry-values
option for the testing/development purposes.

This patch addresses PR46643.

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

4 years ago[obj2yaml][yaml2obj] - Add note-section.yaml tests.
Georgii Rymar [Fri, 24 Jul 2020 11:26:09 +0000 (14:26 +0300)]
[obj2yaml][yaml2obj] - Add note-section.yaml tests.

They were a part of D68983, but were lost in the last
diff and were not committed for unknown reason.

I've renamed (from elf-sht-note.yaml) them and fixed
broken formating a few places. Everything else remained
untouched.

4 years ago[MLIR][Shape] Remove deprecated and unused lowerings
Frederik Gossen [Fri, 24 Jul 2020 11:17:43 +0000 (11:17 +0000)]
[MLIR][Shape] Remove deprecated and unused lowerings

This concerns `from/to_extent_tensor`, `size_to_index`, `index_to_size`, and
`const_size` conversion patterns. The new lowering will work directly on indices
and extent tensors. The shape and size values will allow for error values but
are not yet supported by the dialect conversion.

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

4 years ago[MLIR][Shape] Allow `get_extent` to operate on extent tensors and indices
Frederik Gossen [Fri, 24 Jul 2020 11:12:39 +0000 (11:12 +0000)]
[MLIR][Shape] Allow `get_extent` to operate on extent tensors and indices

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

4 years ago[MLIR][Shape] Allow `shape.any` to operate on extent tensors
Frederik Gossen [Fri, 24 Jul 2020 11:01:23 +0000 (11:01 +0000)]
[MLIR][Shape] Allow `shape.any` to operate on extent tensors

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

4 years ago[MLIR][Shape] Pass Ops instead of Operations in shape lowering
Frederik Gossen [Fri, 24 Jul 2020 10:46:40 +0000 (10:46 +0000)]
[MLIR][Shape] Pass Ops instead of Operations in shape lowering

Shorten builder invocations by using Ops directly instead of `op.getOperation`.

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

4 years ago[MLIR][Shape] Allow `shape.rank` to operate on extent tensors
Frederik Gossen [Fri, 24 Jul 2020 10:26:36 +0000 (10:26 +0000)]
[MLIR][Shape] Allow `shape.rank` to operate on extent tensors

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

4 years ago[NFC][GVN] Clean loadpre-missed-opportunity.ll test some more
Roman Lebedev [Fri, 24 Jul 2020 09:37:02 +0000 (12:37 +0300)]
[NFC][GVN] Clean loadpre-missed-opportunity.ll test some more

4 years ago[IPSCCP] Add another test case with argmemonly callsite attributes.
Florian Hahn [Fri, 24 Jul 2020 08:59:03 +0000 (09:59 +0100)]
[IPSCCP] Add another test case with argmemonly callsite attributes.

4 years ago[MLIR][Shape] Clean up shape to standard lowering
Frederik Gossen [Fri, 24 Jul 2020 08:53:54 +0000 (08:53 +0000)]
[MLIR][Shape] Clean up shape to standard lowering

Put only class declarations in anonymous namespaces.

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

4 years ago[DWARFYAML] Replace 'Format', 'Version', etc with 'FormParams'. NFC.
Xing GUO [Fri, 24 Jul 2020 08:54:31 +0000 (16:54 +0800)]
[DWARFYAML] Replace 'Format', 'Version', etc with 'FormParams'. NFC.

This patch replaces 'Format', 'Version' fields, etc with 'FormParams' to
simplify codes.

Reviewed By: labath

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

4 years ago[MLIR][Shape] Simplify shape lowering
Frederik Gossen [Fri, 24 Jul 2020 08:43:43 +0000 (08:43 +0000)]
[MLIR][Shape] Simplify shape lowering

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

4 years ago[MLIR][Shape] Allow for `shape_of` to return extent tensors
Frederik Gossen [Fri, 24 Jul 2020 08:39:56 +0000 (08:39 +0000)]
[MLIR][Shape] Allow for `shape_of` to return extent tensors

The operation `shape.shape_of` now returns an extent tensor `tensor<?xindex>` in
cases when no error are possible. All consuming operation will eventually accept
both, shapes and extent tensors.

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

4 years ago[LLD][ELF] - Linkerscript: report location for the "unclosed comment in a linker...
Georgii Rymar [Wed, 22 Jul 2020 09:48:16 +0000 (12:48 +0300)]
[LLD][ELF] - Linkerscript: report location for the "unclosed comment in a linker script" error.

Currently we print "error: unclosed comment in a linker script", which doesn't
provide information about the real error location.

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

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

4 years ago[MLIR][Shape] Allow `shape.get_extent` to operate on extent tensors
Frederik Gossen [Fri, 24 Jul 2020 08:34:00 +0000 (08:34 +0000)]
[MLIR][Shape] Allow `shape.get_extent` to operate on extent tensors

`shape.get_extent` now accepts extent tensors `tensor<?xindex>` as an argument.

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

4 years ago[MLIR][Standard] Add default lowering for `assert`
Frederik Gossen [Fri, 24 Jul 2020 08:09:12 +0000 (08:09 +0000)]
[MLIR][Standard] Add default lowering for `assert`

The default lowering of `assert` calls `abort` in case the assertion is
violated. The failure message is ignored but should be used by custom lowerings
that can assume more about their environment.

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

4 years ago[SystemZ] Implement __builtin_eh_return_data_regno
Ulrich Weigand [Fri, 24 Jul 2020 08:28:06 +0000 (10:28 +0200)]
[SystemZ] Implement __builtin_eh_return_data_regno

Implement __builtin_eh_return_data_regno for SystemZ.
Match behavior of GCC.

Author: slavek-kucera

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

4 years agoAMDGPU/GlobalISel: Select set.inactive intrinsic
Petar Avramovic [Fri, 24 Jul 2020 08:13:43 +0000 (10:13 +0200)]
AMDGPU/GlobalISel: Select set.inactive intrinsic

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

4 years ago[MLIR][Shape] Generalze `shape.const_shape` to extent tensors
Frederik Gossen [Fri, 24 Jul 2020 08:05:26 +0000 (08:05 +0000)]
[MLIR][Shape] Generalze `shape.const_shape` to extent tensors

The operation `shape.const_shape` was used for constants of type shape only.
We can now also use it to create constant extent tensors.

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

4 years ago[libFuzzer] Instrument bcmp
Fangrui Song [Fri, 24 Jul 2020 07:23:46 +0000 (00:23 -0700)]
[libFuzzer] Instrument bcmp

If we define memcmp in an archive, bcmp should be defined as well (many libc
define bcmp/memcmp in one object file).  Otherwise if the application calls bcmp
or strcmp which gets optimized to bcmp (SimplifyLibCalls), the undefined
reference may pull in an optimized bcmp/strcmp implementation (libc replacement)
later on the linker command line.  If both libFuzzer's memcmp and the optimized
memcmp are strong => there will be a multiple definition error.

4 years ago[MLIR][LLVMDialect] Added branch weights attribute to CondBrOp
George Mitenkov [Fri, 24 Jul 2020 06:41:22 +0000 (09:41 +0300)]
[MLIR][LLVMDialect] Added branch weights attribute to CondBrOp

This patch introduces branch weights metadata to `llvm.cond_br` op in
LLVM Dialect. It is modelled as optional `ElementsAttr`, for example:
```
llvm.cond_br %cond weights(dense<[1, 3]> : vector<2xi32>), ^bb1, ^bb2
```
When exporting to proper LLVM, this attribute is transformed into metadata
node. The test for metadata creation is added to `../Target/llvmir.mlir`.

Reviewed By: ftynse

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

4 years ago[X86] Make the X86ProcFamilyEnum private to X86Subtarget. Removed unneeded 'protected...
Craig Topper [Fri, 24 Jul 2020 06:06:46 +0000 (23:06 -0700)]
[X86] Make the X86ProcFamilyEnum private to X86Subtarget. Removed unneeded 'protected' from X86Subtarget. NFC

4 years ago[MLIR][SPIRV] Updated documentation for variableOp
George Mitenkov [Fri, 24 Jul 2020 06:37:00 +0000 (09:37 +0300)]
[MLIR][SPIRV] Updated documentation for variableOp

This is an update of the documentation for `spv.Variable`.
Removed `bind` and `built_in` that are now used with `spv.globalVariable`
instead.

Reviewed By: antiagainst

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

4 years ago[CMake] Simplify CMake handling for zlib
Petr Hosek [Thu, 30 Apr 2020 20:07:13 +0000 (13:07 -0700)]
[CMake] Simplify CMake handling for zlib

Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

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

4 years ago[llvm][NFC] Don't use llvm/Config/config.h in .h files
Mircea Trofin [Fri, 24 Jul 2020 05:27:38 +0000 (22:27 -0700)]
[llvm][NFC] Don't use llvm/Config/config.h in .h files

 config.h is excluded from installs, llvm-config.h isn't

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

4 years ago[MLIR] Missing line breaks in MLIR Language Reference
H.-S. Zheng [Fri, 24 Jul 2020 05:06:01 +0000 (05:06 +0000)]
[MLIR] Missing line breaks in MLIR Language Reference

 Missing line breaks in the example under `Codegen of Unranked Memref` section.

Reviewed By: mehdi_amini

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

4 years ago[AST][FPEnv] Keep FP options in trailing storage of CallExpr
Serge Pavlov [Fri, 24 Jul 2020 05:04:19 +0000 (12:04 +0700)]
[AST][FPEnv] Keep FP options in trailing storage of CallExpr

This change allow a CallExpr to have optional FPOptionsOverride object,
stored in trailing storage. The implementaion is made similar to the way
used in BinaryOperator.

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

4 years ago[DWARFYAML] Use writeDWARFOffset() to simplify emitting offsets. NFC.
Xing GUO [Fri, 24 Jul 2020 04:10:21 +0000 (12:10 +0800)]
[DWARFYAML] Use writeDWARFOffset() to simplify emitting offsets. NFC.

This patch uses writeDWARFOffset() to simplify some codes. NFC.

4 years ago[mlir][DialectConversion] Enable deeper integration of type conversions
River Riddle [Fri, 24 Jul 2020 02:38:30 +0000 (19:38 -0700)]
[mlir][DialectConversion] Enable deeper integration of type conversions

This revision adds support for much deeper type conversion integration into the conversion process, and enables auto-generating cast operations when necessary. Type conversions are now largely automatically managed by the conversion infra when using a ConversionPattern with a provided TypeConverter. This removes the need for patterns to do type cast wrapping themselves and moves the burden to the infra. This makes it much easier to perform partial lowerings when type conversions are involved, as any lingering type conversions will be automatically resolved/legalized by the conversion infra.

To support this new integration, a few changes have been made to the type materialization API on TypeConverter. Materialization has been split into three separate categories:
* Argument Materialization: This type of materialization is used when converting the type of block arguments when calling `convertRegionTypes`. This is useful for contextually inserting additional conversion operations when converting a block argument type, such as when converting the types of a function signature.
* Source Materialization: This type of materialization is used to convert a legal type of the converter into a non-legal type, generally a source type. This may be called when uses of a non-legal type persist after the conversion process has finished.
* Target Materialization: This type of materialization is used to convert a non-legal, or source, type into a legal, or target, type. This type of materialization is used when applying a pattern on an operation, but the types of the operands have not yet been converted.

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

4 years ago[gn build] (manually) merge d054c7ee2e9
Nico Weber [Fri, 24 Jul 2020 02:28:00 +0000 (22:28 -0400)]
[gn build] (manually) merge d054c7ee2e9

4 years agoAdd test utility 'extract'
Fangrui Song [Fri, 24 Jul 2020 02:13:16 +0000 (19:13 -0700)]
Add test utility 'extract'

See https://lists.llvm.org/pipermail/llvm-dev/2020-July/143373.html
"[llvm-dev] Multiple documents in one test file" for some discussions.

`extract part filename` splits the input file into multiple parts separated by
regex `^(.|//)--- ` and extract the specified part to stdout or the
output file (if specified).

Use case A (organizing input of different formats (e.g. linker
script+assembly) in one file).

```
// RUN: extract lds %s -o %t.lds
// RUN: extract asm %s -o %t.s
// RUN: llvm-mc %t.s -o %t.o
// RUN: ld.lld -T %t.lds %t.o -o %t
This is sometimes better than the %S/Inputs/ approach because the user
can see the auxiliary files immediately and don't have to open another file.
```

Use case B (for utilities which don't have built-in input splitting
feature):

```
// RUN: extract case1 %s | llc | FileCheck %s --check-prefix=CASE1
// RUN: extract case2 %s | llc | FileCheck %s --check-prefix=CASE2
Combing tests prudently can improve readability.
This is sometimes better than having multiple test files.
```

Since this is a new utility, there is no git history concerns for
UpperCase variable names. I use lowerCase variable names like mlir/lld.

Reviewed By: jhenderson

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