platform/upstream/llvm.git
4 years ago[Hexagon][llvm-objcopy] Add missing check for SHN_HEXAGON_SCOMMON_1
Sid Manning [Wed, 24 Jun 2020 14:36:03 +0000 (09:36 -0500)]
[Hexagon][llvm-objcopy] Add missing check for SHN_HEXAGON_SCOMMON_1

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

4 years ago[Inliner] Handle 'no-signed-zeros-fp-math' function attribute.
Michele Scandale [Thu, 25 Jun 2020 00:47:03 +0000 (17:47 -0700)]
[Inliner] Handle 'no-signed-zeros-fp-math' function attribute.

All other floating point math optimization related attribute are merged
in a conservative way during function inlining. This commit adds the
merge rule for the 'no-signed-zeros-fp-math' attribute.

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

4 years ago[lldb] Use std::make_unique<> (NFC)
Jonas Devlieghere [Thu, 25 Jun 2020 00:44:33 +0000 (17:44 -0700)]
[lldb] Use std::make_unique<> (NFC)

Update the rest of lldb to use std::make_unique<>. I used clang-tidy to
automate this, which probably missed cases that are wrapped in ifdefs.

4 years ago[MLIR][SPIRVToLLVM] Implementation of SPIR-V module conversion pattern
George Mitenkov [Thu, 25 Jun 2020 00:42:39 +0000 (20:42 -0400)]
[MLIR][SPIRVToLLVM] Implementation of SPIR-V module conversion pattern

This patch introduces conversion patterns for `spv.module` and `spv._module_end`.
SPIR-V module is converted into `ModuleOp`. This will play a role of enclosing
scope to LLVM ops. At the moment, SPIR-V module attributes (such as memory model,
etc) are ignored.

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

4 years ago[mlir][DialectConversion][NFC] Add comment blocks and organize a bit of the code
River Riddle [Thu, 25 Jun 2020 00:34:16 +0000 (17:34 -0700)]
[mlir][DialectConversion][NFC] Add comment blocks and organize a bit of the code

This helps improve the readability when scrolling through the many functions of ConversionPatternRewriterImpl.

4 years ago[mlir][spirv] Add TransposeOp
HazemAbdelhafez [Thu, 25 Jun 2020 00:34:34 +0000 (20:34 -0400)]
[mlir][spirv] Add TransposeOp

Add Transpose operation to SPIRV dialect.

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

4 years agoDon't inline dynamic allocas that simplify to huge static allocas.
Amara Emerson [Fri, 12 Jun 2020 17:19:28 +0000 (10:19 -0700)]
Don't inline dynamic allocas that simplify to huge static allocas.

Some sequences of optimizations can generate call sites which may never be
executed during runtime, and through constant propagation result in dynamic
allocas being converted to static allocas with very large allocation amounts.

The inliner tries to move these to the caller's entry block, resulting in the
stack limits being reached/bypassed. Avoid inlining functions if this would
result.

The threshold of 64k currently doesn't get triggered on the test suite with an
-Os LTO build on arm64, care should be taken in changing this in future to avoid
needlessly pessimising inlining behaviour.

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

4 years ago[mlir] Refactor OpInterface internals to be faster and factor out common bits.
River Riddle [Thu, 25 Jun 2020 00:23:41 +0000 (17:23 -0700)]
[mlir] Refactor OpInterface internals to be faster and factor out common bits.

This revision adds a new support header, InterfaceSupport, to contain various generic bits of functionality for implementing "Interfaces". Interfaces embody a mechanism for attaching concept-based polymorphism to a type system. With this refactoring a new InterfaceMap type is added to allow for efficient interface lookups without going through an indirect call. This should provide a decent performance speedup without changing the size of AbstractOperation.

In a future revision, this functionality will also be used to bring Interface like functionality to Attributes and Types.

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

4 years ago[DWARFYAML][debug_gnu_*] 'Descriptor' field should be 1-byte. NFC.
Xing GUO [Thu, 25 Jun 2020 00:06:56 +0000 (08:06 +0800)]
[DWARFYAML][debug_gnu_*] 'Descriptor' field should be 1-byte. NFC.

The 'Descriptor' field of .debug_gnu_pubnames and .debug_gnu_pubtypes
section should be 1-byte rather than 4-byte. This patch helps resolve
this issue.

4 years ago[MLIR][NFC] Adopt variadic isa<>
Rahul Joshi [Wed, 24 Jun 2020 18:49:30 +0000 (11:49 -0700)]
[MLIR][NFC] Adopt variadic isa<>

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

4 years ago[HostInfoMacOS] Parse correctly the triple for Apple Silicon.
Davide Italiano [Wed, 24 Jun 2020 23:37:21 +0000 (16:37 -0700)]
[HostInfoMacOS] Parse correctly the triple for Apple Silicon.

Again, debugging doesn't work on the new platform without this, so
it's implicitly covered by the testsuite.

4 years ago[Apple Silicon] Handle macOS in PlatformDarwin
Davide Italiano [Wed, 24 Jun 2020 23:35:10 +0000 (16:35 -0700)]
[Apple Silicon] Handle macOS in PlatformDarwin

This makes "target create /bin/ls" properly detect which platform
is needed when running lldb. Covered by many tests in the suite.

4 years ago[lldb/API] Use std::make_unique<> (NFC)
Jonas Devlieghere [Wed, 24 Jun 2020 23:25:05 +0000 (16:25 -0700)]
[lldb/API] Use std::make_unique<> (NFC)

I was holding off on this change until we moved to C++14 as to not have
to convert llvm::make_unique to std::make_unique. That happened a while
ago so here's the first patch for the API which had a bunch of raw
`new`s.

