platform/upstream/llvm.git
4 years ago[llvm-objdump] Display locations of variables alongside disassembly
Oliver Stannard [Tue, 17 Mar 2020 14:21:42 +0000 (14:21 +0000)]
[llvm-objdump] Display locations of variables alongside disassembly

This adds the --debug-vars option to llvm-objdump, which prints
locations (registers/memory) of source-level variables alongside the
disassembly based on DWARF info. A vertical line is printed for each
live-range, with a label at the top giving the variable name and
location, and the position and length of the line indicating the program
counter range in which it is valid.

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

4 years ago[clangd] Enable async preambles by default
Kadir Cetinkaya [Tue, 7 Jul 2020 10:30:58 +0000 (12:30 +0200)]
[clangd] Enable async preambles by default

Summary:
We've been testing this internally for a couple weeks now and it seems
to be stable enough. Let's flip the flag before branch cut to increase testing
coverage and have enough time to revert if need be.

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

Tags: #clang

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

4 years ago[PredicateInfo] Add additional RenamedOp field to PB.
Florian Hahn [Thu, 9 Jul 2020 08:43:16 +0000 (09:43 +0100)]
[PredicateInfo] Add additional RenamedOp field to PB.

 OriginalOp of a predicate always refers to the original IR
value that was renamed. So for nested predicates of the same value, it
will always refer to the original IR value.

For the use in SCCP however, we need to find the renamed value that is
currently used in the condition associated with the predicate. This
patch adds a new RenamedOp field to do exactly that.

NewGVN currently relies on the existing behavior to merge instruction
metadata. A test case to check for exactly that has been added in
195fa4bfae10.

Reviewers: efriedma, davide, nikic

Reviewed By: nikic

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

4 years ago[CodeGen] Matching promoted type for 16-bit integer bitcasts from fp16 operand
Lucas Prates [Thu, 25 Jun 2020 14:01:02 +0000 (15:01 +0100)]
[CodeGen] Matching promoted type for 16-bit integer bitcasts from fp16 operand

Summary:
When legalizing a biscast operation from an fp16 operand to an i16 on a
target that requires both input and output types to be promoted to
32-bits, an assertion can fail when building the new node due to a
mismatch between the the operation's result size and the type specified to
the node.

This patches fix the issue by making sure the bit width of the types
match for the FP_TO_FP16 node, covering the difference with an extra
ANYEXTEND operation.

Reviewers: ostannard, efriedma, pirama, jmolloy, plotfi

Reviewed By: efriedma

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[MC] Simplify the logic of applying fixup for fragments, NFCI
Shengchen Kan [Thu, 9 Jul 2020 07:06:27 +0000 (15:06 +0800)]
[MC] Simplify the logic of applying fixup for fragments, NFCI

Replace mutiple `if else`  clauses with a `switch` clause and remove redundant checks. Before this patch, we need to add a statement like `if(!isa<MCxxxFragment>(Frag)) `  here each time we add a new kind of `MCEncodedFragment` even if it has no fixups. After this patch, we don't need to do that.

Reviewed By: MaskRay

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

4 years agoFix return status of AtomicExpandPass
serge-sans-paille [Thu, 9 Jul 2020 07:36:41 +0000 (09:36 +0200)]
Fix return status of AtomicExpandPass

Correctly reflect change in the return status.

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

4 years ago[clangd] Fix error handling in config.yaml parsing.
Sam McCall [Wed, 8 Jul 2020 22:13:54 +0000 (00:13 +0200)]
[clangd] Fix error handling in config.yaml parsing.

Summary:
A few things were broken:
 - use of Document::parseBlockNode() is incorrect and prevents moving to the
   next doc in error cases. Use getRoot() instead.
 - bailing out in the middle of iterating over a list/dict isn't allowed,
   unless you are going to throw away the parser: the next skip() asserts.
   Always consume all items.
 - There were two concepts of fatal errors: error-diagnostics and drop-fragment.
   (The latter is the "return false" case in the parser). They didn't coincide.
   Now, parser errors and explicitly emitted error diagnostics are fatal.

Fixes https://github.com/clangd/clangd/issues/452

Reviewers: hokein

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

Tags: #clang

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

4 years ago[PowerPC] Only make copies of registers on stack in variadic function when va_start...
Kai Luo [Thu, 9 Jul 2020 06:51:49 +0000 (06:51 +0000)]
[PowerPC] Only make copies of registers on stack in variadic function when va_start is called

On PPC64, for a variadic function, if va_start is not called, it won't
access any variadic argument on stack, thus we can save stores of
registers used to pass arguments.

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

4 years ago[StackSafety,NFC] Update documentation
Vitaly Buka [Thu, 9 Jul 2020 06:57:13 +0000 (23:57 -0700)]
[StackSafety,NFC] Update documentation

 It's follow up for D80908

Reviewed By: tejohnson

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

4 years ago[X86] Remove unnecessary union from getHostCPUFeatures. NFC
Craig Topper [Thu, 9 Jul 2020 06:40:37 +0000 (23:40 -0700)]
[X86] Remove unnecessary union from getHostCPUFeatures. NFC

This seems to be leftover copied from an older implementation
of getHostCPUName where we needed this to check the name of
CPU vendor. We don't check the CPU vendor at all in
getHostCPUFeatures so this union and the variable are unneeded.

4 years agoIncrease DIAG_SIZE_AST as we have hit it.
Douglas Yung [Thu, 9 Jul 2020 06:29:47 +0000 (23:29 -0700)]
Increase DIAG_SIZE_AST as we have hit it.

4 years ago[OpenMP] Make complex soft-float functions on the GPU weak definitions
Johannes Doerfert [Thu, 9 Jul 2020 06:04:16 +0000 (01:04 -0500)]
[OpenMP] Make complex soft-float functions on the GPU weak definitions

