Uday Bondhugula [Mon, 28 Jun 2021 19:39:51 +0000 (01:09 +0530)]
[MLIR] Fix memref get constant bound size and shape method
Fix FlatAffineConstraints::getConstantBoundOnDimSize to ensure that
returned bounds on dim size are always non-negative regardless of the
constraints on that dimension. Add an assertion at the user.
Differential Revision: https://reviews.llvm.org/D105171
Akira Hatanaka [Mon, 5 Jul 2021 17:12:16 +0000 (10:12 -0700)]
Precommit another test for https://reviews.llvm.org/D104953
Tiehu Zhang [Mon, 5 Jul 2021 16:12:37 +0000 (00:12 +0800)]
[AArch64ISelDAGToDAG] Fix ORRWrs/ORRXrs usefulbits calculation bug
For the following case:
t8: i32 = or t7, t4
t10: i32 = ORRWrs t8, t8, TargetConstant:i32<73>
Current code wrongly returns (t8 >> shiftConstant) as the
UsefulBits of t8, which in fact is (t8 | (t8 >> shiftConstant)).
Reviewed by: sdesmalen, mdchen
Differential Revision: https://reviews.llvm.org/D102759
Paul Walker [Mon, 5 Jul 2021 15:02:25 +0000 (16:02 +0100)]
Fix typo in help text for -aarch64-enable-branch-targets.
Marius Brehler [Mon, 5 Jul 2021 15:01:12 +0000 (15:01 +0000)]
[mlir] Unbreak building mlir-reduce
Unbreaks building mlir-reduce when `DLLVM_INCLUDE_TESTS` is set to OFF.
The dependency MLIRTestDialect is only available if building with tests.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D105434
Anirudh Prasad [Mon, 5 Jul 2021 15:06:38 +0000 (11:06 -0400)]
[MCParser][z/OS] Mark a few tests as unsupported for the z/OS Target
- Background here is that that these sets of tests are "invalid" to be run on z/OS
- The reason is because these test constructs that HLASM never supports (HLASM doesn't support GNU style directives)
- Usually tests are geared towards a particular target via the use of a triple that targets just that platform, but these tests require the use of a "default triple"
- Thus, we mark these tests as "UNSUPPORTED" for z/OS since we don't want to run these for z/OS
Reviewed By: yusra.syeda, abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/D105204
Florian Hahn [Mon, 5 Jul 2021 14:56:03 +0000 (15:56 +0100)]
[LV] Extend FIXME in test add in
91ee1e379901af3.
Florian Hahn [Thu, 1 Jul 2021 16:39:31 +0000 (17:39 +0100)]
[LV] Add initial test cases with small clamped indices.
Simon Camphausen [Mon, 5 Jul 2021 14:39:28 +0000 (16:39 +0200)]
[mlir] Change custom syntax of emitc.include op to resemble C
This changes the custom syntax of the emitc.include operation for standard includes.
Reviewed By: marbre
Differential Revision: https://reviews.llvm.org/D105281
Louis Dionne [Mon, 5 Jul 2021 14:25:26 +0000 (10:25 -0400)]
[libc++] NFC: Add note about how the libcxx website gets updated
Sanjay Patel [Mon, 5 Jul 2021 13:57:39 +0000 (09:57 -0400)]
[InstCombine] fold icmp slt/sgt of offset value with constant
This follows up patches for the unsigned siblings:
0c400e895306
c7b658aeb526
We are translating an offset signed compare to its
unsigned equivalent when one end of the range is
at the limit (zero or unsigned max).
(X + C2) >s C --> X <u (SMAX - C) (if C == C2 - 1)
(X + C2) <s C --> X >u (C ^ SMAX) (if C == C2)
This probably does not show up much in IR derived
from C/C++ source because that would likely have
'nsw', and we have folds for that already.
As with the previous unsigned transforms, the folds
could be generalized to handle non-constant patterns:
https://alive2.llvm.org/ce/z/Y8Xrrm
; sgt
define i1 @src(i8 %a, i8 %c) {
%c2 = add i8 %c, 1
%t = add i8 %a, %c2
%ov = icmp sgt i8 %t, %c
ret i1 %ov
}
define i1 @tgt(i8 %a, i8 %c) {
%c_off = sub i8 127, %c ; SMAX
%ov = icmp ult i8 %a, %c_off
ret i1 %ov
}
https://alive2.llvm.org/ce/z/c8uhnk
; slt
define i1 @src(i8 %a, i8 %c) {
%t = add i8 %a, %c
%ov = icmp slt i8 %t, %c
ret i1 %ov
}
define i1 @tgt(i8 %a, i8 %c) {
%c_offnot = xor i8 %c, 127 ; SMAX
%ov = icmp ugt i8 %a, %c_offnot
ret i1 %ov
}
Sanjay Patel [Mon, 5 Jul 2021 13:13:38 +0000 (09:13 -0400)]
[InstCombine][tests] add tests for signed icmp with constant and offset; NFC
Caroline Concatto [Fri, 18 Jun 2021 14:39:03 +0000 (15:39 +0100)]
[AArch64][CostModel] Add cost model for experimental.vector.splice
This patch adds a new ShuffleKind SK_Splice and then handle the cost in
getShuffleCost, as in experimental.vector.reverse.
Differential Revision: https://reviews.llvm.org/D104630
Wang, Pengfei [Mon, 5 Jul 2021 13:08:49 +0000 (21:08 +0800)]
[X86] Twist shuffle mask when fold HOP(SHUFFLE(X,Y),SHUFFLE(X,Y)) -> SHUFFLE(HOP(X,Y))
This patch fixes PR50823.
The shuffle mask should be twisted twice before gotten the correct one due to the difference between inner HOP and outer.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D104903
Louis Dionne [Mon, 5 Jul 2021 13:25:15 +0000 (09:25 -0400)]
[libc++] NFC: Sort headers in CMakeLists.txt
Simon Pilgrim [Mon, 5 Jul 2021 12:19:47 +0000 (13:19 +0100)]
[CostModel][X86] Handle costs for insert/extractelement with non-immediate indices via stack
Determine the insert/extractelement costs when performing this as a sequence of aliased loads+stores via the stack.
Simon Pilgrim [Fri, 2 Jul 2021 16:05:50 +0000 (17:05 +0100)]
[CostModel][X86] Adjust i32/i64 to f32/f64 scalar based on llvm-mca reports (+ Agner).
Older SSE targets have slower gpr->fpu scalar conversions - we also need to account for uitofp i32 > f32/f64 being lowered as sitofp i64 -> f32/f64
Sanjay Patel [Mon, 5 Jul 2021 12:14:20 +0000 (08:14 -0400)]
[InstSimplify] fold extractelement of splat with variable extract index
We already have a fold for variable index with constant vector,
but if we can determine a scalar splat value, then it does not
matter whether that value is constant or not.
We overlooked this fold in D102404 and earlier patches,
but the fixed vector variant is shown in:
https://llvm.org/PR50817
Alive2 agrees on that:
https://alive2.llvm.org/ce/z/HpijPC
The same logic applies to scalable vectors.
Differential Revision: https://reviews.llvm.org/D104867
Kirill Bobyrev [Mon, 5 Jul 2021 11:58:54 +0000 (13:58 +0200)]
[clangd] NFC: Remove outdated comment
Caroline Concatto [Mon, 21 Jun 2021 14:22:58 +0000 (15:22 +0100)]
[SLPVectorizer] Fix crash in vectorizeChainsInBlock for scalable vector.
The function vectorizeChainsInBlock does not support scalable vector,
because function like canReuseExtract and isCommutative in the code
path assert with scalable vectors.
This patch avoids vectorizing blocks that have extract instructions with scalable
vector..
Differential Revision: https://reviews.llvm.org/D104809
Ole Strohm [Tue, 29 Jun 2021 10:09:24 +0000 (11:09 +0100)]
[C++][Sema] Ignore top-level qualifiers in casts
Ignore top-level qualifiers in casts, which fixes issues in reinterpret_cast.
This rule comes from [expr.type]/8.2.2 which explains that casting to a
pr-qualified type should actually cast to the unqualified type. In C++
this is only done for types that aren't classes or arrays.
Fixes: PR49221
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D102689
Bradley Smith [Tue, 22 Jun 2021 15:34:15 +0000 (16:34 +0100)]
[AArch64][SVE] Improve fixed length codegen for common vector shuffle case
Improve codegen when lowering the common vector shuffle case from the
vectorizer (op1[last]:op2[0:last-1]). This patch only handles this
common case as it is difficult to handle this more generally when using
fixed length vectors, due to being unable to use the SVE ext instruction.
Differential Revision: https://reviews.llvm.org/D105289
David Stuttard [Thu, 13 May 2021 13:08:56 +0000 (14:08 +0100)]
[DAGCombiner] Add support for mulhi const folding in DAGCombiner
Differential Revision: https://reviews.llvm.org/D103323
Change-Id: I4ffaaa32301795ba8a339567a68e77fe0862b869
Adrian Kuegel [Thu, 1 Jul 2021 08:49:04 +0000 (10:49 +0200)]
Add MulOp lowering from Complex dialect to Standard/Math dialect.
The lowering handles special cases with NaN or infinity like C++.
Differential Revision: https://reviews.llvm.org/D105270
David Stuttard [Mon, 5 Jul 2021 10:08:03 +0000 (11:08 +0100)]
[DAGCombiner] Pre-commit test to demonstrate mulhi const folding
D103323 will fold this
Differential Revision: https://reviews.llvm.org/D105424
Change-Id: I64947215eb531fbd70b52a72203b39e43fefafcc
Sjoerd Meijer [Thu, 1 Jul 2021 13:45:54 +0000 (14:45 +0100)]
[AArch64] Cost-model i8 vector loads/stores
Loads of <4 x i8> vectors were modeled as extremely expensive. And while we
don't have a load instruction that supports this, it isn't that expensive to
create a vector of i8 elements. The codegen for this was fixed/optimised in
D105110. This now tweaks the cost model and enables SLP vectorisation of my
motivating case loadi8.ll.
Differential Revision: https://reviews.llvm.org/D103629
Markus Böck [Mon, 5 Jul 2021 10:13:36 +0000 (12:13 +0200)]
[mlir] Escape strings of opaque attributes
Opaque attributes that currently contain string literals can't currently be properly roundtripped as they are not printed as escaped strings. This leads to incorrect tokens being generated and the parser to almost certainly fail. This patch simply uses llvm::printEscapedString from LLVM. It escapes all non printable characters and quotes to \xx hex literals, and backslashes to two backslashes. This syntax is supported by MLIRs Lexer as well. The same function is also currently in use for the same purpose in printSymbolReference, printAttribute for StringAttr and many more in AsmPrinter.cpp.
Differential Revision: https://reviews.llvm.org/D105405
Stephen Tozer [Mon, 5 Jul 2021 08:45:08 +0000 (09:45 +0100)]
[DebugInfo] CGP+HWasan: Handle dbg.values with duplicate location ops
This patch fixes an issue which occurred in CodeGenPrepare and
HWAddressSanitizer, which both at some point create a map of Old->New
instructions and update dbg.value uses of these. They did this by
iterating over the dbg.value's location operands, and if an instance of
the old instruction was found, replaceVariableLocationOp would be
called on that dbg.value. This would cause an error if the same operand
appeared multiple times as a location operand, as the first call to
replaceVariableLocationOp would update all uses of the old instruction,
invalidating the old iterator and eventually hitting an assertion.
This has been fixed by no longer iterating over the dbg.value's location
operands directly, but by first collecting them into a set and then
iterating over that, ensuring that we never attempt to replace a
duplicated operand multiple times.
Differential Revision: https://reviews.llvm.org/D105129
David Stuttard [Thu, 13 May 2021 13:08:36 +0000 (14:08 +0100)]
[AMDGPU] Stop mulhi from doing 24 bit mul for uniform values
Added support to check if architecture supports s_mulhi which is used as part of
the decision whether or not to use valu 24 bit mul (if the mulhi gets
transformed to a valu op anyway, then may as well use it).
This is an extension of the work in D97063
Differential Revision: https://reviews.llvm.org/D103321
Change-Id: I80b1323de640a52623d69ac005a97d06a5d42a14
Georgy Komarov [Sun, 4 Jul 2021 17:45:40 +0000 (20:45 +0300)]
[docs] Fix linking issues in LibASTMatchers tutorial
Update CMakeLists.txt in the tutorial to reflect the latest changes in
LLVM. The demo project cannot be linked without added libraries.
Reviewed By: xgupta
Differential Revision: https://reviews.llvm.org/D105409
Jez Ng [Mon, 5 Jul 2021 07:39:35 +0000 (03:39 -0400)]
[lld-macho][nfc] Add REQUIRES: x86 to test
I didn't realize that llvm-objdump's features were arch-specific.
This should fix the non-x86 buildbots.
Adrian Kuegel [Fri, 2 Jul 2021 11:20:13 +0000 (13:20 +0200)]
[mlir] Add LogOp lowering from Complex dialect to Standard/Math dialect.
Differential Revision: https://reviews.llvm.org/D105342
Craig Topper [Mon, 5 Jul 2021 05:59:20 +0000 (22:59 -0700)]
[RISCV] Pass FeatureBitset by reference rather than by value. NFCI
FeatureBitset is 4 64-bit values in an array. It's better passed by
reference rather than copying it.
I may be adding FeatureBitset as an argument to another function
and noticed this while working on that.
Jez Ng [Mon, 5 Jul 2021 05:13:30 +0000 (01:13 -0400)]
[lld-macho] Parse relocations quickly by assuming sorted order
clang and gcc both seem to emit relocations in reverse order of
address. That means we can match relocations to their containing
subsections in `O(relocs + subsections)` rather than the `O(relocs *
log(subsections))` that our previous binary search implementation
required.
Unfortunately, `ld -r` can still emit unsorted relocations, so we have a
fallback code path for that (less common) case.
Numbers for linking chromium_framework on my 3.2 GHz 16-Core Intel Xeon W:
N Min Max Median Avg Stddev
x 20 4.04 4.11 4.075 4.0775 0.
018027756
+ 20 3.95 4.02 3.98 3.985 0.
020900768
Difference at 95.0% confidence
-0.0925 +/- 0.0124919
-2.26855% +/- 0.306361%
(Student's t, pooled s = 0.0195172)
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D105410
Esme-Yi [Mon, 5 Jul 2021 04:16:58 +0000 (04:16 +0000)]
[llvm-readobj][XCOFF] Add support for printing the String Table.
Summary: The patch adds the StringTable dumping to
llvm-readobj. Currently only XCOFF is supported.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D104613
Chen Zheng [Mon, 5 Jul 2021 02:53:30 +0000 (02:53 +0000)]
[XCOFF][NFC] add DWARF section support in XCOFF object writer
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D97049
Chia-hung Duan [Mon, 5 Jul 2021 02:15:11 +0000 (10:15 +0800)]
[mlir-reduce] Improve diagnostic message and clean build dependency
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D104443
Chia-hung Duan [Tue, 29 Jun 2021 10:38:55 +0000 (18:38 +0800)]
[mlir-tblgen] Avoid ODS verifier duplication
Different constraints may share the same predicate, in this case, we
will generate duplicate ODS verification function.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D104369
Nathan Ridge [Mon, 14 Jun 2021 07:23:35 +0000 (03:23 -0400)]
[clangd] Type hints for structured bindings
Hints are shown for the individual bindings, not the aggregate.
Differential Revision: https://reviews.llvm.org/D104617
Xiang1 Zhang [Fri, 2 Jul 2021 08:21:39 +0000 (16:21 +0800)]
[X86] Refine code of generating BB labels in Keylocker
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D105336
Matthias Springer [Mon, 5 Jul 2021 01:04:01 +0000 (10:04 +0900)]
[mlir][NFC] MemRef cleanup: Remove helper functions
Remove `getDynOperands` and `createOrFoldDimOp` from MemRef.h to decouple MemRef a bit from Tensor. These two functions are used in other dialects/transforms.
Differential Revision: https://reviews.llvm.org/D105260
Nico Weber [Sun, 4 Jul 2021 02:23:42 +0000 (22:23 -0400)]
[lld/mac] Fix function offset on 1st-level unwind table sentinel
Two bugs:
1. This tries to take the address of the last symbol plus the length
of the last symbol. However, the sorted vector is cuPtrVector,
not cuVector. Also, cuPtrVector has tombstone values removed
and cuVector doesn't. If there was a stripped value at the end,
the "last" element's value was UINT64_MAX, which meant the
sentinel value was one less than the length of that "last"
dead symbol.
2. We have to subtract in.header->addr. For 64-bit binaries that's
(1 << 32) and functionAddress is 32-bit so this is a no-op, but
for 32-bit binaries the sentinel's value was too large.
I believe this has no effect in practice since the first-level
binary search code in libunwind (in UnwindCursor.hpp) does:
uint32_t low = 0;
uint32_t high = sectionHeader.indexCount();
uint32_t last = high - 1;
while (low < high) {
uint32_t mid = (low + high) / 2;
if ((mid == last) ||
(topIndex.functionOffset(mid + 1) > targetFunctionOffset)) {
low = mid;
break;
} else {
low = mid + 1;
}
So the address of the last entry in the first-level table isn't really
checked -- except for the very end, but the check against `last` means
we just run the loop once more than necessary. But it makes `unwinddump` output
look less confusing, and it's what it looks was the intention here.
(No test since I can't think of a way to make FileCheck check that one
number is larger than another.)
Differential Revision: https://reviews.llvm.org/D105404
Nico Weber [Sun, 4 Jul 2021 01:57:43 +0000 (21:57 -0400)]
[lld/mac] Don't crash on 32-bit output binaries when dead-stripping
Fixes PR50974.
Differential Revision: https://reviews.llvm.org/D105399
Nico Weber [Fri, 2 Jul 2021 14:03:32 +0000 (10:03 -0400)]
[libunwind] reflow some debug logs for better greppability
"bad second level page" and "second level compressed unwind table"
can now be grepped for.
(Also remove one of the two spaces between "second" and "level"
in the second message.)
patacca [Sun, 4 Jul 2021 17:49:41 +0000 (19:49 +0200)]
[Polly][Isl] Update isl to isl-0.24-47-g8853f375
This is needed for the new functions exposed in the C++ interface as used in https://reviews.llvm.org/D104994
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D105132
Markus Böck [Sun, 4 Jul 2021 15:12:02 +0000 (17:12 +0200)]
[mlir][OpAsmParser] Add parseString method
Basically every kind of parseOptional* method in DialectAsmParser has a corresponding parse* method which will emit an error if the requested token has not been found. An odd one out of this rule is parseOptionalString which does not have a corresponding parseString method.
This patch adds that method and implements it in basically the same fashion as parseKeyword, by first going through parseOptionalString and emitting an error on failure.
Differential Revision: https://reviews.llvm.org/D105406
Nikita Popov [Sun, 4 Jul 2021 14:30:18 +0000 (16:30 +0200)]
[IR] Deprecate GetElementPtrInst::CreateInBounds without element type
This API is not compatible with opaque pointers, the method
accepting an explicit pointer element type should be used instead.
Thankfully there were few in-tree users. The BPF case still ends
up using the pointer element type for now and needs something like
D105407 to avoid doing so.
Paul Walker [Thu, 1 Jul 2021 12:07:28 +0000 (13:07 +0100)]
[NFC] Fix a few whitespace issues and typos.
Nikita Popov [Sat, 3 Jul 2021 12:57:41 +0000 (14:57 +0200)]
[IRBuilder] Add type argument to CreateMaskedLoad/Gather
Same as other CreateLoad-style APIs, these need an explicit type
argument to support opaque pointers.
Differential Revision: https://reviews.llvm.org/D105395
Christopher Di Bella [Sun, 4 Jul 2021 02:22:37 +0000 (02:22 +0000)]
[llvm][iwyu] explicitly includes <functional> and <utility>
Compiling LLVM with Clang modules and libc++ identified that
`Support/Printable.h` and `ADL/SmallVector.h` were using features that
live in these headers.
Differential Revision: https://reviews.llvm.org/D105402
Christopher Di Bella [Sun, 4 Jul 2021 02:17:43 +0000 (02:17 +0000)]
[clangd][iwyu] explicitly includes `<atomic>`
Compiling clangd with Clang modules and libc++ revealed that
`support/Threading.h` uses `std::atomic` but wasn't including the
correct header.
Differential Revision: https://reviews.llvm.org/D105400
Georgy Komarov [Fri, 28 May 2021 08:58:50 +0000 (11:58 +0300)]
[analyzer] Fix calculating offset for fields with an empty type
Fix offset calculation routines in padding checker to avoid assertion
errors described in bugzilla issue 50426. The fields that are subojbects
of zero size, marked with [[no_unique_address]] or empty bitfields will
be excluded from padding calculation routines.
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D104097
Simon Pilgrim [Sat, 3 Jul 2021 18:00:25 +0000 (19:00 +0100)]
[KnownBits] Merge const/non-const KnownBits::extractBits implementations. NFC.
These are identical and can be just const.
Simon Pilgrim [Sat, 3 Jul 2021 16:01:59 +0000 (17:01 +0100)]
[X86][SSE] Add mulhu/mulhs constant folding tests
These should be folded by D103323
Simon Pilgrim [Sat, 3 Jul 2021 15:32:41 +0000 (16:32 +0100)]
[SelectionDAG] Replace APInt.lshr().trunc() with APInt.extractBits() where possible. NFC.
This also allows us to use KnownBits::extractBits in one case.
Simon Pilgrim [Sat, 3 Jul 2021 14:58:52 +0000 (15:58 +0100)]
[SelectionDAG] Use KnownBits::insertBits instead of separate APInt::insertBits calls. NFC.
Nikita Popov [Sat, 3 Jul 2021 10:44:21 +0000 (12:44 +0200)]
[IRBuilder] Avoid fetching pointer element type in some assertions
Specifically the CreateMaskedStore and CreateMaskedScatter APIs.
The CreateMaskedLoad and CreateMaskedGather APIs will need an
additional type argument.
Andrzej Warzynski [Fri, 2 Jul 2021 15:02:08 +0000 (16:02 +0100)]
[flang][driver] Add support for `--version` in the bash wrapper
The bash wrapper script, `flang`, calls `flang-new -fc1` under the hood,
which does not support `--version` (this is consistent with `clang -cc1
--version`). This change is needed for `flang --version` to work as
expected.
Note that `flang --version` (the Flang bash wrapper script for the
compiler driver) gives rather minimal output compared to `flang-new
--version` (the Flang compiler driver). As the wrapper script is just a
temporary solution for us, this should be sufficient.
Differential Revision: https://reviews.llvm.org/D105352
Roman Lebedev [Sat, 3 Jul 2021 07:45:44 +0000 (10:45 +0300)]
[SimplifyCFG] simplifyUnreachable(): erase instructions iff they are guaranteed to transfer execution to unreachable
This replaces the current ad-hoc implementation,
by syncing the code from InstCombine's implementation in `InstCombinerImpl::visitUnreachableInst()`,
with one exception that here in SimplifyCFG we are allowed to remove EH instructions.
Effectively, this now allows SimplifyCFG to remove calls (iff they won't throw and will return),
arithmetic/logic operations, etc.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D105374
David Green [Sat, 3 Jul 2021 06:57:19 +0000 (07:57 +0100)]
[AArch64] Add S/UQXTRN tablegen patterns.
This adds simple patterns for signed and unsigned saturating extract
narrow instructions. They combine a min/max/truncate into a single
instruction, providing that the immediates on the min/max are correct
for the saturation type. This is just handled in tablegen with some
extra patterns.
v2i64->v2i32 is not handled here as the min/max nodes are not legal,
making the lowering quite different.
Differential Revision: https://reviews.llvm.org/D103263
Kai Luo [Sat, 3 Jul 2021 04:45:11 +0000 (04:45 +0000)]
[AIX] Adjust CSR order to avoid breaking ABI regarding traceback
Allocate non-volatile registers in order to be compatible with ABI, regarding gpr_save.
Quoted from https://www.ibm.com/docs/en/ssw_aix_72/assembler/assembler_pdf.pdf page55,
> The preferred method of using GPRs is to use the volatile registers first. Next, use the nonvolatile registers
> in descending order, starting with GPR31.
This patch is based on @jsji 's initial draft.
Tested on test-suite and SPEC, found no degradation.
Reviewed By: jsji, ZarkoCA, xingxue
Differential Revision: https://reviews.llvm.org/D100167
Craig Topper [Sat, 3 Jul 2021 00:36:27 +0000 (17:36 -0700)]
[SelectionDAG] Rename memory VT argument for getMaskedGather/getMaskedScatter from VT to MemVT.
Use getMemoryVT() in MGATHER/MSCATTER DAG combines instead of
using the passthru or store value VT for this argument.
Fangrui Song [Sat, 3 Jul 2021 00:08:25 +0000 (17:08 -0700)]
[ThinLTO] Respect ClearDSOLocalOnDeclarations for unimported functions
D74751 added `ClearDSOLocalOnDeclarations` and dropped dso_local for
isDeclarationForLinker `GlobalValue`s. It missed a case for imported
declarations (`doImportAsDefinition` is false while `isPerformingImport` is
true). This can lead to a linker error for a default visibility symbol in
`ld.lld -shared`.
When `ClearDSOLocalOnDeclarations` is true, we check
`isPerformingImport() && !doImportAsDefinition(&GV)` along with
`GV.isDeclarationForLinker()`. The new condition checks an imported declaration.
This patch fixes a `LLVMPolly.so` link error using a trunk clang -DLLVM_ENABLE_LTO=Thin.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D104986
Jonas Devlieghere [Fri, 2 Jul 2021 23:17:25 +0000 (16:17 -0700)]
Revert "Create synthetic symbol names on demand to improve memory consumption and startup times."
This reverts commit
c8164d0276b97679e80db01adc860271ab4a5d11 and
43f6dad2344247976d5777f56a1fc29e39c6c717 because it breaks
TestDyldTrieSymbols.py on GreenDragon.
Jonas Devlieghere [Fri, 2 Jul 2021 22:45:15 +0000 (15:45 -0700)]
Revert "[DebugInfo] Enforce implicit constraints on `distinct` MDNodes"
This reverts commit
8cd35ad854ab4458fd509447359066ea3578b494.
It breaks `TestMembersAndLocalsWithSameName.py` on GreenDragon and
Mikael Holmén points out in D104827 that bitcode files created with the
patch cannot be parsed with binaries built before it.
Aart Bik [Fri, 2 Jul 2021 19:26:18 +0000 (12:26 -0700)]
[mlir][sparse] support for negation and subtractions
This revision extends the sparse compiler support from fp/int addition and multiplication to fp/int negation and subtraction, thereby increasing the scope of sparse kernels that can be compiled.
Reviewed By: gussmith23
Differential Revision: https://reviews.llvm.org/D105306
Saleem Abdulrasool [Fri, 2 Jul 2021 19:43:01 +0000 (19:43 +0000)]
Lex: add a callback for `#pragma mark`
Allow a preprocessor observer to be notified of mark pragmas. Although
this does not impact code generation in any way, it is useful for other
clients, such as clangd, to be able to identify any marked regions.
Reviewed By: dgoldman
Differential Revision: https://reviews.llvm.org/D105368
Jonas Devlieghere [Fri, 2 Jul 2021 22:33:46 +0000 (15:33 -0700)]
[lldb] Update shebang in heap.py and crashlog.py
David Blaikie [Fri, 2 Jul 2021 21:59:50 +0000 (14:59 -0700)]
Fix test so it doesn't try to write to the test directory, only to %t
Nicolas Vasilache [Fri, 2 Jul 2021 15:32:53 +0000 (15:32 +0000)]
[mlir][Vector] NFC - Compress vector to outerproduct lowering.
The implementation has become too unwieldy and cognitive overhead wins.
Instead compress the implementation in preparation for additional lowering paths.
This is a resubmit of https://reviews.llvm.org/D105359 without ordering ambiguities.
Differential Revision: https://reviews.llvm.org/D105367
Mitch Phillips [Fri, 2 Jul 2021 20:50:52 +0000 (13:50 -0700)]
Name all DEATH tests using 'DeathTest' suffix.
gtest highly recommends this prefix, and runs death tests first
(https://github.com/google/googletest/blob/master/docs/advanced.md#death-test-naming).
This may help with some spurious bot failures like
https://lab.llvm.org/buildbot/#/builders/169/builds/1290/steps/25/logs/stdio.
Reviewed By: cryptoad, vitalybuka
Differential Revision: https://reviews.llvm.org/D105371
Roman Lebedev [Fri, 2 Jul 2021 20:29:18 +0000 (23:29 +0300)]
[NFC][Codegen] Autogenerate check lines in PowerPC/2007-11-16-landingpad-split.ll
It is being affected by an upcoming SimplifyCFG change.
Roman Lebedev [Fri, 2 Jul 2021 20:14:21 +0000 (23:14 +0300)]
[NFC][Codegen] Tune a few tests to not end with a naked `unreachable` terminator
These rely on the fact that currently simplifycfg won't really propagate
said `unreachable`, but that is about to change.
Med Ismail Bennani [Fri, 2 Jul 2021 20:01:21 +0000 (20:01 +0000)]
[lldb/test] Fix failure caused by synthetic symbol name refactoring
This patch fixes a failure in `TestFunctionStarts.py` that appeared
following a change of implementation for synthetic symbol names:
https://reviews.llvm.org/D105160
The failure is caused because the previously mentioned patch removes the
object file basename from the generated synthetic symbol names to allow
them to be shared in the constant string pool.
Hence, that last check is not necessary anymore.
rdar://
80092322
Differential Revision: https://reviews.llvm.org/D105366
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Amara Emerson [Fri, 2 Jul 2021 20:07:00 +0000 (13:07 -0700)]
[GlobalISel] Clean up CombinerHelper::apply* functions to return void.
For some reason we/I started writing these as returning bool when the return value
is actually ignored by the combiner.
Joachim Meyer [Fri, 2 Jul 2021 19:54:39 +0000 (21:54 +0200)]
[NFC][CUDA] Fix order of round(f) definition in __clang_cuda_math.h for non-LP64.
This broke ARM builds e.g.: https://lab.llvm.org/buildbot/#/builders/187/builds/212
Roman Lebedev [Fri, 2 Jul 2021 19:35:14 +0000 (22:35 +0300)]
[NFC][SimplifyCFG] Autogenerate checklines in a few tests
Michał Górny [Sun, 11 Apr 2021 11:04:54 +0000 (13:04 +0200)]
[lldb] [gdb-remote client] Support switching PID along with TID
Extend the SetCurrentThread() method to support specifying an alternate
PID to switch to. This makes it possible to issue requests to forked
processes.
Differential Revision: https://reviews.llvm.org/D100262
Amara Emerson [Sun, 27 Jun 2021 06:36:46 +0000 (23:36 -0700)]
[GlobalISel] Add re-association combine for G_PTR_ADD to allow better addressing mode usage.
We're trying to match a few pointer computation patterns here for
re-association opportunities.
1) Isolating a constant operand to be on the RHS, e.g.:
G_PTR_ADD(BASE, G_ADD(X, C)) -> G_PTR_ADD(G_PTR_ADD(BASE, X), C)
2) Folding two constants in each sub-tree as long as such folding
doesn't break a legal addressing mode.
G_PTR_ADD(G_PTR_ADD(BASE, C1), C2) -> G_PTR_ADD(BASE, C1+C2)
AArch64 code size improvements on CTMark with -Os:
Program before after diff
pairlocalalign 251048 251044 -0.0%
consumer-typeset 421820 421812 -0.0%
kc 431348 431320 -0.0%
SPASS 413404 413300 -0.0%
clamscan 384396 384220 -0.0%
tramp3d-v4 370640 370412 -0.1%
lencod 432096 431772 -0.1%
bullet 479400 478796 -0.1%
sqlite3 288504 288072 -0.1%
7zip-benchmark 573796 570768 -0.5%
Geomean difference -0.1%
Differential Revision: https://reviews.llvm.org/D105069
Roman Lebedev [Fri, 2 Jul 2021 18:57:49 +0000 (21:57 +0300)]
[NFCI][SimplifyCFG] simplifyUnreachable(): Use poison constant to represent the result of unreachable instrs
Mimics similar change for InstCombine:
ce192ced2b901be67444c481ab5ca0d731e6d982 / D104602
All these uses are in blocks that aren't reachable from function's entry,
and said blocks are removed by SimplifyCFG itself,
so we can't really test this change.
Heejin Ahn [Thu, 1 Jul 2021 19:22:41 +0000 (12:22 -0700)]
[InstCombine] Don't combine PHI before catchswitch
This tries to bail out if the PHI is in a `catchswitch` BB in
InstCombine. A PHI cannot be combined into a non-PHI instruction if it
is in a `catchswitch` BB, because `catchswitch` BB cannot have any
non-PHI instruction other than `catchswitch` itself.
The given test case started crashing after D98058.
Reviewed By: lebedev.ri, rnk
Differential Revision: https://reviews.llvm.org/D105309
Adam Paszke [Fri, 2 Jul 2021 17:03:46 +0000 (10:03 -0700)]
Add C API files for the LLVM dialect
For now only expose a builder for the LLVM pointer type.
Reviewed By: jpienaar, ftynse
Differential Revision: https://reviews.llvm.org/D105346
Roman Lebedev [Fri, 2 Jul 2021 18:47:12 +0000 (21:47 +0300)]
[SimplifyCFG] Volatile memory operations do not trap
Somewhat related to D105338.
While it is up for discussion whether or not volatile store traps,
so far there has been no complaints that volatile load/cmpxchg/atomicrmw also may trap.
And even if simplifycfg currently concervatively believes that to be the case,
instcombine does not: https://godbolt.org/z/5vhv4K5b8
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D105343
Jonas Devlieghere [Fri, 2 Jul 2021 18:27:37 +0000 (11:27 -0700)]
[lldb] Replace default bodies of special member functions with = default;
Replace default bodies of special member functions with = default;
$ run-clang-tidy.py -header-filter='lldb' -checks='-*,modernize-use-equals-default' -fix ,
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html
Differential revision: https://reviews.llvm.org/D104041
Eric Astor [Fri, 2 Jul 2021 18:17:15 +0000 (14:17 -0400)]
[ms] [llvm-ml] Standardize blocking of lexical substitution
In MASM, the ifdef family of directives treats its argument literally, without expanding it as a text macro. Add support for this, and also replace the special handling that was previously used for echo.
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D104196
MaheshRavishankar [Fri, 2 Jul 2021 17:43:29 +0000 (10:43 -0700)]
[mlir][Linalg] Fix incorrect logic in deciding when to fuse reshapes by linearization.
Fusion by linearization should not happen when
- The reshape is expanding and it is a consumer
- The reshape is collapsing and is a producer.
The bug introduced in this logic by some recent refactoring resulted
in a crash.
To enforce this (negetive) use case, add a test that reproduces the
error and verifies the fix.
Differential Revision: https://reviews.llvm.org/D104970
Krzysztof Parzyszek [Fri, 2 Jul 2021 15:20:41 +0000 (10:20 -0500)]
[OpaquePtr] Add type parameter to emitLoadLinked
Differential Revision: https://reviews.llvm.org/D105353
Krzysztof Parzyszek [Fri, 2 Jul 2021 14:39:56 +0000 (09:39 -0500)]
[Hexagon] Handle opaque pointers in vector combine
Sam Clegg [Wed, 23 Jun 2021 19:02:32 +0000 (12:02 -0700)]
[clang][emscripten] Reduce alignof long double from 16 to 8 bytes
This means `max_align_t` is 8 bytes which also sets the alignment
malloc. Since this is technically and ABI breaking change we have
limited to just the emscripten OS target. It is also relatively low
import breakage since it will only effect the alignement of struct that
contai `long double`s (extremerly rare I imagine).
Emscripten's malloc implementation already use 8 byte alignement
(dlmalloc uses and alignement of 2*sizeof(void*) == 8 rather than
checking max_align_t) so will not be effected by this change. By
bringing the ABI in line with the current malloc code this will fix
several issue we have seen in the wild.
See: https://github.com/emscripten-core/emscripten/pull/14456
Differential Revision: https://reviews.llvm.org/D104808
Mitch Phillips [Fri, 2 Jul 2021 17:54:20 +0000 (10:54 -0700)]
Revert "[clang-repl] Allow passing in code as positional arguments."
This reverts commit
e386871e1d21cf206a1287356e88c5853563fc77.
Reason: Broke the ASan buildbots
(https://lab.llvm.org/buildbot/#/builders/5/builds/9291). See comments
on https://reviews.llvm.org/D104898 for more information.
Mehdi Amini [Fri, 2 Jul 2021 17:55:06 +0000 (17:55 +0000)]
Revert "[mlir][Vector] NFC - Compress vector to outerproduct lowering."
This reverts commit
db188adfb12f6783c5419d5165a1123b9f5b56b0.
Breaks the GCC tests, likely because of some order of evaluation
difference between clang and gcc.
Vy Nguyen [Wed, 30 Jun 2021 16:50:24 +0000 (12:50 -0400)]
[lld-macho] Ignore debug symbols while preparing relocations.
Details: see https://bugs.llvm.org/show_bug.cgi?id=50812
Differential Revision: https://reviews.llvm.org/D105210
Amir Ayupov [Fri, 2 Jul 2021 17:26:22 +0000 (10:26 -0700)]
[X86] Modify LOOP*, HLT control flow attributes
Add missing control flow attributes:
- LOOP*: isBranch, isTerminator
- HLT: isTerminator
This helps downstream disassemblers (such as BOLT) reconstruct the control
flow graph more accurately.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D102297
Alexey Bataev [Fri, 2 Jul 2021 17:12:41 +0000 (10:12 -0700)]
[SLP][NFC]Refactor findLaneForValue and make it static member, NFC, by
V.Dmitriev.
Reduces number of arguments
Jacob Hegna [Fri, 2 Jul 2021 17:28:25 +0000 (17:28 +0000)]
[MLGO] Update Oz model url.
Jon Roelofs [Wed, 30 Jun 2021 23:49:48 +0000 (16:49 -0700)]
[Intrinsics] Make MemCpyInlineInst a MemCpyInst
This opens up more optimization opportunities in passes that already handle MemCpyInst's.
Differential revision: https://reviews.llvm.org/D105247
wmbat [Fri, 2 Jul 2021 17:08:36 +0000 (17:08 +0000)]
[libcxx][type_traits] remove `std::is_literal_type` and `std::result_of` for C++20
C++17 deprecated `std::is_literal_type` and `std::result_of`, C++20 removed them.
Implements parts of:
* P0174R2 'Deprecating Vestigial Library Parts in C++17'.
* P0619R4 'Reviewing Deprecated Facilities of C++17 for C++20'.
Reviewed By: ldionne, Mordante, Quuxplusone, #libc
Differential Revision: https://reviews.llvm.org/D102992
LLVM GN Syncbot [Fri, 2 Jul 2021 17:03:49 +0000 (17:03 +0000)]
[gn build] Port
99f00635d7ac
Joachim Meyer [Thu, 1 Jul 2021 23:24:29 +0000 (01:24 +0200)]
[NFC][OpenMP][CUDA] Add test for using `-x cuda -fopenmp`
This adds a very basic test in `cuda_with_openmp.cu` that just checks whether the CUDA & OpenMP integrated headers do compile, when a CUDA file is compiled with OpenMP (CPU) enabled.
Thus this basically adds the missing test for https://reviews.llvm.org/D90415.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D105322
Jacob Hegna [Thu, 10 Jun 2021 02:16:04 +0000 (02:16 +0000)]
Unpack the CostEstimate feature in ML inlining models.
This change yields an additional 2% size reduction on an internal search
binary, and an additional 0.5% size reduction on fuchsia.
Differential Revision: https://reviews.llvm.org/D104751