platform/upstream/llvm.git
3 years ago[AMDGPU] GCNDPPCombine: simplify API of isShrinkable. NFC.
Jay Foad [Mon, 19 Apr 2021 13:20:46 +0000 (14:20 +0100)]
[AMDGPU] GCNDPPCombine: simplify API of isShrinkable. NFC.

3 years ago[clang][deps] NFC: Remove unused FullDependencies member
Jan Svoboda [Mon, 19 Apr 2021 12:34:10 +0000 (14:34 +0200)]
[clang][deps] NFC: Remove unused FullDependencies member

This patch removes the `FullDependencies::AdditionalNonPathCommandLine` member, as it's value-initialized and never mutated.

Reviewed By: dexonsmith

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

3 years ago[TableGen] Add support for the 'assert' statement in multiclasses
Paul C. Anagnostopoulos [Thu, 1 Apr 2021 17:01:43 +0000 (13:01 -0400)]
[TableGen] Add support for the 'assert' statement in multiclasses

This is step 3 of adding the 'assert' statement.

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

3 years ago[mlir][linalg] enable library call rewrites for linalg operations with index semantics.
Tobias Gysi [Mon, 19 Apr 2021 12:23:11 +0000 (12:23 +0000)]
[mlir][linalg] enable library call rewrites for linalg operations with index semantics.

The patch enables the library call lowering for linalg operations that contain index operations.

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

3 years ago[mlir] Improve debug flag management in Python bindings
Alex Zinenko [Mon, 19 Apr 2021 11:37:01 +0000 (13:37 +0200)]
[mlir] Improve debug flag management in Python bindings

Expose the debug flag as a readable and assignable property of a
dedicated class instead of a write-only function. Actually test the fact
of setting the flag. Move test to a dedicated file, it has zero relation
to context_managers.py where it was added.

Arguably, it should be promoted from mlir.ir to mlir module, but we are
not re-exporting the latter and this functionality is purposefully
hidden so can stay in IR for now. Drop unnecessary export code.

Refactor C API and put Debug into a separate library, fix it to actually
set the flag to the given value.

Reviewed By: nicolasvasilache

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

3 years ago[clang][deps] Generate the full command-line for modules
Jan Svoboda [Tue, 30 Mar 2021 11:31:03 +0000 (13:31 +0200)]
[clang][deps] Generate the full command-line for modules

This patch uses the new `CompilerInvocation::generateCC1CommandLine` to generate the full canonical command line for modular dependencies, instead of only appending additional arguments.

Reviewed By: dexonsmith

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

3 years ago[IR] GlobalObject.h - remove unused <utility> include. NFCI.
Simon Pilgrim [Mon, 19 Apr 2021 12:25:24 +0000 (13:25 +0100)]
[IR] GlobalObject.h - remove unused <utility> include. NFCI.

In fact there's no explicit use of any std:: type or method in this header.

3 years ago[mlir][linalg] adding pass to run the interchange pattern.
Tobias Gysi [Mon, 19 Apr 2021 11:53:18 +0000 (11:53 +0000)]
[mlir][linalg] adding pass to run the interchange pattern.

Instead of interchanging loops during the loop lowering this pass performs the interchange by permuting the indexing maps. It also updates the iterator types and the index accesses in the body of the operation.

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

3 years ago[SystemZ][z/OS] Set files in FileRemapper.cpp are text
Abhina Sreeskantharajan [Mon, 19 Apr 2021 11:59:23 +0000 (07:59 -0400)]
[SystemZ][z/OS] Set files in FileRemapper.cpp are text

This patch sets files in FileRemapper to open as text.

Reviewed By: Jonathan.Crowther

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

3 years ago[IR] GlobalObject.h - remove unused <string> include. NFCI.
Simon Pilgrim [Mon, 19 Apr 2021 10:51:27 +0000 (11:51 +0100)]
[IR] GlobalObject.h - remove unused <string> include. NFCI.

All string usage is hidden behind StringRefs - so we don't need an explicit <string> include.

3 years ago[llvm-exegesis] Analysis.cpp - use for-range loop. NFCI.
Simon Pilgrim [Mon, 19 Apr 2021 10:49:35 +0000 (11:49 +0100)]
[llvm-exegesis] Analysis.cpp - use for-range loop. NFCI.

3 years ago[MCA] CodeEmitter.h - remove unused <string> include. NFCI.
Simon Pilgrim [Mon, 19 Apr 2021 10:44:12 +0000 (11:44 +0100)]
[MCA] CodeEmitter.h - remove unused <string> include. NFCI.

Add explicit SmallString.h include - which is used in the header

3 years agoTry to unbreak the compiler-rt build on s390x
Sylvestre Ledru [Mon, 19 Apr 2021 11:17:47 +0000 (13:17 +0200)]
Try to unbreak the compiler-rt build on s390x

Introduced by:
3d1d7156e9a9a794ba649b79e27fe448274fd558

3 years ago[AMDGPU] Remove MachineDCE after SIFoldOperands
Jay Foad [Thu, 8 Apr 2021 16:10:54 +0000 (17:10 +0100)]
[AMDGPU] Remove MachineDCE after SIFoldOperands

Remove the MachineDCE pass after the first SIFoldOperands pass now
that SIFoldOperands deletes its own dead instructions.

Reapply after fixing dependent change D100188.

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

3 years ago[AMDGPU] SIFoldOperands: eagerly erase dead REG_SEQUENCEs
Jay Foad [Fri, 9 Apr 2021 12:52:35 +0000 (13:52 +0100)]
[AMDGPU] SIFoldOperands: eagerly erase dead REG_SEQUENCEs

This is fairly cheap to implement and means less work for future
passes like MachineDCE.