4 years ago[unittest] Fix FrontendTests CanGenerateCC1CommandLineFlag when LLVM_DEFAULT_TARGET_T...
Fangrui Song [Wed, 24 Jun 2020 23:18:28 +0000 (16:18 -0700)]
[unittest] Fix FrontendTests CanGenerateCC1CommandLineFlag when LLVM_DEFAULT_TARGET_TRIPLE is not normalized after D79796

`TargetOpts->Triple` is initialized as llvm::sys::getDefaultTargetTriple() which may not be normalized.
If LLVM_DEFAULT_TARGET_TRIPLE is powerpc64le-linux-gnu, we should check
check `-triple powerpc64le-linux-gnu`, instead of (normalized) `-triple powerpc64le-unknown-linux-gnu`

4 years ago[InlineCost] PrinterPass prints constants to which instructions are simplified
Kirill Naumov [Tue, 2 Jun 2020 18:57:30 +0000 (18:57 +0000)]
[InlineCost] PrinterPass prints constants to which instructions are simplified

This patch enables printing of constants to see which instructions were
constant-folded. Needed for tests and better visiual analysis of
inliner's work.

Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev

Reviewed By: mtrofin

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

4 years ago[clangd] Make background index thread count calculation clearer
Sam McCall [Tue, 23 Jun 2020 06:39:30 +0000 (08:39 +0200)]
[clangd] Make background index thread count calculation clearer

Summary:
This confusion was inadvertently introduced in a change to the
heavyweight_hardware_concurrency API: 8404aeb56a73ab24f9b295111de3b37a37f0b841

- don't indirect through the rebuilder policy when building the thread pool
- document that rebuilder thresholds are exposed for testing only
- don't use 0 as a sentinel value for "all threads", as we use it as a
  sentinel value for "synchronous" (though unsupported for BackgroundIndex)
- rather than pick some new sentinel value, just always use 4 threads for tests

Reviewers: kadircet, aganea

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

Tags: #clang

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

4 years ago[llvm-profdata] --hot-func-list: fix some style issues in D81800
Fangrui Song [Wed, 24 Jun 2020 22:17:03 +0000 (15:17 -0700)]
[llvm-profdata] --hot-func-list: fix some style issues in D81800

Reviewed By: wenlei, hoyFB

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

4 years ago[MIR] Fix CFI_INSTRUCTION escape printing
Scott Linder [Wed, 24 Jun 2020 22:15:27 +0000 (18:15 -0400)]
[MIR] Fix CFI_INSTRUCTION escape printing

Summary:
The printer seems to intend to not print the trailing comma but has a
copy-paste error for the last value in the escape, and the parser
enforces having no trailing comma, but somehow a test was never included
to actually confirm it.

Reviewers: thegameg, arsenm

Reviewed By: thegameg, arsenm

Subscribers: wdng, arsenm, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[gn build] Port 1e2691fe238
LLVM GN Syncbot [Wed, 24 Jun 2020 22:11:22 +0000 (22:11 +0000)]
[gn build] Port 1e2691fe238

4 years ago[NFCI][InstSimplify] Add CHECK-LABEL to new icmp.ll test
Roman Lebedev [Wed, 24 Jun 2020 22:10:35 +0000 (01:10 +0300)]
[NFCI][InstSimplify] Add CHECK-LABEL to new icmp.ll test

4 years ago[SROA] convertValue(): we can have <N x iK*> to <M x iQ> cast
Roman Lebedev [Wed, 24 Jun 2020 21:51:18 +0000 (00:51 +0300)]
[SROA] convertValue(): we can have <N x iK*> to <M x iQ> cast

Provided test case crashes otherwise.
Much like to the opposite case.

4 years ago[SROA] convertValue(): we can have <N x iK> to <M x iQ*> cast
Roman Lebedev [Wed, 24 Jun 2020 18:12:19 +0000 (21:12 +0300)]
[SROA] convertValue(): we can have <N x iK> to <M x iQ*> cast

Provided test case crashes otherwise.

If NewTy is already DL.getIntPtrType(NewTy),
CreateBitCast() won't actually create any bitcast,
so we are better off just doing the general thing.

4 years ago[IR] GetUnderlyingObject(), stripPointerCastsAndOffsets(): don't crash on `bitcast...
Roman Lebedev [Wed, 24 Jun 2020 18:11:49 +0000 (21:11 +0300)]
[IR] GetUnderlyingObject(), stripPointerCastsAndOffsets(): don't crash on `bitcast <1 x i8*> to i8*`

I'm not sure how to write standalone tests for each of two changes here.
If either one of these two fixes is missing, the test fill crash.

4 years ago[InstCombine] visitBitCast(): do not crash on weird `bitcast <1 x i8*> to i8*`
Roman Lebedev [Wed, 24 Jun 2020 18:12:09 +0000 (21:12 +0300)]
[InstCombine] visitBitCast(): do not crash on weird `bitcast <1 x i8*> to i8*`

Even if we know that RHS of a bitcast is a pointer,
we can't assume LHS is, because it might be
a single-element vector of pointer.

4 years ago[NFCI] SCEV: promote ScalarEvolutionDivision into an publicly usable class
Roman Lebedev [Wed, 17 Jun 2020 10:09:22 +0000 (13:09 +0300)]
[NFCI] SCEV: promote ScalarEvolutionDivision into an publicly usable class

This makes it usable from outside of SCEV,
while previously it was internal to the ScalarEvolution.cpp

In particular, i want to use it in an WIP alloca promotion helper pass,
to analyze if some SCEV is a multiple of some other SCEV.

4 years agoRevert "Use concrete natural type alignment for masked load/store operations instead...
Guillaume Chatelet [Wed, 24 Jun 2020 21:52:52 +0000 (21:52 +0000)]
Revert "Use concrete natural type alignment for masked load/store operations instead of 0."

