Valentin Clement [Tue, 9 May 2023 20:21:16 +0000 (13:21 -0700)]
[mlir][openacc] Cleanup acc.data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.data in D149673, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150155
Aaron Ballman [Tue, 9 May 2023 20:16:07 +0000 (16:16 -0400)]
Further amend
945f6e65be0d20b3446e7c1537c64151de618af4
This addresses the ARM issue found by:
https://lab.llvm.org/buildbot/#/builders/109/builds/63726
(This test wouldn't run for me locally, hence missing it in the last fix.)
Aaron Ballman [Tue, 9 May 2023 20:08:41 +0000 (16:08 -0400)]
Fix test failure from
945f6e65be0d20b3446e7c1537c64151de618af4
It seems we were testing the behavior of the debug messages!
Ben Langmuir [Mon, 8 May 2023 22:59:51 +0000 (15:59 -0700)]
[clang] Prevent creation of new submodules in ASTWriter
Avoid inferring new submodules for headers in ASTWriter's collection of
affecting modulemap files, since we don't want to pick up dependencies
that didn't actually exist during parsing.
rdar://
109112624
Differential Revision: https://reviews.llvm.org/D150151
Valentin Clement [Tue, 9 May 2023 19:59:14 +0000 (12:59 -0700)]
Revert "[flang][openacc] Fix lowerbound when there is no subscripts"
This reverts commit
626aa8518d873c5760cd033fe49b1809c9de3494.
Aaron Ballman [Tue, 9 May 2023 19:53:24 +0000 (15:53 -0400)]
Wrap debug code with the LLVM_DEBUG macro; NFC
While investigating a bug in Clang, I noticed that -Wframe-larger-than
was emitting extra debug information along with the diagnostic. It
turns out that
2e1e2f52f357768186ecfcc5ac53d5fa53d1b094 fixed an issue
with the diagnostic, but accidentally left in some debug code that was
exposed in all builds.
So now we no longer emit things like:
8/
4294967304 (0.00%) spills,
4294967296/
4294967304 (100.00%) variables
along with the diagnostic
Aaron Ballman [Tue, 9 May 2023 19:28:02 +0000 (15:28 -0400)]
Fix LLVM sphinx build
This addresses the issues found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/34937
Valentin Clement [Tue, 9 May 2023 19:21:44 +0000 (12:21 -0700)]
[flang][openacc] Fix lowerbound when there is no subscripts
The lowerbound was not correctly normalized to 0 when the bound
are generated for an array without subscripts.
```
integer :: a(11:20)
!$acc enter data create(a)
```
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150208
Sami Tolvanen [Tue, 9 May 2023 16:51:52 +0000 (16:51 +0000)]
[CodeGen][KCFI] Move cfi-type lowering to TargetLowering
KCFI machine function passes transform indirect calls with a
cfi-type attribute into architecture-specific type checks bundled
together with the calls. Instead of having a separate pass for each
architecture, add a generic machine function pass for KCFI and
move the architecture-specific code that emits the actual check to
TargetLowering. This avoids unnecessary duplication and makes it
easier to add KCFI support to other architectures.
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D149915
Alexander Yermolovich [Tue, 9 May 2023 18:37:13 +0000 (11:37 -0700)]
[BOLT][DWARF][NFC] Fixed an assertion check
Spotted this one while working on new DWARF Rewriter. We were using wrong check
in assertion.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D150167
Valentin Clement [Tue, 9 May 2023 18:36:28 +0000 (11:36 -0700)]
[mlir][openacc] Cleanup acc.exit_data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.exit_data in D149601, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150145
Alexander Shaposhnikov [Tue, 9 May 2023 18:14:39 +0000 (18:14 +0000)]
[Clang][Sema] Fix comparison of constraint expressions
This diff switches the approach to comparison of constraint expressions
to the new one based on template args substitution.
It continues the effort to fix our handling of out-of-line definitions
of constrained templates.
This is a recommit of
3a54022934.
Differential revision: https://reviews.llvm.org/D146178
Casey Smalley [Tue, 9 May 2023 18:10:54 +0000 (20:10 +0200)]
Do not link asan_rtl_x86_64.S for non x86_64 platforms.
Do not link asan_rtl_x86_64.S for non x86_64 platforms.
Prior to this CL asan_rtl_x86_64.S would be always be linked when
building compiler-rt for non x86_64 platforms, this normally isn't an
issue since at that link time is an empty file anyway.
When attempting to link a Aarch64 program with branch protection enabled
with the address sanitizer.
E.g.
```
clang --target=aarch64 \
-fsanitize=address \
-mbranch-protection=standard \
-Wl,-z,force-bti
-o test \
test.cc
```
Results in the linking error from the sections generated from the empty
asan_rtl_x86_64.S owed to missing a .note.gnu.property
Also see [[ https://bugs.chromium.org/p/chromium/issues/detail?id=1427165 | https://bugs.chromium.org/p/chromium/issues/detail?id=1427165 ]]
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D149957
Min-Yih Hsu [Tue, 9 May 2023 17:54:57 +0000 (10:54 -0700)]
[M68k] Register MIR Passes with the PassRegistry
In order to use the -stop-before/after infrastructure. Also remove the
creator function for M68kConvertMOVToMOVMPass, which has never been
created.
NFC.
Dave Lee [Mon, 8 May 2023 23:51:01 +0000 (16:51 -0700)]
[lldb] Simplify Log::PutString (NFC)
* As no format string is involved, avoid unecessary call into `Printf`
* Eliminate creation of a `std::string` to print a `StringRef`
Differential Revision: https://reviews.llvm.org/D150160
Jordan Rupprecht [Tue, 9 May 2023 17:38:46 +0000 (10:38 -0700)]
Revert "[AggressiveInstCombine] folding load for constant global patterened arrays and structs by GEP-indices Differential Revision: https://reviews.llvm.org/D146622 Fixes https://github.com/llvm/llvm-project/issues/61615"
This reverts commit
0574a4be879e07b48ba9be8d63eebba49a04dfe8. It causes a compiler crash due to a div by zero.
Craig Topper [Tue, 9 May 2023 17:37:20 +0000 (10:37 -0700)]
[AArch64] Remove global constructors from AArch64Disassembler.cpp.
Instead of using SmallVectors of SmallVectors, use a plain array.
Reviewed By: c-rhodes
Differential Revision: https://reviews.llvm.org/D150077
Valentin Clement [Tue, 9 May 2023 17:29:41 +0000 (10:29 -0700)]
[flang][openacc] Lower self clause on acc update as host clause
Self clause is the same same as the host clause. Lower it
in a simmilar way.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150174
Alan Zhao [Fri, 5 May 2023 21:50:36 +0000 (14:50 -0700)]
[clang] Fix initializer_list matching failures with modules
Previously, if a class with a defined public virtual destructor is
declared before including <initializer_list> and initializer_list is
provided via a Clang module, then overload resolution would fail for
std::initializer_list. This is because when Clang sees the virtual
destructor, Clang creates an implicit NamespaceDecl for std to
implicitly declare a std::bad_alloc. That NamespaceDecl is not added to
the translation unit's lookup table, so when the module containing
std::initializer_list is imported later, that module's std NamespaceDecl
can't find the previous std NamespaceDecl during redeclaration lookup,
causing overload resolution to fail.
To fix this, implicitly created std NamespaceDecls are now added to the
lookup map. At the same time, their IdentifierNamespace members are
cleared to prevent regular name lookups from finding it.
Fixes 60929
Reviewed By: ChuanqiXu, #clang-language-wg, inclyc
Differential Revision: https://reviews.llvm.org/D150001
Ben Langmuir [Thu, 4 May 2023 16:12:52 +0000 (09:12 -0700)]
[clang][deps] Teach dep directive scanner about _Pragma
While we cannot handle `_Pragma` used inside macros, we can handle
this at the top level, and it some projects use the `_Pragma("once")`
spelling like that, which was causing spurious failures in the scanner.
Limitations
* Cannot handle #define ONCE _Pragma("once"), same issue as using
@import in a macro -- ideally we should diagnose this in obvious cases
* Our LangOpts are currently fixed, so we are not handling u"" strings
or R"()" strings that require C11/C++11.
rdar://
108629982
Differential Revision: https://reviews.llvm.org/D149884
Alex Langford [Tue, 9 May 2023 01:29:38 +0000 (18:29 -0700)]
[lldb] Simplify predicates of find_if in BroadcastManager
We had some custom classes that were used as the predicate for
`std::find_if`. It would be a lot simpler if we used lambdas instead.
Differential Revision: https://reviews.llvm.org/D150168
Kevin Sala [Tue, 9 May 2023 14:03:21 +0000 (16:03 +0200)]
[OpenMP][libomptarget] Init device when printing device info
This patch fixes the printing of device information. Devices are initialized
before printing its information. Fixes #61392
Differential Revision: https://reviews.llvm.org/D146081
Carlos Galvez [Sun, 7 May 2023 17:08:33 +0000 (17:08 +0000)]
[clang-tidy] Fix bugprone-assert-side-effect to actually give warnings
Some time ago a patch was merged to disable all clang-tidy warnings
from system macros. This led to bugprone-assert-side-effect
silently no longer working, since the warnings came from a system
macro. The problem was not detected because the fake assert functions
were implemented in the same file as the test, instead of being a
system include like it's done in the real world.
Move the assert to a proper system header, and fix the code to
warn at the correct location.
This patch is breakdown from https://reviews.llvm.org/D147081
by PiotrZSL.
Fixes https://github.com/llvm/llvm-project/issues/62314
Differential Revision: https://reviews.llvm.org/D150071
Rahul Kayaith [Mon, 8 May 2023 03:56:04 +0000 (23:56 -0400)]
[mlir][python] Allow specifying block arg locations
Currently blocks are always created with UnknownLoc's for their arguments. This
adds an `arg_locs` argument to all block creation APIs, which takes an optional
sequence of locations to use, one per block argument. If no locations are
supplied, the current Location context is used.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D150084
Jean Perier [Tue, 9 May 2023 16:22:55 +0000 (18:22 +0200)]
[flang] Ensure pointer components are always established
Follow up of https://reviews.llvm.org/D149979 for lowering.
In Fortran, it is possible to assign a pointer to another pointer
with an undefined association status.
When using the runtime do to none trivial pointer association, if the
descriptor are garbage, the runtime cannot safely detect that it has
a garbage descriptor, and it cannot safely know the descriptor size
leading to undefined behavior.
Another reason to initialize descriptor of pointers is to record any
non deferred length parameter value.
Hence, although this is not required by Fortran, f18 always initialize
pointers to NULL().
This was already done in lowering for whole pointer object, but not for
pointer components.
This patch uses the related semantics patch that updated
derivedTypeSpe::HasDefaultInitialization to ensure pointer components
of local and global object are always initialized.
It adds tests to ensure that allocation of such derived type uses the
runtime to ensure the storage is initialized, and that structure
constructors are setting the descriptor component to NULL() if no
initial target is given.
Differential Revision: https://reviews.llvm.org/D150180
Valentin Clement [Tue, 9 May 2023 16:00:36 +0000 (09:00 -0700)]
[mlir][openacc] Cleanup acc.enter_data from old data clause operands
Since the new data operand operations have been added in D148389 and
adopted on acc.enter_data in D148721, the old clause operands are no longer
needed.
The LegalizeDataOpForLLVMTranslation will become obsolete when all
operations will be cleaned. For the time being only the appropriate
part are being removed.
processOperands will also receive some updates once all the operands
will be coming from an acc data operand operation.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D150132
Valentin Clement [Tue, 9 May 2023 15:58:59 +0000 (08:58 -0700)]
[flang][openacc] Lower if_present clause correctly on acc update
The `if_present` clause is modeled as an attribute on the
acc.update operation. The lowering was not adding correctly the attribute
when the clause was present. This patch update the lowering to add
the attribute when needed.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D150171
Kévin Petit [Tue, 9 May 2023 15:52:13 +0000 (16:52 +0100)]
libclc: clspv: fix fma, add vstore and fix inlining issues
https://reviews.llvm.org/D147773
Patch by Romaric Jodin <rjodin@google.com>
Cordell Bloor [Tue, 9 May 2023 13:46:48 +0000 (09:46 -0400)]
[HIP] Detect HIP for Ubuntu, Mint, Gentoo, etc.
HIP may be installed into /usr or /usr/local on a variety of Linux
operating systems. It may become unwieldy to list them all.
Reviewed by: Siu Chi Chan, Yaxun Liu
Differential Revision: https://reviews.llvm.org/D149110
Thomas Symalla [Tue, 9 May 2023 15:24:00 +0000 (17:24 +0200)]
[NFC][AMDGPU] Add option to test.
Zain Jaffal [Tue, 9 May 2023 14:15:13 +0000 (17:15 +0300)]
[IRGen] Change annotation metadata to support inserting tuple of strings into annotation metadata array.
Annotation metadata supports adding singular annotation strings to annotation block. This patch adds the ability to insert a tuple of strings into the metadata array.
The idea here is that each tuple of strings represents a piece of information that can be all related. It makes it easier to parse through related metadata information given it will be contained in one tuple.
For example in remarks any pass that implements annotation remarks can have different type of remarks and pass additional information for each.
The original behaviour of annotation remarks is preserved here and we can mix tuple annotations and single annotations for the same instruction.
Reviewed By: paquette
Differential Revision: https://reviews.llvm.org/D148328
khei4 [Fri, 24 Mar 2023 09:48:30 +0000 (18:48 +0900)]
[AggressiveInstCombine] folding load for constant global patterened arrays and structs by GEP-indices Differential Revision: https://reviews.llvm.org/D146622 Fixes https://github.com/llvm/llvm-project/issues/61615
Florian Hahn [Tue, 9 May 2023 14:17:20 +0000 (15:17 +0100)]
[VPlan] Address missed suggestions from D149082.
This address 2 comments missed from D149082. It sets inbounds directly
when creating the GEP and fixes the order in the enum.
Théo Degioanni [Tue, 9 May 2023 14:01:31 +0000 (14:01 +0000)]
[mlir][mem2reg] Add mem2reg rewrite pattern.
This revision introduces the ability to invoke mem2reg as a rewrite pattern. This also modified the canonical mem2reg pass to use the rewrite pattern approach.
Depends on D149825
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D149958
Mehdi Amini [Fri, 21 Apr 2023 06:28:39 +0000 (00:28 -0600)]
Adopt Properties to store operations inherent Attributes in the GPU dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148889
Mehdi Amini [Fri, 21 Apr 2023 06:27:39 +0000 (00:27 -0600)]
Adopt Properties to store operations inherent Attributes in the EmitC dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148888
Mehdi Amini [Fri, 21 Apr 2023 06:26:54 +0000 (00:26 -0600)]
Adopt Properties to store operations inherent Attributes in the DLTI dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148887
Mehdi Amini [Fri, 21 Apr 2023 06:26:00 +0000 (00:26 -0600)]
Adopt Properties to store operations inherent Attributes in the ControlFlow dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148886
Mehdi Amini [Fri, 21 Apr 2023 06:24:10 +0000 (00:24 -0600)]
Adopt Properties to store operations inherent Attributes in the Complex dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148885
Mehdi Amini [Fri, 21 Apr 2023 06:23:18 +0000 (00:23 -0600)]
Adopt Properties to store operations inherent Attributes in the Bufferization dialect
This is part of an on-going migration to adopt Properties inside MLIR.
Differential Revision: https://reviews.llvm.org/D148884
Kevin Sala [Wed, 12 Apr 2023 20:02:23 +0000 (22:02 +0200)]
[OpenMP][libomptarget] Improve device info printing in NextGen plugins
This patch improves the device info printing in the NextGen plugins. The device
info properties are composed of keys, values and units (if necessary). These
properties are pushed into a queue by each vendor-specifc plugin, and later,
these properties are printed processed and printed by the common Plugin
Interface. The printing format is common across the different plugins.
Differential Revision: https://reviews.llvm.org/D148178
Louis Dionne [Tue, 28 Mar 2023 17:10:25 +0000 (13:10 -0400)]
[libc++] Add assertions for potential OOB reads in std::sort
We introduced an optimization to std::sort in
4eddbf9f10a6. However,
that optimization led to issues where users that were passing invalid
comparators to std::sort could start seeing OOB reads. This led to
the revert of the std::sort optimization from the LLVM 16 release
(see https://llvm.org/D146421).
This patch introduces _LIBCPP_ASSERTs to the places in the algorithm
where we make an assumption that the comparator will be consistent and
hence avoid a bounds check based on that. If the comparator happens not
to be consistent with itself, these are the places where we would
incorrectly go out of bounds. This allows users that enable libc++
assertions to catch such misuse at the cost of basically a bounds
check. For users that do not enable libc++ assertions (which is 99.9%
of users since assertions are off by default), this is basically a
no-op, and in fact the assertion will turn into a __builtin_assume,
making it explicit to the compiler that it can rely on the fact that
we're not going out of bounds.
I think this patch strikes the right balance. Folks that want absolute
performance will get what they want, since it is a precondition for the
comparator to be consistent, so the bounds checks are technically not
mandatory. Folks who want more safety *already* need to be enabling
libc++ assertions to catch other types of bugs (like operator[] OOB),
so this solution should also work for them.
I do think we have a lot of work towards popularizing the use of libc++
assertions and integrating it better so that users don't have to know
about the obscure _LIBCPP_ENABLE_ASSERTIONS macro to enable them, but
that's a separate concern.
rdar://
106897934
Differential Revision: https://reviews.llvm.org/D147089
Joseph Huber [Tue, 9 May 2023 12:56:33 +0000 (07:56 -0500)]
[clangd][NFX][FIX] Fix conflicting symbol name `Expr`
Summary:
This class has a member named `Expr` which conflicts with the clang type
of the same name due to the namespace. If we want to do this we need to
explicitly scope the variable. This was preventing me from building.
This was introduced in https://reviews.llvm.org/D148457
Thomas Symalla [Tue, 9 May 2023 12:53:44 +0000 (14:53 +0200)]
[NFC][AMDGPU] Pre-commit test.
Pre-commit fold-fabs.ll.
Louis Dionne [Mon, 8 May 2023 13:50:57 +0000 (09:50 -0400)]
[libc++] Provide an assignment operator from pair<U, V> in C++03
This adds an extension to std::pair in C++03 mode where we provide an
assignment operator from a pair<U, V>. Previously, any code trying to
trigger such an assignment operator would have tried using the
`operator=(pair const&)` copy assignment operator, which would then
have tried creating a `pair const&` by using the unconstrained
pair<U, V> constructor.
After this patch, pair will instead go through operator= directly if
its member types are assignable. If they are not assignable, the extension
operator= is disabled with SFINAE and the pair(pair<U, V>) constructor
will be used. Since that constructor is unconstrained, that will either
work or give a hard error.
This should be pretty transparent to users, but this is technically a
behavior change in C++03. Indeed, if a type has both a valid cross-type
assignment operator *and* a valid cross-type constructor, the library
will now prefer the cross-type assignment instead of going through the
cross-type constructor and then using the copy-constructor. Since this
is the mandated behavior in C++11, however, one could argue that any user
broken by that needs to change their code.
The motivation for this change is to allow simplifying the definition
of std::map's value_type, which requires handling assignment to a pair
of references properly. This patch will allow removing complexity from
https://llvm.org/D121485 instead of adding complexity in that patch.
Differential Revision: https://reviews.llvm.org/D150119
Vedant Paranjape [Tue, 9 May 2023 11:56:48 +0000 (11:56 +0000)]
[PartialInlining] Fix incorrect costing when IR has unreachable BBs
Partial Inlining identifies basic blocks that can be outlined into a
function. It is possible that an unreachable basic block is marked for
outlining. During costing of the outlined region, such unreachable basic
blocks are included as well. However, the CodeExtractor eliminates such
unreachable basic blocks and emits outlined function without them.
Thus, during costing of the outlined function, it is possible that the
cost of the outlined function comes out to be lesser than the cost of
outlined region, which triggers an assert.
Assertion `OutlinedFunctionCost >= Cloner.OutlinedRegionCost && "Outlined
function cost should be no less than the outlined region"' failed.
This patch adds code to eliminate unreachable blocks from the function
body before passing it on to be inlined. It also adds a test that checks
for behaviour of costing in case of unreachable basic blocks.
Discussion: https://discourse.llvm.org/t/incorrect-costing-in-partialinliner-if-ir-has-unreachable-basic-blocks/70163
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D149130
Florian Hahn [Tue, 9 May 2023 11:33:14 +0000 (12:33 +0100)]
[VPlan] Use VPRecipeWithIRFlags for VPWidenGEPRecipe (NFCI).
Extend VPRecipeWithIRFlags to also include InBounds and use for VPWidenGEPRecipe.
The last remaining recipe that needs updating for
MayGeneratePoisonRecipes is VPReplicateRecipe.
Depends on D149081.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D149082
Alexandros Lamprineas [Tue, 9 May 2023 10:46:53 +0000 (11:46 +0100)]
[FuncSpec][NFC] Rename cryptic variable to better describe it.
UM -> UniqueSpecs
Brought up on the review of D145379. Committing it seperately for now
since the Cost model improvements need rethink.
Kadir Cetinkaya [Tue, 9 May 2023 09:30:07 +0000 (11:30 +0200)]
[tidy][IdentifierNaming] Fix crashes on non-identifiers
Differential Revision: https://reviews.llvm.org/D150187
Younan Zhang [Sun, 16 Apr 2023 07:35:04 +0000 (15:35 +0800)]
[clangd] Support macro evaluation on hover
Creating a SelectionTree at the location where macro expands allows
us to obtain the associated expression, which might then be used to
evaluate compile-time values if possible.
Closes clangd/clangd#1595.
Reviewed By: nridge
Differential Revision: https://reviews.llvm.org/D148457
Alexandros Lamprineas [Tue, 9 May 2023 10:09:49 +0000 (11:09 +0100)]
[FuncSpec][NFC] Add an alias for InstructionCost.
Split from D145379. I'll rethink the Cost model improvements and
commit separately.
Chuanqi Xu [Tue, 9 May 2023 09:51:32 +0000 (17:51 +0800)]
[C++20] [Modules] Handle modules visible relationship properly
Close https://github.com/llvm/llvm-project/issues/62589.
Previously, for global module fragments, we will justify if it is
visible by the visibility of their top level parents. But this is an
overkill, it is problematic if we have a deduction guide in the global
module fragments. See the attached test for example. In this example, we
will mark the global module fragments as visible, but our old strategy
will miss the case surprisingly due to we will only search for the top
level modules.
Benjamin Chetioui [Tue, 9 May 2023 10:21:07 +0000 (10:21 +0000)]
Ilya Biryukov [Tue, 9 May 2023 10:06:32 +0000 (12:06 +0200)]
[Sema] Lambdas are not part of immediate context for deduction
This commit implements [temp.deduct]p9.
Test updates include:
- New notes in `cxx1y-init-captures.cpp`, `lambda-expressions.cpp`
and 'warn-unused-lambda-capture.cpp'.
This seems to be caused by diagnosing errors earlier (during
deduction) that were previously surfaced later (during
instantiation).
- New error `lambda-unevaluated.cpp` is in line with [temp.deduct]p9.
Reviewed By: erichkeane, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D148802
Matthias Springer [Tue, 9 May 2023 09:37:13 +0000 (11:37 +0200)]
[mlir][transform] SplitHandleOp: add additional distribution options
Add options to handle cases where there are not enough or too many payload ops mapped to the given handle.
Differential Revision: https://reviews.llvm.org/D149955
Théo Degioanni [Tue, 9 May 2023 09:01:33 +0000 (09:01 +0000)]
Reland "[mlir][mem2reg] Expose algorithm internals."
This patch refactors the Mem2Reg infrastructure. It decouples
analysis from promotion, allowing for more control over the execution of
the logic. It also adjusts the interfaces to be less coupled to mem2reg
and more general. This will be useful for an upcoming revision
introducing generic SROA.
This commit reverts
f333977eb20a and relands
91cff8a71872.
The original commit was reverted accidentally due to a misinterpretation
of a bazel build bot failure.
Reviewed By: gysit
Differential Revision: https://reviews.llvm.org/D149825
Jacques Pienaar [Tue, 9 May 2023 09:08:39 +0000 (02:08 -0700)]
[mlir] Fix missing dep on MLIRX86VectorTransforms
Tom Dohrmann [Tue, 9 May 2023 06:06:30 +0000 (14:06 +0800)]
fix stack probe lowering for x86_intrcc
The x86_intrcc calling convention will build two STACKALLOC_W_PROBING machine instructions if the function takes an error code. This is caused by an additional call to emitSPUpdate in llvm/lib/Target/X86/X86FrameLowering.cpp:1650. Previously only the first STACKALLOC_W_PROBING machine instruction was properly handled, the second one was simply ignored. This lead to miscompilations where the stack pointer wasn't properly updated (see https://github.com/rust-lang/rust/issues/109918). This patch fixes this by handling all STACKALLOC_W_PROBING machine instructions.
To be honest I don't quite understand why this didn't lead to more noticeable miscompilations previously.
This is my first time contributing to LLVM.
Reviewed By: pengfei
Differential Revision: https://reviews.llvm.org/D150033
Mariya Podchishchaeva [Tue, 9 May 2023 07:43:59 +0000 (03:43 -0400)]
[clang] Evaluate non-type default template argument when it is required
Before this change a default template argument for a non-type template
parameter was evaluated and checked immediately after it is met by
parser. In some cases it is too early.
Fixes https://github.com/llvm/llvm-project/issues/62224
Fixes https://github.com/llvm/llvm-project/issues/62596
Reviewed By: shafik, erichkeane, cor3ntin
Differential Revision: https://reviews.llvm.org/D150108
Nikita Popov [Fri, 10 Mar 2023 14:01:31 +0000 (15:01 +0100)]
[CodeGen] Only consider innermost cast for !heapallocsite
Without opaque pointers, this code determined !heapallocsite based
on the innermost cast of the allocation call. With opaque pointers,
the casts no longer generate an instruction, so the outermost cast
is used. Add an explicit check for nested casts to prevent this.
Differential Revision: https://reviews.llvm.org/D145788
Martin Braenne [Mon, 8 May 2023 19:08:36 +0000 (19:08 +0000)]
[clang][dataflow][NFC] Remove `SkipPast` param from `getValue(const ValueDecl &)`.
This parameter was already a no-op, so removing it doesn't change behavior.
Reviewed By: ymandel
Differential Revision: https://reviews.llvm.org/D150137
LLVM GN Syncbot [Tue, 9 May 2023 07:24:20 +0000 (07:24 +0000)]
[gn build] Port
17bbb224f99c
Jean Perier [Tue, 9 May 2023 07:22:24 +0000 (09:22 +0200)]
[flang][hlfir] Lower left-hand side vector subscripts to HLFIR
This patch lowers assignments to vector subscripted designators into the
newly added hlfir.elemental_addr and hlfir.region_assign.
Note that the codegen of these operation to FIR is still TODO and will
still emit a TODO message when trying to compile programs end to end.
Differential Revision: https://reviews.llvm.org/D149962
Jean Perier [Tue, 9 May 2023 07:21:09 +0000 (09:21 +0200)]
[flang][hlfir] Lower WHERE to HLFIR
Lower WHERE to the newly added hlfir.where and hlfir.elsewhere
operations.
Differential Revision: https://reviews.llvm.org/D149950
Jean Perier [Tue, 9 May 2023 07:18:53 +0000 (09:18 +0200)]
[flang][hlfir] Lower forall to HLFIR
Lower Forall to the previously added hlfir.forall, hlfir.forall_mask.
hlfir.forall_index, and hlfir.region_assign operations.
The HLFIR assignment code lowering is moved into genDataAssignment for
more readability and so that user defined assignment (still a TODO),
will be able to share most of the logic.
Differential Revision: https://reviews.llvm.org/D149878
Hans Wennborg [Mon, 8 May 2023 17:15:46 +0000 (19:15 +0200)]
Undo include order work-around in Regex.cpp
r327256 /
2b8b90a7686858b1d22cae6fcfbd0904135112aa added this
include-order work-around since regex_impl.h's include guard conflicted
with macOS's xlocale.h which used the same macro.
Since
b86c249691a7973a451bc6a586b39da64778d219 renamed the include
guard, that work-around is no longer needed.
Differential revision: https://reviews.llvm.org/D150127
Hans Wennborg [Tue, 9 May 2023 07:15:18 +0000 (09:15 +0200)]
Revert "[ValutTracking] Use isGuaranteedNotToBePoison in impliesPoison"
This broke two lit tests:
LLVM :: Transforms/LoopSimplify/merge-exits.ll
LLVM :: Transforms/PhaseOrdering/X86/vector-reductions.ll
see comment on the code review.
> Differential Revision: https://reviews.llvm.org/D149934
This reverts commit
2ba4cfd56769ab50c9c6f432f93265d7793bd1f2.
pvanhout [Mon, 8 May 2023 07:31:09 +0000 (09:31 +0200)]
[AMDGPU] Recompute liveness in SIOptimizeExecMaskingPreRA
Instead of ad-hoc updating liveness, recompute it completely for the affected register.
This does not affect any existing test and fixes an edge case that
caused a "Non-empty but used interval" error in the register allocator
due to how the pass updated liveranges. It created a "isolated" live-through
segment.
Overall this change just seems to be a net positive with no side effect observed. There may be a compile time impact but it's expected to be minimal.
Fixes SWDEV-388279
Reviewed By: critson
Differential Revision: https://reviews.llvm.org/D150105
Weining Lu [Mon, 8 May 2023 03:34:34 +0000 (11:34 +0800)]
[LoongArch] Support fcc* (condition flag) registers in inlineasm clobbers
Differential Revision: https://reviews.llvm.org/D150089
varconst [Tue, 9 May 2023 06:40:21 +0000 (23:40 -0700)]
[libc++][ranges] Implement the changes to vector from P1206 (`ranges::to`):
- add the `from_range_t` constructors and the related deduction guides;
- add the `insert_range`/`assign_range`/etc. member functions.
(Note: this patch is split from https://reviews.llvm.org/D142335)
Differential Revision: https://reviews.llvm.org/D149826
Shengchen Kan [Tue, 9 May 2023 06:05:30 +0000 (14:05 +0800)]
Set mayLoad = 1 for shift/rotate with a memory operand
Amara Emerson [Mon, 8 May 2023 05:09:27 +0000 (22:09 -0700)]
[GlobalISel] Implement commuting shl (add/or x, c1), c2 -> add/or (shl x, c2), c1 << c2
There's a target hook that's called in DAGCombiner that we stub here, I'll
implement the equivalent override for AArch64 in a subsequent patch since it's
used by different shift combine.
This change by itself has minor code size improvements on arm64 -Os CTMark:
Program size.__text
outputg181ppyy output8av1cxfn diff
consumer-typeset/consumer-typeset 410648.00 410648.00 0.0%
tramp3d-v4/tramp3d-v4 364176.00 364176.00 0.0%
kimwitu++/kc 449216.00 449212.00 -0.0%
7zip/7zip-benchmark 576128.00 576120.00 -0.0%
sqlite3/sqlite3 285108.00 285100.00 -0.0%
SPASS/SPASS 411720.00 411688.00 -0.0%
ClamAV/clamscan 379868.00 379764.00 -0.0%
Bullet/bullet 452064.00 451928.00 -0.0%
mafft/pairlocalalign 246184.00 246108.00 -0.0%
lencod/lencod 428524.00 428152.00 -0.1%
Geomean difference -0.0%
Differential Revision: https://reviews.llvm.org/D150086
Jon Roelofs [Tue, 9 May 2023 04:52:12 +0000 (21:52 -0700)]
CMake: add missing dependency on intrinsics_gen
luxufan [Fri, 5 May 2023 07:53:16 +0000 (15:53 +0800)]
[ValutTracking] Use isGuaranteedNotToBePoison in impliesPoison
Differential Revision: https://reviews.llvm.org/D149934
William Huang [Tue, 9 May 2023 04:37:08 +0000 (04:37 +0000)]
[llvm-profdata] ProfileReader cleanup - preparation for MD5 refactoring - 2
Cleanup profile reader classes to prepare for complex refactoring as propsed in D147740, continuing D148868
This is patch 2/n. This patch refactors CSNameTable and related things
The decision to move CSNameTable up to the base class is because a planned improvement (D147740) to use MD5 to lookup Functions/Context frames. In this case we want a unified data structure between contextless function or Context frames, so that it can be mapped by MD5 value. Since Context Frames can represent contextless functions, it is being used for MD5 lookup, therefore exposing it to the base class
Reviewed By: snehasish, wenlei
Differential Revision: https://reviews.llvm.org/D148872
Jason Molenda [Tue, 9 May 2023 03:28:52 +0000 (20:28 -0700)]
Add a new report_load_commands option to jGetLoadedDynamicLibrariesInfos
jGetLoadedDynamicLibrariesInfos has a mode where it will list
every binary in the process - the load address and filepath from dyld
SPI, and the mach-o header and load commands from a scan by debugserver
for perf reasons. With a large enough number of libraries, creating
that StructuredData representation of all of this, and formatting it
into an ascii string to send up to lldb, can grow debugserver's heap
size too large for some environments.
This patch adds a new report_load_commands:false boolean to the
jGetLoadedDynamicLibrariesInfos packet, where debugserver will now
only report the dyld SPI load address and filepath for all of the
binaries. lldb can then ask for the detailed information on
the process binaries in smaller chunks, and avoid debugserver
having ever growing heap use as the number of binaries inevitably
increases.
This patch also removes a version of jGetLoadedDynamicLibrariesInfos
for pre-iOS 10 and pre-macOS 10.12 systems where we did not use
dyld SPI. We can't back compile to those OS builds any longer
with modern Xcode.
Finally, it removes a requirement in DynamicLoaderMacOS that the
JSON reply from jGetLoadedDynamicLibrariesInfos include the
mod_date field for each binary. This has always been reported as
0 in modern dyld, and is another reason for packet growth in
the reply. debugserver still puts the mod_date field in its replies
for interop with existing lldb's, but we will be able to remove it
the field from debugserver's output after the next release cycle
when this patch has had time to circulate.
I'll add lldb support for requesting the load addresses only
and splitting the request up into chunks in a separate patch.
Differential Revision: https://reviews.llvm.org/D150158
rdar://
107848326
Kazu Hirata [Tue, 9 May 2023 03:23:33 +0000 (20:23 -0700)]
[clang] Modernize LoopHint (NFC)
Kazu Hirata [Tue, 9 May 2023 03:23:32 +0000 (20:23 -0700)]
[Hexagon] Remove unused struct AlignVectors::Segment
Kazu Hirata [Tue, 9 May 2023 03:23:31 +0000 (20:23 -0700)]
[mlir] Replace None with std::nullopt in comments (NFC)
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Amir Aupov [Tue, 9 May 2023 03:16:58 +0000 (20:16 -0700)]
[BOLT][test] Fix retpoline-synthetic.test
Fix test on BOLT's buildbot, e.g.
https://lab.llvm.org/buildbot/#/builders/244/builds/10885
Owen Pan [Sat, 6 May 2023 23:29:16 +0000 (16:29 -0700)]
[clang-format] Fix consecutive alignments in #else blocks
Since 3.8 or earlier, clang-format has been lumping all #else, #elif,
etc blocks together when doing whitespace replacements and causing
consecutive alignments across #else blocks.
Commit c077975 partially addressed the problem but also triggered
"regressions".
This patch fixes the root cause of the problem and "reverts" c077975
(except for the unit tests).
Fixes #36070.
Fixes #55265.
Fixes #60721.
Fixes #61498.
Differential Revision: https://reviews.llvm.org/D150057
Joseph Huber [Mon, 8 May 2023 23:37:55 +0000 (18:37 -0500)]
[OpenMP] Fix incorrect interop type for number of dependencies
The interop types use the number of dependencies in the function
interface. Every other function uses an `i32` to count the number of
dependencies except for the initialization function. This leads to
codegen issues when the rest of the compiler passes in an `i32` that
then creates an invalid call. Fix this to be consistent with the other
uses.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D150156
Amir Ayupov [Tue, 9 May 2023 01:53:48 +0000 (18:53 -0700)]
[BOLT] Use opcode name in hashBlock
Use MCInst opcode name instead of opcode value in hashing.
Opcode values are unstable wrt changes to target tablegen definitions,
and we notice that as output mismatches in NFC testing. This makes BOLT YAML
profile tied to a particular LLVM revision which is less portable than
offset-based fdata profile.
Switch to using opcode names which have 1:1 mapping with opcode values for any
given LLVM revision, and are stable wrt modifications to .td files (except of
course modifications to names themselves).
Test Plan:
D150154 is a test commit adding new X86 instruction which shifts opcode values.
With current change, pre-aggregated-perf.test passes in nfc check mode.
Without current change, pre-aggregated-perf.test expectedly fails.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D150005
Amir Ayupov [Tue, 9 May 2023 01:48:40 +0000 (18:48 -0700)]
[BOLT] Use MCInstPrinter in createRetpolineFunctionTag
Make retpoline functions invariant of X86 register numbers.
retpoline-synthetic.test is known to fail NFC testing due to shifting
register numbers. Use canonical register names instead of tablegen
numbers.
Before:
```
__retpoline_r51_
__retpoline_mem_r58+DATAat0x200fe8
__retpoline_mem_r51+0
__retpoline_mem_r132+0+8*53
```
After:
```
__retpoline_%rax_
__retpoline_mem_%rip+DATAat0x200fe8
__retpoline_mem_%rax+0
__retpoline_mem_%r12+0+8*%rbx
```
Test Plan:
- Revert
67bd3c58c0c7389e39c5a2f4d3b1a30459ccf5b7 that touches X86RegisterInfo.td.
- retpoline-synthetic.test passes in NFC mode with this diff, fails without it.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D150138
David Blaikie [Tue, 9 May 2023 00:40:11 +0000 (00:40 +0000)]
Fix for release notes (follow-up to D149182/
a8b0c6fa)
David Blaikie [Tue, 25 Apr 2023 20:01:43 +0000 (20:01 +0000)]
Remove -Wpacked false positive for non-pod types where the layout isn't directly changed
The packed attribute can still be useful in this case if the struct is
then placed inside another packed struct - the non-pod element type's
packed attribute declares that it's OK to misalign this element inside
the packed structure. (otherwise the non-pod element is not packed/its
alignment is preserved, as per D117616/2771233)
Fixes PR62353
Differential Revision: https://reviews.llvm.org/D149182
Pierre Calixte [Tue, 9 May 2023 00:03:35 +0000 (00:03 +0000)]
Do not optimize debug locations across section boundaries
Prevent optimization of DebugLoc across section boundaries, such optimization will yield incorrect source location if memory layout of sections does not strictly match the Asm file.
Reviewed By: #debug-info, dblaikie, MaskRay
Differential Revision: https://reviews.llvm.org/D149294
Slava Zakharin [Mon, 8 May 2023 23:21:14 +0000 (16:21 -0700)]
[flang] Prevent character length setting with dangling ac-do-variable.
This fixes LEN inquiry on array constructors where the length
expression includes references to the ac-do-variable.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D150149
Vitaly Buka [Mon, 8 May 2023 22:24:33 +0000 (15:24 -0700)]
[NFC][HWASAN] Use InternalAlloc for ThreadStartArg
Vitaly Buka [Mon, 8 May 2023 18:03:40 +0000 (11:03 -0700)]
[NFC][ASAN] Hide placeholder buffer
Alan Zhao [Mon, 8 May 2023 23:26:32 +0000 (16:26 -0700)]
Revert "[CodeGen][ShrinkWrap] Split restore point"
This reverts commit
1ddfd1c8186735c62b642df05c505dc4907ffac4.
The original commit causes a Chrome build assertion failure with
ThinLTO: https://crbug.com/1443635
Vitaly Buka [Mon, 8 May 2023 22:15:15 +0000 (15:15 -0700)]
[NFC][HWASAN] Move HwasanThreadStartFunc
Vitaly Buka [Mon, 8 May 2023 22:03:22 +0000 (15:03 -0700)]
[NFC][HWASAN] Reformat the file
Vitaly Buka [Mon, 8 May 2023 22:32:55 +0000 (15:32 -0700)]
[NFC][HWASAN] Hide thread_list_placeholder
Vitaly Buka [Mon, 8 May 2023 22:58:24 +0000 (15:58 -0700)]
[NFC][sanitizer] Rename internal function
Peter Klausler [Fri, 21 Apr 2023 17:03:17 +0000 (10:03 -0700)]
[flang] Semantics for ISO_C_BINDING's C_LOC()
Make __builtin_c_loc() into an intrinsic function and verify the
special semantic requirements on its actual arguments.
Differential Revision: https://reviews.llvm.org/D149988
Michael Francis [Sun, 19 Mar 2023 22:42:35 +0000 (22:42 +0000)]
[AIX][Clang][K] Create `-K` Option for AIX.
`-K` is a linker option on AIX, that is used to align the header, text, data, and loader sections of the output file so that each section begins on a page boundary.
This patch creates the `-K` option in clang. On non-AIX targets, the "unsupported option" error is thrown.
Differential Revision: https://reviews.llvm.org/D146399
Peter Klausler [Thu, 20 Apr 2023 21:12:24 +0000 (14:12 -0700)]
[flang] Procedure pointers are not descriptors
Code in Evaluate/type.cpp was maintaining a very old assumption that
procedure pointers would need to be represented as descriptors. This
is not the case -- they are code or thunk addresses.
Differential Revision: https://reviews.llvm.org/D149984
Alexander Yermolovich [Mon, 8 May 2023 22:39:10 +0000 (15:39 -0700)]
[BOLT][DWARF] Fix dwarf5-one-loclists-two-bases test
Fix assembly for the helper file to work with the new DWARF rewriter.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D150147
Jon Roelofs [Mon, 8 May 2023 21:10:18 +0000 (14:10 -0700)]
cmake: add missing dependencies on Attributes.inc
Differential revision: https://reviews.llvm.org/D150144