Reapply with a fix for using InstToErase after it had been erased.

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

3 years ago[TTI] NFC: Remove unused 'OptSize' parameter from shouldMaximizeVectorBandwidth
Cullen Rhodes [Tue, 13 Apr 2021 11:46:33 +0000 (11:46 +0000)]
[TTI] NFC: Remove unused 'OptSize' parameter from shouldMaximizeVectorBandwidth

Reviewed By: sdesmalen

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

3 years ago[clang][parser] Unify rejecting (non) decl stmts with gnu attributes
Timm Bäder [Tue, 6 Apr 2021 09:54:02 +0000 (11:54 +0200)]
[clang][parser] Unify rejecting (non) decl stmts with gnu attributes

The comment here was introduced in
a3e01cf822f7415337e5424af3c6f4c94a12c1b9 and suggests that we should
handle declaration statements and non-declaration statements the same,
but don't because ProhibitAttributes() can't handle GNU attributes. That
has recently changed, so remove the comment and handle all statements
the same.

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

3 years ago[AMDGPU][MC] Corrected parsing of carry in/out operands in VOP3
Dmitry Preobrazhensky [Mon, 19 Apr 2021 10:40:00 +0000 (13:40 +0300)]
[AMDGPU][MC] Corrected parsing of carry in/out operands in VOP3

Disabled constants as carry in/out operands. See bug 48711.

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

3 years ago[clang][deps] Remove the -full-command-line flag
Jan Svoboda [Tue, 30 Mar 2021 08:45:04 +0000 (10:45 +0200)]
[clang][deps] Remove the -full-command-line flag

This patch removes the `-full-command-line` option from `clang-scan-deps`. It's only used with `-format=experimental-full`, where omitting the command lines doesn't make much sense. There are no tests without `-full-command-line`.

Depends on D100531.

Reviewed By: Bigcheese

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

3 years ago[X86][CostModel] X86TTIImpl::getShuffleCost(): subvector insertions are cheap
Roman Lebedev [Mon, 19 Apr 2021 10:23:48 +0000 (13:23 +0300)]
[X86][CostModel] X86TTIImpl::getShuffleCost(): subvector insertions are cheap

This is similar to the subvector extractions,
except that the 0'th subvector isn't free to insert,
because we generally don't know whether or not
the upper elements need to be preserved:
https://godbolt.org/z/rsxP5W4sW

This is needed to avoid regressions in D100684

Reviewed By: RKSimon

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

3 years ago[RISCV] Lower vector shuffles to vrgather operations
Fraser Cormack [Thu, 15 Apr 2021 09:06:11 +0000 (10:06 +0100)]
[RISCV] Lower vector shuffles to vrgather operations

This patch extends the lowering of RVV fixed-length vector shuffles to
avoid the default stack expansion and instead lower to vrgather
instructions.

For "permute"-style shuffles where one vector is swizzled, we can lower
to one vrgather. For shuffles involving two vector operands, we lower to
one unmasked vrgather (or splat, where appropriate) followed by a masked
vrgather which blends in the second half.

On occasion, when it's not possible to create a legal BUILD_VECTOR for
the indices, we use vrgatherei16 instructions with 16-bit index types.

For 8-bit element vectors where we may have indices over 255, we have a
fairly blunt fallback to the stack expansion to avoid custom-splitting
of the vector types.

To enable the selection of masked vrgather instructions, this patch
extends the various RISCVISD::VRGATHER nodes to take a passthru operand.

Reviewed By: craig.topper

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

3 years ago[NFC] Add tests for scalable vectorization of loops with in-order reductions
Kerry McLaughlin [Mon, 19 Apr 2021 09:47:05 +0000 (10:47 +0100)]
[NFC] Add tests for scalable vectorization of loops with in-order reductions

D98435 added support for in-order reductions and included tests for fixed-width
vectorization with the -enable-strict-reductions flag.

This patch adds similar tests to verify support for scalable vectorization of loops
with in-order reductions.

Reviewed By: david-arm

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

3 years ago[clang][deps] Simplify function discovering .pcm and .modulemap files
Jan Svoboda [Tue, 30 Mar 2021 08:45:04 +0000 (10:45 +0200)]
[clang][deps] Simplify function discovering .pcm and .modulemap files

This patch simplifies (and renames) the `appendCommonModuleArguments` function.

It no longer tries to construct the command line for explicitly building modules. Instead, it only performs the DFS traversal of modular dependencies and queries the callbacks to collect paths to `.pcm` and `.modulemap` files.

This makes it more flexible and usable in two contexts:

* Generating additional command line arguments for the main TU in modular build. The `std::vector<std::string>` output parameters can be used to manually generate appropriate command line flags.
* Generate full command line for a module. The output parameters can be the corresponding parts of `CompilerInvocation`. (In a follow-up patch.)

Reviewed By: dexonsmith

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

3 years ago[DebugInfo] Replace debug uses in replaceUsesOutsideBlock
OCHyams [Mon, 19 Apr 2021 09:31:41 +0000 (10:31 +0100)]
[DebugInfo] Replace debug uses in replaceUsesOutsideBlock

Value::replaceUsesOutsideBlock doesn't replace debug uses which leads to an
unnecessary reduction in variable location coverage. Fix this, add a unittest for
it, and add a regression test demonstrating the change through instcombine's
replacedSelectWithOperand.

Reviewed By: djtodoro

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

3 years agoAdd default DataLayout support for complex numbers
Tres Popp [Mon, 12 Apr 2021 08:27:14 +0000 (10:27 +0200)]
Add default DataLayout support for complex numbers

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