This reverts commit 39819ccd36b6dd61c9decd29df64fd4e8a7ee9ad.

4 years agoRemove Passes dependency on CodeGen
Yuanfang Chen [Wed, 24 Jun 2020 02:52:58 +0000 (19:52 -0700)]
Remove Passes dependency on CodeGen

The dependency was introduced in
5134020ea62d1e1e125fdac48d251a26b80e9781. The only functional change
from this removal would be the new PM interface for the two codegen
passes. This is not necessary since we don't have codegen pipeline using
new PM yet. This removal is to break the potential circular dependency between
Passes and CodeGen once the codegen begins to gain new PM support.

4 years ago[TextAPI/MachO] Fix style issues. NFC
Fangrui Song [Wed, 24 Jun 2020 21:39:54 +0000 (14:39 -0700)]
[TextAPI/MachO] Fix style issues. NFC

See https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions

4 years agoUse concrete natural type alignment for masked load/store operations instead of 0.
Guillaume Chatelet [Wed, 24 Jun 2020 21:26:03 +0000 (21:26 +0000)]
Use concrete natural type alignment for masked load/store operations instead of 0.

4 years agoRevert "[BitcodeReader] Fix DelayedShuffle handling for ConstantExpr shuffles."
Mitch Phillips [Wed, 24 Jun 2020 20:55:28 +0000 (13:55 -0700)]
Revert "[BitcodeReader] Fix DelayedShuffle handling for ConstantExpr shuffles."

Patch has a memory leak bug that broke the ASan buildbots. More info
available at: https://reviews.llvm.org/D80330

This reverts commit b5740105d270a2d76da8812cafb63e4b799ada73.

4 years ago[ARM] Make cp10 and cp11 usage a warning
Stefan Agner [Wed, 24 Jun 2020 19:50:17 +0000 (21:50 +0200)]
[ARM] Make cp10 and cp11 usage a warning

The ARM ARM considers p10/p11 valid arguments for MCR/MRC instructions.
MRC instructions with p10 arguments are also used in kernel code which
is shared for different architectures. Turn usage of p10/p11 to warnings
for ARMv7/ARMv8-M.

Reviewers: rengolin, olista01, t.p.northover, efriedma, psmith, simon_tatham

Reviewed By: simon_tatham

Subscribers: hiraditya, danielkiss, jcai19, tpimh, nickdesaulniers, peter.smith, javed.absar, kristof.beyls, jdoerfert, llvm-commits

Tags: #llvm

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

4 years ago[InlineCost] InlineCostAnnotationWriterPass introduced
Kirill Naumov [Thu, 11 Jun 2020 22:24:10 +0000 (22:24 +0000)]
[InlineCost] InlineCostAnnotationWriterPass introduced

This class allows to see the inliner's decisions for better
optimization verifications and tests. To use, use flag
"-passes="print<inline-cost>"".

This is the second attempt to integrate the patch.
The problem from the first try has been discussed and
fixed in D82205.

Reviewers: apilipenko, mtrofin, davidxl, fedor.sergeev

Reviewed By: mtrofin

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

4 years agoAdd a git hook script that can be manually setup to run some checks on every push
Mehdi Amini [Wed, 24 Jun 2020 21:12:41 +0000 (21:12 +0000)]
Add a git hook script that can be manually setup to run some checks on every push

Right now it just catches arcanist noisy tags, and include a script to
automatically clean these.

Follow up on http://lists.llvm.org/pipermail/llvm-dev/2019-December/137848.html

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

4 years ago[PowerPC][Power10] Implement Count Leading/Trailing Zeroes Builtins under bit Mask...
Amy Kwan [Wed, 24 Jun 2020 20:23:17 +0000 (15:23 -0500)]
[PowerPC][Power10] Implement Count Leading/Trailing Zeroes Builtins under bit Mask in LLVM/Clang

This patch implements builtins for the following prototypes:

unsigned long long __builtin_cntlzdm (unsigned long long, unsigned long long)
unsigned long long __builtin_cnttzdm (unsigned long long, unsigned long long)
vector unsigned long long vec_cntlzm (vector unsigned long long, vector unsigned long long)
vector unsigned long long vec_cnttzm (vector unsigned long long, vector unsigned long long)

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

4 years ago[ProcessGDBRemote] Fix a typo in an ifdef from 58de2a3851391d
Martin Storsjö [Wed, 24 Jun 2020 20:48:43 +0000 (23:48 +0300)]
[ProcessGDBRemote] Fix a typo in an ifdef from 58de2a3851391d

4 years ago[lld-macho] Remove using namespace llvm::MachO
Fangrui Song [Wed, 24 Jun 2020 20:45:41 +0000 (13:45 -0700)]
[lld-macho] Remove using namespace llvm::MachO

llvm/include/llvm/TextAPI/MachO/ inappropriately uses the llvm::MachO namespace (this is for BinaryFormat and Object) and causes conflicts in some MSVC builds::

http://lab.llvm.org:8011/builders/sanitizer-windows/builds/65324/steps/stage%201%20build/logs/stdio

Removing `using namespace llvm::MachO` should decrease name collisions.

4 years ago[NFC][PowerPC] Fix some typos in MachineCombiner comments
Jinsong Ji [Wed, 24 Jun 2020 16:02:51 +0000 (16:02 +0000)]
[NFC][PowerPC] Fix some typos in MachineCombiner comments

4 years ago[SVE] Remove calls to VectorType::getNumElements from IPO
Christopher Tetreault [Wed, 24 Jun 2020 20:27:38 +0000 (13:27 -0700)]
[SVE] Remove calls to VectorType::getNumElements from IPO