To avoid linkage errors we have to ensure the linkage allows multiple
definitions of these compiler inserted functions. Since they are on the
cold path of complex computations, we want to avoid `inline`. Instead,
we opt for `weak` and `noinline` for now.

4 years ago[libc++] Fix test failures in C++14 mode
Louis Dionne [Thu, 9 Jul 2020 05:13:32 +0000 (01:13 -0400)]
[libc++] Fix test failures in C++14 mode

4 years ago[ORC] Modify LazyCallThroughManager to support asynchronous resolution.
Lang Hames [Wed, 8 Jul 2020 04:32:28 +0000 (21:32 -0700)]
[ORC] Modify LazyCallThroughManager to support asynchronous resolution.

Asynchronous resolution is a better fit for handling reentry over
IPC/RPC where we want to avoid blocking a communication handler/thread.

4 years ago[DWARFYAML][unittest] Refactor parseDWARFYAML().
Xing GUO [Thu, 9 Jul 2020 03:59:15 +0000 (11:59 +0800)]
[DWARFYAML][unittest] Refactor parseDWARFYAML().

In this change, `parseDWARFYAML()` is refactored to be able to parse
YAML decription into different data structures. We don't have to craft
the whole DWARF structure for a small test in the future.

Reviewed By: jhenderson

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

4 years agoFix a typo in an error message.
Eric Christopher [Thu, 9 Jul 2020 03:42:22 +0000 (20:42 -0700)]
Fix a typo in an error message.

4 years agoAdd missing CMake bool canonicalizations.
Stella Laurenzo [Thu, 9 Jul 2020 00:54:56 +0000 (17:54 -0700)]
Add missing CMake bool canonicalizations.

Summary:
* This allows these flags to be passed on the command line with normal CMake bool-interpreted values like ON/OFF instead of requiring 0/1.
* As-is, if passing ON/OFF, these will cause a parse error in lit.site.cfg.py because Python tries to interpret the string literally.

Reviewers: stephenneuendorffer

Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, grosul1, Kayjukh, jurahul, msifontes

Tags: #mlir

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

4 years ago[Legalizer] Fix wrong operand in split vector helper
Qiu Chaofan [Wed, 8 Jul 2020 15:57:44 +0000 (23:57 +0800)]
[Legalizer] Fix wrong operand in split vector helper

This should be a typo introduced in D69275, which may cause an unknown
segment fault in getNode.

Reviewed By: uweigand

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

4 years ago[mlir] Print 0 element DenseElementsAttr as dense<> to fix parser bugs with expected...
River Riddle [Thu, 9 Jul 2020 00:44:27 +0000 (17:44 -0700)]
[mlir] Print 0 element DenseElementsAttr as dense<> to fix parser bugs with expected shape.

Depending on where the 0 dimension is within the shape, the parser will currently reject .mlir generated by the printer.

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

4 years agoImprove diagnostics for constant evaluation that fails because a
Richard Smith [Wed, 8 Jul 2020 23:26:01 +0000 (16:26 -0700)]
Improve diagnostics for constant evaluation that fails because a
variable's initializer is not known.

The hope is that a better diagnostic for this case will reduce the rate
at which duplicates of non-bug PR41093 are reported.

4 years ago[flang] Fix negative unit number hashing
peter klausler [Wed, 8 Jul 2020 20:09:53 +0000 (13:09 -0700)]
[flang] Fix negative unit number hashing

Ensure that external unit number hashing produces a valid
index for a negative unit number, viz. a NEWUNIT=.

Reviewed By: sscalpone

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

4 years agoFix debugserver reporting of deployment target
Adrian Prantl [Thu, 9 Jul 2020 00:06:27 +0000 (17:06 -0700)]
Fix debugserver reporting of deployment target

This patch fixes debugserver incorrectly returning the SDK version
instead of the minimum deployment target version.

rdar://problem/65001691

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

4 years ago[lit] Add --show-xxx command line options
Julian Lettner [Fri, 19 Jun 2020 20:32:18 +0000 (13:32 -0700)]
[lit] Add --show-xxx command line options

Provide `--show-xxx` flags for all non-failure result codes, just as we
already do for `--show-xfail` and `--show-unsupported`.

Reviewed By: jdenny

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

4 years ago[openmp] Use switch in isAllowedClauseForDirective instead of multiple if
Valentin Clement [Wed, 8 Jul 2020 23:54:34 +0000 (19:54 -0400)]
[openmp] Use switch in isAllowedClauseForDirective instead of multiple if

Summary:
Change the test in isAllowedClauseForDirective from if with multiple conditions
to a main switch on directive and then switches on clause for each directive. Version
check is still done with a condition in the return statment.

Reviewers: jdoerfert, jdenny

Reviewed By: jdenny

Subscribers: yaxunl, guansong, sstefan1, llvm-commits

Tags: #llvm

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

4 years ago[NFC] Fix some docs warnings
Mitch Phillips [Wed, 8 Jul 2020 23:29:29 +0000 (16:29 -0700)]
[NFC] Fix some docs warnings

Summary:
Fixes two minor issues in the docs present under `ninja docs-llvm-html`:

1 - A header is too small:
```
Warning, treated as error:
llvm/llvm/docs/Passes.rst:70:Title underline too short.

``-basic-aa``: Basic Alias Analysis (stateless AA impl)
------------------------------------------------------
```

2 - Multiple definitions on a non-anonymous target (llvm-dev mailing list):
```
Warning, treated as error:
llvm/llvm/docs/DeveloperPolicy.rst:3:Duplicate explicit target name: "llvm-dev mailing list".
```

Reviewers: lattner