3 years ago[DebugInfo] Move the findDbg* functions into DebugInfo.cpp
OCHyams [Mon, 19 Apr 2021 08:54:22 +0000 (09:54 +0100)]
[DebugInfo] Move the findDbg* functions into DebugInfo.cpp

Move the findDbg* functions into lib/IR/DebugInfo.cpp from
lib/Transforms/Utils/Local.cpp.

D99169 adds a call to a function (findDbgUsers) that lives in
lib/Transforms/Utils/Local.cpp (LLVMTransformUtils) from lib/IR/Value.cpp
(LLVMCore). The Core lib doesn't include TransformUtils. The builtbots caught
this here: https://lab.llvm.org/buildbot/#/builders/109/builds/12664. This patch
moves the function, and the 3 similar ones for consistency, into DebugInfo.cpp
which is part of LLVMCore.

Reviewed By: dblaikie, rnk

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

3 years ago[clang][cli] NFC: Move conditional LangOptions parsing/generation
Jan Svoboda [Fri, 16 Apr 2021 15:20:04 +0000 (17:20 +0200)]
[clang][cli] NFC: Move conditional LangOptions parsing/generation

NFC, this simplifies the main parsing/generating functions by moving logic around conditional `LangOptions` where it belongs.

Reviewed By: Bigcheese

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

3 years ago[OpenCL] Change OpenCL builtin version encoding
Sven van Haastregt [Mon, 19 Apr 2021 09:23:13 +0000 (10:23 +0100)]
[OpenCL] Change OpenCL builtin version encoding

Instead of using a MinVersion and MaxVersion field, encode the version
of a builtin using a mask that aligns better with version handling in
OpenCLOptions.h.  In addition, this saves a field in the BuiltinTable.

This change allows a finer-grained control over the OpenCL versions in
which a builtin is available: instead of a range, we can now toggle
each version individually.

The fine-grained version control is not yet exposed on the TableGen
definitions side, as changes for OpenCL 3 feature optionality still
need to be defined and will affect how we want to expose these.

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

3 years ago[clang][cli] NFC: Use Diags to report parsing success/failure
Jan Svoboda [Fri, 16 Apr 2021 13:30:28 +0000 (15:30 +0200)]
[clang][cli] NFC: Use Diags to report parsing success/failure

`Success` is set to `false` whenever `Diags.Report(diag::err_)` is called. Remove the duplication and use `Diags` as the source of truth when deciding whether to report parsing success/failure.

Reviewed By: dexonsmith

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

3 years ago[clang] Implement CompilerInvocation copy assignment
Jan Svoboda [Wed, 14 Apr 2021 12:35:03 +0000 (14:35 +0200)]
[clang] Implement CompilerInvocation copy assignment

This patch implements the copy assignment for `CompilerInvocation`.

Eventually, the deep-copy operation will be moved into a `clone()` method (D100460), but until then, this is necessary for basic ergonomics.

Depends on D100455.

Reviewed By: Bigcheese

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

3 years ago[llvm-exegesis] Honor -mcpu in analysis mode.
Clement Courbet [Mon, 19 Apr 2021 07:08:44 +0000 (09:08 +0200)]
[llvm-exegesis] Honor -mcpu in analysis mode.

This is useful to set the baseline model for an unknown CPU.

Fixes PR50013.

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

3 years ago[clang] Rename CompilerInvocationBase to RefBase, split out ValueBase
Jan Svoboda [Wed, 14 Apr 2021 12:27:08 +0000 (14:27 +0200)]
[clang] Rename CompilerInvocationBase to RefBase, split out ValueBase

This patch documents the reason `CompilerInvocationBase` exists and renames it to more descriptive `CompilerInvocationRefBase`.

To make the distinction obvious, it also splits out new `CompilerInvocationValueBase` class.

Reviewed By: Bigcheese

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

3 years ago[CodeGen] Improve code generation for clamping of constant indices with scalable...
David Sherwood [Fri, 16 Apr 2021 10:39:44 +0000 (11:39 +0100)]
[CodeGen] Improve code generation for clamping of constant indices with scalable vectors

When trying to clamp a constant index into a scalable vector we can
test if the index is less than the minimum number of elements in the
vector. If so, we can simply return the index because we know it is
guaranteed to fit inside the vector.

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

3 years ago[GreedyRA ORE] Add stats for copy of virtual registers.
Serguei Katkov [Fri, 9 Apr 2021 09:31:05 +0000 (16:31 +0700)]
[GreedyRA ORE] Add stats for copy of virtual registers.

Greedy RA adds copies of virtual registers when splitting live interval.
This stat might be useful.

Reviewers: reames, MatzeB, anemet, thegameg
Reviewed By: reames
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100017

3 years ago[Greedy RA] Add a check to MachineVerifier
Serguei Katkov [Tue, 13 Apr 2021 10:31:23 +0000 (17:31 +0700)]
[Greedy RA] Add a check to MachineVerifier

If Virtual Register is alive in landing pad its def must be
before the call causing the exception or it should be statepoint instruction itself and
in this case def actually means the relocation of gc pointer and is alive in
landing pad.

The test shows the triggering this check for an option under development
use-registers-for-gc-values-in-landing-pad which is off by default until
it is functionally correct.

Reviewers: reames, void, jyknight, nickdesaulniers, efriedma, arsenm, rnk
Reviewed By: rnk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D100525

3 years ago[CVP] processCallSite returns wrong status
Evgeniy Brevnov [Wed, 14 Apr 2021 16:08:17 +0000 (23:08 +0700)]
[CVP] processCallSite returns wrong status