Reviewers: efriedma, jdoerfert, sdesmalen, kmclaughlin

Reviewed By: efriedma, jdoerfert

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

Tags: #llvm

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

4 years ago[ProcessGDBRemote] Placate the Windows buildbot.
Davide Italiano [Wed, 24 Jun 2020 20:23:06 +0000 (13:23 -0700)]
[ProcessGDBRemote] Placate the Windows buildbot.

I'm probably going to rewrite this function anyway, but, in
the meanwhile.

4 years ago[NFCI][CostModel] Add const to Value*.
dfukalov [Tue, 23 Jun 2020 13:07:44 +0000 (16:07 +0300)]
[NFCI][CostModel] Add const to Value*.

Summary:
Get back `const` partially lost in one of recent changes.
Additionally specify explicit qualifiers in few places.

Reviewers: samparker

Reviewed By: samparker

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Use expect_expr in TestStructTypes.py
Raphael Isemann [Wed, 24 Jun 2020 18:28:00 +0000 (20:28 +0200)]
[lldb][NFC] Use expect_expr in TestStructTypes.py

4 years ago[InlineCost] Added InlineCostCallAnalyzer::print()
Kirill Naumov [Fri, 19 Jun 2020 14:57:34 +0000 (14:57 +0000)]
[InlineCost] Added InlineCostCallAnalyzer::print()

For the upcoming changes, we need to have an ability to dump
InlineCostCallAnalyzer info in non-debug builds as well.

Reviewed-By: mtrofin
Differential Revision: https://reviews.llvm.org/D82205

4 years ago[x86][AArch64] add tests for fmul-fma combine; NFC
Sanjay Patel [Wed, 24 Jun 2020 19:54:22 +0000 (15:54 -0400)]
[x86][AArch64] add tests for fmul-fma combine; NFC

As discussed in D80801, there's a possible overstep in
what is allowed by the 'contract' fast-math-flag.

4 years agoFix a pair of wtype-limits and 3 wparentheses warnings from 29125ddf1
Erich Keane [Wed, 24 Jun 2020 19:49:33 +0000 (12:49 -0700)]
Fix a pair of wtype-limits and 3 wparentheses warnings from 29125ddf1

4 years agoAdd --hot-func-list to llvm-profdata show for sample profiles
weihe [Wed, 24 Jun 2020 19:43:27 +0000 (12:43 -0700)]
Add --hot-func-list to llvm-profdata show for sample profiles

Summary:
Add the --hot-func-list feature to llvm-profdata show for sample profiles. This feature prints a list of hot functions whose max sample count are above the 99% threshold, with their numbers of total samples, total samples percentage, max samples, entry samples, and their function names.

Test Plan:

Reviewers: wenlei, hoyFB

Reviewed By: wenlei, hoyFB

Subscribers: hoyFB, wenlei, weihe, llvm-commits

Tags: #llvm

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

4 years agoFix crash on XCore on unused inline in EmitTargetMetadata
Nigel Perks [Wed, 24 Jun 2020 19:20:29 +0000 (12:20 -0700)]
Fix crash on XCore on unused inline in EmitTargetMetadata

EmitTargetMetadata passed to emitTargetMD a null pointer as returned
from GetGlobalValue, for an unused inline function which has been
removed from the module at that point.

A FIXME in CodeGenModule.cpp commented that the calling code in
EmitTargetMetadata should be moved into the one target that needs it
(XCore). A review comment agreed. So the calling loop has been moved
into the XCore subclass. The check for null is done in that loop.

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

4 years ago[llvm-objcopy] Update help message tests
Alexander Shaposhnikov [Wed, 24 Jun 2020 19:24:50 +0000 (12:24 -0700)]
[llvm-objcopy] Update help message tests

This diff merges help message tests for llvm-objcopy, llvm-strip and
llvm-install-name-tool.

Patch by Sameer Arora!

Test plan: make check-all

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

