Sam McCall [Wed, 5 Jan 2022 15:00:13 +0000 (16:00 +0100)]
[clangd] Refine comment on declarator ranges
Haojian Wu [Wed, 5 Jan 2022 14:50:07 +0000 (15:50 +0100)]
[clangd] Fix typos in the SelectionTree comment.
Simon Tatham [Thu, 11 Feb 2021 11:41:20 +0000 (11:41 +0000)]
[AArch64] Adding "armv8.8-a" memcpy/memset support.
This family of instructions includes CPYF (copy forward), CPYB (copy
backward), SET (memset) and SETG (memset + initialise MTE tags), with
some sub-variants to indicate whether address translation is done in a
privileged or unprivileged way. For the copy instructions, you can
separately specify the read and write translations (so that kernels
can safely use these instructions in syscall handlers, to memcpy
between the calling process's user-space memory map and the kernel's
own privileged one).
The unusual thing about these instructions is that they write back to
multiple registers, because they perform an implementation-defined
amount of copying each time they run, and write back to _all_ the
address and size registers to indicate how much remains to be done
(and the code is expected to loop on them until the size register
becomes zero). But this is no problem in LLVM - you just define each
instruction to have multiple outputs, multiple inputs, and a set of
constraints tying their register numbers together appropriately.
This commit introduces a special subtarget feature called MOPS (after
the name the spec gives to the CPU id field), which is a dependency of
the top-level 8.8-A feature, and uses that to enable most of the new
instructions. The SETMG instructions also depend on MTE (and the test
checks that).
Differential Revision: https://reviews.llvm.org/D116157
gbreynoo [Wed, 5 Jan 2022 14:34:45 +0000 (14:34 +0000)]
[llvm-strings] Remove use of hard coded executable name
Other tools take their tool name from argv[0] for use in output
messages. This change makes llvm-strings consistent with other tools
rather than using a hard coded value.
Differential Revision: https://reviews.llvm.org/D116604
Sam McCall [Tue, 4 Jan 2022 21:46:25 +0000 (22:46 +0100)]
[clangd] Handle declarators more consistently in Selection.
Because declarators nest inside-out, we logically need to claim tokens for
parent declarators logically before child ones.
This is the ultimate reason we had problems with DeclaratorDecl, ArrayType etc.
However actually changing the order of traversal is hard, especially for nodes
that have both declarator and non-declarator children.
Since there's only a few TypeLocs corresponding to declarators, we just
have them claim the exact tokens rather than rely on nesting.
This fixes handling of complex declarators, like
`int (*Fun(OuterT^ype))(InnerType);`.
This avoids the need for the DeclaratorDecl early-claim hack, which is
removed.
Unfortunately the DeclaratorDecl early-claims were covering up an AST
anomaly around CXXConstructExpr, so we need to fix that up too.
Based on D116623 and D116618
Differential Revision: https://reviews.llvm.org/D116630
Nicolas Vasilache [Wed, 5 Jan 2022 13:19:32 +0000 (08:19 -0500)]
[mlir] Fix missing check on nested op values in LICM
LICM checks that nested ops depend only on values defined outside
before performing hoisting.
However, it specifically omits to check for terminators which can
lead to SSA violations.
This revision fixes the incorrect behavior.
Differential Revision: https://reviews.llvm.org/D116657
Florian Hahn [Wed, 5 Jan 2022 13:51:50 +0000 (13:51 +0000)]
[LV] Don't use getVPSingleValue for VPWidenMemoryInstRecipe (NFC).
VPWidenMemoryInstructionRecipe is a VPValue, so this can be passed
directly, instead of relying on getVPSingleValue.
Jan Svoboda [Wed, 5 Jan 2022 12:39:19 +0000 (13:39 +0100)]
[clang][lex] NFC: Simplify loop
Nicolas Vasilache [Wed, 5 Jan 2022 12:05:23 +0000 (07:05 -0500)]
[mlir][vector] NFC - Split out transfer split patterns
Differential Revision: https://reviews.llvm.org/D116648
Clement Courbet [Mon, 3 Jan 2022 13:25:29 +0000 (14:25 +0100)]
[clang-tidy] Fix false positive in modernize-pass-by-value
The check should not trigger on lvalue/rvalue overload pairs:
```
struct S {
S(const A& a) : a(a) {}
S(A&& a) : a(std::move(a)) {}
A a;
}
```
Differential Revision: https://reviews.llvm.org/D116535
Sanjay Patel [Tue, 4 Jan 2022 20:23:44 +0000 (15:23 -0500)]
[InstCombine] add tests for bswap; NFC
Sanjay Patel [Tue, 4 Jan 2022 18:52:29 +0000 (13:52 -0500)]
[InstSimplify] add tests for udiv/urem with known bits; NFC
Benjamin Kramer [Wed, 5 Jan 2022 12:58:01 +0000 (13:58 +0100)]
Retire llvm::make_reverse_iterator in favor of std::make_reverse_iterator
std::make_reverse_iterator is a C++14 feature, gcc has it since GCC 5.1.
Nikita Popov [Wed, 5 Jan 2022 13:05:00 +0000 (14:05 +0100)]
[GlobalOpt][Evaluator] Fix off by one error in bounds check (PR53002)
We should bail out if the index is >= the size, not > the size.
Fixes https://github.com/llvm/llvm-project/issues/53002.
Nicholas Guy [Tue, 7 Dec 2021 10:28:33 +0000 (10:28 +0000)]
[AArch64][CodeGen] Emit alignment "Max Skip" operand for AArch64 loops
Differential Revision: https://reviews.llvm.org/D114879
Nicholas Guy [Wed, 1 Dec 2021 10:51:31 +0000 (10:51 +0000)]
[CodeGen] Emit alignment "Max Skip" operand
The current AsmPrinter has support to emit the "Max Skip" operand
(the 3rd of .p2align), however has no support for it to actually be specified.
Adding MaxBytesForAlignment to MachineBasicBlock provides this capability on a
per-block basis. Leaving the value as default (0) causes no observable differences
in behaviour.
Differential Revision: https://reviews.llvm.org/D114590
Marek Kurdej [Wed, 5 Jan 2022 12:41:50 +0000 (13:41 +0100)]
[clang-format] Fix indentation for array variables with alignment of consecutive assignments and declarations.
Fixes https://github.com/llvm/llvm-project/issues/52914.
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D116527
Dmitry Vyukov [Wed, 5 Jan 2022 12:40:10 +0000 (13:40 +0100)]
msan: mark test as x86-specific
Differential Revision: https://reviews.llvm.org/D116653
Marek Kurdej [Wed, 5 Jan 2022 12:39:08 +0000 (13:39 +0100)]
[clang-format] Simplify raw string regex. NFC.
Introduced in https://reviews.llvm.org/D115168.
Reviewed By: MyDeveloperDay, HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D116647
Pavel Labath [Wed, 5 Jan 2022 12:04:20 +0000 (13:04 +0100)]
[lldb/linux] Fix a race in handling of simultaneous thread exits
D116372, while fixing one kind of a race, ended up creating a new one.
The new issue could occur when one inferior thread exits while another
thread initiates termination of the entire process (exit_group(2)).
With some bad luck, we could start processing the exit notification
(PTRACE_EVENT_EXIT) only to have the become unresponsive (ESRCH) in the
middle of the MonitorCallback function. This function would then delete
the thread from our list even though it wasn't completely dead (it stays
zombified until we read the WIFEXITED event). The linux kernel will not
deliver the exited event for the entire process until we process
individual thread exits.
In a pre-D116372 world, this wouldn't be a problem because we would read
this event (even though we would not know what to do with it) with
waitpid(-1). Now, when we issue invididual waitpids, this event will
never be picked up, and we end up hanging.
The fix for this is actually quite simple -- don't delete the thread in
this situation. The thread will be deleted when the WIFEXITED event
comes.
This situation was kind of already tested by
TestCreateDuringInstructionStep (which is how I found this problem), but
it was mostly accidental, so I am also creating a dedicated test which
reproduces this situation.
Sander de Smalen [Tue, 4 Jan 2022 16:20:45 +0000 (16:20 +0000)]
[LV] Remove what seems like stale code in collectElementTypesForWidening.
This was originally added in rG22174f5d5af1eb15b376c6d49e7925cbb7cca6be
although that patch doesn't really mention any reasons for ignoring the
pointer type in this calculation if the memory access isn't consecutive.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D115356
Dmitry Vyukov [Thu, 23 Dec 2021 08:10:54 +0000 (09:10 +0100)]
msan: check that ucontext_t is initialized on signal return
A signal handler can alter ucontext_t to affect execution after
the signal returns. Check that the contents are initialized.
Restoring unitialized values in registers can't be good.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D116209
Dmitry Vyukov [Thu, 23 Dec 2021 08:06:37 +0000 (09:06 +0100)]
msan: account for AVX state when unpoison ucontext_t
ucontext_t can be larger than its static size if it contains
AVX state and YMM/ZMM registers.
Currently a signal handler that tries to access that state
can produce false positives with random origins on stack.
Account for the additional ucontext_t state.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D116208
Archibald Elliott [Wed, 5 Jan 2022 12:09:58 +0000 (12:09 +0000)]
Revert "[Clang][ScanDeps] Use the virtual path for module maps"
This reverts commits:
-
04192422c4e3b730c580498b8e948088cb15580b.
-
015e08c6badad6b27404d6f94569e25c18d79049
D114206 was landed before it was approved - and was landed knowing that
the test crashed on windows, without an xfail. The promised follow-up
commit with fixes has not appeared since it was promised on December 14th.
Matthias Springer [Wed, 5 Jan 2022 11:36:05 +0000 (20:36 +0900)]
[mlir][linalg][bufferize][NFC] Use RewriterBase instead of OpBuilder
This is in preparation of unifying core bufferization and Comprehensive Bufferize.
Differential Revision: https://reviews.llvm.org/D116102
Paul Walker [Thu, 23 Dec 2021 17:47:38 +0000 (17:47 +0000)]
[SVE] Add ISel for fabs(fsub(a,b)) ==> FABD.
Differential Revision: https://reviews.llvm.org/D116227
Paul Walker [Fri, 31 Dec 2021 13:50:59 +0000 (13:50 +0000)]
[AArch64ISelLowering] Don't look through scalable extract_subvector when optimising DUPLANE.
When constructDup is passed an extract_subvector it tries to use
extract_subvector's operand directly when creating the DUPLANE.
This is invalid when extracting from a scalable vector because the
necessary DUPLANE ISel patterns do not exist.
NOTE: This patch is an update to https://reviews.llvm.org/D110524
that originally fixed this but introduced a bug when the result
VT is 64bits. I've restructured the code so the critial final
else block is entered when necessary.
Differential Revision: https://reviews.llvm.org/D116442
Nikita Popov [Wed, 5 Jan 2022 11:37:09 +0000 (12:37 +0100)]
[ConstantFold] Use ConstantFoldLoadFromUniformValue() in more places
In particular, this also preserves undef when loading from padding,
rather than converting it to zero through a different codepath.
This is the remaining part of D115924.
Nikita Popov [Wed, 5 Jan 2022 11:34:10 +0000 (12:34 +0100)]
[ConstantFold] Add test for load of padding (NFC)
This currently load zero rather than undef.
Björn Schäpers [Mon, 3 Jan 2022 06:57:54 +0000 (07:57 +0100)]
[clang-format][NFC] Put all state change into the for statement
Differential Revision: https://reviews.llvm.org/D116563
Björn Schäpers [Sun, 2 Jan 2022 21:22:55 +0000 (22:22 +0100)]
[clang-format][NFC] Right.Previous is Left
Use that name. Also remove the one check for its existence, that is
given.
Differential Revision: https://reviews.llvm.org/D116562
Björn Schäpers [Sun, 2 Jan 2022 21:16:52 +0000 (22:16 +0100)]
[clang-format][NFC] Use Prev instead of Current->Previous
Differential Revision: https://reviews.llvm.org/D116561
Björn Schäpers [Sun, 2 Jan 2022 21:12:46 +0000 (22:12 +0100)]
[clang-format][NFC] TokenAnnotator: Use range based for
Differential Revision: https://reviews.llvm.org/D116560
Björn Schäpers [Sun, 2 Jan 2022 21:06:18 +0000 (22:06 +0100)]
[clang-format][NFC] Early return in TokenAnnotator::next
Differential Revision: https://reviews.llvm.org/D116559
Björn Schäpers [Sun, 2 Jan 2022 21:01:49 +0000 (22:01 +0100)]
[clang-format][NFC] Don't pass member by argument
And then use the argument and member.
Differential Revision: https://reviews.llvm.org/D116558
Björn Schäpers [Mon, 3 Jan 2022 22:12:56 +0000 (23:12 +0100)]
[clang-format] Fix SeparateDefinitionBlocks docs and ...
the Style's equality operator.
This amends
6f6f88ffdae1e12e5f950ef418827a77a55c09c7
Differential Revision: https://reviews.llvm.org/D116557
Björn Schäpers [Fri, 3 Dec 2021 07:27:18 +0000 (08:27 +0100)]
[clang-format][NFC] Replace deque with vector
I think the deque was chosen because of a better push_front, but in
combination with llvm::reverse the push_back'ed vector should be the
better choice.
Differential Revision: https://reviews.llvm.org/D115064
Nikita Popov [Wed, 5 Jan 2022 11:17:22 +0000 (12:17 +0100)]
[ConstantFolding] Unify handling of load from uniform value
There are a number of places that specially handle loads from a
uniform value where all the bits are the same (zero, one, undef,
poison), because we a) don't care about the load offset in that
case b) it bypasses casts that might not be legal generally but
do work with uniform values.
We had multiple implementations of this, with a different set of
supported values each time. This replaces two usages with a more
complete helper. Other usages will be replaced separately, because
they have larger impact.
This is part of D115924.
Nikita Popov [Wed, 5 Jan 2022 11:13:15 +0000 (12:13 +0100)]
[ConstantFold] Add additional load from uniform value tests (NFC)
Matthias Springer [Wed, 5 Jan 2022 11:23:46 +0000 (20:23 +0900)]
[mlir][linalg][bufferize][NFC] Refactor BufferizationOption ownership
Pass unique_ptr<BufferizationOption> to the bufferization. This allows the bufferization to enqueue additional PostAnalysisSteps. When running bufferization a second time, a new BufferizationOptions must be constructed.
Differential Revision: https://reviews.llvm.org/D116101
Benjamin Kramer [Wed, 5 Jan 2022 09:32:11 +0000 (10:32 +0100)]
Revert "Revert "[InferAttrs] Add writeonly to all the math functions""
This reverts commit
29b6e967f3e99ac45340ea37a70262c70e4e7528. The bug it
found in PartiallyInlineLibCalls was fixed in
c8ffc73350dbb6044ca947bbead127b9b914cdf3.
Benjamin Kramer [Wed, 5 Jan 2022 11:04:40 +0000 (12:04 +0100)]
[PartiallyInlineLibCalls] Don't crash when there's a writeonly attribute on the call
readnone subsumes writeonly, so just swap out the attributes. The
verifier doesn't allow us to have both on a call.
Victor Perez [Wed, 5 Jan 2022 09:23:31 +0000 (09:23 +0000)]
[LegalizeTypes][VP] Add integer promotion support for vp.select
Promote select, vselect and vp.select in a similar way.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116400
Florian Hahn [Wed, 5 Jan 2022 11:00:47 +0000 (11:00 +0000)]
[VPlan] Add value numbering in unit test after
65c4d6191fc4.
Jun Ma [Wed, 29 Dec 2021 07:24:16 +0000 (15:24 +0800)]
[TTI] Return invalid cost for scalable vector in getShuffleCost
Differential Revision: https://reviews.llvm.org/D116362
Florian Hahn [Wed, 5 Jan 2022 10:37:28 +0000 (10:37 +0000)]
[VPlan] Add VPCanonicalIVPHIRecipe, partly retire createInductionVariable.
At the moment, the primary induction variable for the vector loop is
created as part of the skeleton creation. This is tied to creating the
vector loop latch outside of VPlan. This prevents from modeling the
*whole* vector loop in VPlan, which in turn is required to model
preheader and exit blocks in VPlan as well.
This patch introduces a new recipe VPCanonicalIVPHIRecipe to represent the
primary IV in VPlan and CanonicalIVIncrement{NUW} opcodes for
VPInstruction to model the increment.
This allows us to partly retire createInductionVariable. At the moment,
a bit of patching up is done after executing all blocks in the plan.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D113223
Archibald Elliott [Wed, 5 Jan 2022 10:41:48 +0000 (10:41 +0000)]
[clang][scandeps] Update Module Cache Path in Test
This fixes the test introduced in D114206 so it no longer writes to the current working directory.
Reviewed By: simon_tatham
Differential Revision: https://reviews.llvm.org/D116611
Fangrui Song [Wed, 5 Jan 2022 10:07:14 +0000 (02:07 -0800)]
[ELF] Remove redundant cast. NFC
Fangrui Song [Wed, 5 Jan 2022 10:06:30 +0000 (02:06 -0800)]
[ELF] --symbol-ordering-file: use getLocalSymbols. NFC
Fangrui Song [Wed, 5 Jan 2022 10:04:36 +0000 (02:04 -0800)]
[ELF] --symbol-ordering-file: remove weird !lazy condition for "no such symbol" diagnostic
The diagnostic is emitted for an unextracted lazy symbol but suppressed for an
undefined symbol. Suppressing the diagnostic for unextracted lazy symbol
probably makes more sense because (a) an unextracted lazy symbol is quite
similar to an undefined symbol and (b) an unextracted lazy symbol is different
from "no such symbol".
Nicolas Vasilache [Tue, 4 Jan 2022 11:35:52 +0000 (06:35 -0500)]
[mlir][scf] NFC - refactor the implementation of outlineIfOp
This revision refactors the implementation of outlineIfOp to expose
a finer-grain functionality `outlineSingleBlockRegion` that will be
reused in other contexts.
Differential Revision: https://reviews.llvm.org/D116591
Victor Perez [Wed, 5 Jan 2022 08:07:46 +0000 (08:07 +0000)]
[LegalizeTypes][VP] Add widening support for vp.select
Widen vp.select the same way as select and vselect.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D116407
Sjoerd Meijer [Wed, 5 Jan 2022 09:11:43 +0000 (09:11 +0000)]
Silence a few unused variable warnings. NFC.
Martin Storsjö [Wed, 5 Jan 2022 08:54:07 +0000 (10:54 +0200)]
Revert "[InferAttrs] Add writeonly to all the math functions"
This reverts commit
ea75be3d9df448b6abafaf752a8141764d93ca33 and
1eb5b6e85045d22720f177a02aaf7097930e4b4f.
That commit caused crashes with compilation e.g. like this
(not fixed by the follow-up commit):
$ cat sqrt.c
float a;
b() { sqrt(a); }
$ clang -target x86_64-linux-gnu -c -O2 sqrt.c
Attributes 'readnone and writeonly' are incompatible!
%sqrtf = tail call float @sqrtf(float %0) #1
in function b
fatal error: error in backend: Broken function found, compilation aborted!
Jim Lin [Wed, 5 Jan 2022 08:28:14 +0000 (16:28 +0800)]
[M68k][test][NFC] Remove new line at end of file
Sjoerd Meijer [Wed, 5 Jan 2022 08:55:26 +0000 (08:55 +0000)]
[LoopInfo] Clarify description of `makeLoopInvariant`. NFC.
Clarify that `Changed` is set to true if the instruction/value was made
loop-invariant; the function is returning true if it was already invariant.
Differential Revision: https://reviews.llvm.org/D116588
Nikita Popov [Wed, 5 Jan 2022 08:48:17 +0000 (09:48 +0100)]
[MemCpyOpt] Look through pointer casts when checking capture
The user scanning loop above looks through pointer casts, so we
also need to strip pointer casts in the capture check. Previously
the source was incorrectly considered not captured if a bitcast
was passed to the call.
Fangrui Song [Wed, 5 Jan 2022 08:46:48 +0000 (00:46 -0800)]
[ELF] Symbol::getVA: assert not called on a lazy symbol
The code path is dead after D111365.
Nikita Popov [Mon, 13 Dec 2021 09:54:53 +0000 (10:54 +0100)]
[MemCpyOpt] Make capture check during call slot optimization more precise
Call slot optimization is currently supposed to be prevented if
the call can capture the source pointer. Due to an implementation
bug, this check currently doesn't trigger if a bitcast of the source
pointer is passed instead. I'm somewhat afraid of the fallout of
fixing this bug (due to heavy reliance on call slot optimization
in rust), so I'd like to strengthen the capture reasoning a bit first.
In particular, I believe that the capture is fine as long as a)
the call itself cannot depend on the pointer identity, because
neither dest has been captured before/at nor src before the
call and b) there is no potential use of the captured pointer
before the lifetime of the source alloca ends, either due to
lifetime.end or a return from a function. At that point the
potentially captured pointer becomes dangling.
Differential Revision: https://reviews.llvm.org/D115615
Nikita Popov [Wed, 5 Jan 2022 08:33:04 +0000 (09:33 +0100)]
[MemCpyOpt] Add additional call slot capture tests (NFC)
Nikita Popov [Wed, 5 Jan 2022 08:14:50 +0000 (09:14 +0100)]
[GlobalOpt][Evaluator] Don't create bitcast for same type (PR52994)
isBitOrNoopPointerCastable() returns true if the types are the
same, but it's not actually possible to create a bitcast for all
such types. The assumption seems to be that the user will omit
creating the cast in that case, as it is unnecessary.
Fixes https://github.com/llvm/llvm-project/issues/52994.
Nikolas Klauser [Tue, 4 Jan 2022 14:56:49 +0000 (15:56 +0100)]
[libc++] Use _LIBCPP_DEBUG_ASSERT in __iterator/wrap_iter.h
Use `_LIBCPP_DEBUG_ASSERT` in `__iterator/wrap_iter.h`
Reviewed By: #libc, Quuxplusone, Mordante, ldionne
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D116347
Bharadwaj, Ritanya B [Wed, 22 Dec 2021 23:30:35 +0000 (15:30 -0800)]
SIGSEGV in Sanitizer INTERCEPTOR of strstr function.
This is a segmentation fault in INTERCEPTOR function on a special edge
case of strstr libc call. When 'Haystack'(main string to be examined) is
NULL and 'needle'(sub-string to be searched in 'Haystack') is an empty
string then it hits a SEGV while using sanitizers and as a 'string not
found' case otherwise.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D115919
serge-sans-paille [Tue, 4 Jan 2022 13:35:09 +0000 (08:35 -0500)]
Document __builtin_trap and __builtin_debugtrap
Differential Revision: https://reviews.llvm.org/D116598
Nikolas Klauser [Mon, 3 Jan 2022 00:24:09 +0000 (01:24 +0100)]
[libc++][NFC] Remove duplicate header includes from <algorithm> and reorder them
Remove duplicate header includes from `<algorithm>` and reorder the includes
Reviewed By: Quuxplusone, ldionne, Mordante, #libc, jloser
Spies: jloser, libcxx-commits
Differential Revision: https://reviews.llvm.org/D116507
Zi Xuan Wu [Wed, 5 Jan 2022 07:55:11 +0000 (15:55 +0800)]
[CSKY] Add python script of CSKY asm update test check
Zi Xuan Wu [Thu, 30 Dec 2021 08:10:22 +0000 (16:10 +0800)]
[CSKY] Add codegen of select/br/cmp instruction and some frame lowering infra
Add basic integer codegen of select/br/cmp instruction. It also includes frame lowering code
such as prologue/epilogue.
Jim Lin [Wed, 5 Jan 2022 06:29:38 +0000 (14:29 +0800)]
[M68k][test][NFC] Remove unecessary labels and assembly directives
Mikael Holmen [Wed, 5 Jan 2022 07:35:16 +0000 (08:35 +0100)]
[Hexagon] Fix warning about unused variable when compiling without asserts
Shao-Ce SUN [Wed, 5 Jan 2022 06:49:03 +0000 (14:49 +0800)]
[NFC][clang] Fix comments.
Florian Mayer [Wed, 5 Jan 2022 02:22:46 +0000 (18:22 -0800)]
[sanitizers] Fix integer underflow when parsing ELF.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D116639
Mehdi Amini [Wed, 5 Jan 2022 05:36:34 +0000 (05:36 +0000)]
Align adaptor's generator accessors for attribute on the Op class
Each attribute has two accessor: one suffixed with `Attr` which returns the attribute itself
and one without the suffix which unwrap the attribute.
For example for a StringAttr attribute with a field named `kind`, we'll generate:
StringAttr getKindAttr();
StringRef getKind();
Differential Revision: https://reviews.llvm.org/D116466
Xu Mingjie [Wed, 5 Jan 2022 05:40:23 +0000 (21:40 -0800)]
[LTO] Fix assertion failed when flushing bitcode incrementally for LTO output.
In https://reviews.llvm.org/D86905, we introduce an optimization, when lld emits LLVM bitcode,
we allow bitcode writer flush data to disk early when buffered data size is above some threshold.
But when `--plugin-opt=emit-llvm` and `-o /dev/null` are used,
lld will trigger assertion `BytesRead >= 0 && static_cast<size_t>(BytesRead) == BytesFromDisk`.
When we write output to /dev/null, BytesRead is zero, but at this program point BytesFromDisk is always non-zero.
Reviewed By: stephan.yichao.zhao, MaskRay
Differential Revision: https://reviews.llvm.org/D112297
Pravin Jagtap [Wed, 5 Jan 2022 03:54:13 +0000 (22:54 -0500)]
[AMDGPU] Test commit. NFC.
Differential Revision: https://reviews.llvm.org/D116641
Mircea Trofin [Tue, 4 Jan 2022 17:22:29 +0000 (09:22 -0800)]
[NFC][MLGO]Add RTTI support for MLModelRunner and simplify runner setup
Chuanqi Xu [Wed, 5 Jan 2022 03:36:49 +0000 (11:36 +0800)]
[NFC] [Coroutines] Rename ReuseFrameSlot to OptimizeFrame
We could use the variable as a flag to indicate if the optimization
is on.
Fangrui Song [Wed, 5 Jan 2022 03:38:32 +0000 (19:38 -0800)]
[lld-link] Remove unneeded lto::InputFile::create after D116434
Luís Ferreira [Wed, 5 Jan 2022 03:05:10 +0000 (03:05 +0000)]
[lld] Add support for other demanglers other than Itanium
LLVM core library supports demangling other mangled symbols other than itanium,
such as D and Rust. LLD should use those demanglers in order to output pretty
demangled symbols on error messages.
Reviewed By: MaskRay, #lld-macho
Differential Revision: https://reviews.llvm.org/D116279
Fangrui Song [Wed, 5 Jan 2022 02:59:35 +0000 (18:59 -0800)]
[InferAttrs] If readonly is already set, set readnone instead of writeonly
D116426 may lead to an assertion failure `Attributes 'readonly and writeonly' are incompatible!` if the builtin function already has `readonly`.
Chuanqi Xu [Wed, 5 Jan 2022 02:19:44 +0000 (10:19 +0800)]
[Coroutines] Set presplit attribute in Clang and mlir
This fixes bug49264.
Simply, coroutine shouldn't be inlined before CoroSplit. And the marker
for pre-splited coroutine is created in CoroEarly pass, which ran after
AlwaysInliner Pass in O0 pipeline. So that the AlwaysInliner couldn't
detect it shouldn't inline a coroutine. So here is the error.
This patch set the presplit attribute in clang and mlir. So the inliner
would always detect the attribute before splitting.
Reviewed By: rjmccall, ezhulenev
Differential Revision: https://reviews.llvm.org/D115790
Heejin Ahn [Mon, 3 Jan 2022 07:42:38 +0000 (23:42 -0800)]
[WebAssembly] Use llvm utility functions in EH/SjLj
This uses `changeToCall` and `changeToInvokeAndSplitBasicBlock` from
`lib/Transforms/Utils`, replacing the custom logic. One difference of
those functions from our previous logic is they delete the original
`CallInst`/`InvokeInst`, which makes them tricky to use while iterating
through instructions/BBs. So this CL gathers the candidate calls first
and run them through `changeToInvokeAndSplitBasicBlock` later.
Also this renames some variables.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D116620
Heejin Ahn [Sun, 2 Jan 2022 02:03:00 +0000 (18:03 -0800)]
[WebAssembly] Nullify unnecessary setjmp calls
D107530 did a small optimization that, if a function contains `setjmp`
calls but not other calls that can `longjmp`, we don't do SjLj
transformation on those `setjmp` calls, because they don't have
possibilities of returning from `longjmp`.
But we should remove those `setjmp` calls even in that case, because
Emscripten doesn't provide that function, assuming it is lowered away by
SjLj transformation. `setjmp` always returns 0 when called directly, so
this CL replaces them with `i32 0`.
Fixes https://github.com/emscripten-core/emscripten/issues/15679.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D116619
Fangrui Song [Wed, 5 Jan 2022 00:52:24 +0000 (16:52 -0800)]
[docs] Re-generate ClangCommandLineReference.rst
Rumeet Dhindsa [Wed, 5 Jan 2022 00:23:20 +0000 (16:23 -0800)]
Revert "[clang][ObjC] Add fix it for missing methods in impl"
This reverts commit
dd72ae3dcc6895f95e1203b40aabcb069c76a0ab.
Notified the author of the internal failure and author suggested to revert it for
now.
wren romano [Tue, 4 Jan 2022 23:15:36 +0000 (15:15 -0800)]
[mlir][sparse] Factoring out type-based function-name suffixes
Depends On D115010
This changes a couple of places that used to `return failure();` to now use `llvm_unreachable()` instead. However, `Transforms/Sparsification.cpp` should be doing the necessary type checks to ensure that those cases are in fact unreachable.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D115012
wren romano [Tue, 4 Jan 2022 23:10:54 +0000 (15:10 -0800)]
[mlir][sparse] adding OverheadType::kIndex
Depends On D115008
This change opens the way for D115012, and removes some corner cases in `CodegenUtils.cpp`. The `SparseTensorAttrDefs.td` already specifies that we allow `0` bitwidth for the two overhead types and that it is interpreted to mean the architecture's native width.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D115010
wren romano [Tue, 4 Jan 2022 23:06:28 +0000 (15:06 -0800)]
[mlir][sparse] Factoring out Transforms/CodegenUtils.{cpp,h}
This moves a bunch of helper functions from `Transforms/SparseTensorConversion.cpp` into `Transforms/CodegenUtils.{cpp,h}` so that they can be reused by `Transforms/Sparsification.cpp`, etc.
See also the dependent D115010 which cleans up some corner cases in this change.
Reviewed By: aartbik, rriddle
Differential Revision: https://reviews.llvm.org/D115008
Henry Linjamäki [Wed, 5 Jan 2022 00:00:36 +0000 (16:00 -0800)]
CUDA/HIP: Allow __int128 on the host side
Consider case where `__int128` type is supported by the host target but
not by a device target (e.g. spirv*). Clang emits an error message for
unsupported type even if the device code does not use it. This patch
fixes this issue by emitting the error message when the device code
attempts to use the unsupported type.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D111047
Sumanth Gundapaneni [Wed, 1 Sep 2021 03:46:21 +0000 (22:46 -0500)]
[Hexagon] Fix MachineSink not to hoist FP instructions that update USR.
Ideally we should make USR as Def for these floating point instructions.
However, it violates some assembler MCChecker rules. This patch fixes
the issue by marking these FP instructions as non-sinkable.
SANTANU DAS [Mon, 2 Nov 2020 19:15:40 +0000 (00:45 +0530)]
[Hexagon] Make A2_tfrsi not cheap for operands exceeding 16 bits
This patch aids to reduce code size since it removes generation
of back-to-back A2_tfrsi instructions. It is enabled only at -Os/-Oz.
Krzysztof Parzyszek [Tue, 4 Jan 2022 23:37:05 +0000 (15:37 -0800)]
[Hexagon] Convert codegen testcase from .ll to .mir
Jacques Pienaar [Tue, 4 Jan 2022 23:37:33 +0000 (15:37 -0800)]
[mlir] Retain metadata for single loc fusedloc
If a fusedloc is created with a single location then no fusedloc
was previously created and single location returned instead. In the case
where there is a metadata associated with the location this results in
discarding the metadata. Instead only canonicalize where there is no
loss of information.
Differential Revision: https://reviews.llvm.org/D115605
Fangrui Song [Tue, 4 Jan 2022 23:11:44 +0000 (15:11 -0800)]
[lld-link] Replace LazyObjFile with lazy ObjFile/BitcodeFile
Similar to ELF
3a5fb57393c3bc77be9e7afc2ec9d4ec3c9bbf70.
* previously when a LazyObjFile was extracted, a new ObjFile/BitcodeFile was created; now the file is reused, just with `lazy` cleared
* avoid the confusing transfer of `symbols` from LazyObjFile to the new file
* simpler code, smaller executable (5200+ bytes smaller on x86-64)
* make eager parsing feasible (for parallel section/symbol table initialization)
Reviewed By: aganea, rnk
Differential Revision: https://reviews.llvm.org/D116434
Nikolas Klauser [Tue, 4 Jan 2022 22:28:21 +0000 (23:28 +0100)]
[libc++][test] Allow multiple tries in some thread tests
LLVM GN Syncbot [Tue, 4 Jan 2022 22:44:20 +0000 (22:44 +0000)]
[gn build] Port
6d722801d1a2
Nikolas Klauser [Tue, 4 Jan 2022 18:55:37 +0000 (19:55 +0100)]
[libc++][ranges] Add indirectly_comparable concept
Add `indirectly_comparable` concept
Reviewed By: Quuxplusone, Mordante, #libc
Spies: mgorny, libcxx-commits
Differential Revision: https://reviews.llvm.org/D116268
Brendon Cahoon [Tue, 4 Jan 2022 22:34:15 +0000 (14:34 -0800)]
[Hexagon] Fix some issues with packetizing slot0-only instructions
V Donaldson [Tue, 4 Jan 2022 20:54:45 +0000 (12:54 -0800)]
[flang] Modify an IO format error message
F18 constraint C1308 is:
For the G edit descriptor, e shall not be specified if w is zero.
For an edit descriptor such as 'G0.2E4', change the error message from:
error: Unexpected 'e' in 'G0' edit descriptor
To:
error: A 'G0' edit descriptor must not have an 'e' value
Arthur O'Dwyer [Fri, 31 Dec 2021 04:28:12 +0000 (23:28 -0500)]
[libc++] [P0887] Add newest feature-test macros; mark `type_identity` as implemented.
`__cpp_lib_type_identity` was implemented way back in
cf49ccd0 (Clang 8),
probably before the feature-test macro had been settled on.
`__cpp_lib_string_resize_and_overwrite` will be added by D113013 so I didn't add it here.
Fixes #46605.
Differential Revision: https://reviews.llvm.org/D116433
Arthur O'Dwyer [Thu, 23 Dec 2021 21:53:48 +0000 (16:53 -0500)]
[libc++] [ranges] ADL-proof the [range.access] CPOs.
For example, `std::ranges::range<Holder<Incomplete>*>` should be
well-formed false, not a hard error at compile time.
Differential Revision: https://reviews.llvm.org/D116239