Akira Hatanaka [Fri, 22 Apr 2022 23:48:38 +0000 (16:48 -0700)]
[Driver] Call hasFlag instead of hasArg
`_HAS_STATIC_RTTI` should be set to 0 only by `-fno-rtti` according to the
summary of https://reviews.llvm.org/
D103771.
rdar://
92039243
Differential Revision: https://reviews.llvm.org/
D124312
Zakk Chen [Fri, 22 Apr 2022 03:01:54 +0000 (20:01 -0700)]
[RISCV][test] Rename prefix and remove unused text (NFC)
In
D123418 we removed some RUN line (ex. RV32-ELEN16) but their
expected results still exist there.
Remove them and rename prefix for more descriptive.
Reviewed By: frasercrmck, asb, craig.topper
Differential Revision: https://reviews.llvm.org/
D124179
Jez Ng [Sat, 23 Apr 2022 02:17:24 +0000 (22:17 -0400)]
[lld-macho] Remove stray debug printf
Accidentally committed as part of
b440c25742.
Vitaly Buka [Sat, 23 Apr 2022 02:10:08 +0000 (19:10 -0700)]
Revert "[nfc][asan][windows] Fix test after
D124057"
The patch does not fix the bot.
This reverts commit
62b78a063ab1dc6c2df33c7a6582ecc62b31b519.
Vitaly Buka [Sat, 23 Apr 2022 02:09:52 +0000 (19:09 -0700)]
[asan] Don't enable detect_stack_use_after_return on Windows
It's not clear how ready it's there.
Vitaly Buka [Sat, 23 Apr 2022 02:08:56 +0000 (19:08 -0700)]
[test] Don't rely on default of detect_stack_use_after_return
Valery N Dmitriev [Sat, 23 Apr 2022 01:59:08 +0000 (18:59 -0700)]
[SLP][NFC] Outline lookahead heuristics into a separate helper class.
Minor refactoring to reduce size of functional change
D124309:
look-ahead scoring routines pulled out of VLOperands and formed
new LookAheadHeuristics helper class.
Reviewed By: Alexey Bataev (ABataev), Vasileios Porpodas (vporpo)
Differential Revision: https://reviews.llvm.org/
D124313
Dan Liew [Sat, 23 Apr 2022 01:44:15 +0000 (18:44 -0700)]
Revert "Revert "[compiler-rt][Darwin] Add arm64 to simulator platforms""
This reverts commit
3469cb14e2316a1e3cf64db5be3738379d9daa8d.
Relanding the patch on behalf of Byoungchan Lee.
The original patch (
8a3afc6da5bc94fcbac708156fc1cf4220e7d1f1) was
reverted because it appeared to be landed without the approval
of an Apple engineer.
After internal discussion we're happy for this to land and I've
formally approved the patch in phabricator
(https://reviews.llvm.org/
D119174).
rdar://
92134140
Vincent Lee [Thu, 21 Apr 2022 02:57:10 +0000 (19:57 -0700)]
[lld-macho] Allow dead_strip to work with exported private extern symbols
It seems like we are overly asserting when running `-dead_strip` with
exported symbols. ld64 treats exported private extern symbols as a liveness
root. Loosen the assert to match ld64's behavior.
Reviewed By: #lld-macho, int3
Differential Revision: https://reviews.llvm.org/
D124143
Volodymyr Sapsai [Sat, 23 Apr 2022 00:59:17 +0000 (17:59 -0700)]
[fixup] Handle enum constant `Lang_OBJC` introduced in
4604db94.
Ben Barham [Fri, 22 Apr 2022 18:36:00 +0000 (11:36 -0700)]
[Index] Remove reference to `UnresolvedUsingIfExists`
Assuming `ns::foo` doesn't exist, given:
```
using ns::foo __attribute__((using_if_exists));
```
The AST will look something like:
UsingDecl
UsingShadowDecl
UnresolvedUsingIfExistsDecl
Thus we end up adding a reference to `UnresolvedUsingIfExistsDecl` when
processing `UsingDecl`, but never add the decl itself. In this case the
decl is really the `UsingDecl` anyway though (which we do output), so it
makes more sense to just remove the extra reference.
Differential Revision: https://reviews.llvm.org/
D124288
Vitaly Buka [Sat, 23 Apr 2022 00:16:11 +0000 (17:16 -0700)]
[nfc][asan][android] Fix test after
D124057
Vitaly Buka [Sat, 23 Apr 2022 00:09:47 +0000 (17:09 -0700)]
[nfc][asan][windows] Fix test after
D124057
Dan Liew [Fri, 22 Apr 2022 23:50:35 +0000 (16:50 -0700)]
Revert "[compiler-rt][Darwin] Add arm64 to simulator platforms"
This reverts commit
8a3afc6da5bc94fcbac708156fc1cf4220e7d1f1.
The commit being was landed without review from any Apple engineers
which is problematic because the patch only affects Apple platforms.
rdar://
92134140
Peter Klausler [Tue, 19 Apr 2022 23:48:42 +0000 (16:48 -0700)]
[flang][runtime] Signal record read overrun when PAD='NO'
When PAD='NO' and ADVANCE='YES', we currently signal an input
error when a formatted read tries to go past the end of a record
only when a fixed RECL= is in effect. Other compilers will signal
an error without RECL= too, and that seems like a precedent we
should follow.
Differential Revision: https://reviews.llvm.org/
D124301
Peter Klausler [Fri, 22 Apr 2022 21:21:51 +0000 (14:21 -0700)]
[flang][runtime] Enforce some limits on kP scale factors
Ew.d and Dw.d output edit descriptors should respect limitations from
the standard on the value of a kP scale factor with respect to the
digit count (d), at least for values of k other than zero.
Differential Revision: https://reviews.llvm.org/
D124300
Volodymyr Sapsai [Sat, 5 Mar 2022 01:33:48 +0000 (17:33 -0800)]
[ASTStructuralEquivalence] Add support for comparing ObjCCategoryDecl.
Differential Revision: https://reviews.llvm.org/
D121176
Shoaib Meenai [Wed, 20 Apr 2022 04:45:54 +0000 (21:45 -0700)]
[ELF] Drop unused original symbol after wrapping if not defined
We were previously only omitting the original of a wrapped symbol if it
was not used by an object file and undefined. We can tighten the second
condition to drop any symbol that isn't defined instead, which lets us
drop a previous check (added in https://reviews.llvm.org/
D118756) that
was only covering some such symbols.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/
D124065
Richard [Sun, 17 Apr 2022 00:26:01 +0000 (18:26 -0600)]
[clang-tidy] Ignore macros defined within declarations
Modernize-macro-to-enum shouldn't try to convert macros to enums
when they are defined inside a declaration or definition, only
when the macros are defined at the top level. Since preprocessing
is disconnected from AST traversal, match nodes in the AST and then
invalidate source ranges spanning AST nodes before issuing diagnostics.
ClangTidyCheck::onEndOfTranslationUnit is called before
PPCallbacks::EndOfMainFile, so defer final diagnostics to the
PPCallbacks implementation.
Differential Revision: https://reviews.llvm.org/
D124066
Fixes #54883
Shoaib Meenai [Wed, 20 Apr 2022 01:04:17 +0000 (18:04 -0700)]
[ELF] Fix wrapping symbols produced during LTO codegen
We were previously not correctly wrapping symbols that were only
produced during LTO codegen and unreferenced before then, or symbols
only referenced from such symbols. The root cause was that we weren't
marking the wrapped symbol as used if we only saw the use after LTO
codegen, leading to the failed wrapping.
Fix this by explicitly tracking whether a symbol will become referenced
after wrapping is done. We can use this property to tell LTO to preserve
such symbols, instead of overload isUsedInRegularObj for this purpose.
Since we're no longer setting isUsedInRegularObj for all symbols which
will be wrapped, its value at the time of performing the wrapping in the
symbol table will accurately reflect whether the symbol was actually
used in an object (including in an LTO-generated object), and we can
propagate that value to the wrapped symbol and thereby ensure we wrap
correctly.
This incorrect wrapping was the only scenario I was aware of where we
produced an invalid PLT relocation, which
D123985 started diagnosing,
and with it fixed, we lose the test for that diagnosis. I think it's
worth keeping the diagnosis though, in case we run into other issues in
the future which would be caught by it.
Fixes PR50675.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/
D124056
Shoaib Meenai [Tue, 19 Apr 2022 20:42:05 +0000 (13:42 -0700)]
[ELF] Move SymbolUnion assertions to source file
Otherwise they fires for every single file which includes the header,
which is very noisy when building.
Reviewed By: MaskRay, peter.smith
Differential Revision: https://reviews.llvm.org/
D124041
Peter Klausler [Wed, 13 Apr 2022 16:56:42 +0000 (09:56 -0700)]
[flang][runtime] Fix edge-case FP input bugs
Blanks are allowed in more places than I allowed for, and
"NAN(foobar)" is allowed to have any parenthesis-balanced
characters in parentheses.
Update: Fix up old sanity test, then avoid usage of "limit" when null.
Differential Revision: https://reviews.llvm.org/
D124294
Paul Kirth [Fri, 22 Apr 2022 22:41:54 +0000 (22:41 +0000)]
[llvm][misexpect] Avoid division by 0 when using sample profiling
MisExpect diagnostics should not prevent compilation from succeeding, and the
assertion is insufficient to prevent division by zero in release builds.
This patch addresses that by replacing the assert with an early return.
Additionally, it disables MisExpect diagnostics when using sample profiling,
since this is the only known case where this error has manifested.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/
D124302
Vasileios Porpodas [Fri, 22 Apr 2022 15:29:51 +0000 (08:29 -0700)]
Recommit "[SLP][AArch64] Implement lookahead operand reordering score of splat loads for AArch64"
This reverts commit
7052a0ad689b990265ec79bd2b0a7d6e8c131bfe.
Ye Luo [Fri, 22 Apr 2022 22:36:59 +0000 (17:36 -0500)]
[libomptarget] Make omp_target_is_present checks storage instead of zero length array.
Consider checking whether a pointer has been mapped can be achieved via omp_get_mapped_ptr.
omp_target_is_present is more needed to check whether the storage being pointed is mapped.
This restore the old behavior of omp_target_is_present before
D123093
Fixes https://github.com/llvm/llvm-project/issues/54899
Reviewed By: jdenny
Differential Revision: https://reviews.llvm.org/
D123891
Ye Luo [Fri, 22 Apr 2022 22:33:41 +0000 (17:33 -0500)]
[Clang][OpenMP] libompd: get libomp hwloc includedir by target_link_libraries
When hwloc is used and is installed outside of the default paths, the omp CMake target
needs to provide the needed include path thru the CMake target by adding it with
target_include_directories to it, so libompd gets it as well when it defines it's cmake
target using target_link_libraries.
As suggested in
D122667
Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/
D123888
Vitaly Buka [Wed, 20 Apr 2022 01:31:13 +0000 (18:31 -0700)]
[asan] Enable detect_stack_use_after_return=1 by default
By default -fsanitize=address already compiles with this check,
why not use it.
For compatibly it can be disabled with env ASAN_OPTIONS=detect_stack_use_after_return=0.
Reviewed By: eugenis, kda, #sanitizers, hans
Differential Revision: https://reviews.llvm.org/
D124057
Matt Arsenault [Fri, 22 Apr 2022 20:31:08 +0000 (16:31 -0400)]
llvm-reduce: Fix cloning unset maxCallFrameSize
This was promoting an unset max call frame size to a max call frame
size of 0.
Matt Arsenault [Fri, 22 Apr 2022 21:43:53 +0000 (17:43 -0400)]
ProcessImplicitDefs: Use required properties instead of isSSA assert
Markus Böck [Fri, 22 Apr 2022 22:10:02 +0000 (00:10 +0200)]
[mlir][LLVM] Fix `DataLayoutTypeInterface` for opqaue pointers with non-default address space
As a fallback mechanism, if no entry was supplied for a given address space, the size or alignment for a pointer type with the default address space is returned instead.
This code currently crashes with opaque pointers, as it tries to construct a typed pointer type from the opaque pointer type, leading to a null pointer dereference when fetching the element type.
This patch fixes the issue by handling the opaque pointer cases explicitly.
Differential Revision: https://reviews.llvm.org/
D124290
Markus Böck [Fri, 22 Apr 2022 22:09:27 +0000 (00:09 +0200)]
[mlir][LLVM] Fix crash when using opaque pointers in function signatures
Using opaque pointers in function signatures leads to an attempt to recursively convert all types, including sub types in LLVM types. In the case of LLVM pointers, it may not have a subtype aka element type if it is opaque which would then lead to a null pointer dereference.
Differential Revision: https://reviews.llvm.org/
D124291
Shilei Tian [Fri, 22 Apr 2022 22:07:20 +0000 (18:07 -0400)]
[Clang][OpenMP] Fix the issue that temp cubin files are not removed after compilation when using new OpenMP driver
The root cause of this is, in `NVPTX::Assembler::ConstructJob`, the output file name might not match the `Output`'s file name passed into the function because `CudaToolChain::getInputFilename` is a specialized version. That means the real output file is not added to the temp files list, which will be all removed in the d'tor of `Compilation`. In order to "fix" it, in the function `NVPTX::OpenMPLinker::ConstructJob`, before calling `clang-nvlink-wrapper`, the function calls `getToolChain().getInputFilename(II)` to get the right output file name for each input, and add it to temp file, and then they can be removed w/o any issue. However, this whole logic doesn't work when using the new OpenMP driver because `NVPTX::OpenMPLinker::ConstructJob` is not called at all, which causing the issue that the cubin file generated in each single unit compilation is out of track.
In this patch, we add the real output file into temp files if its name doesn't match `Output`. We add it when the file is an output instead of doing it when it is an input, like what we did in `NVPTX::OpenMPLinker::ConstructJob`, which makes more sense.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/
D124253
Yi Zhang [Tue, 19 Apr 2022 00:50:30 +0000 (20:50 -0400)]
Fix CollapsedLayoutMap for dim size 1 case
This change fixes `CollapsedLayoutMap` for cases where the collapsed
dims are size 1. The cases where inner most dims are size 1 and
noncontiguous can be represented by the strided form and therefore can
be allowed. For such cases, the new stride should be of the next entry
in an association whose dimension is not size 1. If the next entry is
dynamic, it's not possible to decide which stride to use at compilation
time and the stride is set to dynamic.
Differential Revision: https://reviews.llvm.org/
D124137
Valery N Dmitriev [Fri, 22 Apr 2022 21:47:02 +0000 (14:47 -0700)]
[SLP][NFC] Pre-commit test showing deficiency in current roots selection algorithm.
Test case to show not quite optimal SLP vectorization.
Reviewed By: Vasileios Porpodas (vporpo)
Differential Revision: https://reviews.llvm.org/
D124293
Michael Jones [Fri, 22 Apr 2022 21:38:12 +0000 (14:38 -0700)]
[libc] Fix PrintfMatcher Cmake Rule
The PrintfMatcher depends on printf which is in stdio. Stdio is
currently fullbuild only, but the matcher wasn't, causing failing builds
when fullbuild was off. This patch adds the fullbuild condition to the
PrintfMatcher cmake.
Differential Revision: https://reviews.llvm.org/
D124304
Petr Hosek [Fri, 22 Apr 2022 21:35:38 +0000 (14:35 -0700)]
[CMake] Update ARM32 list for CRT config-ix
This matches the behavior prior to
b0e2ffe151c3.
Fixes: https://github.com/llvm/llvm-project/issues/55046
Differential Revision: https://reviews.llvm.org/
D120682
Alex Zinenko [Fri, 22 Apr 2022 08:26:53 +0000 (10:26 +0200)]
[mlir] use side effects in the Transform dialect
Currently, the sequence of Transform dialect operations only supports a single
use of each operand (verified by the `transform.sequence` operation). This was
originally motivated by the need to guard against accessing a payload IR
operation associated with a transform IR value after this operation has likely
been rewritten by a transformation. However, not all Transform dialect
operations rewrite payload IR, in particular the "navigation" operation such as
`transform.pdl_match` do not.
Introduce memory effects to the Transform dialect operations to describe their
effect on the payload IR and the mapping between payload IR opreations and
transform IR values. Use these effects to replace the single-use rule, allowing
repeated reads and disallowing use-after-free, where operations with the "free"
effect are considered to "consume" the transform IR value and rewrite the
corresponding payload IR operations). As an additional improvement, this
enables code motion transformation on the transform IR itself.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/
D124181
Michael Jones [Wed, 20 Apr 2022 21:39:16 +0000 (14:39 -0700)]
[libc] Add Printf FormatSection Matcher
This patch changes the printf parser tests to use a more robust matcher.
This allows for better debugging of parsing issues. This does not affect
the actual printf code at all, only the tests.
Reviewed By: sivachandra, lntue
Differential Revision: https://reviews.llvm.org/
D124130
Yaxun (Sam) Liu [Thu, 21 Apr 2022 15:44:11 +0000 (11:44 -0400)]
[CUDA][HIP] Externalize kernels with internal linkage
This patch is a continuation of https://reviews.llvm.org/
D123353.
Not only kernels in anonymous namespace, but also template
kernels with template arguments in anonymous namespace
need to be externalized.
To be more generic, this patch checks the linkage of a kernel
assuming the kernel does not have __global__ attribute. If
the linkage is internal then clang will externalize it.
This patch also fixes the postfix for externalized symbol
since nvptx does not allow '.' in symbol name.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/
D124189
Fixes: https://github.com/llvm/llvm-project/issues/54560
Fangrui Song [Fri, 22 Apr 2022 20:55:27 +0000 (13:55 -0700)]
[Bazel] Make mlir/test:TestShapeDialect depend on mlir:FuncDialect
Florian Hahn [Fri, 22 Apr 2022 20:37:08 +0000 (21:37 +0100)]
[LICM] Add test for writeonly fn with noalias call.
Add an additional test for
D123473.
Shafik Yaghmour [Fri, 22 Apr 2022 20:28:59 +0000 (13:28 -0700)]
[LLDB] Applying clang-tidy modernize-use-override over LLDB
Applied clang-tidy modernize-use-override over LLDB and added it to the LLDB .clang-tidy config.
Differential Revision: https://reviews.llvm.org/
D123340
Florian Hahn [Fri, 22 Apr 2022 20:24:55 +0000 (21:24 +0100)]
[SimpleLoopUnswitch] Check if freeze is needed for partial unswitching.
We only need to insert a Freeze instruction if any of the conditions
may be poison. Similar checks are already done in the other places
SimpleLoopUnswitch creates Freeze instruction.
Reviewed By: aeubanks, efriedma
Differential Revision: https://reviews.llvm.org/
D124259
Matt Arsenault [Tue, 5 Apr 2022 14:36:57 +0000 (10:36 -0400)]
TableGen/GlobalISel: Make address space/align predicates consistent
The builtin predicate handling has a strange behavior where the code
assumes that a PatFrag is a stack of PatFrags, and each level adds at
most one predicate. I don't think this particularly makes sense,
especially without a diagnostic to ensure you aren't trying to set
multiple at once.
This wasn't followed for address spaces and alignment, which could
potentially fall through to report no builtin predicate was
added. Just switch these to follow the existing convention for now.
Peter Klausler [Thu, 21 Apr 2022 21:11:32 +0000 (14:11 -0700)]
[flang][runtime] Accept "." as REAL input
".", possibly followed by an exponent, is a valid REAL input value (meaning zero).
Differential Revision: https://reviews.llvm.org/
D124279
Jez Ng [Fri, 22 Apr 2022 19:34:54 +0000 (15:34 -0400)]
[lld-macho] Fix ICF crash when comparing symbol relocs
Previously, when encountering a symbol reloc located in a literal section, we
would look up the contents of the literal at the `symbol value + addend` offset
within the literal section. However, it seems that this offset is not guaranteed
to be valid. Instead, we should use just the symbol value to retrieve the
literal's contents, and compare the addend values separately. ld64 seems to do
this.
Reviewed By: #lld-macho, thevinster
Differential Revision: https://reviews.llvm.org/
D124223
Jez Ng [Fri, 22 Apr 2022 19:34:50 +0000 (15:34 -0400)]
[lld-macho][nfc] Simplify unwind section lookup
Previously, we stored a pointer from the ObjFile to its compact unwind
section in order to avoid iterating over the file's sections a second
time. However, given the small number of sections (not subsections) per
file, this caching was really quite unnecessary. We will soon do lookups
for more sections (such as the `__eh_frame` section), so let's simplify
the code first.
Reviewed By: #lld-macho, Roger
Differential Revision: https://reviews.llvm.org/
D123434
Peter Klausler [Thu, 21 Apr 2022 20:20:24 +0000 (13:20 -0700)]
[flang][runtime] Ignore leading spaces even in BZ mode
When editing numeric input, always skip leading spaces, even if
BZ mode (or BLANK='ZERO') is in effect; otherwise, a sign character
preceded by blanks will not be recognized.
Differential Revision: https://reviews.llvm.org/
D124278
Peter Klausler [Thu, 21 Apr 2022 16:25:39 +0000 (09:25 -0700)]
[flang] Fix regression from generic fix
A recent change that corrected the name resolution of a generic interface
when the same name was visible in scope incorrectly prevented a local
generic from shadowing an outer name that is not a generic, subprogram,
or derived type -- e.g., a simple variable -- leading to an inappropriate
error message.
Differential Revision: https://reviews.llvm.org/
D124276
Okwan Kwon [Fri, 22 Apr 2022 17:49:22 +0000 (10:49 -0700)]
[mlir] Do not bubble up extract slice when it is rank-reducing.
The bubble up logic was written by assuming the slice operation is
always a normal slice that outputs a tensor with the same rank.
Differential Revision: https://reviews.llvm.org/
D124283
Nico Weber [Fri, 22 Apr 2022 17:45:54 +0000 (13:45 -0400)]
[git-clang-format] Change run line from python to python3
Several systems no longer ship `python`.
Differential Revision: https://reviews.llvm.org/
D124280
Nico Weber [Fri, 22 Apr 2022 17:51:05 +0000 (13:51 -0400)]
[git-clang-format] Add some examples to the help text
Differential Revision: https://reviews.llvm.org/
D124282
Evgenii Stepanov [Thu, 21 Apr 2022 22:17:29 +0000 (15:17 -0700)]
[sanitizer] Use canonical syscalls everywhere
These "new" syscalls have been added in 2.6.16, more than 16 years ago.
Surely that's enough time to migrate. Glibc 2.33 is using them on both
i386 and x86_64. Android has an selinux filter to block the legacy
syscalls in the apps.
Differential Revision: https://reviews.llvm.org/
D124212
cpillmayer [Fri, 22 Apr 2022 18:52:54 +0000 (18:52 +0000)]
[MLIR] Add option to print users of an operation as comment in the printer
This allows printing the users of an operation as proposed in the git issue #53286.
To be able to refer to operations with no result, these operations are assigned an
ID in SSANameState.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/
D124048
Nikolas Klauser [Fri, 22 Apr 2022 18:56:58 +0000 (20:56 +0200)]
[libc++] Change vector<bool>::const_iterator::reference to bool in ABIv2
`vector<bool>::const_reference` and `vector<bool>::const_iterator::reference` should be the same type.
Reviewed By: Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/
D123851
Jacques Pienaar [Fri, 22 Apr 2022 18:35:34 +0000 (11:35 -0700)]
[mlir] Add shape.func
Add shape func op for use (primarily) in shape function_library op. Allows
setting default dialect for some simpler authoring. This is a minimal version
of the ops needed.
Differential Revision: https://reviews.llvm.org/
D124055
Lei Zhang [Fri, 22 Apr 2022 18:22:10 +0000 (14:22 -0400)]
[mlir][vector] Fold 1-element reduction into extract or arith ops
If there is only one single element in the vector, then we can
just extract the element to compute the final result.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/
D124129
Vitaly Buka [Fri, 22 Apr 2022 18:13:20 +0000 (11:13 -0700)]
[nfc][msan] Add
D123875 into release notes
Mohammed Nurul Hoque [Fri, 22 Apr 2022 17:25:54 +0000 (10:25 -0700)]
[RISCV] transform MI to W variant to remove sext.w
Backwards search
The sext.w removal pass (before the new patch) checks if the input to sext.w is already in sign-extended form, so it can eliminate it. It does that by checking every definition/source that reaches the sext.w is an instruction that produces a sign-extended value, either by definition (e.g. ADDW), or it propagates sign-extension (e.g. OR) so we check its sources recursively.
Forward search
Sometimes, one of the sources is an instruction that doesn't always produce a sign-extended value, but it has a W-version that does (e.g. ADD / ADDW). If we transform the ADD to ADDW, the sext.w can be removed (assuming other def paths are satisfied), but this transformation is sound only if every use of this ADD/W only reqruires the lower 32-bits either directly (like sll %x, 32) or they propagate dependency (lower word of output only depends on lower word of input) so we check its uses recursively.
When searching backwards, if an instruction that can be replaced with W-variant is encountered, this pass runs the forward search to verify it can be replaced, then adds it to a list of fixable instructions. After verifying all paths, it replaces the instruction and removes the sext.w.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/
D119928
Krzysztof Parzyszek [Fri, 22 Apr 2022 17:32:35 +0000 (10:32 -0700)]
[Hexagon] Generate TargetConstant in SelectAnyInt
At some point in instruction selection, A2_tfrsi Constant:i32<...> was
created, where the "Constant" came from SelectAnyInt. Since it wasn't
a TargetConstant, it was selected again, leading to
%vreg = A2_tfrsi ...
... = A2_tfrsi %vreg
which is not a valid code.
Keith Smiley [Fri, 22 Apr 2022 16:42:23 +0000 (09:42 -0700)]
[lld-macho] Fix crash on invalid framework tbd
Previously these would crash because `file` is null in the case there is
an invalid tbd file.
Differential Revision: https://reviews.llvm.org/
D124271
Eric Schweitz [Fri, 22 Apr 2022 02:06:11 +0000 (19:06 -0700)]
[NFC] Cosmetic changes to OpenACC.cpp.
Differential Revision: https://reviews.llvm.org/
D124272
Florian Hahn [Fri, 22 Apr 2022 17:09:04 +0000 (18:09 +0100)]
[SimpleLoopUnswitch] Add test where all conds are guaranteed non poison.
Extra test for
D124259.
Alexey Lapshin [Wed, 13 Apr 2022 20:40:27 +0000 (23:40 +0300)]
[llvm-objcopy][NFC] refactor restoreStatOnFile out of llvm-objcopy.
Functionality of restoreStatOnFile may be reused. Move it into
FileUtilities.cpp. Create helper class FilePermissionsApplier
to store and apply permissions.
Differential Revision: https://reviews.llvm.org/
D123821
Tom Eccles [Fri, 22 Apr 2022 17:03:28 +0000 (13:03 -0400)]
Fix crash getting name of a template decl
NamedDecl::getIdentifier can return a nullptr when
DeclarationName::isIdentifier is false, which leads to a null pointer
dereference when TypePrinter::printTemplateId calls ->getName().
NamedDecl::getName does the same thing in the successful case and
returns an empty string in the failure case.
This crash affects the llvm 14 packages on llvm.org.
Christopher Di Bella [Sat, 16 Apr 2022 00:22:43 +0000 (00:22 +0000)]
Revert "Revert "Revert "[clang][pp] adds '#pragma include_instead'"""
> Includes regression test for problem noted by @hans.
> is reverts commit
973de71.
>
> Differential Revision: https://reviews.llvm.org/
D106898
Feature implemented as-is is fairly expensive and hasn't been used by
libc++. A potential reimplementation is possible if libc++ become
interested in this feature again.
Differential Revision: https://reviews.llvm.org/
D123885
Fraser Cormack [Fri, 22 Apr 2022 16:19:27 +0000 (17:19 +0100)]
[RISCV][NFC] Adjust some formatting in VL patterns
Fraser Cormack [Wed, 3 Nov 2021 11:41:03 +0000 (11:41 +0000)]
[RISCV] Print human-readable VTYPE/SEW/LMUL in MIR
This patch adds custom MIR operand comments to VTYPE immediate operands
in VSETVLI instructions and SEW/LMUL operands in vector codegen pseudo
instructions. The result is intended to be more human-readable and
hopefully maintainable when working with MIR, particularly when
writing or reading test cases.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/
D124187
owenca [Thu, 21 Apr 2022 23:46:07 +0000 (16:46 -0700)]
[clang-format][NFC] Use isComment() in setCommentLineLevels()
Also replace an unnecessary check with assert() in the unwrapped
line parser.
Differential Revision: https://reviews.llvm.org/
D124215
Matthias Springer [Fri, 22 Apr 2022 15:57:25 +0000 (00:57 +0900)]
[mlir][bufferize][NFC] Add function boundary bufferization flag to BufferizationOptions
This makes the API easier to use. Also allows us to check for incorrect API usage for easier debugging.
Differential Revision: https://reviews.llvm.org/
D124265
Simon Pilgrim [Fri, 22 Apr 2022 15:58:55 +0000 (16:58 +0100)]
[InstCombine] Fold (A & 2^C1) + A => A & (2^C1 - 1) iff bit C1 in A is a sign bit (PR21929)
Alive2: https://alive2.llvm.org/ce/z/Ygq26C
This is the final missing fold to handle the modulo2 simplification: https://github.com/llvm/llvm-project/issues/22303
Fixes #22303
Differential Revision: https://reviews.llvm.org/
D123374
Kadir Cetinkaya [Fri, 22 Apr 2022 08:47:46 +0000 (10:47 +0200)]
[clangd][NFC] Reduce memory usage while building dex
Reduce peak memory usage by tearing down the intermediate representation
as we build the final one. Rather than deleting it in the end.
Differential Revision: https://reviews.llvm.org/
D124240
Simon Pilgrim [Fri, 22 Apr 2022 15:39:25 +0000 (16:39 +0100)]
[DAG] Fold freeze(bitcast(x)) -> bitcast(freeze(x))
This is a very specific fold to fix an upstream poor codegen issue.
InstCombine has the much more flexible pushFreezeToPreventPoisonFromPropagating but I don't think we're quite there with DAG/TLI handling for canCreateUndefOrPoison/isGuaranteedNotToBeUndefOrPoison value tracking yet.
Fixes #54911
Differential Revision: https://reviews.llvm.org/
D124185
Matthias Springer [Fri, 22 Apr 2022 14:54:03 +0000 (23:54 +0900)]
[mlir][bufferize][NFC] Rewrite op filter logic
The `hasFilter` field is not needed. Instead, the filter accepts ops by default if no ALLOW rule was specified.
Differential Revision: https://reviews.llvm.org/
D124264
Vasileios Porpodas [Fri, 22 Apr 2022 15:23:05 +0000 (08:23 -0700)]
Revert "[SLP][AArch64] Implement lookahead operand reordering score of splat loads for AArch64"
This reverts commit
7ba702644bac6df166a02bbd692c1599a95a7c8b.
Denis Antrushin [Fri, 22 Apr 2022 15:03:14 +0000 (22:03 +0700)]
[StatepointLowering] Add test for cross-BB gc.relocate lowering
Matt Arsenault [Wed, 20 Apr 2022 17:50:42 +0000 (13:50 -0400)]
llvm-reduce: Fix variable name typo
Matt Arsenault [Thu, 21 Apr 2022 12:58:15 +0000 (08:58 -0400)]
MIR: Serialize FunctionContextIdx in MachineFrameInfo
Nikita Popov [Fri, 22 Apr 2022 14:54:16 +0000 (16:54 +0200)]
[InstCombine] Fix typo in test (NFC)
Matt Arsenault [Fri, 15 Apr 2022 02:40:48 +0000 (22:40 -0400)]
AMDGPU: Directly implement computeKnownBits for workitem intrinsics
Currently metadata is inserted in a late pass which is lowered
to an AssertZext. The metadata would be more useful if it was
inserted earlier after inlining, but before codegen.
Probably shouldn't change anything now. Just replacing the
late metadata annotation needs more work, since we lose
out on optimizations after these are lowered to CopyFromReg.
Seems to be slightly better than relying on the AssertZext from the
metadata. The test change in cvt_f32_ubyte.ll is a quirk from it using
-start-before=amdgpu-isel instead of running the usual codegen
pipeline.
Matt Arsenault [Fri, 15 Apr 2022 14:54:33 +0000 (10:54 -0400)]
GlobalISel: Relax handling of G_ASSERT_* with source register classes
The most common situation where G_ASSERT_ZEXT appears for AMDGPU is a
copy from a physical register, which happens to use set the actual
register class on the virtual register. After copy coalescing, the
assert's source operand had a vreg with a set class. The verifier was
strictly rejecting cases where the set class/bank weren't an exact
match. Additionally, RegBankSelect was also expecting a register bank
to be set on the register, not a class.
This is much stricter than regular copies so relax this behavior. This
now allows these 2 cases:
1. Source register has either class or bank, and the result does not
2. Source register has a register class, and the result is a register
with a matching bank.
This should avoid needing some kind of special handling to avoid
violating this constraint when folding copies.
Nikita Popov [Fri, 22 Apr 2022 13:07:10 +0000 (15:07 +0200)]
[InstCombine] Extract code for or of icmp eq zero and icmp fold (NFC)
To make it easier to extend this to the congruent and case.
Vasileios Porpodas [Tue, 12 Apr 2022 19:49:44 +0000 (12:49 -0700)]
[SLP][AArch64] Implement lookahead operand reordering score of splat loads for AArch64
The original patch (https://reviews.llvm.org/
D121354) targets x86 and adjusts
the lookahead score of splat loads ad they can be done by the `movddup`
instruction that combines the load and the broadcast and is cheap to execute.
A similar issue shows up on AArch64. The `ld1r` instruction performs a broadcast
load and is cheap to execute.
This patch implements the TargetTransformInfo hooks for AArch64.
Differential Revision: https://reviews.llvm.org/
D123638
Martin Storsjö [Wed, 20 Apr 2022 08:13:43 +0000 (11:13 +0300)]
[doc] [cmake] Fix a typo in examples for the cmake directory docs. NFC.
The previous case was a tautology - this is probably what was intended.
Differential Revision: https://reviews.llvm.org/
D124072
Biplob Mishra [Fri, 22 Apr 2022 14:22:47 +0000 (15:22 +0100)]
InstCombine: Add tests to show or-and scenarios which can be possibly be combined by ORing the masks
Paul Walker [Fri, 22 Apr 2022 14:07:55 +0000 (15:07 +0100)]
[AArch64][SVE] Remove BIC from logical operation DestructiveBinaryComm patterns
This reverts part of https://reviews.llvm.org/
D124224 that causes
an assert because the register allocator triggers a pathological
situation where there's no safe way to insert a zeroing MOVPFRX
instruction.
Nikita Popov [Fri, 22 Apr 2022 12:44:59 +0000 (14:44 +0200)]
[InstCombine] Add tests for and of icmp ne zero and icmp uge (NFC)
Partially based on the conjugated or tests.
Nico Weber [Fri, 22 Apr 2022 12:53:59 +0000 (08:53 -0400)]
[lld/win] Mention in release notes that /winsysroot: currently requires /machine:
Differential Revision: https://reviews.llvm.org/
D124254
Iain Sandoe [Thu, 20 Aug 2020 15:18:57 +0000 (16:18 +0100)]
[C++20][Modules][Driver][HU 2/N] Add fmodule-header, fmodule-header=
These command-line flags are alternates to providing the -x
c++-*-header indicators that we are building a header unit.
Act on fmodule-header= for headers on the c/l:
If we have x.hh -fmodule-header, then we should treat that header
as a header unit input (equivalent to -xc++-header-unit-header x.hh).
Likewise, for fmodule-header={user,system} the source should be now
recognised as a header unit input (since this can affect the job list
that we need).
It's not practical to recognise a header without any suffix so
-fmodule-header=system foo isn't going to happen. Although
-fmodule-header=system foo.hh will work OK. However we can make it
work if the user indicates that the item without a suffix is a valid
header. (so -fmodule-header=system -xc++-header vector)
Differential Revision: https://reviews.llvm.org/
D121589
Lei Zhang [Fri, 22 Apr 2022 12:58:14 +0000 (08:58 -0400)]
[mlir][vector] Fold cancelling vector.shape_cast(vector.broadcast)
vector.broadcast can inject all size one dimensions. If it's
followed by a vector.shape_cast to the original type, we can
cancel the op pair, like cancelling consecutive shape_cast ops.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/
D124094
Byoungchan Lee [Fri, 22 Apr 2022 12:37:25 +0000 (08:37 -0400)]
[cc1as] Add support for emitting the build version load command for -darwin-target-variant
This patch extends cc1as to export the build version load command with
LC_VERSION_MIN_MACOSX.
This is especially important for Mac Catalyst as Mac Catalyst uses
the MacOS's compiler rt built-ins.
Differential Revision: https://reviews.llvm.org/
D121868
zhongyunde [Fri, 22 Apr 2022 12:26:59 +0000 (20:26 +0800)]
[AArch64][SVE] Add some logical operation DestructiveBinaryComm patterns
Add DestructiveBinaryComm* patterns for ORR, EOR, AND and BIC.
The above instructions requires that the source and destination registers are
equal, so use movprfx should be beneficial to performance.
note: BIC (i.e. A & ~B) is not a commutative operation.
Reviewed By: paulwalker-arm, david-arm
Differential Revision: https://reviews.llvm.org/
D124224
Vasileios Porpodas [Tue, 12 Apr 2022 20:11:11 +0000 (13:11 -0700)]
[SLP][AArch64][NFC] Add test for a follow-up patch that fixes the lookahead cost of splat-loads for AArch64
Haojian Wu [Thu, 21 Apr 2022 18:19:32 +0000 (20:19 +0200)]
[AST] QualifiedTemplateName::getTemplateDecl cleanup.
This is a followup cleanup of
1234b1c6d8113d50beef5801be607ad1d502b2f7
Differential Revision: https://reviews.llvm.org/
D124238
Nico Weber [Fri, 22 Apr 2022 12:27:32 +0000 (08:27 -0400)]
Revert "[randstruct] Check final randomized layout ordering"
This reverts commit
a7815d33bf8f955f2a1888abbccf974bd4858f79.
Test fails on Windows, see comments on https://reviews.llvm.org/
D124199
Matthias Springer [Fri, 22 Apr 2022 11:34:08 +0000 (20:34 +0900)]
[mlir][bufferize][NFC] Move SCF test cases to SCF dialect
Differential Revision: https://reviews.llvm.org/
D124249
Daniel Kiss [Fri, 22 Apr 2022 10:04:19 +0000 (12:04 +0200)]
[AArch64] Emit .cfi_negate_ra_state for PAC-auth instructions.
autiasp, autibsp instructions are the counterpart of paciasp/pacibsp instructions
therefore let's emit .cfi_negate_ra_state for these too.
In case of Armv8.3 instruction set the retaa/retbb will do the return and authentication
in one step here we can't emit the . cfi_negate_ra_state because that would be point after
the ret* instruction.
Reviewed By: nickdesaulniers, MaskRay
Differential Revision: https://reviews.llvm.org/
D111780
Ying Yi [Wed, 6 Apr 2022 11:18:15 +0000 (12:18 +0100)]
Bug 51277: [DWARF] DW_AT_alignment incorrect when
attribute((__aligned__)) is present but ignored`
In the original code, the 'getDeclAlignIfRequired' function is used.
The 'getDeclAlignIfRequired' function will return the max alignment
of all aligned attributes if the type has aligned attributes. The
function doesn't consider the type at all.
The 'getTypeAlignIfRequired' function uses the type's alignment value,
which also used by the 'alignof' function. I think we should use the
function of 'getTypeAlignIfRequired'.
Reviewed By: dblaikie, jmorse, wolfgangp
Differential Revision: https://reviews.llvm.org/
D124006
Nikita Popov [Fri, 22 Apr 2022 10:21:32 +0000 (12:21 +0200)]
[InstCombine] Merge foldAndOfICmps() and foldOrOfICmps() (NFCI)
Folds are supposed to always be added in conjugated pairs for and
and or. Merge the two functions to make folds for which this is
currently not the case more obvious.
Matthias Springer [Fri, 22 Apr 2022 09:08:44 +0000 (18:08 +0900)]
[mlir][bufferization] Move ModuleBufferization to bufferization dialect
* Move Module Bufferization to the bufferization dialect. The implementation is split into `OneShotModuleBufferize.cpp` and `FuncBufferizableOpInterfaceImpl.cpp`, so that the external model implementation can be easily moved to the func dialect in the future.
* Split and clean up test cases. A few test cases are still remaining in Linalg and will be updated separately.
* `linalg.inplaceable` is renamed to `bufferization.writable` to accurately reflect its current usage.
* Attributes and their verifiers are moved from the Linalg dialect to the Bufferization dialect.
* Expand documentation.
* Add a new flag to One-Shot Bufferize to allow for function boundary bufferization.
Differential Revision: https://reviews.llvm.org/
D122229