Simon Pilgrim [Wed, 6 Oct 2021 16:23:14 +0000 (17:23 +0100)]
[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_ULT/UGT for generic uadd/usubo cost expansion
Match the predicates used in TargetLowering::expandUADDSUBO
Leonard Chan [Wed, 6 Oct 2021 18:09:29 +0000 (11:09 -0700)]
[compiler-rt][test] Add shared_unwind requirement
When using a static libunwind, the check_memcpy.c can fail because it checks
that tsan intercepted all memcpy/memmoves in the final binary. Though if the
static libunwind is not instrumented, then this will fail because it may contain
regular memcpy/memmoves.
This adds a new REQUIRES check for ensuring that this test won't run unless a
dynamic libunwind.so is provided.
Differential Revision: https://reviews.llvm.org/D111194
Arthur Eubanks [Fri, 24 Sep 2021 22:54:17 +0000 (15:54 -0700)]
Reland [IR] Increase max alignment to 4GB
Currently the max alignment representable is 1GB, see D108661.
Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.
This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits.
We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.
The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.
Updating clang's max allowed alignment will come in a future patch.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D110451
Craig Topper [Wed, 6 Oct 2021 17:56:52 +0000 (10:56 -0700)]
[X86] Add X86 and X64 prefixes to parity.ll to reduce duplicate check lines. NFC
LLVM GN Syncbot [Wed, 6 Oct 2021 17:59:12 +0000 (17:59 +0000)]
[gn build] Port
10f16bc7b2bf
Stella Stamenova [Wed, 6 Oct 2021 17:56:45 +0000 (10:56 -0700)]
Revert "[lldb] [ABI/X86] Split base x86 and i386 classes"
This change broke the windows lldb bot.
This reverts commit
a30a36f66aea459337999a000c7997b220b25227.
Kevin P. Neal [Wed, 6 Oct 2021 17:49:24 +0000 (13:49 -0400)]
[FPEnv][InstSimplify] Fold constrained X + -0.0 ==> X
Currently the fadd optimizations in InstSimplify don't know how to do this
"X + -0.0 ==> X" fold when using the constrained intrinsics. This adds the
support.
This commit is derived from D106362 with some improvements from D107285.
Differential Revision: https://reviews.llvm.org/D111085
Fangrui Song [Wed, 6 Oct 2021 17:49:25 +0000 (10:49 -0700)]
[Driver][test] Add Debian multiarch lib/clang/14.0.0/x86_64-linux-gnu and include/x86_64-linux-gnu/c++/v1 tests
Vitaly Buka [Tue, 5 Oct 2021 20:49:31 +0000 (13:49 -0700)]
[sanitizer] Switch to StackDepotNode to 64bit hash
Now we can avoid scanning the stack on fast path.
The price is the false stack trace with probability of the hash collision.
This increase performance of lsan by 6% and pre-requirement for stack compression.
Depends on D111182.
Reviewed By: morehouse, dvyukov
Differential Revision: https://reviews.llvm.org/D111183
natashaknk [Wed, 6 Oct 2021 17:29:37 +0000 (10:29 -0700)]
[mlir][tosa] Create basic dynamic shape support for several ops.
Transpose, Matmul and Fully-connected dynamic shape support
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D111167
Craig Topper [Wed, 6 Oct 2021 17:29:27 +0000 (10:29 -0700)]
[X86] Add test cases for PR52093. NFC
Mogball [Fri, 1 Oct 2021 19:56:38 +0000 (19:56 +0000)]
[MLIR] Update DRR doc with returnType directive
Add missing documentation.
Reviewed By: Chia-hungDuan, jpienaar
Differential Revision: https://reviews.llvm.org/D110964
Arthur Eubanks [Wed, 6 Oct 2021 17:21:17 +0000 (10:21 -0700)]
Revert "[IR] Increase max alignment to 4GB"
This reverts commit
df84c1fe78130a86445d57563dea742e1b85156a.
Breaks some bots
Michael Kruse [Wed, 6 Oct 2021 16:43:29 +0000 (11:43 -0500)]
[Clang][OpenMP] Allow loop-transformations with template parameters.
Clang would reject
#pragma omp for
#pragma omp tile sizes(P)
for (int i = 0; i < 128; ++i) {}
where P is a template parameter, but the loop itself is not
template-dependent. Because P context-dependent, the TransformedStmt
cannot be generated and therefore is nullptr (until the template is
instantiated by TreeTransform). The OMPForDirective would still expect
the a loop is the dependent context and trigger an error.
Fix by introducing a NumGeneratedLoops field to OMPLoopTransformation.
This is used to distinguish the case where no TransformedStmt will be
generated at all (e.g. #pragma omp unroll full) and template
instantiation is needed. In the latter case, delay resolving the
iteration space like when the for-loop itself is template-dependent
until the template instatiation.
A more radical solution would always delay the iteration space analysis
until template instantiation, but would also break many test cases.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D111124
H.J. Lu [Fri, 10 Sep 2021 13:24:36 +0000 (06:24 -0700)]
[sanitizer] Support Intel CET
1. Include <cet.h> in sanitizer_common/sanitizer_asm.h to mark Intel CET
support when Intel CET is enabled.
2. Add _CET_ENDBR to function entries in assembly codes so that ENDBR
instruction will be generated when Intel CET is enabled.
Reviewed By: dvyukov
Differential Revision: https://reviews.llvm.org/D111185
Frederic Cambus [Wed, 6 Oct 2021 17:07:31 +0000 (22:37 +0530)]
[CMake] Fix typo in error message for LLD in bootstrap builds.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D110836
Shivam Gupta [Wed, 6 Oct 2021 08:19:59 +0000 (13:49 +0530)]
[NFC] Add doxygen comment for hasFp in RISCVFrameLowering.cpp
Pengxuan Zheng [Tue, 5 Oct 2021 22:16:05 +0000 (15:16 -0700)]
[ARM] Fix a bug in finding a pair of extracts to create VMOVRRD
D100244 missed a check on the ResNo of the extract's operand 0 when finding a
pair of extracts to combine into a VMOVRRD (extract(x, n); extract(x, n+1) ->
VMOVRRD(extract x, n/2)). As a result, it can incorrectly pair an extract(x, n)
with another extract(x:3, n+1) for example. This patch fixes the bug by adding
the proper check on ResNo.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D111188
Arthur Eubanks [Fri, 24 Sep 2021 22:54:17 +0000 (15:54 -0700)]
[IR] Increase max alignment to 4GB
Currently the max alignment representable is 1GB, see D108661.
Setting the align of an object to 4GB is desirable in some cases to make sure the lower 32 bits are clear which can be used for some optimizations, e.g. https://crbug.com/1016945.
This uses an extra bit in instructions that carry an alignment. We can store 15 bits of "free" information, and with this change some instructions (e.g. AtomicCmpXchgInst) use 14 bits.
We can increase the max alignment representable above 4GB (up to 2^62) since we're only using 33 of the 64 values, but I've just limited it to 4GB for now.
The one place we have to update the bitcode format is for the alloca instruction. It stores its alignment into 5 bits of a 32 bit bitfield. I've added another field which is 8 bits and should be future proof for a while. For backward compatibility, we check if the old field has a value and use that, otherwise use the new field.
Updating clang's max allowed alignment will come in a future patch.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D110451
Arthur Eubanks [Tue, 5 Oct 2021 20:55:31 +0000 (13:55 -0700)]
[clang] Allow printing 64 bit ints in diagnostics
Currently we're limited to 32 bit ints in diagnostics.
With support for 4GB alignments coming soon, we need to report 4GB as the max alignment allowed.
I've tested that this does indeed properly print 2^32.
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D111184
Max Kazantsev [Wed, 6 Oct 2021 15:51:39 +0000 (22:51 +0700)]
[Test] Add LoopPeel test for loops with profile data available
Patch by Dmitry Makogon!
Gabor Marton [Thu, 30 Sep 2021 21:24:17 +0000 (23:24 +0200)]
[analyzer][NFC] Add RangeSet::dump
This tiny change improves the debugging experience of the solver a lot!
Differential Revision: https://reviews.llvm.org/D110911
Geoffrey Martin-Noble [Fri, 6 Aug 2021 22:59:50 +0000 (15:59 -0700)]
[MLIR] Improve debug messages in BuiltinTypes
It's nice for users to have more information when debugging failures and
these are only triggered in a failure path.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D107676
Alexandre Rames [Tue, 5 Oct 2021 17:53:02 +0000 (10:53 -0700)]
[MLIR] Rename Shape dialect's `join` to `meet`.
For the type lattice, we (now) use the "less specialized or equal" partial
order, leading to the bottom representing the empty set, and the top
representing any type.
This naming is more in line with the generally used conventions, where the top
of the lattice is the full set, and the bottom of the lattice is the empty set.
A typical example is the powerset of a finite set: generally, meet would be the
intersection, and join would be the union.
```
top: {a,b,c}
/ | \
{a,b} {a,c} {b,c}
| X X |
{a} { b } {c}
\ | /
bottom: { }
```
This is in line with the examined lattice representations in LLVM:
* lattice for `BitTracker::BitValue` in `Hexagon/BitTracker.h`
* lattice for constant propagation in `HexagonConstPropagation.cpp`
* lattice in `VarLocBasedImpl.cpp`
* lattice for address space inference code in `InferAddressSpaces.cpp`
Reviewed By: silvas, jpienaar
Differential Revision: https://reviews.llvm.org/D110766
Nikita Popov [Tue, 28 Sep 2021 20:21:37 +0000 (22:21 +0200)]
[BasicAA] Don't unnecessarily extend pointer size
BasicAA GEP decomposition currently performs all calculation on the
maximum pointer size, but at least 64-bit, with an option to double
the size. The code comment claims that this improves analysis power
when working with uint64_t indices on 32-bit systems. However, I don't
see how this can be, at least while maintaining correctness:
When working on canonical code, the GEP indices will have GEP index
size. If the original code worked on uint64_t with a 32-bit size_t,
then there will be truncs inserted before use as a GEP index. Linear
expression decomposition does not look through truncs, so this will
be an opaque value as far as GEP decomposition is concerned. Working
on a wider pointer size does not help here (or have any effect at all).
When working on non-canonical code (before first InstCombine), the
GEP indices are implicitly truncated to GEP index size. The BasicAA
code currently just ignores this fact completely, and pretends that
this truncation doesn't happen. This is incorrect and will be
addressed by D110977.
I believe that for correctness reasons, it is important to work on
the actual GEP index size to properly model potential overflow.
BasicAA tries to patch over the fact that it uses the wrong size
(see adjustToPointerSize), but it only does that in limited cases
(only for constant values, and not all of them either). I'd like to
move this code towards always working on the correct size, and
dropping these artificial pointer size adjustments is the first step
towards that.
Differential Revision: https://reviews.llvm.org/D110657
Sanjay Patel [Wed, 6 Oct 2021 15:32:46 +0000 (11:32 -0400)]
[InstSimplify] (x | y) & (x | !y) --> x
https://alive2.llvm.org/ce/z/QagQMn
This fold is handled by instcombine via SimplifyUsingDistributiveLaws(),
but we are missing the sibliing fold for 'logical and' (implemented with
'select'). Retrofitting the code in instcombine looks much harder
than just adding a small adjustment here, and this is potentially more
efficient and beneficial to other passes.
Sanjay Patel [Wed, 6 Oct 2021 15:06:10 +0000 (11:06 -0400)]
[InstSimplify] add tests for bitwise logic fold of 'and'; NFC
Gabor Marton [Thu, 30 Sep 2021 21:26:22 +0000 (23:26 +0200)]
[analyzer][solver] Fix CmpOpTable handling bug
There is an error in the implementation of the logic of reaching the `Unknonw` tristate in CmpOpTable.
```
void cmp_op_table_unknownX2(int x, int y, int z) {
if (x >= y) {
// x >= y [1, 1]
if (x + z < y)
return;
// x + z < y [0, 0]
if (z != 0)
return;
// x < y [0, 0]
clang_analyzer_eval(x > y); // expected-warning{{TRUE}} expected-warning{{FALSE}}
}
}
```
We miss the `FALSE` warning because the false branch is infeasible.
We have to exploit simplification to discover the bug. If we had `x < y`
as the second condition then the analyzer would return the parent state
on the false path and the new constraint would not be part of the State.
But adding `z` to the condition makes both paths feasible.
The root cause of the bug is that we reach the `Unknown` tristate
twice, but in both occasions we reach the same `Op` that is `>=` in the
test case. So, we reached `>=` twice, but we never reached `!=`, thus
querying the `Unknonw2x` column with `getCmpOpStateForUnknownX2` is
wrong.
The solution is to ensure that we reached both **different** `Op`s once.
Differential Revision: https://reviews.llvm.org/D110910
Michael Forster [Wed, 6 Oct 2021 15:46:26 +0000 (17:46 +0200)]
Revert "[lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo"
This reverts commit
00e704bf080ffeeb9e334fb3ab71594f9aa50969.
This commit should should have updated
llvm/llvm-project/lldb/source/Plugins/ABI/ARC/ABISysV_arc.cpp like the other
architectures.
Michael Kruse [Wed, 6 Oct 2021 15:02:27 +0000 (10:02 -0500)]
[Clang][OpenMP] Infix OMPLoopTransformationDirective abstract class. NFC.
Insert OMPLoopTransformationDirective between OMPLoopBasedDirective and the loop transformations OMPTileDirective and OMPUnrollDirective. This simplifies handling of loop transformations not requiring distinguishing between OMPTileDirective and OMPUnrollDirective anymore.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D111119
Kazu Hirata [Wed, 6 Oct 2021 15:40:39 +0000 (08:40 -0700)]
Revert "[IR] Remove arg_operands and getNumArgOperands (NFC)"
This reverts commit
c72722f45ef1aa6d78e1e6fee07ab6bd86980da8.
Simon Pilgrim [Wed, 6 Oct 2021 15:09:47 +0000 (16:09 +0100)]
[CostModel][TTI] Replace BAD_ICMP_PREDICATE with ICMP_EQ for generic funnel shift cost expansion
The comparison always checks for zero value so know the icmp predicate will be ICMP_EQ
Louis Dionne [Thu, 30 Sep 2021 19:11:48 +0000 (15:11 -0400)]
[runtimes][ci] Run the tests for libunwind in the CI
We should arguably have always been doing that. The state of libunwind
is quite sad, so this commit adds several XFAILs to make the CI pass.
We need to investigate why so many tests are not passing in some
configurations, but I'll defer that to folks who actually work on
libunwind for lack of bandwidth.
Differential Revision: https://reviews.llvm.org/D110872
Kazu Hirata [Wed, 6 Oct 2021 15:14:35 +0000 (08:14 -0700)]
[IR] Remove arg_operands and getNumArgOperands (NFC)
The last uses were removed on Oct 5, 2021 in commit
3081de8c72fc9b6c0cc8b1bb5f02858b78ebaa4c.
Clement Courbet [Wed, 6 Oct 2021 14:54:17 +0000 (16:54 +0200)]
Nico Weber [Wed, 6 Oct 2021 14:30:14 +0000 (10:30 -0400)]
[clang] Don't mark _ReadBarrier, _ReadWriteBarrier, _WriteBarrier deprecated
It's true that docs.microsoft.com says:
"""The _ReadBarrier, _WriteBarrier, and _ReadWriteBarrier compiler
intrinsics and the MemoryBarrier macro are all deprecated and should not
be used. For inter-thread communication, use mechanisms such as
atomic_thread_fence and std::atomic<T>, which are defined in the C++
Standard Library. For hardware access, use the /volatile:iso compiler
option together with the volatile keyword."""
And these attributes have been here since these builtins were added in
r192860.
However:
- cl.exe does not warn on them even with /Wall
- none of the replacements are useful for C code
- we don't add __attribute__((__deprecated__())) to any other
declarations in intrin.h
- intrin0.h in the MSVC headers declares _ReadWriteBarrier() (but
without the deprecation attribute), so you get inconsistent
deprecation warnings depending on if you include intrin.h or intrin0.h
The motivation is that compiling sqlite.h with clang-cl produces a
deprecation warning with clang-cl for _ReadWriteBarrier(), but not with
cl.exe.
Differential Revision: https://reviews.llvm.org/D111232
Clement Courbet [Wed, 6 Oct 2021 14:47:34 +0000 (16:47 +0200)]
Revert "[AA] Teach BasicAA to recognize basic GEP range information."
We have found a miscompile with this change, reverting while working on a
reproducer.
This reverts commit
455b60ccfbfdbb5d2b652666050544c31e6673b1.
Simon Pilgrim [Wed, 6 Oct 2021 14:37:05 +0000 (15:37 +0100)]
[TTI] Remove default condition type and predicate arguments from getCmpSelInstrCost
We need to be better at exposing the comparison predicate to getCmpSelInstrCost calls as some targets (e.g. X86 SSE) have very different costs for different comparisons (PR48337), and we can't always rely on the optional Instruction argument.
This initial commit requires explicit condition type and predicate arguments. The next step will be to review a lot of the existing getCmpSelInstrCost calls which have used BAD_ICMP_PREDICATE even when the predicate is known.
Differential Revision: https://reviews.llvm.org/D111024
Amy Kwan [Tue, 5 Oct 2021 22:21:27 +0000 (17:21 -0500)]
[AIX] Define WCHAR_T_TYPE as unsigned short on AIX for wchar.c test case.
The default wchar type is different on AIX vs. Linux. When this test is run on
AIX, WCHAR_T_TYPE ends up being set to int. This is incorrect as the default
wchar type on AIX is actually unsigned short, and setting the type incorrectly
causes the expected errors to not be found.
This patch sets the type correctly (to unsigned short) for AIX.
Differential Revision: https://reviews.llvm.org/D110428
luxufan [Wed, 6 Oct 2021 13:33:04 +0000 (21:33 +0800)]
Revert "[JITLink][NFC] Add TableManager to replace PerGraph...Builder pass"
This reverts commit
50a278c2aef21bf9b78865ad7c7554e506434b9c.
Simon Pilgrim [Wed, 6 Oct 2021 13:30:31 +0000 (14:30 +0100)]
[Support] ErrorHandling.h - Remove report_fatal_error(std::string)
As described on D111049, removing the <string> dependency from error handling removes considerable build overhead, its recommended that the report_fatal_error(Twine) variant is used instead.
David Green [Wed, 6 Oct 2021 13:32:01 +0000 (14:32 +0100)]
[AArch64] Regenerate even more tests
This updates a few more check lines, in some mte tests that were close
to auto generated already and some CodeGenPrepare/consthoist tests where
being able to see the entire code sequence is useful for determining
whether code differences are improvements or not.
luxufan [Wed, 6 Oct 2021 07:52:25 +0000 (15:52 +0800)]
[JITLink][NFC] Add TableManager to replace PerGraph...Builder pass
This patch add a TableManager which reponsible for fixing edges that need entries to reference the target symbol and constructing such entries.
In the past, the PerGraphGOTAndPLTStubsBuilder pass was used to build GOT and PLT entry, and the PerGraphTLSInfoEntryBuilder pass was used to build TLSInfo entry. By generalizing the behavior of building entry, I added a TableManager which could be reused when built GOT, PLT and TLSInfo entries.
If this patch makes sense and can be accepted, I will apply the TableManager to other targets(MachO_x86_64, MachO_arm64, ELF_riscv), and delete the file PerGraphGOTAndPLTStubsBuilder.h
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D110383
Raphael Isemann [Wed, 6 Oct 2021 12:58:50 +0000 (14:58 +0200)]
[lldb] Make 'this' substituton error more verbose.
Raphael Isemann [Wed, 6 Oct 2021 11:08:33 +0000 (13:08 +0200)]
[lldb] Rewrite and extend TestConstThis
Simon Pilgrim [Wed, 6 Oct 2021 12:32:18 +0000 (13:32 +0100)]
[polly] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine)
As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
Jaroslav Sevcik [Sat, 25 Sep 2021 17:29:04 +0000 (19:29 +0200)]
Reland "[lldb] Refactor variable parsing"
Separates the methods for recursive variable parsing in function
context and non-recursive parsing of global variables.
Original patch: https://reviews.llvm.org/rG601168e42037ac4433e74b920bb22f76d59ba420
Revert patch: https://reviews.llvm.org/rGca5be065c4c612554acdcae3ead01a1474eff296
Diff from the original patch: avoid using nullptr deref/ref.
Differential Revision: https://reviews.llvm.org/D110570
Sanjay Patel [Wed, 6 Oct 2021 11:42:06 +0000 (07:42 -0400)]
[InstCombine] fold fake vector extract to shift+trunc
We already handle more complicated cases like:
extelt (bitcast (inselt poison, X, 0)) --> trunc (lshr X)
But we missed this simpler pattern:
https://alive2.llvm.org/ce/z/D55h64 / https://alive2.llvm.org/ce/z/GKzzRq
This is part of solving:
https://llvm.org/PR52057
I made the transform depend on legal/desirable int type to avoid creating
a shift of an illegal type (for example i128). I'm not sure if that
restriction is actually necessary, but we can change that as a follow-up
if the backend can deal with integer ops on too-wide illegal types.
The pile of AVX512 test changes are all neutral AFAICT - the x86 backend
seems to know how to turn that into the expected "kmov" instructions.
Differential Revision: https://reviews.llvm.org/D111082
Michał Górny [Wed, 6 Oct 2021 08:45:54 +0000 (10:45 +0200)]
[lldb] [FreeBSD] Fix building on systems without PT_COREDUMP
PT_COREDUMP is a relatively recent addition. Use an #ifdef to skip it
if the underlying system does not support it.
Differential Revision: https://reviews.llvm.org/D111214
Max Kazantsev [Wed, 6 Oct 2021 12:00:50 +0000 (19:00 +0700)]
[Test] Few more symmetrical test for D110517
LLVM GN Syncbot [Wed, 6 Oct 2021 11:59:40 +0000 (11:59 +0000)]
[gn build] Port
a30a36f66aea
Michał Górny [Wed, 6 Oct 2021 09:45:27 +0000 (11:45 +0200)]
[lldb] [ABI/X86] Split base x86 and i386 classes
Split the ABIX86 class into two classes: base ABIX86 class that is
common to 32-bit and 64-bit ABIs, and ABIX86_i386 class that is the base
for 32-bit ABIs. This removes the confusing concept that ABIX86
initializes 64-bit ABIs but is only the base for 32-bit ABIs.
Differential Revision: https://reviews.llvm.org/D111216
Simon Pilgrim [Wed, 6 Oct 2021 11:57:04 +0000 (12:57 +0100)]
[mlir] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine)
As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
Pavel Labath [Thu, 23 Sep 2021 12:10:49 +0000 (14:10 +0200)]
[lldb] Remove "dwarf dynamic register size expressions" from RegisterInfo
These were added to support some mips registers on linux, but linux mips
support has now been removed due.
They are still referenced in the freebds mips implementation, but the
completeness of that implementation is also unknown. All other
architectures just set these fields to zero, which is a cause of
significant bloat in our register info definitions.
Arm also has registers with variable sizes, but they were implemented in
a more gdb-compatible fashion and don't use this feature.
Differential Revision: https://reviews.llvm.org/D110914
Amara Emerson [Wed, 6 Oct 2021 06:36:28 +0000 (23:36 -0700)]
Revert "Revert "[GlobalISel][IRTranslator] Emit trap intrinsic for "unreachable"""
This reverts commit
d95cd81141a4e398e0d3337cb2e6617281d06278.
Re-land the original patch now that the bug this exposed in selection has been
fixed by
6bc64e24c38a
Simon Pilgrim [Wed, 6 Oct 2021 11:13:40 +0000 (12:13 +0100)]
[llvm] Unix.h - Replace report_fatal_error(std::string) with report_fatal_error(Twine)
As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
Simon Pilgrim [Wed, 6 Oct 2021 11:04:30 +0000 (12:04 +0100)]
[llvm] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine)
As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
Simon Pilgrim [Wed, 6 Oct 2021 10:23:26 +0000 (11:23 +0100)]
[clang] Replace report_fatal_error(std::string) uses with report_fatal_error(Twine)
As described on D111049, we're trying to remove the <string> dependency from error handling and replace uses of report_fatal_error(const std::string&) with the Twine() variant which can be forward declared.
Max Kazantsev [Wed, 6 Oct 2021 10:36:36 +0000 (17:36 +0700)]
[Test] Add some more symmetrical test cases for D110517
More similar cases to see that the opt we are trying to make is generic enough.
Vince Bridgers [Tue, 28 Sep 2021 13:42:31 +0000 (08:42 -0500)]
[analyzer] canonicalize special case of structure/pointer deref
This simple change addresses a special case of structure/pointer
aliasing that produced different symbolvals, leading to false positives
during analysis.
The reproducer is as simple as this.
```lang=C++
struct s {
int v;
};
void foo(struct s *ps) {
struct s ss = *ps;
clang_analyzer_dump(ss.v); // reg_$1<int Element{SymRegion{reg_$0<struct s *ps>},0 S64b,struct s}.v>
clang_analyzer_dump(ps->v); //reg_$3<int SymRegion{reg_$0<struct s *ps>}.v>
clang_analyzer_eval(ss.v == ps->v); // UNKNOWN
}
```
Acks: Many thanks to @steakhal and @martong for the group debug session.
Reviewed By: steakhal, martong
Differential Revision: https://reviews.llvm.org/D110625
Nathan Sidwell [Thu, 16 Sep 2021 19:29:37 +0000 (12:29 -0700)]
[X86][NFC] structure-return simplificiation
The X86 backend only needs to know whether structure return is via an
sret pointer. This removes the categorization enumeration and
adjusts, templatizes and renames the related functions.
Differential Revision: https://reviews.llvm.org/D109966
Nicolas Vasilache [Wed, 6 Oct 2021 10:00:50 +0000 (10:00 +0000)]
[mlir][Linalg] Don't return early from inPlaceAnalysis
Instead just emit a warning that analysis failed and the result will be treated conservatively.
Differential Revision: https://reviews.llvm.org/D111217
David Green [Wed, 6 Oct 2021 09:38:22 +0000 (10:38 +0100)]
[AArch64] Regenerate some more tests
This updates the check lines in some extra tests, to make them more
maintainable going forward.
Simon Pilgrim [Tue, 5 Oct 2021 21:12:37 +0000 (22:12 +0100)]
[CostModel][X86] getCmpSelInstrCost - treat BAD_PREDICATEs the same as the worst case cost predicates for ICMP/FCMP instructions
As suggested on D111024, we should treat getCmpSelInstrCost calls without a specific predicate as matching the worst case predicate cost.
These regressions will be addressed with a mixture of D111024 and fixing other specific getCmpSelInstrCost calls to have realistic predicates.
Jonas Paulsson [Wed, 6 Oct 2021 08:48:21 +0000 (10:48 +0200)]
[SystemZ] Temporarily revert memcmp and memcpy patches
Seem to cause test failures in compiler-rt.
Revert "[SystemZ] Implement memcmp of variable length with CLC."
This reverts commit
7a4e9a0c73667cb80e4572d41535a9e48f1ed9ef.
Revert "[SystemZ] Implement memcpy of variable length with MVC."
This reverts commit
c6c13c58eebda605a9a05f1f13cac1e46407afc7.
Muhammad Omair Javaid [Wed, 6 Oct 2021 08:56:44 +0000 (13:56 +0500)]
Round XML register bitsize to byte boundary
This patch allows LLDB to accept register sizes which are not aligned
to 8 bits bitsize boundary. This fixes a crash in LLDB when connecting
to OpenOCD stub. GDB xml description allows for non-aligned bit lengths
but they are rounded off to nearest byte during transfer. In case of
OpenOCD some of SOC specific system registers were less than a single
byte in length and were causing LLDB to crash.
Reviewed By: labath
Differential Revision: https://reviews.llvm.org/D111131
David Spickett [Fri, 1 Oct 2021 13:12:01 +0000 (14:12 +0100)]
[compiler-rt][lsan] Add backup AArch64 register for use_registers test
On Ubuntu Focal x13 is used by something in the process of calling
sched_yield. Causing the test to fail depending on when the thread
is stopped.
Adding x14 works around this and the test passes consistently.
Not switching to only x14 because that could make other platforms
fail. With both we'll always find at least one and even if both
values are present we'll only get one report.
Reviewed By: oontvoo, vitalybuka
Differential Revision: https://reviews.llvm.org/D110931
LLVM GN Syncbot [Wed, 6 Oct 2021 08:40:14 +0000 (08:40 +0000)]
[gn build] Port
fc36fb4d23a5
David Spickett [Wed, 6 Oct 2021 08:31:58 +0000 (08:31 +0000)]
Revert "Second Recommit "[AArch64] Split bitmask immediate of bitwise AND operation""
This reverts commit
13f3c39f3658fa28cb008eb56a58d8e34697cd5d.
Due to test failures in stage 2 clang tests on AArch64 bots.
Kinuko Yasuda [Wed, 6 Oct 2021 08:29:52 +0000 (08:29 +0000)]
[docs] Fix typo and minor text changes in MyFirstTypoFix
Reviewed By: kuhnel
Differential Revision: https://reviews.llvm.org/D111211
David Green [Wed, 6 Oct 2021 08:30:48 +0000 (09:30 +0100)]
[AArch64] Regenerate some fast-isel tests
This updates the check lines in some fast isel test, to make them more
maintainable going forward.
David Sherwood [Tue, 28 Sep 2021 13:33:10 +0000 (14:33 +0100)]
[SVE] Fix incorrect DAG combines when extracting fixed-width from scalable vectors
We were previously silently generating incorrect code when extracting a
fixed-width vector from a scalable vector. This is worse than crashing,
since the user will have no indication that this is currently unsupported
behaviour. I have fixed the code to only perform DAG combines when safe
to do so, i.e. the input and output vectors are both fixed-width or
both scalable.
Test added here:
CodeGen/AArch64/sve-extract-scalable-vector.ll
Differential revision: https://reviews.llvm.org/D110624
Paulo Matos [Wed, 6 Oct 2021 08:08:04 +0000 (10:08 +0200)]
[WebAssembly] Fix call_indirect on funcrefs
The currently implementation of funcrefs is broken since it is putting
the funcref itself on the stack before the call_indirect. Instead what
should be on the stack is the constant 0, which is the index at which
we store the funcref in __funcref_call_table.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D111152
Paulo Matos [Wed, 6 Oct 2021 07:28:36 +0000 (09:28 +0200)]
[WebAssembly] De-duplicate WasmAddressSpace and refactor reftype predicates
This is a non-functional change to remove the duplicate
WasmAddressSpace enum and refactor reftype predicates by moving them
to the Utilities source file.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D111144
Albion Fung [Wed, 6 Oct 2021 07:42:17 +0000 (02:42 -0500)]
[PowerPC] Implement vector float and vector double version for vec_orc builtin
The builtin for vec_orc has support for the following two signatures,
but currently the compiler marks it ambiguous:
vector float vec_orc(vector float, vector float)
vector double vec_orc(vector double, vector double)
This patch implements these two builtins.
Differential revision: https://reviews.llvm.org/D110858
Markus Lavin [Wed, 6 Oct 2021 06:48:37 +0000 (08:48 +0200)]
[NPM] Automatic 'opt' pipeline reducer script.
Script for automatic 'opt' pipeline reduction for when using the new
pass-manager (NPM). Based around the '-print-pipeline-passes' option.
The reduction algorithm consists of several phases (steps).
Step #0: Verify that input fails with the given pipeline and make note of the
error code.
Step #1: Split pipeline in two starting from front and move forward as long as
first pipeline exits normally and the second pipeline fails with the expected
error code. Move on to step #2 with the IR from the split point and the
pipeline from the second invocation.
Step #2: Remove passes from end of the pipeline as long as the pipeline fails
with the expected error code.
Step #3: Make several sweeps over the remaining pipeline trying to remove one
pass at a time. Repeat sweeps until unable to remove any more passes.
Usage example:
./utils/reduce_pipeline.py --opt-binary=./build-all-Debug/bin/opt --input=input.ll --output=output.ll --passes=PIPELINE [EXTRA-OPT-ARGS ...]
Differential Revision: https://reviews.llvm.org/D110908
Tobias Gysi [Wed, 6 Oct 2021 06:45:42 +0000 (06:45 +0000)]
[mlir][linalg] Update OpDSL to use the newly introduced min and max ops.
Implement min and max using the newly introduced std operations instead of relying on compare and select.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D111170
Dmitry Vyukov [Tue, 5 Oct 2021 14:54:14 +0000 (16:54 +0200)]
tsan: don't instrument runtime callbacks in tests
These runtime callbacks are supposed to be non-instrumented,
we can't handle runtime recursion well, nor can we afford
explicit recursion checks in the hot functions (memory access,
function entry/exit).
It used to work (not crash), but it won't work with the new runtime.
Mark all runtime callbacks as non-instrumented.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D111157
Amara Emerson [Wed, 6 Oct 2021 00:41:21 +0000 (17:41 -0700)]
[GlobalISel] Clear unreachable blocks' contents after selection.
If these blocks are unreachable, then we can discard all of the instructions.
However, keep the block around because it may have an address taken or the
block may have a stale reference from a PHI somewhere. Instead of finding
those PHIs and fixing them up, just leave the block empty.
Differential Revision: https://reviews.llvm.org/D111201
Arthur Eubanks [Wed, 6 Oct 2021 05:24:16 +0000 (22:24 -0700)]
Revert "[clang] Allow printing 64 bit ints in diagnostics"
This reverts commit
edfff2f8b0435bc4af94bd3b41bf57244d84d993.
Breaks clang-tidy.
Arthur Eubanks [Wed, 29 Sep 2021 22:26:26 +0000 (15:26 -0700)]
Mark PassBuilder::addPass() as minsize
PassBuilder.cpp is the slowest LLVM file to compile (if only building X86).
This makes PassBuilder.o a little faster to compile and a little smaller
as well.
These methods are not performance critical at all but are instantiated many times.
83M -> 72M instructions according to perf stat.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D110782
Arthur Eubanks [Tue, 5 Oct 2021 20:55:31 +0000 (13:55 -0700)]
[clang] Allow printing 64 bit ints in diagnostics
Currently we're limited to 32 bit ints in diagnostics.
With support for 4GB alignments coming soon, we need to report 4GB as the max alignment allowed.
I've tested that this does indeed properly print 2^32.
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D111184
David Carlier [Wed, 6 Oct 2021 05:01:50 +0000 (06:01 +0100)]
[Sanitizers] intercept md5 and sha* apis on FreeBSD.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D110989
Vitaly Buka [Wed, 29 Sep 2021 06:01:20 +0000 (23:01 -0700)]
[NFC][sanitizers] Add StackDepotBase Node::hash_type
Depends on D111177.
Differential Revision: https://reviews.llvm.org/D111182
Vitaly Buka [Wed, 29 Sep 2021 06:01:20 +0000 (23:01 -0700)]
[NFC][sanitizer] Add MurMur2Hash64Builder
Depends on D111176.
Differential Revision: https://reviews.llvm.org/D111177
Vitaly Buka [Tue, 5 Oct 2021 19:02:16 +0000 (12:02 -0700)]
[NFC][sanitizer] Add basic hash test
Differential Revision: https://reviews.llvm.org/D111176
Michael Forster [Wed, 6 Oct 2021 03:34:31 +0000 (05:34 +0200)]
(test commit) Fix capitalization in README.md
This commit primarily checks that my newly acquired commit access works.
But this is also a real spelling fix.
Lang Hames [Tue, 5 Oct 2021 17:50:31 +0000 (10:50 -0700)]
[JITLink][MachO][arm64] Make testcase less brittle.
The operand value is sign extended, so the test broke when sections were
re-ordered. The new test should be robust to reorderings.
Mehdi Amini [Wed, 6 Oct 2021 02:35:58 +0000 (02:35 +0000)]
Stop stripping the `std.` prefix when printing operations in a region with a defined default dialect
This fixes round-trip / ambiguity when an operation in the standard dialect would
have the same name as an operation in the default dialect.
Differential Revision: https://reviews.llvm.org/D111204
Philip Reames [Wed, 6 Oct 2021 01:54:50 +0000 (18:54 -0700)]
Address a rst format error caught by buildbot
Philip Reames [Wed, 6 Oct 2021 01:52:07 +0000 (18:52 -0700)]
[test] autogen a couple of additional tests
kpyzhov [Wed, 6 Oct 2021 01:47:25 +0000 (21:47 -0400)]
[AMDGPU] Correction to
095c48fdf3d27a4f346f8680d1d7e89449bb557b.
Differential Revision: https://reviews.llvm.org/D110337
Philip Reames [Wed, 6 Oct 2021 01:33:24 +0000 (18:33 -0700)]
[docs] Expand the pre-merge testing description a bit
Core changes are:
Be explicit about desired balance between missing true positives and reporting false positives.
Mention the opt-out mechanism.
Provide links to background, and give description of who to contact if needed.
Differential Revision: https://reviews.llvm.org/D110873
Philip Reames [Wed, 6 Oct 2021 01:32:15 +0000 (18:32 -0700)]
[test] refresh a couple of autogen tests
Carl Ritson [Wed, 6 Oct 2021 00:53:52 +0000 (09:53 +0900)]
[AMDGPU] Only remove branches in SIInstrInfo::removeBranch
Without this change _term instructions can be removed during
critical edge splitting.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D111126
Louis Dionne [Thu, 19 Aug 2021 16:21:06 +0000 (12:21 -0400)]
[libc++] Refactor how basic_string and vector hoist exception-throwing functions
In basic_string and vector, we've been encapsulating all exception
throwing code paths in helper functions of a base class, which are defined
in the compiled library. For example, __vector_base_common defines two
methods, __throw_length_error() and __throw_out_of_range(), and the class
is externally instantiated in the library. This was done a long time ago,
but after investigating, I believe the goal of the current design was to:
1. Encapsulate the code to throw an exception (which is non-trivial) in
an externally-defined function so that the important code paths that
call it (e.g. vector::at) are free from that code. Basically, the
intent is for the "hot" code path to contain a single conditional jump
(based on checking the error condition) to an externally-defined function,
which handles all the exception-throwing business.
2. Avoid defining this exception-throwing function once per instantiation
of the class template. In other words, we want a single copy of
__throw_length_error even if we have vector<int>, vector<char>, etc.
3. Encapsulate the passing of the container-specific string (i.e. "vector"
and "basic_string") to the underlying exception-throwing function
so that object files don't contain those duplicated string literals.
For example, we'd like to have a single "vector" string literal for
passing to `std::__throw_length_error` in the library, instead of
having one per translation unit.
However, the way this is achieved right now has two problems:
- Using a base class and exporting it is really weird - I've been confused
about this ever since I first saw it. It's just a really unusual way of
achieving the above goals. Also, it's made even worse by the fact that
the definitions of __throw_length_error and __throw_out_of_range appear
in the headers despite always being intended to be defined in the compiled
library (via the extern template instantiation).
- We end up exporting those functions as weak symbols, which isn't great
for load times. Instead, it would be better to export those as strong
symbols from the library.
This patch fixes those issues while retaining ABI compatibility (e.g. we
still export the exact same symbols as before). Note that we need to
keep the base classes as-is to avoid breaking the ABI of someone who
might inherit from std::basic_string or std::vector.
Differential Revision: https://reviews.llvm.org/D111173
Heejin Ahn [Sat, 2 Oct 2021 02:07:41 +0000 (19:07 -0700)]
[WebAssembly] Remove WasmTagType
This removes `WasmTagType`. `WasmTagType` contained an attribute and a
signature index:
```
struct WasmTagType {
uint8_t Attribute;
uint32_t SigIndex;
};
```
Currently the attribute field is not used and reserved for future use,
and always 0. And that this class contains `SigIndex` as its property is
a little weird in the place, because the tag type's signature index is
not an inherent property of a tag but rather a reference to another
section that changes after linking. This makes tag handling in the
linker also weird that tag-related methods are taking both `WasmTagType`
and `WasmSignature` even though `WasmTagType` contains a signature
index. This is because the signature index changes in linking so it
doesn't have any info at this point. This instead moves `SigIndex` to
`struct WasmTag` itself, as we did for `struct WasmFunction` in D111104.
In this CL, in lib/MC and lib/Object, this now treats tag types in the
same way as function types. Also in YAML, this removes `struct Tag`,
because now it only contains the tag index. Also tags set `SigIndex` in
`WasmImport` union, as functions do.
I think this makes things simpler and makes tag handling more in line
with function handling. These two shares similar properties in that both
of them have signatures, but they are kind of nominal so having the same
signature doesn't mean they are the same element.
Also a drive-by fix: the reserved 'attirubute' part's encoding changed
from uleb32 to uint8 a while ago. This was fixed in lib/MC and
lib/Object but not in YAML. This doesn't change object files because the
field's value is always 0 and its encoding is the same for the both
encoding.
This is effectively NFC; I didn't mark it as such just because it
changed YAML test results.
Reviewed By: sbc100, tlively
Differential Revision: https://reviews.llvm.org/D111086
Louis Dionne [Tue, 5 Oct 2021 20:34:33 +0000 (16:34 -0400)]
[libc++] Pickle substitutions to pass them to dsl.sh.py
This is less brittle than hand-picking the substitutions that we
pass to the test, since a config could theorically use non-base
substitutions as well (such as defining %{flags} in terms of another
substitution like %{include}).
Also, print the decoded substitutions, which makes it much easier
to debug the test when it fails.
Differential Revision: https://reviews.llvm.org/D111179
Louis Dionne [Wed, 29 Sep 2021 19:26:05 +0000 (15:26 -0400)]
[runtimes] Allow FOO_TEST_CONFIG to be a relative path
That makes it possible to store that value in a CMake cache if needed.
Differential Revision: https://reviews.llvm.org/D110843
Diego Caballero [Tue, 5 Oct 2021 22:42:37 +0000 (22:42 +0000)]
[mlir][Linalg] Add support for min/max reduction vectorization in linalg.generic
This patch extends Linalg core vectorization with support for min/max reductions
in linalg.generic ops. It enables the reduction detection for min/max combiner ops.
It also renames MIN/MAX combining kinds to MINS/MAXS to make the sign explicit for
floating point and signed integer types. MINU/MAXU should be introduce din the future
for unsigned integer types.
Reviewed By: pifon2a, ThomasRaoux
Differential Revision: https://reviews.llvm.org/D110854