Reviewed By: lattner

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[Sanitizer]: Require !android for protoent test
Gui Andrade [Wed, 8 Jul 2020 23:07:46 +0000 (23:07 +0000)]
[Sanitizer]: Require !android for protoent test

4 years agoDAG: Remove redundant finalizeLowering call
Matt Arsenault [Wed, 8 Jul 2020 22:38:40 +0000 (18:38 -0400)]
DAG: Remove redundant finalizeLowering call

9cac4e6d1403554b06ec2fc9d834087b1234b695/D32628 intended to eliminate
this, and move all isel pseudo expansion to FinalizeISel. This was a
bad rebase or something, and failed to actually delete this call.

GlobalISel also has a redundant call of finalizeLowering. However, it
requires more work to remove it since it currently triggers a lot of
verifier errors in tests.

4 years ago[gn build] Port d999cbc9883
LLVM GN Syncbot [Wed, 8 Jul 2020 22:37:03 +0000 (22:37 +0000)]
[gn build] Port d999cbc9883

4 years ago[OpenMP] Initial support for std::complex in target regions
Johannes Doerfert [Sun, 12 Apr 2020 07:10:28 +0000 (02:10 -0500)]
[OpenMP] Initial support for std::complex in target regions

This simply follows the scheme we have for other wrappers. It resolves
the current link problem, e.g., `__muldc3 not found`, when std::complex
operations are used on a device.

This will not allow complex make math function calls to work properly,
e.g., sin, but that is more complex (pan intended) anyway.

Reviewed By: tra, JonChesterfield

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

4 years agoUpdated the list of supported platforms in LLDB to include Apple silicon.
Adrian Prantl [Wed, 8 Jul 2020 22:30:21 +0000 (15:30 -0700)]
Updated the list of supported platforms in LLDB to include Apple silicon.

4 years agoDAG: Remove redundant handling of reg fixups
Matt Arsenault [Wed, 8 Jul 2020 22:19:23 +0000 (18:19 -0400)]
DAG: Remove redundant handling of reg fixups

It looks like 9cac4e6d1403554b06ec2fc9d834087b1234b695 accidentally
added a second copy of this from a bad rebase or something. This
second copy was added, and the finalizeLowering call was not deleted
as intended.

4 years ago[InstSimplify] Add test cases for opportunities to fold select ?, X, undef -> X when...
Craig Topper [Wed, 8 Jul 2020 22:19:49 +0000 (15:19 -0700)]
[InstSimplify] Add test cases for opportunities to fold select ?, X, undef -> X when we can prove X isn't poison

Part of addressing post-commit feedback from D83360

4 years agoUnify the ExecutionContextScope computation in Materializer.
Adrian Prantl [Wed, 8 Jul 2020 21:35:02 +0000 (14:35 -0700)]
Unify the ExecutionContextScope computation in Materializer.

This is an NFC cleanup for Clang, and a bugfix for the Swift
branch. In swift-lldb one target may have multiple scratch
TypeSystems, so it is important to pick the one that belongs to the
current frame, rather than the one for the current target.

<rdar://problem/65001402>

4 years ago[mlir] [VectorOps] Expose lowering pass options programmatically
aartbik [Wed, 8 Jul 2020 21:58:04 +0000 (14:58 -0700)]
[mlir] [VectorOps] Expose lowering pass options programmatically