Recently processMinMaxIntrinsic has been added and we started to observe a number of analysis get invalidated after CVP. The problem is CVP conservatively returns 'true'  even if there were no modifications to IR. I found one more place besides processMinMaxIntrinsic  which has the same problem. I think processMinMaxIntrinsic and similar should better have boolean return status to prevent similar issue reappear in future.

Reviewed By: lebedev.ri

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

3 years ago[RISCV][Driver] Make the ordering of CmdArgs consistent between RISCV::Linker and...
ShihPo Hung [Mon, 19 Apr 2021 02:05:20 +0000 (19:05 -0700)]
[RISCV][Driver] Make the ordering of CmdArgs consistent between RISCV::Linker and baremetal::Linker

In baremetal::Linker::ConstructJob, LinkerInput is handled prior to T_Group options,
but on the other side in RISCV::Linker::ConstructJob, it is opposite.

We want it to be consistent whether users are using RISCV::Linker or baremetal::Linker.

Reviewed By: MaskRay

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

3 years ago[clangd][test] Fix build error of FeatureModulesTests
Pan, Tao [Mon, 19 Apr 2021 00:55:31 +0000 (08:55 +0800)]
[clangd][test] Fix build error of FeatureModulesTests

clang-tools-extra/clangd/unittests/FeatureModulesTests.cpp:33:58: error:
could not convert ‘(const char*)""’ from ‘const char*’ to
llvm::StringLiteral’
       llvm::StringLiteral kind() const override { return ""; };

Reviewed By: kadircet

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

3 years agoRevert "[Coroutines] Set presplit attribute in Clang instead of CoroEarly pass"
Xun Li [Mon, 19 Apr 2021 00:20:02 +0000 (17:20 -0700)]
Revert "[Coroutines] Set presplit attribute in Clang instead of CoroEarly pass"

This reverts commit fa6b54c44ab1d5f579304eadb7ac8bd7e72d0e77.
The commited patch broke mlir tests. It seems that mlir tests depend on coroutine function properties set in CoroEarly pass.

3 years agoAdd a missing debug assertion in <list>.
Arthur O'Dwyer [Sun, 18 Apr 2021 17:55:54 +0000 (13:55 -0400)]
Add a missing debug assertion in <list>.

This came up in D100595.

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

3 years ago[TableGen] Pass SmallVector to union_modes instead of returning a std::vector.
Craig Topper [Sun, 18 Apr 2021 21:10:06 +0000 (14:10 -0700)]
[TableGen] Pass SmallVector to union_modes instead of returning a std::vector.

The number of modes is small so this should avoid a heap allocation.

Also replace std::set with SmallSet.

3 years ago[Coroutines] Set presplit attribute in Clang instead of CoroEarly pass
Xun Li [Sun, 18 Apr 2021 22:41:09 +0000 (15:41 -0700)]
[Coroutines] Set presplit attribute in Clang instead of CoroEarly pass

Presplit coroutines cannot be inlined. During AlwaysInliner we check if a function is a presplit coroutine, if so we skip inlining.
The presplit coroutine attributes are set in CoroEarly pass.
However in O0 pipeline, AlwaysInliner runs before CoroEarly, so the attribute isn't set yet and will still inline the coroutine.
This causes Clang to crash: https://bugs.llvm.org/show_bug.cgi?id=49920

To fix this, we set the attributes in the Clang front-end instead of in CoroEarly pass.

Reviewed By: rjmccall, ChuanqiXu

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

3 years agoRevert "[Coroutines] Move CoroEarly pass to before AlwaysInliner"
Xun Li [Sun, 18 Apr 2021 22:38:19 +0000 (15:38 -0700)]
Revert "[Coroutines] Move CoroEarly pass to before AlwaysInliner"

This reverts commit 2b50f5a4343f8fb06acaa5c36355bcf58092c9cd.
Forgot to update the description of the commit to sync with phabricator. Going to redo the commit.

3 years ago[Coroutines] Move CoroEarly pass to before AlwaysInliner
Xun Li [Mon, 12 Apr 2021 05:01:36 +0000 (22:01 -0700)]
[Coroutines] Move CoroEarly pass to before AlwaysInliner

Presplit coroutines cannot be inlined. During AlwaysInliner we check if a function is a presplit coroutine, if so we skip inlining.
The presplit coroutine attributes are set in CoroEarly pass.
However in O0 pipeline, AlwaysInliner runs before CoroEarly, so the attribute isn't set yet and will still inline the coroutine.
This causes Clang to crash: https://bugs.llvm.org/show_bug.cgi?id=49920

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

3 years ago[lit] Fix the return code for "not not" after evaluating "not" internally
Martin Storsjö [Sun, 18 Apr 2021 21:37:13 +0000 (00:37 +0300)]
[lit] Fix the return code for "not not" after evaluating "not" internally

This fixes cases where "not not <command>" is supposed to return
only the error codes 0 or 1, but after efee57925c3f46c74c6697,
it passed the original error code through.

This was visible on AIX in the shtest-output-printing.py testcase,
where 'wc' returns 2, while it returns 1 on other platforms, and the
test required "not not" to normalize it to 1.

3 years ago[TableGen] Use MachineValueTypeSet in place of SmallSet.
Craig Topper [Sun, 18 Apr 2021 20:35:11 +0000 (13:35 -0700)]
[TableGen] Use MachineValueTypeSet in place of SmallSet.

MachineValueTypeSet is effectively a std::bitset<256>. This allows
us quickly insert into the set and check if a type is in the set.

3 years ago[LoopDeletion] Add test for PR49967 (NFC)
Nikita Popov [Sun, 18 Apr 2021 20:07:49 +0000 (22:07 +0200)]
[LoopDeletion] Add test for PR49967 (NFC)

Test case for a SCEV invalidation bug caused by D100264, which
has since been reverted.