4 years ago[lld-macho] Use namespace qualifiers (macho::) instead of `namespace lld { namespace...
Fangrui Song [Wed, 24 Jun 2020 19:22:13 +0000 (12:22 -0700)]
[lld-macho] Use namespace qualifiers (macho::) instead of `namespace lld { namespace macho {`

See https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions
Similar to D79982.

Reviewed By: #lld-macho, int3

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

4 years ago[Apple Silicon] Debugging of process under Rosetta is supported.
Davide Italiano [Wed, 24 Jun 2020 19:25:01 +0000 (12:25 -0700)]
[Apple Silicon] Debugging of process under Rosetta is supported.

Remove this early exit. It's vestigial from the ppc -> Intel transition,
but it doesn't apply anymore.

4 years ago[Apple Silicon] Initial support for Rosetta
Davide Italiano [Wed, 24 Jun 2020 19:18:29 +0000 (12:18 -0700)]
[Apple Silicon] Initial support for Rosetta

Translated processes talk with a different debugserver, shipped with
macOS 11. This patch detects whether a process is translated and
attaches to the correct debugserver implementation.
It's the first patch of a series. Tested on the lldb test suite.

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

4 years ago[SLP] Limit GEP lists based on width of index computation.
Florian Hahn [Wed, 24 Jun 2020 16:04:45 +0000 (17:04 +0100)]
[SLP] Limit GEP lists based on width of index computation.

D68667 introduced a tighter limit to the number of GEPs to simplify
together. The limit was based on the vector element size of the pointer,
but the pointers themselves are not actually put in vectors.

IIUC we try to vectorize the index computations here, so we should base
the limit on the vector element size of the computation of the index.

This restores the test regression on AArch64 and also restores the
vectorization for a important pattern in SPEC2006/464.h264ref on
AArch64 (@test_i16_extend). We get a large benefit from doing a single
load up front and then processing the index computations in vectors.

Note that we could probably even further improve the AArch64 codegen, if
we would do zexts to i32 instead of i64 for the sub operands and then do
a single vector sext on the result of the subtractions. AArch64 provides
dedicated vector instructions to do so. Sketch of proof in Alive:
https://alive2.llvm.org/ce/z/A4xYAB

Reviewers: craig.topper, RKSimon, xbolva00, ABataev, spatel

Reviewed By: ABataev, spatel

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

4 years ago[docs] Fix typo
Vedant Kumar [Wed, 24 Jun 2020 18:51:16 +0000 (11:51 -0700)]
[docs] Fix typo

4 years ago[FileCheck][NFC] Fix typo in test comment
Joel E. Denny [Wed, 24 Jun 2020 18:49:23 +0000 (14:49 -0400)]
[FileCheck][NFC] Fix typo in test comment

4 years ago[ObjC] Copy a block to the heap if it is passed as a variadic argument
Akira Hatanaka [Wed, 24 Jun 2020 18:46:38 +0000 (11:46 -0700)]
[ObjC] Copy a block to the heap if it is passed as a variadic argument

Call maybeExtendBlockObject in DefaultVariadicArgumentPromotion so that
the block is copied to the heap when it is passed as a variadic argument
to any calls, not only to C function calls.

rdar://problem/64201532

4 years ago[OpenMP][NFC] Remove hard-coded line numbers from test
Joel E. Denny [Wed, 24 Jun 2020 18:33:01 +0000 (14:33 -0400)]
[OpenMP][NFC] Remove hard-coded line numbers from test

Otherwise, it's painful to insert new code.  There are many existing
examples in the same test file where the line numbers are not
hard-coded.

I intend to do the same for several other OpenMP tests, but I want to
be sure there are no objections before I spend time on it.

Reviewed By: jdoerfert

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

4 years agoInstCombineInternal.h - reduce AliasAnalysis.h include to forward declaration. NFC.
Simon Pilgrim [Wed, 24 Jun 2020 18:27:22 +0000 (19:27 +0100)]
InstCombineInternal.h - reduce AliasAnalysis.h include to forward declaration. NFC.

Fix implicit include dependencies in source files and replace legacy AliasAnalysis typedef with AAResults where necessary.

4 years agoLocal.h - reduce includes to forward declarations. NFC.
Simon Pilgrim [Wed, 24 Jun 2020 18:02:35 +0000 (19:02 +0100)]
Local.h - reduce includes to forward declarations. NFC.

Fix implicit include dependencies in source files and replace legacy AliasAnalysis typedef with AAResults where necessary.

4 years ago[OpenMP][Docs] Mark TR8 `present` as claimed in docs
Joel E. Denny [Wed, 24 Jun 2020 18:18:08 +0000 (14:18 -0400)]
[OpenMP][Docs] Mark TR8 `present` as claimed in docs

4 years ago[llvm-objcopy] Update help messages
Alexander Shaposhnikov [Wed, 24 Jun 2020 18:19:31 +0000 (11:19 -0700)]
[llvm-objcopy] Update help messages

This diff updates the help messages for llvm-objcopy, llvm-strip and
llvm-install-name-tool.

Patch by Sameer Arora!

Test plan: make check-all

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

4 years ago[NVPTX] Fix for NVPTX module asm regression
tatz.j@northeastern.edu [Wed, 24 Jun 2020 16:55:09 +0000 (09:55 -0700)]
[NVPTX] Fix for NVPTX module asm regression

Currently module asm ends up emitted twice and at the wrong place in the PTX.
This patch moves module asm generation into emitStartOfAsmFile() which puts at
the correct location in the generated PTX.

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

4 years ago[X86] Rename O3-pipeline.ll to opt-pipeline.ll and add O1/O2 command lines
Craig Topper [Wed, 24 Jun 2020 17:56:20 +0000 (10:56 -0700)]
[X86] Rename O3-pipeline.ll to opt-pipeline.ll and add O1/O2 command lines

Eric Cristopher asked me about possibly disabling some passes at
-O1/Og. Figured a good first step was to test all the pipelines.
They all appear to be the same for now. Hoping we can use FileCheck
prefixes for differences to avoid repeating the contents 3 times.

4 years agoDisable a flaky lldb-vscode test on aarch64
Walter Erquinigo [Wed, 24 Jun 2020 18:08:29 +0000 (11:08 -0700)]
Disable a flaky lldb-vscode test on aarch64

Summary:
These tests isflaky only on this arch for some reason. It's testing important features and is not flaky on x86_64, so I'll investigate this arm issue separatedly.

A flaky run:
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/5540/steps/test/logs/stdio

Diff that created those tests:
https://reviews.llvm.org/D81978

4 years ago[WPD] Allow virtual calls to be analyzed with multiple type tests
Teresa Johnson [Fri, 1 May 2020 15:16:38 +0000 (08:16 -0700)]
[WPD] Allow virtual calls to be analyzed with multiple type tests

Summary:
In D52514 I had fixed a bug with WPD after indirect call promotion, by
checking that a type test being analyzed dominates potential virtual
calls. With that fix I included a small effiency enhancement to avoid
processing a devirt candidate multiple times (when there are multiple
type tests). This latter change wasn't in response to any measured
efficiency issues, it was merely theoretical. Unfortuantely, it turns
out to limit optimization opportunities after inlining.

Specifically, consider code that looks like:

class A {
  virtual void foo();
};
class B : public A {
  void foo();
}
void callee(A *a) {
  a->foo(); // Call 1
}
void caller(B *b) {
  b->foo(); // Call 2
  callee(b);
}

After inlining callee into caller, because of the existing call to
b->foo() in caller there will be 2 type tests in caller for the vtable
pointer of b: the original type test against B from Call 2, and the
inlined type test against A from Call 1. If the code was compiled with
-fstrict-vtable-pointers, then after optimization WPD will see that
both type tests are associated with the inlined virtual Call 1.
With my earlier change to only process a virtual call against one type
test, we may only consider virtual Call 1 against the base class A type
test, which can't be devirtualized. With my change here to remove this
restriction, it also gets considered for the type test against the
derived class B type test, where it can be devirtualized.

Note that if caller didn't include it's own earlier virtual call
b->foo() we will not be able to devirtualize after inlining callee even
after this fix, since there would not be a type test against B in the
IR. As a future enhancement we can consider inserting type tests at call
sites that pass pointers to classes with virtual calls, to enable
context-sensitive devirtualization after inlining.

Reviewers: pcc, vitalybuka, evgeny777

Subscribers: Prazek, hiraditya, steven_wu, dexonsmith, llvm-commits

Tags: #llvm

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

4 years ago[X86] Replace PROC macros with an enum and a lookup table of processor information.
Craig Topper [Wed, 24 Jun 2020 17:36:02 +0000 (10:36 -0700)]
[X86] Replace PROC macros with an enum and a lookup table of processor information.

This patch removes the PROC macro in favor of CPUKind enum and a
table that contains information about CPUs.

The current information in the table is the CPU name, CPUKind enum
value, key feature for target multiversioning, and Is64Bit capable.
For the strings that are aliases, I've duplicated the information
in the table. This means there are more rows in the table than
CPUKind enums.

This replaces multiple StringSwitch's with loops through the table.
They are linear searches due to the table being more logically
ordered than alphabetical. The StringSwitch's would have also been
linear. I've used StringLiteral on the strings in the table so we
can quickly check the length while searching.

I contemplated having a CPUKind for each string so there was a 1:1
mapping, but didn't want to spread more names to the places that
use the enum.

My ultimate goal here is to store the features for each CPU as a
bitset within the table. Hoping to use constexpr to make this
composable so we can group features and inherit them. After the
table lookup we can turn the bitset into a list of strings for the
frontend. The current switch we have for selecting features for
CPUs has become difficult to maintain while trying to express
inheritance relationships.

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

4 years agoFix coding style. NFC.
Michael Liao [Wed, 24 Jun 2020 17:12:52 +0000 (13:12 -0400)]
Fix coding style. NFC.

- Remove `else` after `return`.

4 years ago[gn build] Port 29125ddf132
LLVM GN Syncbot [Wed, 24 Jun 2020 17:05:39 +0000 (17:05 +0000)]
[gn build] Port 29125ddf132

4 years agoStart adding support for generating CC1 command lines from CompilerInvocation
Daniel Grumberg [Mon, 11 May 2020 10:42:38 +0000 (11:42 +0100)]
Start adding support for generating CC1 command lines from CompilerInvocation

This change includes the following:
- Add additional information in the relevant table-gen files to encode
the necessary information to automatically parse the argument into a
CompilerInvocation instance and to generate the appropriate command
line argument from a CompilerInvocation instance.
- Extend OptParserEmitter to emit the necessary macro tables as well as
constant tables to support parsing and generating command line
arguments for options that provide the necessary information.
- Port some options to use this new system for parsing and generating
command line arguments.

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

4 years ago[gn build] Port 4fb2116ee7f
LLVM GN Syncbot [Wed, 24 Jun 2020 17:00:19 +0000 (17:00 +0000)]
[gn build] Port 4fb2116ee7f

4 years ago[gn build] (manually) port bdceefe95ba6a
Nico Weber [Wed, 24 Jun 2020 16:59:59 +0000 (12:59 -0400)]
[gn build] (manually) port bdceefe95ba6a

4 years agoLoopUtils.h - reduce AliasAnalysis.h include to forward declarations. NFC.
Simon Pilgrim [Wed, 24 Jun 2020 16:38:56 +0000 (17:38 +0100)]
LoopUtils.h - reduce AliasAnalysis.h include to forward declarations. NFC.

Fix implicit include dependencies in source files and replace legacy AliasAnalysis typedef with AAResults where necessary.

4 years ago[MLIR] Fix affine loop fusion private memref alloc
Uday Bondhugula [Tue, 23 Jun 2020 20:52:03 +0000 (02:22 +0530)]
[MLIR] Fix affine loop fusion private memref alloc

Drop stale code that provided the wrong operands to alloc.

Reported-by: rjnw on discourse
Differential Revision: https://reviews.llvm.org/D82409

4 years ago[libTooling] Delete deprecated `Stencil` combinators.
Yitzhak Mandelbaum [Fri, 19 Jun 2020 16:47:12 +0000 (16:47 +0000)]
[libTooling] Delete deprecated `Stencil` combinators.

Summary: Deletes `text()` and `selection()` combinators, since they have been deprecated for months.

Reviewers: tdl-g

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[llvm] Remove full stop frome error message
Jonas Devlieghere [Wed, 24 Jun 2020 16:40:44 +0000 (09:40 -0700)]
[llvm] Remove full stop frome error message

Address post-commit feedback from James Henderson in D80959.

4 years agoRevert "[llvm] Added support for stand-alone cmake object libraries."
Mircea Trofin [Wed, 24 Jun 2020 16:37:15 +0000 (09:37 -0700)]
Revert "[llvm] Added support for stand-alone cmake object libraries."

This reverts commit 62841415e685fe8857f75edd1fa92b7d1d08b875.

The commit is a misnomer, and it "made its way in" unintentionally,
through a patch that had it as a depdendency. The change itself ended up
to be just a comment update, but the description is completely wrong.

4 years ago[OpenMP] Adopt std::set in HostDataToTargetMap
Ye Luo [Wed, 24 Jun 2020 16:18:00 +0000 (12:18 -0400)]
[OpenMP] Adopt std::set in HostDataToTargetMap

Summary:
lookupMapping took significant time due to linear complexity searching.
This is bad for offloading from multiple host threads because lookupMapping is protected by mutex.
Use std::set for logarithmic complexity searching.

Before my change.
libomptarget inclusive time 16.7 sec, exclusive time 8.6 sec.
After the change
libomptarget inclusive time 7.3 sec, exclusive time 0.4 sec.

Most of the overhead of libomptarget (exclusive time) is gone.

Reviewers: jdoerfert, grokos

Reviewed By: grokos

Subscribers: tianshilei1992, yaxunl, guansong, sstefan1

Tags: #openmp

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

4 years ago[SemaObjC] Fix a crash on invalid when 'auto' is used in a @property
Erik Pilkington [Wed, 24 Jun 2020 16:11:39 +0000 (12:11 -0400)]
[SemaObjC] Fix a crash on invalid when 'auto' is used in a @property

rdar://48506879

4 years agoGlobalISel: Add unit tests for some utils functions
Matt Arsenault [Sat, 6 Jun 2020 23:37:43 +0000 (19:37 -0400)]
GlobalISel: Add unit tests for some utils functions

The test constants were originally constexpr, but this apparently
crashes old versions of gcc.

4 years ago[SLP] Precommit short load / wide math test for AArch64.
Florian Hahn [Tue, 23 Jun 2020 22:07:16 +0000 (23:07 +0100)]
[SLP] Precommit short load / wide math test for AArch64.

This pattern is key to eliminate a 10% performance regression in
SPEC2006.

4 years agoDisable flaky lldb-vscode tests on aarch64
Walter Erquinigo [Wed, 24 Jun 2020 15:54:13 +0000 (08:54 -0700)]
Disable flaky lldb-vscode tests on aarch64

Summary:
These two tests are flaky only on this arch for some reason. They are testing important features and are not flaky on x86_64, so I'll investigate this arm issue separatedly.

Some flaky runs:
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/5517/steps/test/logs/stdio
http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/5527/steps/test/logs/stdio

Diff that created those tests:
https://reviews.llvm.org/D81978

4 years ago[AMDGPU] Make sure to fix implicit operands on insertBranch
dstuttar [Tue, 23 Jun 2020 16:47:58 +0000 (17:47 +0100)]
[AMDGPU] Make sure to fix implicit operands on insertBranch

Summary:
Without fixImplicitOperands we may end up creating default implicit operands
that are the wrong wave size

Includes simple test that provokes insertBranch in the correct way to expose the
issue being fixed.

Change-Id: I92bdcdee9fcb7b4d91529b84e76a48ac8218483e

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

Tags: #llvm

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

4 years agoAMDGPU/GlobalISel: Legalize 64-bit G_SDIV/G_SREM
Matt Arsenault [Wed, 17 Jun 2020 01:38:29 +0000 (21:38 -0400)]
AMDGPU/GlobalISel: Legalize 64-bit G_SDIV/G_SREM

Now all the divisions should be complete, although we should fix
emitting the entire common part for div/rem when you use both.

4 years agoAMDGPU/GlobalISel: Invert parameter for div/rem lowering function
Matt Arsenault [Wed, 24 Jun 2020 15:12:02 +0000 (11:12 -0400)]
AMDGPU/GlobalISel: Invert parameter for div/rem lowering function

4 years ago[clangd] Disable printing of Value for tag-types on hover
Kadir Cetinkaya [Mon, 22 Jun 2020 19:53:47 +0000 (21:53 +0200)]
[clangd] Disable printing of Value for tag-types on hover

Summary: This is both confusing and crashy.

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[Hexagon] Reducing minimum alignment requirement
Ikhlas Ajbar [Mon, 22 Jun 2020 21:03:22 +0000 (16:03 -0500)]
[Hexagon] Reducing minimum alignment requirement

This patch reduces minimum alignment requirement to 1 byte for arguments
passed by value on stack.

4 years ago[ELF] -r: don't parse @ (symbol versioning) for .symver inline asm in bitcode
Fangrui Song [Wed, 24 Jun 2020 15:22:17 +0000 (08:22 -0700)]
[ELF] -r: don't parse @ (symbol versioning) for .symver inline asm in bitcode

Fixes PR46420
Similar to D43307 for non-LTO.

Module-level inline assembly can use .symver to create a symbol with `@` in the name.
For relocatable output, @ should be retained in the symbol name. `@ver` should
not be parsed and dropped.

Reviewed By: grimar, psmith

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

4 years agoRevert "[AMDGPU] Enable compare operations to be selected by divergence"
Matt Arsenault [Wed, 24 Jun 2020 14:27:23 +0000 (10:27 -0400)]
Revert "[AMDGPU] Enable compare operations to be selected by divergence"

This reverts commit 521ac0b5cea02f629d035f807460affbb65ae7ad.

Reported to break thousands of piglit tests.

4 years ago[NewPM] Add SimpleLoopUnswitchPass to PassRegistry.def
Arthur Eubanks [Tue, 23 Jun 2020 23:11:59 +0000 (16:11 -0700)]
[NewPM] Add SimpleLoopUnswitchPass to PassRegistry.def

Summary:
Seems to just be missing from PassRegistry.def.

Makes the number of check-llvm failures under new PM go from 2619 to 2581.

Reviewers: hans, ychen, asbirlea, leonardchan

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NewPM] Handle -simplifycfg in opt
Arthur Eubanks [Tue, 23 Jun 2020 23:11:59 +0000 (16:11 -0700)]
[NewPM] Handle -simplifycfg in opt

Summary:
-simplifycfg is the legacy pass name for SimplifyCFGPass.

There is already -simplify-cfg in FUNCTION_PASS_WITH_PARAMS which
handles options for SimplifyCFGPass. Maybe that should be renamed to
-simplifycfg as well?

This reduces the number of check-llvm failures under NewPM from 2619 to 2392.

Reviewers: hans, leonardchan, asbirlea, ychen

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[llvm] Release-mode ML InlineAdvisor
Mircea Trofin [Tue, 9 Jun 2020 21:50:50 +0000 (14:50 -0700)]
[llvm] Release-mode ML InlineAdvisor

Summary:
This implementation uses a pre-trained model which is statically
compiled into a native function.

RFC: http://lists.llvm.org/pipermail/llvm-dev/2020-April/140763.html

Reviewers: davidxl, jdoerfert, dblaikie

Subscribers: mgorny, eraman, hiraditya, arphaman, llvm-commits

Tags: #llvm

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

4 years ago[llvm] Added support for stand-alone cmake object libraries.
Mircea Trofin [Tue, 9 Jun 2020 19:44:07 +0000 (12:44 -0700)]
[llvm] Added support for stand-alone cmake object libraries.

Summary:
Currently, add_llvm_library would create an OBJECT library alongside
of a STATIC / SHARED library, but losing the link interface (its
elements would become dependencies instead). To support scenarios
where linking an object library also brings in its usage
requirements, this patch adds support for 'stand-alone' OBJECT
libraries - i.e. without an accompanying SHARED/STATIC library, and
maintaining the link interface defined by the user.

This is useful for cases where, for example, we want to build a part
of a component separately. Using a STATIC target would incur the risk
that symbols not referenced in the consumer would be dropped (which may
be undesirable).

The current application is the ML part of Analysis. It should be part
of the Analysis component, so it may reference other analyses; and (in
upcoming changes) it has dependencies on optional libraries.

Reviewers: karies, davidxl, beanz, phosek, smeenai

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[VectorCombine] give invalid index value a name; NFC
Sanjay Patel [Wed, 24 Jun 2020 14:11:18 +0000 (10:11 -0400)]
[VectorCombine] give invalid index value a name; NFC

4 years ago[VectorCombine] add tests for extract + cmp + binop; NFC
Sanjay Patel [Tue, 23 Jun 2020 16:12:54 +0000 (12:12 -0400)]
[VectorCombine] add tests for extract + cmp + binop; NFC

4 years agoWebAssembly: Don't store MachineFunction in MachineFunctionInfo
Matt Arsenault [Thu, 18 Jun 2020 14:32:32 +0000 (10:32 -0400)]
WebAssembly: Don't store MachineFunction in MachineFunctionInfo

Soon it will be disallowed to depend on MachineFunction state in the
constructor. This was only being used to get the MachineRegisterInfo
for an assert, which I'm not sure is necessarily worth it. I would
think any missing defs would be caught by the verifier later instead.

4 years agoCloning.h - reduce AliasAnalysis.h include to forward declarations. NFC.
Simon Pilgrim [Wed, 24 Jun 2020 14:12:11 +0000 (15:12 +0100)]
Cloning.h - reduce AliasAnalysis.h include to forward declarations. NFC.

Fix implicit include dependencies in source files.

4 years ago[AST][RecoveryExpr] Add error-bit TemplateArgument
Haojian Wu [Wed, 24 Jun 2020 14:14:34 +0000 (16:14 +0200)]
[AST][RecoveryExpr] Add error-bit TemplateArgument

Summary: We are missing the error-bit somehow if the error-bit is propagated
through the code path: "error type/expr" -> "template argument" ->
"template specialization type", which will lead to crashes.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[lldb] Refactor Scalar::TruncOrExtendTo
Pavel Labath [Wed, 24 Jun 2020 13:26:42 +0000 (15:26 +0200)]
[lldb] Refactor Scalar::TruncOrExtendTo

The "type" argument to the function is mostly useless -- the only
interesting aspect of it is signedness. Pass signedness directly and
compute the value of bits and signedness fields -- that's exactly
what the single caller of this function does.

4 years ago[AMDGPU] Avoid redundant mode register writes
Tim Corringham [Fri, 19 Jun 2020 17:23:56 +0000 (18:23 +0100)]
[AMDGPU] Avoid redundant mode register writes

Summary:
The SIModeRegister pass attempts to generate the minimal number of
writes to the mode register. However it was failing to correctly
deal with some loops, resulting in some redundant setreg instructions
being inserted.

This change amends the pass to avoid generating these redundant
instructions.

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

Tags: #llvm

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

4 years ago[DSE,MSSA] Add missing -enable-dse-memoryssa flag to test.
Florian Hahn [Wed, 24 Jun 2020 13:02:09 +0000 (14:02 +0100)]
[DSE,MSSA] Add missing -enable-dse-memoryssa flag to test.

4 years ago[llvm-readobj] - Don't crash when a broken GNU hash table is dumped with --hash-symbols.
Georgii Rymar [Wed, 24 Jun 2020 10:23:04 +0000 (13:23 +0300)]
[llvm-readobj] - Don't crash when a broken GNU hash table is dumped with --hash-symbols.

Start using the `checkGNUHashTable` helper which was recently introduced to report
a proper warning when a GNU hash table goes past the end of the file.

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

4 years agoLoads.h - reduce AliasAnalysis.h include to forward declarations. NFC.
Simon Pilgrim [Wed, 24 Jun 2020 12:17:44 +0000 (13:17 +0100)]
Loads.h - reduce AliasAnalysis.h include to forward declarations. NFC.

Fix implicit include dependencies in source files.