Fraser Cormack [Thu, 5 May 2022 10:06:41 +0000 (11:06 +0100)]
[InstCombine] Fix scalable-vector bitwise select matching
D113035 enhanced the matching of bitwise selects from vector types. This
change unfortunately introduced crashes as it tries to cast scalable
vector types to integers.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D124997
Simon Pilgrim [Fri, 6 May 2022 12:07:26 +0000 (13:07 +0100)]
[CostModel][X86] Adjust 128-bit select costs to account for slow BLENDV op
Based off the script from D103695 - Jaguar, Bulldozer, Silvermont (et al) and Haswell all have slow BLENDV ops, so adjust the worse case cost values
Kiran Chandramohan [Fri, 6 May 2022 11:45:18 +0000 (11:45 +0000)]
[Flang][OpenMP] Initial lowering of the OpenMP worksharing loop
The OpenMP worksharing loop operation in the dialect is a proper loop
operation and not a container of a loop. So we have to lower the
parse-tree OpenMP loop construct and the do-loop inside the construct
to a omp.wsloop operation and there should not be a fir.do_loop inside
it. This is achieved by skipping fir.do_loop creation and calling genFIR
for the nested evaluations in the lowering of the do construct.
Note: Handling of more clauses, parallel do, storage of loop index variable etc will come in separate patches.
Part of the upstreaming effort to move LLVM Flang from fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project to the LLVM Project.
Reviewed By: peixin
Differential Revision: https://reviews.llvm.org/D125024
Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Co-authored-by: Shraiysh Vaishay <Shraiysh.Vaishay@amd.com>
Fraser Cormack [Fri, 6 May 2022 11:14:09 +0000 (12:14 +0100)]
[RISCV] Add an extra vsetvli insertion test
This test starts failing with the changes in D125021.
Nikolas Klauser [Wed, 4 May 2022 12:19:09 +0000 (14:19 +0200)]
[libc++] Implement ranges::is_partitioned
Reviewed By: var-const, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D124440
Simon Pilgrim [Fri, 6 May 2022 10:41:45 +0000 (11:41 +0100)]
[CostModel][X86] Adjust pre-SSE41 fp scalar select costs to account for vector ops
Based off the script from D103695, we now mainly use BLENDV or OR(AND,ANDN) to select scalar float/double ops
Sam McCall [Wed, 16 Mar 2022 18:46:28 +0000 (19:46 +0100)]
Generalize "check-all" umbrella targets, use for check-clang-tools
The mechanism behind "check-all" is recording params of add_lit_testsuite()
calls in global variables LLVM_LIT_*, and then creating an extra suite with
their union at the end.
This avoids composing the check-* targets directly, which doesn't work well.
We generalize this by allowing multiple families of variables LLVM_{name}_LIT_*:
umbrella_lit_testsuite_begin(check-foo)
... test suites here will be added to LLVM_FOO_LIT_* variables ...
umbrella_lit_testsuite_end(check-foo)
(This also moves some implementation muck out of {llvm,clang}/CMakeLists.txt
This patch also changes check-clang-tools to use be an umbrella test target,
which means the clangd and clang-pseudo tests are included in it, along with the
the other testsuites that already are (like check-clang-extra-clang-tidy).
Differential Revision: https://reviews.llvm.org/D121838
Simon Pilgrim [Fri, 6 May 2022 10:27:37 +0000 (11:27 +0100)]
[CostModel][X86] Adjust 256-bit select costs to account for slow BLENDV op
Based off the script from D103695, on AVX1, Jaguar/Bulldozer both have low throughput for ymm select patterns (BLENDV + OR(AND,ANDN))), and even on AVX2 Haswell still struggles with BLENDV ops
Simon Pilgrim [Fri, 6 May 2022 10:21:44 +0000 (11:21 +0100)]
[SLP][X86] Regenerate ssat tests to remove defunct AVX1/AVX2 checks
Sam McCall [Wed, 6 Apr 2022 19:29:59 +0000 (21:29 +0200)]
[pseudo] Strip directives from a token stream
This includes only the taken branch of conditional sections.
The API allows for producing a stream for a particular PP branch, which
will be used later for the secondary GLR parses of not-taken branches.
Differential Revision: https://reviews.llvm.org/D123243
Balazs Benics [Fri, 6 May 2022 10:13:51 +0000 (12:13 +0200)]
Revert "[analyzer] Canonicalize SymIntExpr so the RHS is positive when possible"
It seems like multiple users are affected by a crash introduced by this
commit, thus I'm reverting it for the time being.
Read more about the found reproducers at Phabricator.
Differential Revision: https://reviews.llvm.org/D124658
This reverts commit
f0d6cb4a5cf5723d7ddab2c7dab74f2f62116a6d.
David Spickett [Thu, 21 Apr 2022 14:09:56 +0000 (14:09 +0000)]
[libcxx] Reject month 0 in get_date/__get_month
[libcxx] Reject month 0 in get_date/__get_month
This fixes #47663.
Months in dates should be >= 1 and <= 12.
We parse up to two digits then minus one, because
we want to store this as "months since January"
(0-11).
However we didn't check that the result of that
was not -1. For example if you had (MM/DD/YYYY)
00/21/2022.
Added tests for:
* Failing if month is 0
* Failing if month is 13
* Allowing a leading zero in month e.g. "01"
Note that libc++ and libstdc++ return different
values on parsing failure, and MSVC STL returns
end of stream instead.
Handle the first two by checking for defines, MSVC STL
expects these tests to fail for other reasons already:
https://github.com/microsoft/STL/blob/main/tests/libcxx/expected_results.txt#L372
so not handling that case here.
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D124175
John Brawn [Fri, 6 May 2022 09:43:06 +0000 (10:43 +0100)]
[libc++] Mark tests that use check_assertion.h as requiring unix headers
On targets without unistd.h or sys/wait.h (such as bare metal targets)
any test that uses check_assertion.h will fail, so add
REQUIRES: has-unix-headers to them and autodetect whether we have
these headers or not.
These tests currently have unsupported on windows, but that's exactly
because windows doesn't have these headers so we can remove the
specific check for windows.
Differential Revision: https://reviews.llvm.org/D124623
David Green [Fri, 6 May 2022 09:50:31 +0000 (10:50 +0100)]
[DAG][PowerPC] Combine shuffle(bitcast(X), Mask) to bitcast(shuffle(X, Mask'))
If the mask is made up of elements that form a mask in the higher type
we can convert shuffle(bitcast into the bitcast type, simplifying the
instruction sequence. A v4i32 2,3,0,1 for example can be treated as a
1,0 v2i64 shuffle. This helps clean up some of the AArch64 concat load
combines, along with helping simplify a number of other tests.
The PowerPC combine for v16i8 splat vector loads needed some fixes to
keep it working for v16i8 vectors. This improves the handling of v2i64
shuffles to match too, hopefully improving them in general.
Differential Revision: https://reviews.llvm.org/D123801
Simon Pilgrim [Fri, 6 May 2022 09:43:49 +0000 (10:43 +0100)]
[CostModel][X86] Add more complete float/double select cost test coverage
We were only testing basic vector types
Matthias Springer [Fri, 6 May 2022 09:01:39 +0000 (18:01 +0900)]
[mlir][bufferize] Disallow adding new bufferizable ops during bufferization
Ops that are created during the bufferization were not analyzed (when run with One-Shot Bufferize), and users should instead create memref ops directly.
Futhermore, this fixes an issue where an op was erased (and put on the `erasedOps` list), but subsequently a new tensor op was created at the same memory location. This op was then not bufferized. Disallowing the creation of new tensor ops simplifies the bufferization and fixes such issues.
Differential Revision: https://reviews.llvm.org/D125017
wangpc [Fri, 6 May 2022 09:30:49 +0000 (17:30 +0800)]
[RISCV] Enable MachineOutliner by default under -Oz for RISCV
Enable default outlining when the function has the minsize attribute.
`addr-label.ll` crashed after enabling this, so a barrier is added before
instruction selection as a workaround.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D122213
David Spickett [Fri, 6 May 2022 09:28:21 +0000 (09:28 +0000)]
[lldb] Correct hex digit regex in some tests
"A-f" -> "A-F"
Kiran Chandramohan [Fri, 6 May 2022 09:09:01 +0000 (09:09 +0000)]
[Flang] Lower Unstructured do loops
The FIR `do_loop` is designed as a structured operation with a single
block inside it. Presence of unstructured constructs like jumps, exits
inside the loop will cause the loop to be marked as unstructured. These
loops are lowered using the `control-flow` dialect branch operations.
Fortran semantics do not allow the loop variable to be modified inside
the loop. To prevent accidental modification, the iteration of the
loop is modeled by two variables, trip-count and loop-variable.
-> The trip-count and loop-variable are initialized in the pre-header.
The trip-count is set as (end-start+step)/step where end, start and
step have the usual meanings. The loop-variable is initialized to start.
-> The header block contains a conditional branch instruction which
selects between branching to the body of the loop or the exit block
depending on the value of the trip-count.
-> Inside the body, the trip-count is decremented and the loop-variable
incremented by the step value. Finally it branches to the header of the
loop.
Part of the upstreaming effort to move LLVM Flang from fir-dev branch of
https://github.com/flang-compiler/f18-llvm-project to the LLVM Project.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D124837
Co-authored-by: Val Donaldson <vdonaldson@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Peter Klausler <pklausler@nvidia.com>
Florian Hahn [Fri, 6 May 2022 08:50:03 +0000 (09:50 +0100)]
[SimpleLoopUnswitch] Collect either logical ANDs/ORs but not both.
After D97756, collectHomogenousInstGraphLoopInvariants may collect
conditions for both logical ANDs and logical ORs in case the root is a
select that matches both logical AND & OR.
This means the function won't return invariant values of either AND/OR
chains, but both. This can result in incorrect transformations.
See llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-logical-and-or.ll.
Without the patch, Alive2 rejects the modified tests with:
Source and target don't have the same return domain.
Note that this also applies to the test case added in D97756
(@test_partial_condition_unswitch_or_select). We can't unswitch on
%cond6, because the graph leading to it contains and AND and an OR.
This only fixes trivial unswitching for now, but a similar problem
likely exists with non-trivial unswitching.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D124526
Andrzej Warzynski [Fri, 29 Apr 2022 11:48:36 +0000 (11:48 +0000)]
[flang][driver] Add support for -save-temps
This patch adds support for `-save-temps` in `flang-new`, Flang's
compiler driver. The semantics of this option are inherited from Clang.
The file extension for temporary Fortran preprocessed files is set to
`i`. This is identical to what Clang uses for C (or C++) preprocessed
files. I have tried researching what other compilers do here, but I
couldn't find any definitive answers. One GFortran thread [1] suggests
that indeed it is not clear what the right approach should be.
Normally, various phases in Clang/Flang are combined. The `-save-temps`
option works by forcing the compiler to run every phase separately. As
there is no integrated assembler driver in Flang, user will have to use
`-save-temps` together with `-fno-integrated-as`. Otherwise, an
invocation to the integrated assembler would be generated generated,
which is going to fail (i.e. something equivalent to `clang -cc1as` from
Clang).
There are no specific plans for implementing an integrated assembler for
Flang for now. One possible solution would be to share it entirely with
Clang.
Note that on Windows you will get the following error when using
`-fno-integrated-as`:
```bash
flang-new: error: there is no external assembler that can be used on this platform
```
Unfortunately, I don't have access to a Windows machine to investigate
this. Instead, I marked the tests in this patch as unsupported on
Windows.
[1] https://gcc.gnu.org/bugzilla//show_bug.cgi?id=81615
Differential Revision: https://reviews.llvm.org/D124669
Matthias Springer [Fri, 6 May 2022 08:30:02 +0000 (17:30 +0900)]
[mlir][bufferize] Do not copy buffers with undefined contents
Buffers with undefined contents (e.g., the result of an init_tensor) are no longer copied.
Differential Revision: https://reviews.llvm.org/D125015
Matthias Springer [Fri, 6 May 2022 08:22:44 +0000 (17:22 +0900)]
[mlir][scf] Implement BufferizableOpInterface for scf::WhileOp
This follows the same implementation strategy as scf::ForOp and common functionality is extracted into helper functions.
This implementation works well in cases where each yielded value (from either body/condition region) is equivalent to the corresponding bbArg of the parent block. In that case, each OpResult of the loop may be aliasing with the corresponding OpOperand of the loop (and with no other OpOperand).
In the absence of said equivalence relationship, new buffer copies must be inserted, so that the aliasing OpOperand/OpResult contract of scf::WhileOp is honored. In essence, by yielding a newly allocated buffer, we can enforce the specified may-alias relationship. (Newly allocated buffers cannot alias with any OpOperands of the loop.)
Differential Revision: https://reviews.llvm.org/D124929
Luo, Yuanke [Fri, 6 May 2022 07:38:42 +0000 (15:38 +0800)]
[fastregalloc] Add test case for self loop (D125079).
Diana Picus [Wed, 2 Mar 2022 11:02:59 +0000 (11:02 +0000)]
[flang] Add ExternalNameConversionPass to pass pipeline
This seems to be the consensus in
https://github.com/flang-compiler/f18-llvm-project/issues/1316
The patch adds ExternalNameConversion to the default FIR CodeGen pass
pipeline, right before the FIRtoLLVM pass. It also adds a flag to
optionally disable it, and sets it in `tco`. In other words, `flang-new`
and `flang-new -fc1` will both run the pass by default, whereas `tco`
will not, so none of the tests need to be updated.
Differential Revision: https://reviews.llvm.org/D121171
Sam McCall [Thu, 5 May 2022 19:20:32 +0000 (21:20 +0200)]
[pseudo] Add fuzzer for the pseudoparser.
As confirmation, running this locally found 2 crashes:
- trivial: crashes on file with no tokens
- lexer: hits an assertion failure on bytes: 0x5c,0xa,0x5c,0x1,0x65,0x5c,0xa
Differential Revision: https://reviews.llvm.org/D125037
Marco Elver [Fri, 6 May 2022 06:53:31 +0000 (08:53 +0200)]
[Instrumentation] Share InstrumentationIRBuilder between TSan and SanCov
Factor our InstrumentationIRBuilder and share it between ThreadSanitizer
and SanitizerCoverage. Simplify its usage at the same time (use function
of passed Instruction or BasicBlock).
This class may be used in other instrumentation passes in future.
NFCI.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D125038
David Green [Fri, 6 May 2022 07:13:18 +0000 (08:13 +0100)]
[VectorCombine] Fold shuffle select pattern
This patch adds a combine to attempt to reduce the costs of certain
select-shuffle patterns. The form of code it attempts to detect is:
%x = shuffle ...
%y = shuffle ...
%a = binop %x, %y
%b = binop %x, %y
shuffle %a, %b, selectmask
A classic select-mask will pick items from each lane of a or b. These
do not always have a great lowering on many architectures. This patch
attempts to pack a and b into the lower elements, creating a differently
ordered shuffle for reconstructing the orignal which may be better than
the select mask. This can be better for performance, especially if less
elements of a and b need to be computed and the input shuffles are
cheaper.
Because select-masks are just one form of shuffle, we generalize to any
mask. So long as the backend has decent costmodel for the shuffles, this
can generally improve things when they come up. For more basic cost
models the folds do not appear to be profitable, not getting past the
cost checks.
Differential Revision: https://reviews.llvm.org/D123911
Martin Storsjö [Wed, 4 May 2022 08:05:44 +0000 (11:05 +0300)]
[libcxx] [ci] Add a i386 Windows configuration to CI
Adding a mingw based config is easy in the current CI environment
(where we can just choose the different target by calling
`i686-w64-mingw32-clang`), while adding a clang-cl based config would
require setting up different environment variables pointing to the
i386 library directory.
Just adding one config (DLL) instead of exhaustively testing both
(DLL and static) as very few tests would differ in practice, to keep
the CI load reasonable.
Differential Revision: https://reviews.llvm.org/D124991
Sam McCall [Thu, 5 May 2022 20:54:22 +0000 (22:54 +0200)]
[Support] Fix UB in BumpPtrAllocator when first allocation is zero.
BumpPtrAllocator::Allocate() is marked __attribute__((returns_nonnull)) when the
compiler supports it, which makes it UB to return null.
When there have been no allocations yet, the current slab is [nullptr, nullptr).
A zero-sized allocation fits in this range, and so Allocate(0, 1) returns null.
There's no explicit docs whether Allocate(0) is valid. I think we have to assume
that it is:
- the implementation tries to support it (e.g. >= tests instead of >)
- malloc(0) is allowed
- requiring each callsite to do a check is bug-prone
- I found real LLVM code that makes zero-sized allocations
Differential Revision: https://reviews.llvm.org/D125040
Sam McCall [Thu, 5 May 2022 22:15:07 +0000 (00:15 +0200)]
[pseudo] Only expand UCNs for raw_identifiers
It turns out clang::expandUCNs only works on tokens that contain valid UCNs
and no other random escapes, and clang only uses it on raw_identifiers.
Currently we can hit an assertion by creating tokens with stray non-valid-UCN
backslashes in them.
Fortunately, expanding UCNs in raw_identifiers is actually all we need.
Most tokens (keywords, punctuation) can't have them. UCNs in literals can be
treated as escape sequences like \n even this isn't the standard's
interpretation. This more or less matches how clang works.
(See https://isocpp.org/files/papers/P2194R0.pdf which points out that the
standard's description of how UCNs work is misaligned with real implementations)
Differential Revision: https://reviews.llvm.org/D125049
Sam McCall [Thu, 5 May 2022 23:44:41 +0000 (01:44 +0200)]
[Lex] Don't assert when decoding invalid UCNs.
Currently if a lexically-valid UCN encodes an invalid codepoint, then we
diagnose that, and then hit an assertion while trying to decode it.
Since there isn't anything preventing us reaching this state, remove the
assertion. expandUCNs("X\UAAAAAAAAY") will produce "XY".
Differential Revision: https://reviews.llvm.org/D125059
Ben Shi [Fri, 6 May 2022 06:10:37 +0000 (06:10 +0000)]
[AVR][NFC] Eliminate warning 'unused variable'
Reviewed By: Patryk27, aykevl
Differential Revision: https://reviews.llvm.org/D125066
Chuanqi Xu [Fri, 6 May 2022 05:50:08 +0000 (13:50 +0800)]
[Coroutines] Don't re-materialize for debug instructions
Re-materialize for debug instructions would cause a different code
generated if we enabled `-g`. This is bad. So we disable to
re-materialize for debug instructions.
Mehdi Amini [Thu, 5 May 2022 23:01:50 +0000 (23:01 +0000)]
Apply clang-tidy fixes for llvm-else-after-return in OpenMPDialect.cpp (NFC)
Mehdi Amini [Thu, 5 May 2022 22:37:00 +0000 (22:37 +0000)]
Apply clang-tidy fixes for bugprone-argument-comment in AffineOps.cpp (NFC)
Chenbing Zheng [Fri, 6 May 2022 02:53:12 +0000 (10:53 +0800)]
[InstCombine] precommit tests for D124590
Chenbing Zheng [Fri, 6 May 2022 02:45:10 +0000 (10:45 +0800)]
[InstCombine] try to narrow more shifted bswap-of-zext
Try to narrow more bswap, if the shift amount is less than the zext
(bswap (zext X)) >> C --> (zext (bswap X)) << C'
https://alive2.llvm.org/ce/z/i7ddjn
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D124598
Volodymyr Sapsai [Thu, 31 Mar 2022 18:06:42 +0000 (11:06 -0700)]
[clang][NFC] In parts of Objective-C Sema use Obj-C-specific types instead of `Decl`.
Differential Revision: https://reviews.llvm.org/D124285
Lian Wang [Thu, 5 May 2022 06:30:12 +0000 (06:30 +0000)]
[RISCV][SelectionDAG] Support VP_REDUCE_ADD mask operation.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D124986
Wael Yehia [Fri, 6 May 2022 00:08:34 +0000 (20:08 -0400)]
XFAIL some PGO tests on AIX until the new linker becomes publicly available.
Jason Molenda [Fri, 6 May 2022 00:53:43 +0000 (17:53 -0700)]
Insert crashing stack frame when call to null func ptr
On arm64 targets, when the crashing pc is 0, the caller
frame can be found by looking at $lr, but the crash
reports don't use that trick to show the actual crashing
frame. This patch adds that stack frame that lldb shows.
Also fix an issue where some register names were printed
as having a prefix of 'None'.
Differential Revision: https://reviews.llvm.org/D125042
rdar://
92631787
Nico Weber [Fri, 6 May 2022 00:34:49 +0000 (20:34 -0400)]
[gn build] (semi-manually) port
70a66c08fc65
Sheng [Fri, 6 May 2022 00:04:52 +0000 (08:04 +0800)]
[NFC][test] Replace hardcoded number with numeric substitution blocks
In VarLenDecoder.td, the opcode in CHECK line is hardcoded, which
causes chaos in several downstream projects. This patch is trying
to fix that.
Chengji Yao [Thu, 5 May 2022 23:29:33 +0000 (16:29 -0700)]
[mlir] Fix printer when it is a DenseElementsAttr of i1
A large DenseElementsAttr of i1could trigger a bug in printer/parser roundtrip.
Ex. A DenseElementsAttr of i1 with 200 elements will print as Hex format of length 400 before the fix. However, when parsing the printed text, an error will be triggered. After fix, the printed length will be 50.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D122925
Florian Mayer [Thu, 5 May 2022 18:51:53 +0000 (11:51 -0700)]
[HWASan] Clean up hwasan_symbolize.
The globals are better expressed as members of the Symbolizer, and all
functions operating on it should be methods instead.
Also using the standard idiom of wrapping the main code in
`if __name__ == '__main__'`.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D125032
Florian Mayer [Tue, 3 May 2022 22:12:30 +0000 (15:12 -0700)]
[HWASan] Allow to linkify symbolizer output.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D124950
Ben Shi [Thu, 5 May 2022 07:35:09 +0000 (07:35 +0000)]
[compiler-rt][builtins] Add helper functions for uint16/sint16/uint8/sint8 div and mod
__udivmodhi4 : uint16 div and mod
__udivmodqi4 : uint8 div and mod
__divmodhi4 : sint16 div and mod
__divmodqi4 : sint8 div and mod
The above helper functions in libgcc have special ABI as described at
https://gcc.gnu.org/wiki/avr-gcc#Exceptions_to_the_Calling_Convention .
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D124600
Ilia Diachkov [Thu, 5 May 2022 20:29:26 +0000 (23:29 +0300)]
[SPIRV] Add SPIR-V specific intrinsics, two passes and tests
The patch adds SPIR-V specific intrinsics required to keep information
critical to SPIR-V consistency (types, constants, etc.) during translation
from IR to MIR.
Two related passes (SPIRVEmitIntrinsics and SPIRVPreLegalizer) and several
LIT tests (passed with this change) have also been added.
It also fixes the issue with opaque pointers in SPIRVGlobalRegistry.cpp
and the mismatch of the data layout between the SPIR-V backend and clang
(Issue #55122).
Differential Revision: https://reviews.llvm.org/D124416
Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com>
Co-authored-by: Andrey Tretyakov <andrey1.tretyakov@intel.com>
Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
Richard Smith [Thu, 5 May 2022 23:04:19 +0000 (16:04 -0700)]
[docs] Fix uses of `foo` that should be ``foo`` throughout release notes.
Richard Smith [Thu, 5 May 2022 22:57:17 +0000 (15:57 -0700)]
[docs] Add blank lines to help Sphinx parse nested bullets.
Aaron Ballman [Thu, 5 May 2022 22:39:13 +0000 (18:39 -0400)]
Revert "Pedantically warn about // comments in gnu89 mode"
This reverts commit
f6dff93641b2259623e686eb13a1884b8b9f4a00.
This diagnostic is also in the -Wcomment group, which is in the -Wall
group, so the diagnostic is enabled in a wider context than GCC does.
That turns out to be disruptive for the Linux kernel builds still using
-std=gnu89 because the kernel requires C source files to start with //
comments: https://kernel.org/doc/html/v5.18-rc5/process/license-rules.html#license-identifier-syntax
Aart Bik [Thu, 5 May 2022 21:02:03 +0000 (14:02 -0700)]
[mlir][sparse] add more zero-preserving unary ops to sparse compiler
Although we now have semi-rings to deal with arbitrary ops,
it is still good to convey zero-preserving semantics of
ops to the sparse compiler.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D125043
Peter Steinfeld [Thu, 5 May 2022 21:54:57 +0000 (14:54 -0700)]
[flang] Change "unsupported" messages in the runtime to "not yet implemented"
If a programmer is able to compile and link a program that contains types that
are not yet supported by the runtime, it must be because they're not yet
implemented.
This change will make it easier to find unimplemented code in tests.
Differential Revision: https://reviews.llvm.org/D125046
owenca [Thu, 5 May 2022 22:02:34 +0000 (15:02 -0700)]
[clang-format][NFC] Add a few regression tests
River Riddle [Tue, 3 May 2022 19:54:31 +0000 (12:54 -0700)]
[mlir] Add a better error message when failing to parse an attribute
The fallback attribute parse path is parsing a Type attribute, but this results
in a really unintuitive error message: `expected non-function type`, which
doesn't really hint at tall that we were trying to parse an attribute. This
commit fixes this by trying to optionally parse a type, and on failure
emitting an error that we were expecting an attribute.
Differential Revision: https://reviews.llvm.org/D124870
Alexander Yermolovich [Thu, 5 May 2022 21:57:14 +0000 (14:57 -0700)]
[BOLT][DWARF] Add version 5 split dwarf support
Added support for DWARF5 Split Dwarf.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D122988
Richard Smith [Thu, 5 May 2022 21:52:57 +0000 (14:52 -0700)]
Reimplement `__builtin_dump_struct` in Sema.
Compared to the old implementation:
* In C++, we only recurse into aggregate classes.
* Unnamed bit-fields are not printed.
* Constant evaluation is supported.
* Proper conversion is done when passing arguments through `...`.
* Additional arguments are supported and are injected prior to the
format string; this directly supports use with `fprintf`, for example.
* An arbitrary callable can be passed rather than only a function
pointer. In particular, in C++, a function template or overload set is
acceptable.
* All text generated by Clang is printed via `%s` rather than directly;
this avoids issues where Clang's pretty-printing output might itself
contain a `%` character.
* Fields of types that we don't know how to print are printed with a
`"*%p"` format and passed by address to the print function.
* No return value is produced.
Reviewed By: aaron.ballman, erichkeane, yihanaa
Differential Revision: https://reviews.llvm.org/D124221
owenca [Wed, 4 May 2022 19:25:22 +0000 (12:25 -0700)]
[clang-format] Fix another bug in AlignConsecutiveAssignments
The ShouldShiftBeAdded lambda checks if extra space should be
added before the wrapped part of a braced list. If the first
element of the list is wrapped, no extra space should be added.
Fixes #55161.
Differential Revision: https://reviews.llvm.org/D124956
River Riddle [Thu, 5 May 2022 21:21:03 +0000 (14:21 -0700)]
[mlir:ExecutionEngine] Update use of getAddress now that lookup returns ExecutorAddr
This was changed in
16dcbb53dc7968a3752661aac731172ebe0faf64
Jason Molenda [Thu, 5 May 2022 21:13:23 +0000 (14:13 -0700)]
Decr return pc mid-stack when picking UnwindPlan row
When picking the UnwindPlan row to use to backtrace,
off of the zeroth frame, decrement the return pc so
we're in the address range of the call instruction.
If this is a noretrun function call, the instruction
at the "return address" is likely an entirely different
basic block with possibly very different unwind rules,
and this can cause the backtrace to be incorrect.
Differential Revision: https://reviews.llvm.org/D124957
rdar://
84651805
Amara Emerson [Thu, 5 May 2022 21:05:15 +0000 (14:05 -0700)]
[GlobalISel] Re-generate some tests.
Lang Hames [Thu, 5 May 2022 20:24:39 +0000 (13:24 -0700)]
[ORC] Return ExecutorAddrs rather than JITEvaluatedSymbols from LLJIT::lookup.
Clients don't care about linkage, and ExecutorAddr is much more ergonomic.
H.J. Lu [Thu, 5 May 2022 16:49:05 +0000 (09:49 -0700)]
[sanitizer] Correct GetTls for x32
Since x32 pointer size is 4 bytes, the self pointer offset in TCB:
struct
{
void *tcb;
dtv_t *dtv;
void *self;
...
should be 8, not 16.
Fixes https://github.com/llvm/llvm-project/issues/55288
Differential Revision: https://reviews.llvm.org/D125025
Stella Stamenova [Thu, 5 May 2022 20:46:15 +0000 (13:46 -0700)]
[mlir] Fix the names of exported functions
The names of the functions that are supposed to be exported do not match the implementations. This is due in part to https://github.com/llvm/llvm-project/commit/
cac7aabbd8236bef2909bfc0dbba17644f7aaade.
This change makes the implementations and declarations match and adds a couple missing declarations.
The new names follow the pattern of the existing `verify` functions where the prefix is maintained as `_mlir_ciface_` but the suffix follows the new naming convention.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D124891
Eric Li [Wed, 4 May 2022 21:08:43 +0000 (21:08 +0000)]
[clang][dataflow] Centralize expression skipping logic
A follow-up to 62b2a47 to centralize the logic that skips expressions
that the CFG does not emit. This allows client code to avoid
sprinkling this logic everywhere.
Add redirects in the transfer function to similarly skip such
expressions by forwarding the visit to the sub-expression.
Differential Revision: https://reviews.llvm.org/D124965
Martin Storsjö [Thu, 5 May 2022 07:04:54 +0000 (07:04 +0000)]
[libcxx] [test] Narrow down an XFAIL for clang-cl configurations
This test only fails on x86_64 clang-cl, not for i386.
(The root cause is still not explored, thus the FIXME is still
relevant.)
Differential Revision: https://reviews.llvm.org/D124994
Martin Storsjö [Wed, 4 May 2022 19:05:50 +0000 (22:05 +0300)]
[libcxx] [test] Extend the UNSUPPORTED lines in strong_order_long_double.verify.cpp for non-x86_64 Windows
Differential Revision: https://reviews.llvm.org/D124992
Martin Storsjö [Wed, 4 May 2022 12:50:24 +0000 (15:50 +0300)]
[libcxxabi] Use the right calling convention for exception destructors on i386 Windows
On Windows on i386, C++ member functions use a different calling
convention (`__thiscall`) than the default one for regular functions
(`__cdecl`). (On Windows on architectures other than i386, both calling
convention attributes are no-ops.)
This matches how libstdc++ declares these types.
This fixes the std/thread/futures/futures.{shared,unique}_future/dtor.pass.cpp
tests on i386 mingw.
Differential Revision: https://reviews.llvm.org/D124990
Martin Storsjö [Wed, 4 May 2022 11:39:21 +0000 (14:39 +0300)]
[libcxx] [test] Fix max_size.pass.cpp for other Windows architectures
All current Windows architectures (i386, x86_64, arm, arm64) get
the full_size() behaviour here. x86_64 (the only one tested in CI
currently) is handled by the first ifdef at the top, but handle
Windows in general on all other architectures later.
Differential Revision: https://reviews.llvm.org/D124989
Craig Topper [Thu, 5 May 2022 19:57:17 +0000 (12:57 -0700)]
[SelectionDAGISel] Add back a comment to MergeInputChains handling. NFC
This comment used to exist, but was lost in a refactor over 10 years
ago, but still seems relevant and improves readability.
Lang Hames [Thu, 5 May 2022 16:20:52 +0000 (09:20 -0700)]
[ORC] Add an ExecutorAddr::toPtr overload for function types.
In the common case of converting an ExecutorAddr to a function pointer type,
this eliminates the need for the '(*)' boilerplate to explicitly specify a
function pointer. E.g.:
auto *F = A.toPtr<int(*)()>();
can now be written as
auto *F = A.toPtr<int()>();
Simon Pilgrim [Thu, 5 May 2022 19:06:09 +0000 (20:06 +0100)]
[X86] Add some test coverage for Issue #55271
We needed something that would delay the creation of the undef until after the rem-by-constant expansion, so I used a SSE shift of undef by zero which will expand to undef.
phyBrackets [Mon, 2 May 2022 15:52:32 +0000 (21:22 +0530)]
[clang][ASTImporter][NFC]: Move clang::ImportError into own header.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D124774
Rahman Lavaee [Thu, 5 May 2022 18:37:15 +0000 (11:37 -0700)]
[BOLT] Report per-section hotness in bolt-heatmap.
This patch adds a new feature to bolt heatmap to print the hotness of each section in terms of the percentage of samples within that section.
Sample output generated for the clang binary:
Section Name, Begin Address, End Address, Percentage Hotness
.text, 0x1a7b9b0, 0x20a2cc0, 1.4709
.init, 0x20a2cc0, 0x20a2ce1, 0.0001
.fini, 0x20a2ce4, 0x20a2cf2, 0.0000
.text.unlikely, 0x20a2d00, 0x431990c, 0.3061
.text.hot, 0x4319910, 0x4bc6927, 97.2197
.text.startup, 0x4bc6930, 0x4c10c89, 0.0058
.plt, 0x4c10c90, 0x4c12010, 0.9974
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D124412
Aaron Ballman [Thu, 5 May 2022 18:33:55 +0000 (14:33 -0400)]
Pedantically warn about // comments in gnu89 mode
GCC warns with a pedantic warning when -std=gnu89, but Clang would only
diagnose in -std=c89 mode. Clang now matches the GCC behavior in both
modes.
Fixes #18427
Alexandre Perez [Mon, 2 May 2022 21:16:45 +0000 (14:16 -0700)]
Fix debugserver translation check
Currently, debugserver has a test to check if it was launched in
translation. The intent was to cover the case where an x86_64
debugserver attempts to control an arm64/arm64e process, returning
an error. However, this check also covers the case where users
are attaching to an x86_64 process, exiting out before attempting
to hand off control to the translated debugserver at
`/Library/Apple/usr/libexec/oah/debugserver`.
This diff delays the debugserver translation check until after
determining whether to hand off control to
`/Library/Apple/usr/libexec/oah/debugserver`. Only when the
process is not translated and thus has not been handed off do we
check if the debugserver is translated, erroring out in that case.
Reviewed By: jasonmolenda
Differential Revision: https://reviews.llvm.org/D124814
Florian Hahn [Thu, 5 May 2022 18:29:02 +0000 (19:29 +0100)]
[VPlan] Remove dead code to create VPWidenPHIRecipes (NFCI).
After introducing VPWidenPointerInductionRecipe, VPWidenPHIRecipes
should not be created at this point. Turn check into an assert.
David Blaikie [Thu, 5 May 2022 18:09:34 +0000 (18:09 +0000)]
DWARFVerifier: Verify CU/TU index overlap issues
Discovered in a large object that would need a 64 bit index (but the
cu/tu index format doesn't include a 64 bit offset/length mode in
DWARF64 - a spec bug) but instead binutils dwp overflowed the offsets
causing overlapping regions.
Nick Desaulniers [Thu, 5 May 2022 18:06:09 +0000 (11:06 -0700)]
[X86SchedSandyBridge] update cost of COPY to 1 cycle from 0
To match the cost of other scheduling models. This is expected to
schedule mov instructions around INLINEASM less frequently for the
default machineschedule (pre-RA scheduling).
Suggested by Craig Topper.
Link: https://github.com/llvm/llvm-project/issues/41914
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D122350
Serge Pavlov [Thu, 5 May 2022 18:05:05 +0000 (01:05 +0700)]
Revert "[InstCombine] Remove side effect of replaced constrained intrinsics"
This reverts commit
83914ee96fc2d828e1cfb8913f5d156d39150e2c.
The change caused discussion: https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20220502/1034841.html
Peter Kasting [Thu, 5 May 2022 17:52:12 +0000 (19:52 +0200)]
[libc++] Avoid a Microsoft SAL macro.
Bug: https://github.com/llvm/llvm-project/issues/55195
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D124695
Nick Desaulniers [Thu, 5 May 2022 17:59:49 +0000 (10:59 -0700)]
[x86][scheduler] Add MIR test for 41914
Generated via:
$ clang -fno-omit-frame-pointer -m32 -mregparm=3 -O2 crash.c -emit-llvm -S
$ llc -print-before=machine-scheduler -mcpu=sandybridge crash.mir
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D122348
Andrzej Warzynski [Thu, 5 May 2022 17:58:08 +0000 (17:58 +0000)]
[flang][driver] Add missing parentheses in an assert
The assert in https://reviews.llvm.org/D124665 was missing parentheses,
which triggered a warning in GCC (verified with GCC 11). As `-Werror` is
on by default in FLang, that triggered build errors, see e.g. [1].
The fix is rather straightforward, so I am sending this without a
review.
[1] https://lab.llvm.org/buildbot/#/builders/160/builds/7016
Differential Revision: https://reviews.llvm.org/D125027
Aaron Ballman [Thu, 5 May 2022 17:53:03 +0000 (13:53 -0400)]
No longer accept scoped enumerations in C
We had a think-o that would allow a user to declare a scoped
enumeration in C language modes "as a C++11 extension". This is a
think-o because there's no way for the user to spell the name of the
enumerators; C does not have '::' for a fully-qualified name. See
commit
d0d87b597259a2b74ae5c2825a081c7e336cb1d0 for details on why this
is unintentional for C.
Fixes #42372
Joe Nash [Thu, 14 Apr 2022 13:29:25 +0000 (09:29 -0400)]
[AMDGPU] Split FeatureAtomicFaddInsts
FeatureAtomicFaddInsts is replaced with three more granular features.
Contributors:
Petar Avramovic <Petar.Avramovic@amd.com>
Patch 3/N for upstreaming of AMDGPU gfx11 architecture
Depends on D124537
Reviewed By: foad, #amdgpu, arsenm
Differential Revision: https://reviews.llvm.org/D124538
Amir Ayupov [Thu, 5 May 2022 17:38:31 +0000 (10:38 -0700)]
[BOLT][CMAKE] Check build target architecture for runtime libs
Account for cross-compilation build scenarios (X86 to ARM, Linux
to Windows, etc).
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D124712
Christopher Bate [Wed, 4 May 2022 20:12:07 +0000 (14:12 -0600)]
[mlir][nvvm] Fix support for tf32 data type in mma.sync
The NVVM dialect test coverage for all possible type/shape combinations
in the `nvvm.mma.sync` op is mostly complete. However, there were tests
missing for TF32 datatype support. This change adds tests for the one
relevant shape/type combination. This uncovered a small bug in the op
verifier, which this change also fixes.
Differential Revision: https://reviews.llvm.org/D124975
Sam McCall [Thu, 5 May 2022 16:50:44 +0000 (18:50 +0200)]
[clangd] Fix inlayhints crash, don't assume functions have FunctionTypeLocs
Fixes https://github.com/clangd/clangd/issues/1140
Sanjay Patel [Thu, 5 May 2022 16:47:11 +0000 (12:47 -0400)]
[InstCombine] fix typo in test name; NFC
Sanjay Patel [Thu, 5 May 2022 16:41:32 +0000 (12:41 -0400)]
[InstCombine] add scalable vector test for logical select; NFC
D124997 shows that the code is not ready to handle scalable vectors,
so add some more coverage for a potential crashing case.
Craig Topper [Thu, 5 May 2022 16:40:10 +0000 (09:40 -0700)]
[SelectionDAG] Constant fold (sext_inreg undef, VT) to 0 instead of undef.
The result of sign_extend_inreg needs to have as many sign bits
as requested by the VT argument. The easiest way to guarantee this
is to fold it to 0.
SystemZ test was modified to avoid using undef.
Fixes https://github.com/llvm/llvm-project/issues/55178
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D124696
Andrzej Warzynski [Thu, 5 May 2022 16:35:59 +0000 (16:35 +0000)]
[flang] Fix triple in a couple of driver tests
In https://reviews.llvm.org/D124667, I added tests that check the
generated assembly. I verified the assembly on AArch64 and X86_64, but
the PPC Flang buildbot [1] started failing (i.e. the assembly was not
generic enough).
In order to fix this, I'm changing these tests to be only run on
AAarch64 - that's the architecture that most of public Flang buildbots
use.
I'm hoping that this is straightforward enough and am merging it without
a review.
[1] https://lab.llvm.org/buildbot/#/builders/21/builds/40256
Craig Topper [Thu, 5 May 2022 07:19:10 +0000 (00:19 -0700)]
[DAGCombiner] Fold (sext/zext undef) -> 0 and aext(undef) -> undef.
Differential Revision: https://reviews.llvm.org/D124988
Craig Topper [Thu, 5 May 2022 06:38:24 +0000 (23:38 -0700)]
[DAGCombiner] Fold (max/min X, X) -> X.
Differential Revision: https://reviews.llvm.org/D124951
Craig Topper [Thu, 5 May 2022 06:37:00 +0000 (23:37 -0700)]
[RISCV] Add integer min/max intrinsic tests. NFC
Add basic tests and some tests for same operands and all undef
operands inspired by PR55271.
i32 is umin/umax is using signext to match RISC-V ABI. i8/i16 are
using signext/zeroext to match the operation.
Differential Revision: https://reviews.llvm.org/D124948
AndreyChurbanov [Thu, 5 May 2022 16:27:48 +0000 (11:27 -0500)]
[OpenMP] libomp: Add itt notifications to sync dependent tasks.
Intel Inspector uses itt notifications to analyze code execution, and it
reports race conditions in dependent tasks.
This patch fixes the issue notifying Inspector on tasks dependency
synchronizations.
Differential Revision: https://reviews.llvm.org/D123042
Amara Emerson [Thu, 5 May 2022 16:09:51 +0000 (09:09 -0700)]
[AArch64][GlobalISel] Add undef combines to postlegalizer combiner.
Aaron Ballman [Thu, 5 May 2022 16:10:06 +0000 (12:10 -0400)]
Silence a false positive about an unevaluated expr w/side effects
If the operand to `sizeof` is an expression of VLA type, the operand is
still evaluated, so we should not issue a diagnostic about ignoring the
side effects in this case, as they're not actually ignored.
Fixes #48010
Ilya Biryukov [Thu, 5 May 2022 16:09:23 +0000 (16:09 +0000)]
[clang] Fix Clang release notes
I have forgotten a space by mistake in the previous commit.