3 years ago[TableGen] Use range-based for loop. NFC
Craig Topper [Sun, 18 Apr 2021 04:49:45 +0000 (21:49 -0700)]
[TableGen] Use range-based for loop. NFC

3 years ago[Introspection] Dont emit json if unchanged.
Nathan James [Sun, 18 Apr 2021 19:22:08 +0000 (20:22 +0100)]
[Introspection] Dont emit json if unchanged.

Saves running the generate inc script in the, somewhat common, case where the json file doesn't need changing.

Reviewed By: steveire

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

3 years ago[sanitizer] Don't call __tls_get_addr on s390x after D98926
Fangrui Song [Sun, 18 Apr 2021 17:42:43 +0000 (10:42 -0700)]
[sanitizer] Don't call __tls_get_addr on s390x after D98926

glibc s390x doesn't define __tls_get_addr.

Fix PR50017

3 years ago[libc++] [CI] Fail if the headers contain cyclic dependencies.
Arthur O'Dwyer [Sat, 17 Apr 2021 13:56:34 +0000 (09:56 -0400)]
[libc++] [CI] Fail if the headers contain cyclic dependencies.

Since we have a tool to detect cycles now; and since we're entering
a phase where people can easily introduce cycles by accident (D100682)
or by request (D90999), I think it's increasingly important to shift
the burden of detecting these cycles onto the buildbot instead of
the poor human reviewer.

Also, grep for non-ASCII characters (such as U+200B and U+00AD)
and hard tabs; don't let those get checked in.

Differential Review: https://reviews.llvm.org/D100703

3 years agoRevert "[SCEV] Model `ashr exact x, C` as `(abs(x) EXACT/u (1<<C)) * signum(x)`"
Roman Lebedev [Sun, 18 Apr 2021 13:20:34 +0000 (16:20 +0300)]
Revert "[SCEV] Model `ashr exact x, C` as `(abs(x) EXACT/u (1<<C)) * signum(x)`"

As being discussed in https://reviews.llvm.org/D100721,
this modelling is lossy, we can't reconstruct `ash`/`ashr exact`
from it, which means that whenever we actually expand the IR,
we've just pessimized the code..

It would be good to model this pattern, after all it comes up every time
you want to compute a distance between two pointers, but not at this cost.

This reverts commit ec54867df5e7f20e12146e628af34f0384308bcb.

3 years ago[clang] Fix cross compiling clang for windows after 141945f950e2f3f
Martin Storsjö [Sun, 18 Apr 2021 12:53:48 +0000 (15:53 +0300)]
[clang] Fix cross compiling clang for windows after 141945f950e2f3f

Don't try to execute clang-ast-dump when cross compiling.

3 years ago[lldb] Remove a superfluous trailing semicolon, fixing warnings. NFC.
Martin Storsjö [Sun, 18 Apr 2021 12:53:04 +0000 (15:53 +0300)]
[lldb] Remove a superfluous trailing semicolon, fixing warnings. NFC.

3 years ago[Docs] Correct Boehm collector weblink in GarbageCollection.rst
xgupta [Sun, 18 Apr 2021 12:00:17 +0000 (17:30 +0530)]
[Docs] Correct Boehm collector weblink in GarbageCollection.rst

3 years ago[gn build] Port 01ace074fcb6
LLVM GN Syncbot [Sun, 18 Apr 2021 11:35:28 +0000 (11:35 +0000)]
[gn build] Port 01ace074fcb6

3 years ago[libc++] Implements ranges::enable_borrowed_range
Mark de Wever [Tue, 24 Nov 2020 17:08:02 +0000 (18:08 +0100)]
[libc++] Implements ranges::enable_borrowed_range

This is the initial patch to implement ranges in libc++.

Implements parts of:
- P0896R4 One Ranges Proposal
- P1870 forwarding-range is too subtle
- LWG3379 in several library names is misleading

Reviewed By: ldionne, #libc, cjdb, zoecarver, Quuxplusone

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

3 years ago[IndVarSimplify] Add test requiring ashr expansion.
Florian Hahn [Sun, 18 Apr 2021 11:09:59 +0000 (12:09 +0100)]
[IndVarSimplify] Add test requiring ashr expansion.

Add test cases showing large ashr expansion during IndVarSimplify
after ec54867df5e7.

3 years ago[AST][Introspection][NFC] Remove unnecessary temporary strings.
Nathan James [Sun, 18 Apr 2021 08:25:12 +0000 (09:25 +0100)]
[AST][Introspection][NFC] Remove unnecessary temporary strings.

3 years ago[NFC][X86][CostModel] Rewrite load_store.ll
Roman Lebedev [Sun, 18 Apr 2021 08:07:04 +0000 (11:07 +0300)]
[NFC][X86][CostModel] Rewrite load_store.ll

Test SSE41, since that added float/i64/i32/i8 inserts/extracts.
Don't forget to test vectors of pointers.
Do test byte-aligned loads/stores.
Fixup test coverage to be rather more exhaustive,
testing all reasonable element sizes vs element counts permutations
that fit up to witin ZMM.

3 years ago[NFC][LoopVectorize] Autogenerate check lines in X86/gather_scatter.ll test
Roman Lebedev [Sun, 18 Apr 2021 07:26:16 +0000 (10:26 +0300)]
[NFC][LoopVectorize] Autogenerate check lines in X86/gather_scatter.ll test

3 years agoUpdate InstCombine to use undef matcher instead
Juneyoung Lee [Sun, 18 Apr 2021 02:05:34 +0000 (11:05 +0900)]
Update InstCombine to use undef matcher instead

This is a patch to use m_Undef() matcher instead of isa<UndefValue>().