The ConvertVectorToLLVM pass defines options that can be passed
on the command line (currently only reassociation of FP reductions
through -convert-vector-to-llvm='reassociate-fp-reductions). This
CL enables setting these options programmatically (forward looking
to more options than just reassociation, as well as setting the
values from code rather than command line).

Reviewed By: nicolasvasilache

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

4 years agosanitizers: Add interceptors for getproto{ent,byname,bynumber}_r
Gui Andrade [Tue, 7 Jul 2020 17:05:41 +0000 (17:05 +0000)]
sanitizers: Add interceptors for getproto{ent,byname,bynumber}_r

This also allows intercepting these getprotoent functions on Linux as
well, since Linux exposes them.

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

4 years agoPR46640: Permit the first parameter of a destroying 'operator delete' to
Richard Smith [Wed, 8 Jul 2020 21:26:18 +0000 (14:26 -0700)]
PR46640: Permit the first parameter of a destroying 'operator delete' to
be dependent if it names the right type.

This matches the GCC behavior, but no longer matches the standard
wording. However, the standard wording in this case is not in line with
the intent, which was to require the enclosing class type to be named
directly. I've reported this wording oversight to the committee.

4 years agoGlobalISel: Verify G_BITCAST changes the type
Matt Arsenault [Tue, 9 Jun 2020 01:32:39 +0000 (21:32 -0400)]
GlobalISel: Verify G_BITCAST changes the type

Updated the AArch64 tests the best I could with my vague, inferred
understanding of AArch64 register banks. As far as I can tell, there
is only one 32-bit/64-bit type which will use the gpr register bank,
so we have to use the fpr bank for the other operand.

4 years ago[libc++] Make sure the ENABLE_FILESYSTEM variable is always bound
Louis Dionne [Wed, 8 Jul 2020 20:27:33 +0000 (16:27 -0400)]
[libc++] Make sure the ENABLE_FILESYSTEM variable is always bound

The script always fails otherwise, since we run with 'set -u'

4 years ago[opt] Remove obsolete --quiet option
Arthur Eubanks [Wed, 8 Jul 2020 20:20:34 +0000 (13:20 -0700)]
[opt] Remove obsolete --quiet option

 git blame shows these were last touched in 2004?
 Obsoleted in r13844.

Reviewed By: hans

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

4 years ago[libclang] Fix crash when visiting a captured VLA
Christian Kandeler [Wed, 8 Jul 2020 19:19:49 +0000 (12:19 -0700)]
[libclang] Fix crash when visiting a captured VLA

Array returned by LambdaExpr::capture_inits() can contain nullptrs.

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

4 years agoRevert "[lldb/API] Overwrite variables with SBLaunchInfo::SetEnvironment(append=true)"
Davide Italiano [Wed, 8 Jul 2020 20:00:29 +0000 (13:00 -0700)]
Revert "[lldb/API] Overwrite variables with SBLaunchInfo::SetEnvironment(append=true)"

This reverts commit 695b33a56919af8873eecb47cb83fa17a271e99f beacuse
it broke the macOS bot.

4 years agoRecover more gracefully from stack exhaustion during template argument
Richard Smith [Wed, 8 Jul 2020 20:04:37 +0000 (13:04 -0700)]
Recover more gracefully from stack exhaustion during template argument
deduction.

Template argument deduction can trigger substitution, both with
explicitly-specified template arguments and with deduced template
arguments in various ways. We previously had no check for stack
exhaustion along some of those codepaths, making it fairly easy to crash
clang with a template resulting in a substitution that referred back to
that same template. We should now produce a proper diagnostic for such
cases rather than crashing.

4 years ago[InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X transforms
Craig Topper [Wed, 8 Jul 2020 18:56:01 +0000 (11:56 -0700)]
[InstSimplify] Remove select ?, undef, X -> X and select ?, X, undef -> X transforms

As noted here https://lists.llvm.org/pipermail/llvm-dev/2016-October/106182.html and by alive2, this transform isn't valid. If X is poison this potentially propagates poison when it shouldn't.

This same transform still exists in DAGCombiner.

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

4 years agoRevert "[NFC] Separate Peeling Properties into its own struct"
Nikita Popov [Wed, 8 Jul 2020 19:43:06 +0000 (21:43 +0200)]
Revert "[NFC] Separate Peeling Properties into its own struct"

This reverts commit 0369dc98f958a1ca2ec05f1897f091129bb16e8a.

Many failing tests.

4 years ago[InstSimplify] Handle not inserted instruction gracefully (PR46638)
Nikita Popov [Wed, 8 Jul 2020 19:29:43 +0000 (21:29 +0200)]
[InstSimplify] Handle not inserted instruction gracefully (PR46638)

When simplifying comparisons using a dominating assume, bail out
if the context instruction is not inserted.

4 years agoReword description of ISD::BUILD_VECTOR
Cameron McInally [Wed, 8 Jul 2020 19:38:52 +0000 (14:38 -0500)]
Reword description of ISD::BUILD_VECTOR

Move operand type restriction to the end of the description. This
hopefully makes the intention more clear.

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

4 years ago[Solaris] Fix Solaris build bots
Christopher Tetreault [Wed, 8 Jul 2020 19:11:42 +0000 (12:11 -0700)]
[Solaris] Fix Solaris build bots

Reviewers: ro

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoTighten description of ISD::BUILD_VECTOR
Cameron McInally [Wed, 8 Jul 2020 19:03:50 +0000 (14:03 -0500)]
Tighten description of ISD::BUILD_VECTOR

VerifySDNode(...) in SelectionDAG.cpp shows that the operands of a BUILD_VECTOR must all be the same type. This patch cleans up the comment in ISDOpcodes.h to make that more obvious. Also, remove the requirement that the number of elements must be a power-of-2. That's not true.

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

4 years ago[LLVM] Accept `noundef` attribute in function definitions/calls
Gui Andrade [Wed, 8 Jul 2020 17:22:48 +0000 (17:22 +0000)]
[LLVM] Accept `noundef` attribute in function definitions/calls

The `noundef` attribute indicates an argument or return value which
may never have an undef value representation.

This patch allows LLVM to parse the attribute.

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

4 years ago[LangRef] Introduce `noundef` attribute for fully defined function params
Gui Andrade [Mon, 22 Jun 2020 16:49:41 +0000 (16:49 +0000)]
[LangRef] Introduce `noundef` attribute for fully defined function params

LLVM currently does not require function parameters or return values
to be fully initialized, and does not care if they are poison. This can
be useful if the frontend ABI makes no such demands, but may prevent
helpful backend transformations in case they do. Specifically, the C
and C++ languages require all scalar function operands to be fully
determined.

Introducing this attribute is of particular use to MemorySanitizer
today, although other transformations may benefit from it as well.
We can modify MemorySanitizer instrumentation to provide modest (17%)
space savings where `frozen` is present.

This commit only adds the attribute to the Language Reference, and
the actual implementation of the attribute will follow in a separate
commit.

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

4 years ago[libc++] Install PSTL when installing libc++ with parallel algorithms enabled
Louis Dionne [Wed, 8 Jul 2020 19:00:31 +0000 (15:00 -0400)]
[libc++] Install PSTL when installing libc++ with parallel algorithms enabled

4 years ago[NFC] Separate Peeling Properties into its own struct
Sidharth Baveja [Wed, 8 Jul 2020 18:59:01 +0000 (18:59 +0000)]
[NFC] Separate Peeling Properties into its own struct

Summary:
This patch makes the peeling properties of the loop accessible by other loop transformations.

Author: sidbav (Sidharth Baveja)

Reviewers: Whitney (Whitney Tsang), Meinersbur (Michael Kruse), skatkov (Serguei Katkov), ashlykov (Arkady Shlykov), bogner (Justin Bogner), hfinkel (Hal Finkel)

Reviewed By: Meinersbur (Michael Kruse)

Subscribers: fhahn (Florian Hahn), hiraditya (Aditya Kumar), llvm-commits, LLVM

Tag: LLVM

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

4 years agoRevert "[NFC] Separate Peeling Properties into its own struct"
Anh Tuyen Tran [Wed, 8 Jul 2020 18:58:05 +0000 (18:58 +0000)]
Revert "[NFC] Separate Peeling Properties into its own struct"

This reverts commit fead250b439bbd4ec0f21e6a52d0c174e5fcdf5a.

4 years ago[NFC] Separate Peeling Properties into its own struct
Anh Tuyen Tran [Wed, 8 Jul 2020 18:56:03 +0000 (18:56 +0000)]
[NFC] Separate Peeling Properties into its own struct

Summary:
This patch makes the peeling properties of the loop accessible by other loop transformations.

Author: sidbav (Sidharth Baveja)

Reviewers: Whitney (Whitney Tsang), Meinersbur (Michael Kruse), skatkov (Serguei Katkov), ashlykov (Arkady Shlykov), bogner (Justin Bogner), hfinkel (Hal Finkel)

Reviewed By: Meinersbur (Michael Kruse)

Subscribers: fhahn (Florian Hahn), hiraditya (Aditya Kumar), llvm-commits, LLVM

Tag: LLVM

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

4 years ago[pstl] Do not install the __config_site.in file
Louis Dionne [Wed, 8 Jul 2020 18:51:30 +0000 (14:51 -0400)]
[pstl] Do not install the __config_site.in file

The generated version of the file is already installed -- we shouldn't
install the pre-generation version of the file.

4 years ago[DAGCombiner] clean up in mergeConsecutiveStores(); NFC
Sanjay Patel [Wed, 8 Jul 2020 18:47:21 +0000 (14:47 -0400)]
[DAGCombiner] clean up in mergeConsecutiveStores(); NFC

4 years ago[DAGCombiner] fix code comment and improve readability; NFC
Sanjay Patel [Wed, 8 Jul 2020 17:02:18 +0000 (13:02 -0400)]
[DAGCombiner] fix code comment and improve readability; NFC

4 years ago[ELF] Enforce double-dash form for --warn-backrefs-exclude
Fangrui Song [Wed, 8 Jul 2020 18:43:48 +0000 (11:43 -0700)]
[ELF] Enforce double-dash form for --warn-backrefs-exclude

This is an LLD-specific option. We have enforced double-dash forms for
other options (reduce collision with short options) but missed this one.

4 years ago[pstl] Fix a few errors when running PSTL tests through the libc++ test suite
Louis Dionne [Wed, 8 Jul 2020 18:38:59 +0000 (14:38 -0400)]
[pstl] Fix a few errors when running PSTL tests through the libc++ test suite

4 years agoSILoadStoreOptimizer: add support for GFX10 image instructions
Jay Foad [Thu, 11 Jun 2020 16:42:30 +0000 (17:42 +0100)]
SILoadStoreOptimizer: add support for GFX10 image instructions

GFX10 image instructions use one or more address operands starting at
vaddr0, instead of a single vaddr operand, to allow for NSA forms.

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

4 years ago[AMDGPU] Fix and simplify AMDGPULegalizerInfo::legalizeUDIV_UREM32Impl
Jay Foad [Mon, 22 Jun 2020 16:17:17 +0000 (17:17 +0100)]
[AMDGPU] Fix and simplify AMDGPULegalizerInfo::legalizeUDIV_UREM32Impl

Use the algorithm from AMDGPUCodeGenPrepare::expandDivRem32.

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

4 years ago[AMDGPU] Fix and simplify AMDGPUTargetLowering::LowerUDIVREM
Jay Foad [Mon, 22 Jun 2020 16:11:58 +0000 (17:11 +0100)]
[AMDGPU] Fix and simplify AMDGPUTargetLowering::LowerUDIVREM

Use the algorithm from AMDGPUCodeGenPrepare::expandDivRem32.

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

4 years ago[AMDGPU] Fix and simplify AMDGPUCodeGenPrepare::expandDivRem32
Jay Foad [Mon, 22 Jun 2020 14:27:37 +0000 (15:27 +0100)]
[AMDGPU] Fix and simplify AMDGPUCodeGenPrepare::expandDivRem32

Fix the division/remainder algorithm by adding a second quotient
refinement step, which is required in some cases like
0xFFFFFFFFu / 0x11111111u (https://bugs.llvm.org/show_bug.cgi?id=46212).

Also document, rewrite and simplify it by ensuring that we always have a
lower bound on inv(y), which simplifies the UNR step and the quotient
refinement steps.

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

4 years ago[SVE] Remove calls to VectorType::getNumElements from Scalar
Christopher Tetreault [Wed, 8 Jul 2020 18:00:57 +0000 (11:00 -0700)]
[SVE] Remove calls to VectorType::getNumElements from Scalar

Reviewers: efriedma, fhahn, reames, kmclaughlin, sdesmalen

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years ago[libc++] Reimplement platform detection features without running on the test host
Louis Dionne [Wed, 8 Jul 2020 18:04:45 +0000 (14:04 -0400)]
[libc++] Reimplement platform detection features without running on the test host

It's sufficient to sniff the platform we're running on using the compiler
macros -- we don't need to run any code.

4 years ago[test] Add REQUIRES: x86-registered-target to tools/obj2yaml/COFF/bss.s
Fangrui Song [Wed, 8 Jul 2020 17:53:30 +0000 (10:53 -0700)]
[test] Add REQUIRES: x86-registered-target to tools/obj2yaml/COFF/bss.s

4 years ago[Support] Define llvm::parallel::strategy for -DLLVM_ENABLE_THREADS=off builds after...
Fangrui Song [Wed, 8 Jul 2020 17:50:53 +0000 (10:50 -0700)]
[Support] Define llvm::parallel::strategy for -DLLVM_ENABLE_THREADS=off builds after D76885

4 years agoRemove the unnecessary `is_nothrow_swappable` condition in `swap`.
Michael Park [Wed, 8 Jul 2020 17:46:02 +0000 (10:46 -0700)]
Remove the unnecessary `is_nothrow_swappable` condition in `swap`.

Thanks to @lewissbaker who pointed out the unnecessary condition in
https://reviews.llvm.org/D81954#inline-756872. Since this codepath does not
make use of `swap` anyway (that codepath is a different branch), we can safely
remove this condition and produce better codegen when all types are nothrow
movable but are potentially-throwing swappable.

See codegen in https://gcc.godbolt.org/z/uDFZjz

Reviewed By: ldionne, #libc

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

4 years ago[X86] Enabled a bunch of 64-bit Interlocked* functions intrinsics on 32-bit Windows...
Craig Topper [Wed, 8 Jul 2020 17:39:56 +0000 (10:39 -0700)]
[X86] Enabled a bunch of 64-bit Interlocked* functions intrinsics on 32-bit Windows to match recent MSVC

This enables _InterlockedAnd64/_InterlockedOr64/_InterlockedXor64/_InterlockedDecrement64/_InterlockedIncrement64/_InterlockedExchange64/_InterlockedExchangeAdd64/_InterlockedExchangeSub64 on 32-bit Windows

The backend already knows how to expand these to a loop using cmpxchg8b on 32-bit targets.

Fixes PR46595

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

4 years agohwasan: Don't pass the tagged-globals target-feature to non-aarch64 backends.
Craig Topper [Wed, 8 Jul 2020 17:17:44 +0000 (10:17 -0700)]
hwasan: Don't pass the tagged-globals target-feature to non-aarch64 backends.

The other backends don't know what this feature is and print a
message to stderr.

I recently tried to rework some target feature stuff in X86 and
this unknown feature tripped an assert I added.

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

4 years ago[ELF] Rename canRelax to toExecRelax. NFC
Fangrui Song [Wed, 8 Jul 2020 17:27:31 +0000 (10:27 -0700)]
[ELF] Rename canRelax to toExecRelax. NFC

In the absence of TLS relaxation (rewrite of code sequences),
there is still an applicable optimization:

[gd]: General Dynamic: resolve DTPMOD to 1 and/or resolve DTPOFF statically

All the other relaxations are only performed when transiting to
executable (`!config->shared`).
Since [gd] is handled differently, we can fold `!config->shared` into canRelax
and simplify its use sites. Rename the variable to reflect to new semantics.

Reviewed By: grimar, psmith

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

4 years ago[test] Run llvm/test/**/*.yaml & don't run llvm/test/**/*.cxx (not exist)
Fangrui Song [Wed, 8 Jul 2020 17:22:49 +0000 (10:22 -0700)]
[test] Run llvm/test/**/*.yaml & don't run llvm/test/**/*.cxx (not exist)

This patch extends D58439 (`llvm/test/{yaml2obj,obj2yaml}/**/*.yaml`) and runs all
`llvm/test/**/*.yaml`

Many directories have configured `.yaml` (see the deleted lit.local.cfg
files). Yet still some don't configure .yaml and have caused stale tests:

8c5825befb7bbb2e76f7eccedc6d3bf26e9b2a6a test/llvm-readobj
bdc3134e237737dd46b51cd1ecd41ecbbe9f921a test/ExecutionEngine

Just hoist .yaml to `llvm/test/lit.cfg.py`. Also delete .cxx which is
not used.  The number of tests running on my machine increases from 38304 to 38309.
The list of new tests:

```
ExecutionEngine/RuntimeDyld/X86/ELF_x86-64_none.yaml
Object/archive-error-tmp.txt
tools/llvm-ar/coff-weak.yaml
tools/llvm-readobj/ELF/verneed-flags.yaml
tools/obj2yaml/COFF/bss.s
```

Reviewed By: grimar, jhenderson, rupprecht

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

4 years ago[ELF] Add -z dead-reloc-in-nonalloc=<section_glob>=<value>
Fangrui Song [Wed, 8 Jul 2020 17:10:43 +0000 (10:10 -0700)]
[ELF] Add -z dead-reloc-in-nonalloc=<section_glob>=<value>

... to customize the tombstone value we use for an absolute relocation
referencing a discarded symbol. This can be used as a workaround when
some debug processing tool has trouble with current -1 tombstone value
(https://bugs.chromium.org/p/chromium/issues/detail?id=1102223#c11 )

For example, to get the current built-in rules (not considering the .debug_line special case for ICF):

```
-z dead-reloc-in-nonalloc='.debug_*=0xffffffffffffffff'
-z dead-reloc-in-nonalloc=.debug_loc=0xfffffffffffffffe
-z dead-reloc-in-nonalloc=.debug_ranges=0xfffffffffffffffe
```

To get GNU ld (as of binutils 2.35)'s behavior:

```
-z dead-reloc-in-nonalloc='*=0'
-z dead-reloc-in-nonalloc=.debug_ranges=1
```

This option has other use cases. For example, if we want to check
whether a non-SHF_ALLOC section has dead relocations.
With this patch, we can run a regular LLD and run another with a special
-z dead-reloc-in-nonalloc=, then compare their output.

Reviewed By: thakis

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

4 years ago[flang] Fix a crash when cosubscript list is empty
Pete Steinfeld [Wed, 8 Jul 2020 17:05:04 +0000 (10:05 -0700)]
[flang] Fix a crash when cosubscript list is empty

Summary:
When there are errors in the evaluation of every cosubscript expression in a
coindexed object, the compiler would crash.  I fixed this by just checking to
see if there were errors in the evaluation of the cosubscripts before
constructing the `DataRef` for the coindexed object.

Reviewers: klausler, tskeith, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[CUDA][HIP] Let lambda be host device by default
Yaxun (Sam) Liu [Fri, 17 Apr 2020 03:51:40 +0000 (23:51 -0400)]
[CUDA][HIP] Let lambda be host device by default

This patch let lambda be host device by default and adds diagnostics for
capturing host variable by reference in device lambda.

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

4 years ago[RecordLayout] Fix ItaniumRecordLayoutBuilder so that is grabs the correct bases...
shafik [Wed, 8 Jul 2020 17:02:13 +0000 (10:02 -0700)]
[RecordLayout] Fix ItaniumRecordLayoutBuilder so that is grabs the correct bases class offsets from the external source

Currently the ItaniumRecordLayoutBuilder when laying out base classes has the virtual
and non-virtual bases mixed up when pulling the base class layouts from the external source.

This came up in an LLDB bug where on arm64 because of differences in how it deals with
tail padding would layout the bases differently without the correct layout from the
external source (LLDB). This would result in some fields being off by 4 bytes.

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

4 years ago[libc++][NFC] Remove outdated TODO item
Louis Dionne [Wed, 8 Jul 2020 17:04:17 +0000 (13:04 -0400)]
[libc++][NFC] Remove outdated TODO item

4 years ago[DAGCombiner] fix function-name formatting; NFC
Sanjay Patel [Wed, 8 Jul 2020 15:57:45 +0000 (11:57 -0400)]
[DAGCombiner] fix function-name formatting; NFC

4 years ago[DAGCombiner] add enum for store source value; NFC
Sanjay Patel [Wed, 8 Jul 2020 15:48:41 +0000 (11:48 -0400)]
[DAGCombiner] add enum for store source value; NFC

This removes existing code duplication and allows us to
assert that we are handling the expected cases.

We have a list of outstanding bugs that could benefit by
handling truncated source values, so that's a possible
addition going forward.

4 years ago[X86][SSE] Pull out PACK(SHUFFLE(),SHUFFLE()) folds into its own function. NFC.
Simon Pilgrim [Wed, 8 Jul 2020 16:07:41 +0000 (17:07 +0100)]
[X86][SSE] Pull out PACK(SHUFFLE(),SHUFFLE()) folds into its own function. NFC.

Future patches will extend this so declutter combineVectorPack before we start.

4 years ago[X86] Fix copy+paste typo in combineVectorPack assert message. NFC.
Simon Pilgrim [Wed, 8 Jul 2020 15:54:47 +0000 (16:54 +0100)]
[X86] Fix copy+paste typo in combineVectorPack assert message. NFC.

4 years ago[NewPM] Add PredicateInfoPrinterPass to PassRegistry.def
Arthur Eubanks [Wed, 8 Jul 2020 16:27:57 +0000 (09:27 -0700)]
[NewPM] Add PredicateInfoPrinterPass to PassRegistry.def

Fixes tests under NPM in Transforms/Util/PredicateInfo.

4 years ago[SampleFDO] Enable sample-profile-top-down-load and sample-profile-merge-inlinee
Wei Mi [Tue, 30 Jun 2020 21:32:46 +0000 (14:32 -0700)]
[SampleFDO] Enable sample-profile-top-down-load and sample-profile-merge-inlinee
by default.

sample-profile-top-down-load is an internal option which can enable top-down
order of inlining and profile annotation in sample profile load pass. It was
found to be beneficial for better profile annotation.

Recently we found it could also solve some build time issue. Suppose function
A has many callsites in function B. In the last release binary where sample
profile was collected, the outline copy of A is large because there are many
other functions inlined into A. However although all the callsites calling A
in B are inlined, but every inlined body is small (A was inlined into B
before other functions are inlined into A), there is no build time issue in
last release.

In an optimized build using the sample profile collected from last release,
without top-down inlining, we saw a case that A got very large because of
inlining, and then multiple callsites of A got inlined into B, and that led
to a huge B which caused significant build time issue besides profile
annotation issue.

To solve that problem, the patch enables the flag
sample-profile-top-down-load by default. sample-profile-top-down-load can
have better performance when it is enabled together with
sample-profile-merge-inlinee so in this patch we also enable
sample-profile-merge-inlinee by default.

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

4 years ago[SystemZ] Allow specifying integer registers as part of the address calculation
Ulrich Weigand [Wed, 8 Jul 2020 16:17:03 +0000 (18:17 +0200)]
[SystemZ] Allow specifying integer registers as part of the address calculation

Revision e1de2773a534957305d7a559c6d88c4b5ac354e2 provided support for
accepting integer registers in inline asm i.e.

__asm("lhi %r0, 5") -> lhi %r0, 5
__asm("lhi 0, 5") -> lhi 0,5

This patch aims to extend this support to instructions which compute
addresses as well. (i.e instructions of type BDMem and BD[X|R|V|L]Mem)

Author: anirudhp

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

4 years agoDomTree: remove explicit use of DomTreeNodeBase::iterator
Nicolai Hähnle [Thu, 2 Jul 2020 18:36:30 +0000 (20:36 +0200)]
DomTree: remove explicit use of DomTreeNodeBase::iterator

Summary:
Almost all uses of these iterators, including implicit ones, really
only need the const variant (as it should be). The only exception is
in NewGVN, which changes the order of dominator tree child nodes.

Change-Id: I4b5bd71e32d71b0c67b03d4927d93fe9413726d4

Reviewers: arsenm, RKSimon, mehdi_amini, courbet, rriddle, aartbik

Subscribers: wdng, Prazek, hiraditya, kuhar, rogfer01, rriddle, jpienaar, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, stephenneuendorffer, Joonsoo, grosul1, vkmr, Kayjukh, jurahul, msifontes, cfe-commits, llvm-commits

Tags: #clang, #mlir, #llvm

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

4 years agoRevert "Double check that passes correctly set their Modified status"
serge-sans-paille [Wed, 8 Jul 2020 16:13:59 +0000 (18:13 +0200)]
Revert "Double check that passes correctly set their Modified status"

This reverts commit 37afd99c768b29c7df7c5f2eb645362fb61f9915.

4 years ago[matrix] Add some more Verifier negative tests. NFC.
Sjoerd Meijer [Wed, 8 Jul 2020 16:04:23 +0000 (17:04 +0100)]
[matrix] Add some more Verifier negative tests. NFC.

4 years ago[libc++] Mark some tests as unsupported on GCC 5
Louis Dionne [Wed, 8 Jul 2020 15:09:03 +0000 (11:09 -0400)]
[libc++] Mark some tests as unsupported on GCC 5

There used to be a workaround where we'd pretend that GCC 5 didn't support
C++14 because it doesn't implement it properly. Since that workaround has
been removed (in 1eb211ada17a), we need to mark a few individual tests as
failing with GCC 5.

4 years ago[NewPM][opt] Translate "-O#" to NPM's "default<O#>"
Arthur Eubanks [Wed, 8 Jul 2020 15:56:27 +0000 (08:56 -0700)]
[NewPM][opt] Translate "-O#" to NPM's "default<O#>"

 Fixes 52 check-llvm tests under NPM.

Reviewed By: hans

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

4 years ago[clang] Fix a crash when passing a C structure of incompatible type to a function...
Aleksandr Platonov [Wed, 8 Jul 2020 15:46:30 +0000 (16:46 +0100)]
[clang] Fix a crash when passing a C structure of incompatible type to a function with a reference parameter.

__builtin_va_*() and __builtin_ms_va_*() are declared as functions with a
parameter of reference type.

This patch fixes a crash when using these functions in C where an argument
of structure type is incompatible with the parameter type.

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

Reviewed By: riccibruno

Patch by: Aleksandr Platonov <platonov.aleksandr@huawei.com>

4 years ago[libc] Fix typographical error in math_utils.h.
Chris Gyurgyik [Wed, 8 Jul 2020 15:56:21 +0000 (11:56 -0400)]
[libc] Fix typographical error in math_utils.h.

4 years ago[NewPM][opt] Share -disable-loop-unrolling between pass managers
Arthur Eubanks [Wed, 8 Jul 2020 15:50:22 +0000 (08:50 -0700)]
[NewPM][opt] Share -disable-loop-unrolling between pass managers

There's no reason to introduce a new option for the NPM.
The various PGO options are shared in this manner.

Reviewed By: echristo

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

4 years ago[MIR] Speedup parsing of function with large number of basic blocks
Evgeny Leviant [Wed, 8 Jul 2020 15:50:00 +0000 (18:50 +0300)]
[MIR] Speedup parsing of function with large number of basic blocks

Patch eliminates string length calculation when lexing a token. Speedup can be up to
1000x.

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

4 years ago[Preallocated] Add @llvm.call.preallocated.teardown
Arthur Eubanks [Wed, 8 Jul 2020 15:48:44 +0000 (08:48 -0700)]
[Preallocated] Add @llvm.call.preallocated.teardown

This cleans up the stack allocated by a @llvm.call.preallocated.setup.
Should either call the teardown or the preallocated call to clean up the
stack. Calling both is UB.

Add LangRef.

Add verifier check that the token argument is a @llvm.call.preallocated.setup.

Reviewed By: efriedma

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

4 years agopartial revert on RTBuilder.h to avoid warnings.
Eric Schweitz [Wed, 8 Jul 2020 15:47:13 +0000 (08:47 -0700)]
partial revert on RTBuilder.h to avoid warnings.

4 years ago[lldb] Modernize/clean up ValueObject::GetChildMemberWithName
Pavel Labath [Wed, 8 Jul 2020 15:33:58 +0000 (17:33 +0200)]
[lldb] Modernize/clean up ValueObject::GetChildMemberWithName

4 years ago[SelectionDAG] Fix incorrect offset when expanding CONCAT_VECTORS.
Paul Walker [Wed, 8 Jul 2020 15:12:22 +0000 (15:12 +0000)]
[SelectionDAG] Fix incorrect offset when expanding CONCAT_VECTORS.

ExpandVectorBuildThroughStack is also used for CONCAT_VECTORS.
However, when calculating the offsets for each of the operands we
incorrectly use the element size rather than actual size and thus
the stores overlap.

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

4 years ago[clang][NFC] Also test for serialization in test/AST/ast-dump-APValue-*
Bruno Ricci [Wed, 8 Jul 2020 15:36:48 +0000 (16:36 +0100)]
[clang][NFC] Also test for serialization in test/AST/ast-dump-APValue-*

This does not actually exercise the serialization of APValue, but it
will at least prevent a regression in the future. NFC.

4 years agoDouble check that passes correctly set their Modified status
serge-sans-paille [Thu, 28 May 2020 10:40:17 +0000 (12:40 +0200)]
Double check that passes correctly set their Modified status

The approach is simple: if a pass reports that it's not modifying a
Function/Module, compute a loose hash of that Function/Module and compare it
with the original one. If we report no change but there's a hash change, then we
have an error.

This approach misses a lot of change but it's not super intrusive and can
detect most of the simple mistakes.

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

4 years ago[clangd] Improve serialization error messages. NFC
Sam McCall [Wed, 8 Jul 2020 15:30:24 +0000 (17:30 +0200)]
[clangd] Improve serialization error messages. NFC