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
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.
Simon Pilgrim [Mon, 19 Apr 2021 10:49:35 +0000 (11:49 +0100)]
[llvm-exegesis] Analysis.cpp - use for-range loop. 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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.
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
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.
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
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.
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.
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.
Craig Topper [Sun, 18 Apr 2021 04:49:45 +0000 (21:49 -0700)]
[TableGen] Use range-based for loop. NFC
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
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
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
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.
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.
Martin Storsjö [Sun, 18 Apr 2021 12:53:04 +0000 (15:53 +0300)]
[lldb] Remove a superfluous trailing semicolon, fixing warnings. NFC.
xgupta [Sun, 18 Apr 2021 12:00:17 +0000 (17:30 +0530)]
[Docs] Correct Boehm collector weblink in GarbageCollection.rst
LLVM GN Syncbot [Sun, 18 Apr 2021 11:35:28 +0000 (11:35 +0000)]
[gn build] Port
01ace074fcb6
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
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.
Nathan James [Sun, 18 Apr 2021 08:25:12 +0000 (09:25 +0100)]
[AST][Introspection][NFC] Remove unnecessary temporary strings.
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.
Roman Lebedev [Sun, 18 Apr 2021 07:26:16 +0000 (10:26 +0300)]
[NFC][LoopVectorize] Autogenerate check lines in X86/gather_scatter.ll test
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.
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
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
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.
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
Nikita Popov [Sat, 17 Apr 2021 18:58:27 +0000 (20:58 +0200)]
[LoopUnroll] Regenerate test checks (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.
Lang Hames [Sat, 17 Apr 2021 18:55:14 +0000 (11:55 -0700)]
[JITLink] Add testcase that was accidentally left out of
19e402d2b34.
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
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
Alexandre Ganea [Sat, 17 Apr 2021 17:56:23 +0000 (13:56 -0400)]
[Support] ThreadPool tests: silence warning unused variable 'It'
Stephen Kelly [Sat, 17 Apr 2021 17:58:05 +0000 (18:58 +0100)]
[AST] Enable AST node introspection on WIN32
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.
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
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
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.
Mark de Wever [Sat, 17 Apr 2021 16:01:32 +0000 (18:01 +0200)]
[libcxx][doc] Fixes typos.
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
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.
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
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
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.
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
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.
Simon Pilgrim [Sat, 17 Apr 2021 11:00:38 +0000 (12:00 +0100)]
[Support] AbsoluteDifference - add brackets to appease static analyzer warning. NFCI.
David CARLIER [Sat, 17 Apr 2021 10:15:31 +0000 (11:15 +0100)]
[Sanitizers] Fix build
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
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
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.
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
Siva Chandra [Sat, 17 Apr 2021 05:29:52 +0000 (22:29 -0700)]
[libc][NFC] Use explicit conversion in aarch64 FEnv.
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.
Siva Chandra Reddy [Sat, 17 Apr 2021 05:41:20 +0000 (05:41 +0000)]
[libc][NFC] Use explicit conversion in modfl_test.
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
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.
Fangrui Song [Sat, 17 Apr 2021 02:08:23 +0000 (19:08 -0700)]
[ELF] Simplify R_386_TLS_GD computation. NFC
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.
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
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.
Ben Shi [Fri, 16 Apr 2021 23:17:34 +0000 (07:17 +0800)]
[clang][NFC] Fix a potential assert failure
Reviewed By: MaskRay, craig.topper
Differential Revision: https://reviews.llvm.org/D100616
Jason Molenda [Fri, 16 Apr 2021 23:10:16 +0000 (16:10 -0700)]
Target::ReadMemory read from read-only binary file Section, not memory
Commiting this patch for Augusto Noronha who is getting set
up still.
This patch changes Target::ReadMemory so the default behavior
when a read is in a Section that is read-only is to fetch the
data from the local binary image, instead of reading it from
memory. Update all callers to use their old preferences
(the old prefer_file_cache bool) using the new API; we should
revisit these calls and see if they really intend to read
live memory, or if reading from a read-only Section would be
equivalent and important for performance-sensitive cases.
rdar://
30634422
Differential revision: https://reviews.llvm.org/D100338
Philip Reames [Fri, 16 Apr 2021 22:28:15 +0000 (15:28 -0700)]
[inferattrs] Don't infer lib func attributes for nobuiltin functions
If we have a nobuiltin function, we can't assume we know anything about the implementation.
I noticed this when tracing through a log from an in the wild miscompile (https://github.com/emscripten-core/emscripten/issues/9443) triggered after 8666463. We were incorrectly assuming that a custom allocator could not free. (It's not clear yet this is the only problem in said issue.)
I also noticed something similiar mentioned in the commit message of ab243e when scrolling back through history. Through, from what I can tell, that commit fixed symptom not root cause.
The interface we have for library function detection is extremely error prone, but given the interaction between ``nobuiltin`` decls and ``builtin`` callsites, it's really hard to imagine something much cleaner. I may iterate on that, but it'll be invasive enough I didn't want to hold an obvious functional fix on it.
Nico Weber [Fri, 16 Apr 2021 22:16:14 +0000 (18:16 -0400)]
[gn build] (manually) port
ca6751043d88 better
Craig Topper [Fri, 16 Apr 2021 21:59:40 +0000 (14:59 -0700)]
[TableGen] Run GenerateVariants before ExpandHwModeBasedTypes.
A large portion of the patterns are duplicated for HwMode on RISCV.
If we expand HwMode first, we need to check nearly twice as many
patterns for variants. HwModes shouldn't affect whether a variant
is valid so we should be able to expand after.
This also reduces the RISCV isel table by 539 bytes due to factoring
working better on this pattern order. Unfortunately it increases
Hexagon table size by ~50 bytes. But I think this is a reasonable
trade.
Nico Weber [Fri, 16 Apr 2021 22:03:44 +0000 (18:03 -0400)]
[gn build] (manually) port
ca6751043d88
Guillaume Chatelet [Fri, 16 Apr 2021 21:58:27 +0000 (21:58 +0000)]
[libc] Fix wrongly deduced type
Peyton, Jonathan L [Mon, 15 Mar 2021 19:02:34 +0000 (14:02 -0500)]
[OpenMP] Implement GOMP task reductions
Implement the remaining GOMP_* functions to support task reductions
in taskgroup, parallel, loop, and taskloop constructs. The unused mem
argument to many of the work-sharing constructs has to do with the
scan() directive/ inscan() modifier. If mem is set, each function
will call KMP_FATAL() and tell the user scan/inscan is unsupported. The
GOMP reduction implementation is kept separate from our implementation
because of how GOMP presents reduction data and computes the reductions.
GOMP expects the privatized copies to be present even after a #pragma
omp parallel reduction(task:...) region has ended so the data is stored
inside GOMP's uintptr_t* data pseudo-structure. This style is tightly
coupled with GCC compiler codegen. There also isn't any init(),
combiner(), fini() functions in GOMP's codegen so the two
implementations were to disparate to try to wrap GOMP's around our own.
Differential Revision: https://reviews.llvm.org/D98806