As suggested in D100122, this update is separately committed.

3 years agoUpdate m_Undef to match vectors/aggrs with undefs and poisons mixed
Juneyoung Lee [Sun, 18 Apr 2021 01:57:04 +0000 (10:57 +0900)]
Update m_Undef to match vectors/aggrs with undefs and poisons mixed

This fixes https://reviews.llvm.org/D93990#2666922
by teaching `m_Undef` to match vectors/aggrs with poison elements.

As suggested, fixes in InstCombine files to use the `m_Undef` matcher instead
of `isa<UndefValue>` will be followed.

Reviewed By: lebedev.ri

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

3 years ago[AST] Add TypeLoc support to node introspection
Stephen Kelly [Wed, 24 Mar 2021 02:29:30 +0000 (02:29 +0000)]
[AST] Add TypeLoc support to node introspection

Extend the matchers gathering API for types to record template
parameters.  The TypeLoc type hierarchy has some types which are
templates used in CRTP such as PointerLikeTypeLoc.  Record the inherited
template and template arguments of types inheriting those CRTP types in
the ClassInheritance map.  Because the name inherited from is now
computed, the value type in that map changes from StringRef to
std::string.  This also causes the toJSON override signature used to
serialize that map to change.

Remove the logic for skipping over empty ClassData instances.  Several
classes such as TypeOfExprTypeLoc inherit a CRTP class which provides
interesting locations though the derived class does not.  Record it as a
class to make the locations it inherits available.

Record the typeSourceInfo accessors too as they provide access to
TypeLocs in many classes.

The existing unit tests use UnorderedElementsAre to compare the
introspection result with the expected result.  Our current
implementation of google mock (in gmock-generated-matchers.h) is limited
to support for comparing a container of 10 elements.  As we are now
returning more than 10 results for one of the introspection tests,
change it to instead compare against an ordered vector of pairs.

Because a macro is used to generate API strings and API calls, disable
clang-format in blocks of expected results.  Otherwise clang-format
would insert whitespaces which would then be compared against the
introspected strings and fail the test.

Introduce a recursion guard in the generated code.  The TypeLoc class
has IgnoreParens() API which by default returns itself, so it would
otherwise recurse infinitely.

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

3 years ago[libc++] Remove hard tabs, U+00AD, and U+200B from all libc++ headers. NFCI.
Arthur O'Dwyer [Sat, 17 Apr 2021 21:03:20 +0000 (17:03 -0400)]
[libc++] Remove hard tabs, U+00AD, and U+200B from all libc++ headers. NFCI.

3 years ago[ADT] Update RPOT to work with specializations of different types.
Florian Hahn [Sat, 17 Apr 2021 17:16:07 +0000 (18:16 +0100)]
[ADT] Update RPOT to work with specializations of different types.

At the moment, ReversePostOrderTraversal performs a post-order walk on
the entry node of the passed in graph, rather than the graph type
itself.

If GT::NodeRef is the same as GraphT, everything works as expected and
this is the case for the current uses in-tree. But it does not work as
expected if GraphT != GT::NodeRef. In that case, we either fail to build
(if there is no GraphTrait specialization for GT:NodeRef) or we pick the
GraphTrait specialization for GT::NodeRef, instead of the specialization
of GraphT.

Both the depth-first and post-order iterators pick the expected
specalization and this patch updates ReversePostOrderTraversal to
delegate to po_begin & po_end to pick the right specialization, rather
than forcing using GraphTraits<GT::NodeRef>, by first getting the entry
node.

This makes `ReversePostOrderTraversal<Graph<6>> RPOT(G);` build and
work as expected in the test.

Reviewed By: dexonsmith

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

3 years ago[LoopUnroll] Regenerate test checks (NFC)
Nikita Popov [Sat, 17 Apr 2021 18:58:27 +0000 (20:58 +0200)]
[LoopUnroll] Regenerate test checks (NFC)

3 years ago[LoopUnroll] Make some tests more robust (NFC)
Nikita Popov [Sat, 17 Apr 2021 18:55:57 +0000 (20:55 +0200)]
[LoopUnroll] Make some tests more robust (NFC)

Replace branch on undef by branch on unknown condition.

3 years ago[JITLink] Add testcase that was accidentally left out of 19e402d2b34.
Lang Hames [Sat, 17 Apr 2021 18:55:14 +0000 (11:55 -0700)]
[JITLink] Add testcase that was accidentally left out of 19e402d2b34.

3 years ago[clang-scan-deps] Add support for clang-cl
Sylvain Audi [Sat, 17 Apr 2021 16:49:40 +0000 (12:49 -0400)]
[clang-scan-deps] Add support for clang-cl

clang-scan-deps contains some command line parsing and modifications.
This patch adds support for clang-cl command options.

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

3 years ago[clang-scan-deps] Support double-dashes in clang command lines
Sylvain Audi [Sat, 17 Apr 2021 01:45:42 +0000 (21:45 -0400)]
[clang-scan-deps] Support double-dashes in clang command lines

This fixes argument injection in clang command lines, by adding them before "--".

Previously, the arguments were injected at the end of the command line and could be added after "--", which would be wrongly interpreted as input file paths.

This fix is needed for a subsequent patch, see D92191.

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

3 years ago[Support] ThreadPool tests: silence warning unused variable 'It'
Alexandre Ganea [Sat, 17 Apr 2021 17:56:23 +0000 (13:56 -0400)]
[Support] ThreadPool tests: silence warning unused variable 'It'

3 years ago[AST] Enable AST node introspection on WIN32
Stephen Kelly [Sat, 17 Apr 2021 17:58:05 +0000 (18:58 +0100)]
[AST] Enable AST node introspection on WIN32

3 years ago[TableGen] Remove local SmallSet from TypeSetByHwMode::insert.
Craig Topper [Sat, 17 Apr 2021 17:47:04 +0000 (10:47 -0700)]
[TableGen] Remove local SmallSet from TypeSetByHwMode::insert.

This keeps track of which modes are in VVT so we can find out
if a mode is missing later. But we can just ask VVT whether it
has a particular mode.

3 years ago[NFC] Fixed Typos
Jennifer Chukwu [Sat, 17 Apr 2021 15:04:06 +0000 (20:34 +0530)]
[NFC] Fixed Typos

Reviewed By: xgupta

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

3 years ago[AST] Remove args from LocationCall
Stephen Kelly [Fri, 16 Apr 2021 21:29:06 +0000 (22:29 +0100)]
[AST] Remove args from LocationCall

This class initially had args to be generic to future needs. In
particular, I thought that source location introspection should show the
getBeginLoc of CallExpr args and the getArgLoc of
TemplateSpecializationLocInfo etc.  However, that is probably best left
out of source location introspection because it involves node traversal.

If something like this is needed in the future, it can be added in the
future.

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

3 years ago[ADT] Take graph as const & in some post-order iterators (NFC).
Florian Hahn [Sat, 17 Apr 2021 14:22:54 +0000 (15:22 +0100)]
[ADT] Take graph as const & in some post-order iterators (NFC).

This patch updates a couple of functions that unnecessarily took the
input graph by value, when it was not needed. They can take the graph by
const-reference instead, which does not require GraphT to provide a copy
constructor.

Split off from D100169.

3 years ago[libcxx][doc] Fixes typos.
Mark de Wever [Sat, 17 Apr 2021 16:01:32 +0000 (18:01 +0200)]
[libcxx][doc] Fixes typos.

3 years ago[HIP] Support hipRTC in header
Yaxun (Sam) Liu [Fri, 16 Apr 2021 14:40:17 +0000 (10:40 -0400)]
[HIP] Support hipRTC in header

hipRTC compiles HIP device code at run time. Since the system may not
have development tools installed, when a HIP program is compiled through
hipRTC, there is no standard C or C++ header available. As such, the HIP
headers should not depend on standard C or C++ headers when used
with hipRTC. Basically when hipRTC is used, HIP headers only provides
definitions of HIP device API functions. This is in line with what nvRTC does.

This patch adds support of hipRTC to HIP headers in clang. Basically hipRTC
defines a macro __HIPCC_RTC__ when compile HIP code at run time. When
this macro is defined, HIP headers do not include standard C/C++ headers.

Reviewed by: Artem Belevich

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

3 years ago[Pragma] Added support for GCC unroll/nounroll
Dávid Bolvanský [Sat, 17 Apr 2021 15:27:11 +0000 (17:27 +0200)]
[Pragma] Added support for GCC unroll/nounroll

GCC 8 introduced these new pragmas to control loop unrolling. We should support them for compatibility reasons and the implementation itself requires few lines of code, since everything needed is already implemented for #pragma unroll/nounroll.

3 years ago[CUDA][HIP] Mark device var used by host only
Yaxun (Sam) Liu [Wed, 17 Mar 2021 20:14:03 +0000 (16:14 -0400)]
[CUDA][HIP] Mark device var used by host only

Add device variables to llvm.compiler.used if they are
ODR-used by either host or device functions.

This is necessary to prevent them from being
eliminated by whole-program optimization
where the compiler has no way to know a device
variable is used by some host code.

Reviewed by: Artem Belevich

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

3 years ago[AMDGPU] Add GlobalDCE before internalization pass
Yaxun (Sam) Liu [Wed, 17 Mar 2021 14:31:06 +0000 (14:31 +0000)]
[AMDGPU] Add GlobalDCE before internalization pass

The internalization pass only internalizes global variables
with no users. If the global variable has some dead user,
the internalization pass will not internalize it.

To be able to internalize global variables with dead
users, a global dce pass is needed before the
internalization pass.

This patch adds that.

Reviewed by: Artem Belevich, Matt Arsenault

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

3 years ago[LICM] Add more tests for promotion and capture (NFC)
Nikita Popov [Sat, 17 Apr 2021 14:56:21 +0000 (16:56 +0200)]
[LICM] Add more tests for promotion and capture (NFC)

We could optimize the first case, as the pointer is captured only
after the loop.

3 years ago[SimplifyCFG] Skip dbg intrinsics when checking for branch-only BBs.
Florian Hahn [Sat, 17 Apr 2021 12:12:15 +0000 (13:12 +0100)]
[SimplifyCFG] Skip dbg intrinsics when checking for branch-only BBs.

Debug intrinsics are free to hoist and should be skipped when looking
for terminator-only blocks. As a consequence, we have to delegate to the
main hoisting loop to hoist any dbg intrinsics instead of jumping to the
terminator case directly.

This fixes PR49982.

Reviewed By: lebedev.ri

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

3 years ago[Inline] Don't add noalias metadata to inaccessiblememonly calls
Nikita Popov [Sat, 17 Apr 2021 12:51:29 +0000 (14:51 +0200)]
[Inline] Don't add noalias metadata to inaccessiblememonly calls

It will not do anything useful for them, as we already know that
they don't modref with any accessible memory.

In particular, this prevents noalias metadata from being placed
on noalias.scope.decl intrinsics. This reduces the amount of
metadata needed, and makes it more likely that unnecessary decls
can be eliminated.

3 years ago[Support] AbsoluteDifference - add brackets to appease static analyzer warning. NFCI.
Simon Pilgrim [Sat, 17 Apr 2021 11:00:38 +0000 (12:00 +0100)]
[Support] AbsoluteDifference - add brackets to appease static analyzer warning. NFCI.

3 years ago[Sanitizers] Fix build
David CARLIER [Sat, 17 Apr 2021 10:15:31 +0000 (11:15 +0100)]
[Sanitizers] Fix build

3 years ago[Sanitizers] DragonFlyBSD adding support for builtins
David Carlier [Sat, 17 Apr 2021 10:10:35 +0000 (11:10 +0100)]
[Sanitizers] DragonFlyBSD adding support for builtins
Reviewed By: vitalybuka

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

3 years ago[Sanitizers] Undefined Behavior Sanitizer support for DragonFlyBSD
David Carlier [Sat, 17 Apr 2021 10:08:00 +0000 (11:08 +0100)]
[Sanitizers] Undefined Behavior Sanitizer support for DragonFlyBSD
Reviewed By: vitalybuka

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

3 years ago[ELF] --wrap: don't clear sym->isUsedInRegularObj if real->isUsedInRegularObj; set...
Fangrui Song [Sat, 17 Apr 2021 07:29:51 +0000 (00:29 -0700)]
[ELF] --wrap: don't clear sym->isUsedInRegularObj if real->isUsedInRegularObj; set wrap's initial binding to sym's

Fix PR49897: if `__real_foo` has the isUsedInRegularObj bit set, we need to
retain `foo` in .symtab, even if `foo` is undefined. The new behavior will match
GNU ld.

Before the patch, we produced an R_X86_64_JUMP_SLOT relocation referencing the
index 0 undefined symbol, which would be erroed by glibc
(see f96ff3c0f8ebd941b3f6b345164c3d858b781484).

While here, fix another bug: if `__wrap_foo` does not exist, its initial binding
should be `foo`'s.

3 years agoNormalize interaction with boolean attributes
Serge Guelton [Wed, 24 Mar 2021 20:45:04 +0000 (16:45 -0400)]
Normalize interaction with boolean attributes

Such attributes can either be unset, or set to "true" or "false" (as string).
throughout the codebase, this led to inelegant checks ranging from

        if (Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true")

to

        if (Fn->hasAttribute("no-jump-tables") && Fn->getFnAttribute("no-jump-tables").getValueAsString() == "true")

Introduce a getValueAsBool that normalize the check, with the following
behavior:

no attributes or attribute set to "false" => return false
attribute set to "true" => return true

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

3 years ago[libc][NFC] Use explicit conversion in aarch64 FEnv.
Siva Chandra [Sat, 17 Apr 2021 05:29:52 +0000 (22:29 -0700)]
[libc][NFC] Use explicit conversion in aarch64 FEnv.

3 years ago[libc]NFC] Use explicit conversion on frexpl_test and logbl_test.
Siva Chandra Reddy [Sat, 17 Apr 2021 05:49:23 +0000 (05:49 +0000)]
[libc]NFC] Use explicit conversion on frexpl_test and logbl_test.

3 years ago[libc][NFC] Use explicit conversion in modfl_test.
Siva Chandra Reddy [Sat, 17 Apr 2021 05:41:20 +0000 (05:41 +0000)]
[libc][NFC] Use explicit conversion in modfl_test.

3 years ago[libc][NFC] Make conversion from FPBits to the float point type explicit.
Siva Chandra Reddy [Wed, 14 Apr 2021 06:04:11 +0000 (06:04 +0000)]
[libc][NFC] Make conversion from FPBits to the float point type explicit.

This will help us catch errors like the ones fixed by the commit
31ed45d9cfd5da2bf4f1d7ddba54122df6fc91fa

3 years ago[libc][NFC] Add common template test class for sqrt, sqrtf and sqrtl.
Siva Chandra Reddy [Sat, 17 Apr 2021 05:06:13 +0000 (05:06 +0000)]
[libc][NFC] Add common template test class for sqrt, sqrtf and sqrtl.

3 years ago[ELF] Simplify R_386_TLS_GD computation. NFC
Fangrui Song [Sat, 17 Apr 2021 02:08:23 +0000 (19:08 -0700)]
[ELF] Simplify R_386_TLS_GD computation. NFC

3 years ago[TableGen] Replace two SmallDenseSets with SmallSets.
Craig Topper [Sat, 17 Apr 2021 00:45:40 +0000 (17:45 -0700)]
[TableGen] Replace two SmallDenseSets with SmallSets.

The key here is HwMode indices. They're going to be small numbers,
contiguous, and only a few different values. I don't think we need
to go through the SmallDenseSet hashing.

A BitVector would be even better, but we don't have the upper
bound here.

3 years ago[ASTReader] Only mark module out of date if not already compiled
Ben Barham [Sat, 17 Apr 2021 00:55:39 +0000 (17:55 -0700)]
[ASTReader] Only mark module out of date if not already compiled

If a module contains errors (ie. it was built with
-fallow-pcm-with-compiler-errors and had errors) and was from the module
cache, it is marked as out of date - see
a2c1054c303f20be006e9ef20739dbb88bd9ae02.

When a module is imported multiple times in the one compile, this caused
it to be recompiled each time - removing the existing buffer from the
module cache and replacing it. This results in various errors further
down the line.

Instead, only mark the module as out of date if it isn't already
finalized in the module cache.

Reviewed By: akyrtzi

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

3 years ago[PowerPC] Minor improvement for insert_vector_elt codegen
Nemanja Ivanovic [Fri, 16 Apr 2021 23:51:07 +0000 (18:51 -0500)]
[PowerPC] Minor improvement for insert_vector_elt codegen

For v2f64, all VSX subtargets can insert an element with a single
XXPERMDI.