Matheus Izvekov [Fri, 26 Aug 2022 11:09:55 +0000 (13:09 +0200)]
Revert "Clang: fix AST representation of expanded template arguments."
This reverts commit
1d1a56929b725f9a79d98877f12d0a14f8418b38.
Matthias Gehre [Wed, 25 May 2022 11:19:28 +0000 (12:19 +0100)]
[llvm/CodeGen] Add ExpandLargeDivRem pass
Adds a pass ExpandLargeDivRem to expand div/rem instructions
with more than 128 bits into a loop computing that value.
As discussed on https://reviews.llvm.org/D120327, this approach has the advantage
that it is independent of the runtime library. This also helps the clang driver,
which otherwise would need to understand enough about the runtime library
to know whether to allow _BitInts with more than 128 bits.
Targets are still free to disable this pass and instead provide a faster
implementation in a runtime library.
Fixes https://github.com/llvm/llvm-project/issues/44994
Differential Revision: https://reviews.llvm.org/D126644
Felipe de Azevedo Piovezan [Tue, 23 Aug 2022 15:11:06 +0000 (11:11 -0400)]
[lldb] Fix dotest argument order
When running LLDB API tests, a user can override test arguments with
LLDB_TEST_USER_ARGS. However, these flags used to be concatenated with a
CMake-derived variable LLDB_TEST_COMMON_ARGS, as below:
```
set(LLDB_DOTEST_ARGS ${LLDB_TEST_COMMON_ARGS};${LLDB_TEST_USER_ARGS}
CACHE INTERNAL STRING)
```
This is problematic, because LLDB_TEST_COMMON_ARGS must be processed
first, while LLDB_TEST_USER_ARGS args must be processed last, so that
user overrides are respected. Currently, if a user attempts to override
one of the "inferred" flags, the user's request is ignored. This is the
case, for example, with `--libcxx-include-dir` and
`--libcxx-library-dir`. Both flags are needed by the greendragon bots.
This commit removes the concatenation above, keeping the two original
variables throughout the entire flow, processing the user's flag last.
The variable LLDB_TEST_COMMON_ARGS needs to be a CACHE property, but it
is modified throughout the CMake file with `set` or `list` or `string`
commands, which don't work with properties. As such, a temporary
variable `LLDB_TEST_COMMON_ARGS_VAR` is created.
This was tested locally by invoking CMake with:
-DLLDB_TEST_USER_ARGS="--libcxx-include-dir=blah --libcxx-library-dir=blah2"
and checking that tests failed appropriately.
Differential Revision: https://reviews.llvm.org/D132642
Simon Pilgrim [Fri, 26 Aug 2022 10:47:44 +0000 (11:47 +0100)]
[DAG] Strip poison generating flags in freeze(op()) -> op(freeze()) fold
This patch follows the InstCombine approach of stripping poison generating flags (nsw/nuw from add/sub etc.) to allow us to push a freeze() through the op. Unlike InstCombine it doesn't retain any flags, but we have plenty of DAG folds that do the same thing already. We assert that the newly generated op isGuaranteedNotToBeUndefOrPoison.
Similar to the ValueTracking approach, isGuaranteedNotToBeUndefOrPoison has been updated to confirm that if an op can't create undef/poison and its operands are guaranteed not to be undef/poison - then its not undef/poison. This is just for the generic opcodes - target specific opcodes will need to do this manually just in case they have some special cases.
Differential Revision: https://reviews.llvm.org/D132333
Pavel Samolysov [Fri, 26 Aug 2022 10:21:29 +0000 (13:21 +0300)]
Revert "[Pipelines] Introduce DAE after ArgumentPromotion"
The commit breaks the compiler when a function is used as a function
parameter (hm... for a function from the standard C library?):
```
static float strtof(char *, char *) {}
void a() { strtof(a, 0); }
```
This reverts commit
879f5118fc74657e4a5c4eff6810098e1eed75ac.
Nicolas Vasilache [Fri, 26 Aug 2022 10:34:39 +0000 (03:34 -0700)]
[mlir][Vector] Support 0-D vectors in TransposeOp
Co-authored-by: Michal Terepeta <michalt@google.com>
Reviewed-by: ftynse
Differential Revision: https://reviews.llvm.org/D115743
Simon Pilgrim [Fri, 26 Aug 2022 10:16:57 +0000 (11:16 +0100)]
[CostModel][X86] getTypeBasedIntrinsicInstrCost - adjustTableCost - split CostTblEntry into ISD/Cost pair. NFC
This will be necessary to allow us to reuse this for other cost kind types
Paul Walker [Fri, 19 Aug 2022 17:51:02 +0000 (18:51 +0100)]
[SVE] Lower fixed-length floating point loads and stores to integer variants.
There's no advatange to emitting floating point scalable accesses,
whereas by lowering them to integer variants we can benefit from
several combines that seek to replace explicit extends/truncates
with extending/truncating accesses.
Differential Revision: https://reviews.llvm.org/D132393
Daniil Dudkin [Fri, 26 Aug 2022 10:00:06 +0000 (13:00 +0300)]
[flang] Remove obsolete TODO
As the comment tells, the TODO was added because
there was no conversion for abstract results in function types inside GlobalOps.
Since the conversion was added, this TODO is obsolete, so it is removed.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D130369
Florian Hahn [Fri, 26 Aug 2022 10:00:08 +0000 (11:00 +0100)]
[LAA] Rename printing pass to print<access-info>.
This updates the naming for the LAA printing pass to be in line with
most other analysis printing passes.
The old name has come up as confusing multiple times already, e.g. in
D131924.
Matthias Gehre [Wed, 25 May 2022 15:00:54 +0000 (16:00 +0100)]
Revert "[SelectionDAG] Emit calls to __divei4 and friends for division/remainder of large integers"
This reverts https://reviews.llvm.org/D120329.
I abandoned the PR [0] to add __divei4 functions to compiler-rt
in favor of adding a pass to transform div/rem [1].
This removes the backend code that was supposed to emit calls to the __divei4 functions.
[0] https://reviews.llvm.org/D120327
[1] https://reviews.llvm.org/D130076
Differential Revision: https://reviews.llvm.org/D130079
WANG Xuerui [Fri, 26 Aug 2022 04:12:26 +0000 (12:12 +0800)]
[LoongArch] Port over minimal applyFixup from RISCV
Many DebugInfo tests now pass with native builds.
Differential Revision: https://reviews.llvm.org/D132323
Alex Richardson [Thu, 25 Aug 2022 12:34:12 +0000 (12:34 +0000)]
[ARM] Use getSymbolPreferLocal() in GetARMGVSymbol
This allows relaxing some relocations to symbol+offset instead of emitting
a relocation against a symbol.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D131433
Alex Richardson [Thu, 25 Aug 2022 12:15:47 +0000 (12:15 +0000)]
Mark the $local function begin symbol as a function
While this does not matter for most targets, when building for Arm Morello,
we have to mark the symbol as a function and add size information, so that
LLD can correctly evaluate relocations against the local symbol.
Since Morello is an out-of-tree target, I tried to reproduce this with
in-tree backends and with the previous reviews applied this results in
a noticeable difference when targeting Thumb.
Background: Morello uses a method similar Thumb where the encoding mode is
specified in the LSB of the symbol. If we don't mark the target as a
function, the relocation will not have the LSB set and calls will end up
using the wrong encoding mode (which will almost certainly crash).
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D131429
Michael Buch [Fri, 26 Aug 2022 09:28:28 +0000 (10:28 +0100)]
[lldb][Test] Add missing breakpoint in TestNamespaceLookup.py
Michael Buch [Thu, 25 Aug 2022 22:41:47 +0000 (23:41 +0100)]
[lldb][ClangExpression] Fix LLDB_LOG incorrect format specifier
Previously this would log:
```
FindExternalLexicalDecls on (ASTContext*)0x00000005CE825200 'Expression
ASTContext for '<user expression 0>'' in 'weak_ptr'
(%sDecl*)ClassTemplateSpecialization
FindExternalLexicalDecls on (ASTContext*)0x00000005CE825200 'Expression
ASTContext for '<user expression 0>'' in '__shared_count'
(%sDecl*)CXXRecord
```
Note that the `%s` isn't actually respected. This patch fixes this
by providing the format specifiers that `lldb::formatv` supports.
Differential Revision: https://reviews.llvm.org/D132709
Nicolai Hähnle [Fri, 26 Aug 2022 09:02:00 +0000 (11:02 +0200)]
Revert "ManagedStatic: remove from DebugCounter"
This reverts commit
b5b6ef1500af29b6aba71330d8aaf82ecccb1f37.
Utkarsh Saxena [Thu, 25 Aug 2022 14:05:50 +0000 (16:05 +0200)]
PotentiallyEvaluatedContext in a ImmediateFunctionContext.
Body of `consteval` should be in an `ImmediateFunctionContext` instead of `ConstantEvaluated`.
PotentiallyEvaluated expressions in Immediate functions are in a `ImmediateFunctionContext` as well.
Fixes https://github.com/llvm/llvm-project/issues/51182
Original divergence: https://godbolt.org/z/vadGT5j6f
Differential Revision: https://reviews.llvm.org/D132659
Dmitry Makogon [Mon, 22 Aug 2022 08:06:57 +0000 (15:06 +0700)]
[SimplifyCFG] Don't widen cond br if false branch has successors
Fixes https://github.com/llvm/llvm-project/issues/57221.
This limits the tryWidenCondBranchToCondBranch transform making it
work only if the false block of widenable condition branch
has no successors.
If that block has successors, then SimplifyCondBranchToCondBranch
may undo the transform done by tryWidenCondBranchToCondBranch, which
would lead to infinite cycle of transformation and eventually
an assert failing.
Differential Revision: https://reviews.llvm.org/D132356
Alexander Potapenko [Wed, 24 Aug 2022 09:58:59 +0000 (11:58 +0200)]
[compiler-rt][hwasan] Support for Intel LAM v6 API
Version 6 of Intel LAM kernel patches
(https://lore.kernel.org/all/
20220815041803.17954-1-kirill.shutemov@linux.intel.com/)
introduces arch_prctl(ARCH_GET_MAX_TAG_BITS), which (unlike
ARCH_GET_UNTAG_MASK) can be used to determine if the kernel really
supports pointer tagging. arch_prctl(ARCH_GET_UNTAG_MASK) will be used to
verify that HWASan can place tags in the given bit range.
Depends on D132545
Differential Revision: https://reviews.llvm.org/D132546
Ilya Biryukov [Fri, 26 Aug 2022 08:17:44 +0000 (10:17 +0200)]
[clang] NFC. Small tweak to release notes
Forgotten in the last patch.
Luke Nihlen [Fri, 26 Aug 2022 07:52:06 +0000 (09:52 +0200)]
[clang] Add cxx scope if needed for requires clause.
Fixes issue #55216.
Patch by Luke Nihlen! (luken@google.com, luken-google@)
Reviewed By: #clang-language-wg, aaron.ballman
Differential Revision: https://reviews.llvm.org/D132503
Nicolai Hähnle [Mon, 4 Jul 2022 10:52:08 +0000 (12:52 +0200)]
ManagedStatic: remove from DebugCounter
Follow the pattern used in MLIR for the cl::opt instances.
v2:
- make DebugCounter::isCountingEnabled public so that the
DebugCounterOwner doesn't have to be a nested class. This simplifies
later changes
v3:
- remove the indirection via DebugCounterOwner::instance()
Differential Revision: https://reviews.llvm.org/D129116
Adrian Kuegel [Fri, 26 Aug 2022 07:06:40 +0000 (09:06 +0200)]
[mlir][Bazel] Fix wrong dependency to //llvm:Support
Adrian Kuegel [Fri, 26 Aug 2022 07:04:50 +0000 (09:04 +0200)]
[mlir][Bazel] Fix bazel build.
Sheng [Fri, 26 Aug 2022 06:42:15 +0000 (14:42 +0800)]
[NFC][M68k][test] Fix incorrect use of `getelementptr`
Reviewers: RKSimon
Differential Revision: https://reviews.llvm.org/D132007
Yunze Zhu [Fri, 26 Aug 2022 06:05:15 +0000 (14:05 +0800)]
[RISCV] Generate correct ELF abi flag when empty .ll file has target-abi attribute
In patch D121183, target abi is get from .ll file's target-abi
attribute and set in RISCVAsmPrinter::emitFunctionEntryLabel
function. In https://github.com/llvm/llvm-project/issues/57242,
an api mismatch error may be caused by failing to call function
RISCVAsmPrinter::emitFunctionEntryLabel to set target-abi to
correct one when the .ll is empty or a module has no function.
This patch move setting target-abi part to function
RISCVAsmPrinter::emitStartOfAsmFile, make sure all .ll file and
module in LTO read target-abi from module flag and set, with or
without function.
Signed-off-by: xiaojing.zhang <xiaojing.zhang@xcalibyte.com>
Signed-off-by: jianxin.lai <jianxin.lai@xcalibyte.com>
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D132204
LiaoChunyu [Fri, 26 Aug 2022 06:18:53 +0000 (14:18 +0800)]
[RISCV] : Add support for simm10_lsb0000nonzero operand.
Running on RISCV machine llvm-exegesis I faced with trouble: can't measure C_ADDI16SP, beacuse immediate has type simm10_lsb0000nonzero.
Patch adds support for processing this immediate operand type.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D132650
Chuanqi Xu [Fri, 26 Aug 2022 05:49:00 +0000 (13:49 +0800)]
[Coroutines] Store the index for final suspend point if there is unwind coro end
Closing https://github.com/llvm/llvm-project/issues/57339
The root cause for this issue is an pre-mature optimization to eliminate
the index for the final suspend point since we feel like we can judge
if a coroutine is suspended at the final suspend by if resume_fn_addr is
null. However this is not true if the coroutine exists via an exception
in promise.unhandled_exception(). According to
[dcl.fct.def.coroutine]p14:
> If the evaluation of the expression promise.unhandled_exception()
> exits via an exception, the coroutine is considered suspended at the
> final suspend point.
But from the perspective of the implementation, we can't set the coro
index to the final suspend point directly since it breaks the states.
To fix the issue, we block the optimization if we find there is any
unwind coro end, which indicates that it is possible that the coroutine
exists via an exception from promise.unhandled_exception().
Test Plan: folly
owenca [Fri, 26 Aug 2022 04:57:40 +0000 (21:57 -0700)]
[clang-format][NFC] Call eof() and isEOF() in UnwrappedLineParser
WANG Xuerui [Fri, 26 Aug 2022 03:42:17 +0000 (11:42 +0800)]
[Object] Support LoongArch in RelocationResolver
Similar to the RISCV logic added in D62062.
With this patch applied, llvm-dwarfdump works on existing LoongArch
object files, but generation of debuginfo on LoongArch is still pending
on proper support for relocations, so no test cases this time. They will
come later.
Differential Revision: https://reviews.llvm.org/D132019
gonglingqin [Fri, 26 Aug 2022 02:14:30 +0000 (10:14 +0800)]
[LoongArch] Support register-register-addressed FPR load and store
Differential Revision: https://reviews.llvm.org/D132453
Slava Zakharin [Tue, 12 Jul 2022 23:07:38 +0000 (16:07 -0700)]
[mlir][math] Added math::IPowI conversion to calls of outlined implementations.
Power functions are implemented as linkonce_odr scalar functions
for integer types used by IPowI operations met in a module.
Vector form of IPowI is linearized into a sequence of calls
of the scalar functions.
Differential Revision: https://reviews.llvm.org/D129810
Joe Loser [Thu, 25 Aug 2022 00:50:28 +0000 (18:50 -0600)]
[libc++][test] Use TEST_HAS_NO_CHAR8_T to simplify #ifdefs. NFCI.
Many tests in `libcxx/test/std/strings` use
`#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L`
which can be replaced with the more terse `#ifndef TEST_HAS_NO_CHAR8_T`.
Differential Revision: https://reviews.llvm.org/D132626
Joe Loser [Thu, 25 Aug 2022 01:31:15 +0000 (19:31 -0600)]
[ADT] Make `llvm::identity` a transparent function object
`llvm::identity` is similar to `std::identity` from C++20, but one surprising
thing is that `llvm::identity` is not a transparent function object. Add the
`is_transparent` type alias to denote it can be used as a transparent function
object.
Differential Revision: https://reviews.llvm.org/D132628
jacquesguan [Thu, 25 Aug 2022 08:43:43 +0000 (16:43 +0800)]
[RISCV][NFC] Use common prefix to simplify test.
Differential Revision: https://reviews.llvm.org/D132637
Fangrui Song [Fri, 26 Aug 2022 02:30:21 +0000 (19:30 -0700)]
[Driver][test] Replace legacy -target with --target=
Adrian Vogelsgesang [Thu, 25 Aug 2022 23:29:06 +0000 (16:29 -0700)]
[lldb][test] Fix nullptr test expctation for 32-bit system
Follow-up to https://reviews.llvm.org/D132415
Fixes https://lab.llvm.org/buildbot/#/builders/17/builds/26630
Alexander Yermolovich [Fri, 26 Aug 2022 00:01:41 +0000 (17:01 -0700)]
[BOLT][DWARF] Fix updating CU that has no entry in .debug_addr
We were trying to process .debug_addr for CU that doesn't have it. This resulted
in assert. Example came from GCC that also doesn't use DW_OP_addrx in
DW_FORM_exprloc.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132422
Chris Bieneman [Thu, 25 Aug 2022 23:25:20 +0000 (18:25 -0500)]
[HLSL] Add abs library function
This change exposes the abs library function for HLSL scalar types. Abs
is supported for all scalar, vector and matrix types. This patch only
adds a subset of scalar type support.
Fixes #57100 (https://llvm.org/pr57100)
The full documentation of the HLSL abs function is available here:
https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-abs
Reviewed By: bogner
Differential Revision: https://reviews.llvm.org/D131718
Peter Klausler [Thu, 28 Oct 2021 16:37:43 +0000 (09:37 -0700)]
[flang] Fold DOT_PRODUCT()
Implement constant folding of the intrinsic function DOT_PRODUCT().
Differential Revision: https://reviews.llvm.org/D132688
Jonas Devlieghere [Thu, 25 Aug 2022 23:36:16 +0000 (16:36 -0700)]
[lldb] Computer the slide when and apply it to each fileset's vm addr
Computer the slide when and apply it to each entry's vm addr when
reading from memory.
Differential revision: https://reviews.llvm.org/D132710
Hsiangkai Wang [Wed, 24 Aug 2022 08:25:32 +0000 (08:25 +0000)]
[AArch64] Filter out invalid code model in frontend.
AArch64 only supports tiny, small, and large code model. Show error
messages when users specify other code model.
Fix https://github.com/llvm/llvm-project/issues/53402
Differential Revision: https://reviews.llvm.org/D132538
Peter Klausler [Thu, 25 Aug 2022 17:27:32 +0000 (10:27 -0700)]
[flang] Allow NULL() actual argument for procedure pointer dummy argument with unspecified intent
A NULL() pointer is a valid actual argument for a procedure pointer dummy
argument whose intent is INTENT(IN); it should also be acceptable for a
procedure pointer dummy argument with unspecified intent.
Also make it possible to discern null object pointers from null procedure
pointers, so that an attempt to use one in place of the other in a context
where the distinction matters will still elicit an error.
Differential Revision: https://reviews.llvm.org/D132687
Valery N Dmitriev [Thu, 25 Aug 2022 23:02:22 +0000 (16:02 -0700)]
[SLP][NFC] Add a coverage test for horizontal reductions.
Reduction feeds single insertelement instruction.
Peter Klausler [Tue, 23 Aug 2022 21:31:18 +0000 (14:31 -0700)]
[flang] Fix module file issue with renamed shadowed specific procedures
A specific procedure in the list of specific procedures associated with
a generic interface needs to be a symbol that is not inadvertently
resolved to its ultimate symbol in another module when it is also
shadowed by a generic interface of the same name.
Differential Revision: https://reviews.llvm.org/D132686
Peter Klausler [Thu, 25 Aug 2022 17:24:53 +0000 (10:24 -0700)]
[flang] Make C_F_POINTER a generic interface
The intrinsic procedure C_F_POINTER needs to be a generic interface
in intrinsic module ISO_C_BINDING. (It also needs to be implemented,
but that remains a TODO for either lowering or the runtime.)
Differential Revision: https://reviews.llvm.org/D132685
LLVM GN Syncbot [Thu, 25 Aug 2022 22:25:21 +0000 (22:25 +0000)]
[gn build] Port
48506fbbbf27
Jonas Devlieghere [Thu, 25 Aug 2022 22:11:32 +0000 (15:11 -0700)]
[lldb] Teach LLDB about Mach-O filesets
This patch teaches LLDB about Mach-O filesets. Filsets are Mach-O files
that contain a bunch of other Mach-O files. Unlike universal binaries,
which have a different header, Filesets use load commands to describe
the different entries it contains.
Differential revision: https://reviews.llvm.org/D132433
Peter Klausler [Thu, 25 Aug 2022 17:23:19 +0000 (10:23 -0700)]
[flang] Allow non-definable actual arguments to volatile/asynchronous dummy arguments
Semantic checking for calls was requiring an actual argument that corresponds
to an ASYNCHRONOUS or VOLATILE dummy argument to be definable, but this is not
a constraint or requirement in the standard and doesn't even make sense
as a warning; these two attributes are "scopable" in the context of BLOCK
constructs. Remove the checks and adjust the tests.
Differential Revision: https://reviews.llvm.org/D132684
Peter Klausler [Thu, 25 Aug 2022 17:22:10 +0000 (10:22 -0700)]
[flang] Emit missing IMPORTs in module file interfaces
When a symbol from the enclosing scope is necessary to declare
a procedure or procedure pointer dummy argument or function result
for a procedure interface, note it in the collection of symbols to
be imported when scanning that interface.
Differential Revision: https://reviews.llvm.org/D132683
Peter Klausler [Thu, 25 Aug 2022 17:20:41 +0000 (10:20 -0700)]
[flang] Accept unambiguous USE name clashes
When, due to one or more USE associations, possibly with renaming,
a symbol conflicts with another of the same name in the same scope,
don't raise an error if both symbols resolve to the same intrinsic
procedure or to the same non-generic external procedure interface --
the usage is unambiguous and safe, and (14.2.2 p8) standard.
(Generic interfaces already work by way of combining their sets of
specific procedures.)
Differential Revision: https://reviews.llvm.org/D132682
Peter Klausler [Thu, 25 Aug 2022 17:19:20 +0000 (10:19 -0700)]
[flang] Allow a construct entity as a concurrent-header index
A construct entity of an ASSOCIATE or SELECT TYPE construct
should be acceptable as an index variable of a concurrent-header in
a FORALL or DO CONCURRENT, so long as it also satisfies other
requirements.
Differential Revision: https://reviews.llvm.org/D132681
Peter Klausler [Thu, 25 Aug 2022 17:17:25 +0000 (10:17 -0700)]
[flang] Add nested scoping to label distinctness checking
Fortran defines derived type definitions and explicit interface
blocks for subroutines and functions to be nestable scopes for
statement labels, even though such labels are useless for all
purposes. Handle these scopes in label resolution so that bogus
errors about conflicting labels in "real" code don't come out.
Note that BLOCK constructs could have also been defined as scopes
for statement labeling, but were not.
Differential Revision: https://reviews.llvm.org/D132679
Roy Jacobson [Thu, 25 Aug 2022 21:51:06 +0000 (00:51 +0300)]
[Clang] Implement P0848 (Conditionally Trivial Special Member Functions)
This patch implements P0848 in Clang.
During the instantiation of a C++ class, in `Sema::ActOnFields`, we evaluate constraints for all the SMFs and compare the constraints to compute the eligibility. We defer the computation of the type's [copy-]trivial bits from addedMember to the eligibility computation, like we did for destructors in D126194. `canPassInRegisters` is modified as well to better respect the ineligibility of functions.
Note: Because of the non-implementation of DR1734 and DR1496, I treat deleted member functions as 'eligible' for the purpose of [copy-]triviallity. This is unfortunate, but I couldn't think of a way to make this make sense otherwise.
Reviewed By: #clang-language-wg, cor3ntin, aaron.ballman
Differential Revision: https://reviews.llvm.org/D128619
Greg Clayton [Mon, 8 Aug 2022 19:30:20 +0000 (12:30 -0700)]
Don't index the skeleton CU when we have a fission compile unit.
When fission is enabled, we were indexing the skeleton CU _and_ the .dwo CU. Issues arise when users enable compiler options that add extra data to the skeleton CU (like -fsplit-dwarf-inlining) and there can end up being types in the skeleton CU due to template parameters. We never want to index this information since the .dwo file has the real definition, and we really don't want function prototypes from this info since all parameters are removed. The index doesn't work correctly if it does index the skeleton CU as the DIE offset will assume it is from the .dwo file, so even if we do index the skeleton CU, the index entries will try and grab information from the .dwo file using the wrong DIE offset which can cause errors to be displayed or even worse, if the DIE offsets is valid in the .dwo CU, the wrong DIE will be used.
We also fix DWO ID detection to use llvm::Optional<uint64_t> to make sure we can load a .dwo file with a DWO ID of zero.
Differential Revision: https://reviews.llvm.org/D131437
Louis Dionne [Wed, 24 Aug 2022 17:22:42 +0000 (13:22 -0400)]
[libc++] Allow specifying conditional compile flags dependent on basic Lit features
This patch adds support for passing basic Lit features to the
ADDITIONAL_COMPILE_FLAGS keyword by enclosing them in parentheses.
This is done to support https://llvm.org/D131836.
In the future, we should instead add proper support for conditional
keywords in Lit, so that we can evaluate arbitrary Lit boolean
expressions such as `ADDITIONAL_COMPILE_FLAGS(x && !y): -flag`.
Note that I can see this being exceptionally useful when combined
with RUN commands, which would allow using different commands on
different systems. For example:
RUN(!buildhost=windows): something
RUN(buildhost=windows): something-else
Differential Revision: https://reviews.llvm.org/D132575
Peter Klausler [Fri, 19 Aug 2022 19:33:00 +0000 (12:33 -0700)]
[flang][runtime] Fix MINVAL([CHARACTER(2)::])
The result of MINVAL over an empty default character array should
(per the standard) have a 127 in every character position, not just
the first.
Differential Revision: https://reviews.llvm.org/D132677
Philip Reames [Thu, 25 Aug 2022 21:16:34 +0000 (14:16 -0700)]
[LAA] Prune dependencies with distance large than access implied by trip count
When we have a dependency with a dependence distance which can only be hit on an iteration beyond the actual trip count of the loop, we can ignore that dependency when analyzing said loop. We already had this code, but had restricted it solely to unknown dependence distances. This change applies it to all dependence distances.
Without this code, we relied on the vectorizer reducing VF such that our infeasible dependence was respected. This usually worked out to about the same result, but not always. For fixed length vectorization, this could mean a smaller VF than optimal being chosen or additional runtime checks. For scalable vectorization - where the bounds on access implied by VF are broader - we could often not find a feasible VF at all.
Differential Revision: https://reviews.llvm.org/D131924
Adhemerval Zanella [Thu, 25 Aug 2022 20:25:34 +0000 (17:25 -0300)]
[MC][ELF] Mark GNU ABI if ifunc are used
Similar to D107861. Some tools required the GNU ABI mark to output
the symbol is a IFUNC type correctly (for instance binutils readelf).
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D131162
Jeff Niu [Thu, 25 Aug 2022 20:36:37 +0000 (13:36 -0700)]
[mlir][LLVMIR] Fix oneToOneRewrite for zero-result ops
`oneToOneRewrite` segfaulted for zero result-ops because a null type was being
passed to the op builders.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D132702
Jakub Kuderski [Thu, 25 Aug 2022 21:00:07 +0000 (17:00 -0400)]
[mlir] Add convenience builder for arith.addui_carry
This is so that future conversions do not have to figure out how to
create matching boolean types for the second result.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D132630
Jakub Kuderski [Thu, 25 Aug 2022 20:54:26 +0000 (16:54 -0400)]
[mlir][spirv] Add convenience builders for AddICarry and SubIBorrow
This is so that we do not have to spell out long structure types every
time we create these ops.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D132629
Sanjay Patel [Thu, 25 Aug 2022 19:43:39 +0000 (15:43 -0400)]
[ValueTracking][InstCombine] restrict FP min/max matching to avoid miscompile
This is a long-standing FIXME with a non-FMF test that exposes
the bug as shown in issue #57357.
It's possible that there's still a way to miscompile by
mis-identifying/mis-folding FP min/max patterns, but
this patch only exposes a couple of seemingly minor
regressions while preventing the broken transform.
Rajas Vanjape [Thu, 25 Aug 2022 19:05:58 +0000 (19:05 +0000)]
Remove TODO related to adding assert from Sparse Tensor Pipeline code
Removing the TODO related to asserting that original `pm` is for ModuleOp.
The TODO is removed for following reasons:
1. There is no easy way to do this. We currently don't have this information stored in OpPassManager object.
2. There are currently no consumers of this information and storing this information with OpPassManager for a
simple assert will be an overkill.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D132699
Nikolas Klauser [Thu, 25 Aug 2022 20:45:47 +0000 (22:45 +0200)]
[libc++][NFC] Remove tab in filebuf/traits_mismatch.fail.cpp
Florian Hahn [Thu, 25 Aug 2022 20:40:21 +0000 (21:40 +0100)]
[LAA] Cache PSE.getSE() in variable (NFC).
Preparation for follow-up patches will introduce additional uses
of SE.
Akira Hatanaka [Thu, 25 Aug 2022 20:27:29 +0000 (13:27 -0700)]
[compiler-rt][builtins] Revert all the recent changes I made for adding
security-related compiler flags
The changes broke Fuchsia builders.
Nikolas Klauser [Thu, 25 Aug 2022 20:24:21 +0000 (22:24 +0200)]
[libc++][NFC] Remove mentions of warn_unused_result
We don't use `clang::warn_unused_result` anymore, so let's remove the mentions of it from the tests
Reviewed By: Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D132339
Nikolas Klauser [Fri, 19 Aug 2022 13:41:56 +0000 (15:41 +0200)]
[libc++] Consolidate the different [[nodiscard]] configuration options into a single one
Reviewed By: ldionne, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D129054
Florian Hahn [Thu, 25 Aug 2022 19:57:45 +0000 (20:57 +0100)]
[LV] Add additional test coverage for SCEVexp and LCSSA interaction.
Also converts the test to use opaque pointers while I am here.
Akira Hatanaka [Thu, 25 Aug 2022 19:51:09 +0000 (12:51 -0700)]
[compiler-rt][builtins] Check whether the flags are usable before adding
them to the compiler command line
This is another attempt to fix the broken window bot.
Craig Topper [Thu, 25 Aug 2022 19:38:42 +0000 (12:38 -0700)]
[RISCV][M68k] Replace fixed size BitVector with std::bitset.
Saves a heap allocation and avoids an explicit call to the BitVector constructor.
Reviewed By: reames, myhsu
Differential Revision: https://reviews.llvm.org/D132674
Sanjay Patel [Thu, 25 Aug 2022 19:38:19 +0000 (15:38 -0400)]
[InstCombine] add test for fcmp+select miscompile; NFC
issue #57357
Daniil Dudkin [Thu, 25 Aug 2022 18:57:45 +0000 (21:57 +0300)]
[flang] Introduce `AbstractResultOnGlobalOpt` pass
This pass allows to convert operations
which use functions with abstract results to ones that do not.
Depends on D130087
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D130088
Nikolas Klauser [Wed, 24 Aug 2022 00:14:29 +0000 (02:14 +0200)]
[libc++][NFC] Enable modernize-use-override
Reviewed By: Mordante, #libc
Spies: aheejin, libcxx-commits, smeenai
Differential Revision: https://reviews.llvm.org/D124714
Siva Chandra Reddy [Wed, 24 Aug 2022 06:53:34 +0000 (06:53 +0000)]
[libc] Implement linux link, linkat, symlink, symlinkat, readlink, readlinkat.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D132619
Akira Hatanaka [Thu, 25 Aug 2022 18:42:22 +0000 (11:42 -0700)]
[compiler-rt][builtins] Check whether -Wformat-security is usable before
adding it to the compiler command line
This is an attempt to fix the window bot broken by
e1dcd4ba444b0aaac05c399670d870925cef4459
Mahesh Ravishankar [Thu, 25 Aug 2022 18:01:58 +0000 (18:01 +0000)]
[mlir][Linalg] Fix out of bounds access while handling multiple results.
Previous change (
a7bfdc23ab3ade54da99f0f59dababe4d71ae75b) added
support for fusion of `linalg.generic` op with `tensor.expand_shape`
op when the former had multiple results. Fix a bug related to this
that resulted in a segfault.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D132631
Craig Topper [Thu, 25 Aug 2022 17:24:50 +0000 (10:24 -0700)]
[RISCV] Teach combineDeMorganOfBoolean to handle (and (xor X, 1), (not Y)).
SimplifyDemandedBits tries to agressively turn xor immediates into -1
to match a 'not' instruction. In this case, because X is a boolean, the
upper bits of (xor X, 1) are known to be 0. Because this is an AND
instruction, that means those bits aren't demanded from the other
operand, and thus SimplifyDemandedBits can turn (xor Y, 1) to (not Y).
We need to detect that this has happened to enable the DeMorgan
optimization. To do this we allow one of the xors to use -1 when
the outer operation is And.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D132671
Markus Böck [Thu, 25 Aug 2022 17:54:55 +0000 (19:54 +0200)]
[mlir][NFC] Fix compilation error downstream when `NDEBUG` is defined
If the LLVM build used was compiled with `LLVM_ENABLE_ABI_BREAKING_CHECKS` but the header was included with `NDEBUG` defined, a compilation error would occur as there is a pack expansion operator (`...`), but no variadic arguments existed. This was due to the assert being preprocessed to an empty expression.
This commit moves the pack expansion within the `assert` to also be removed with the `assert`.
Nicolai Hähnle [Thu, 25 Aug 2022 17:44:06 +0000 (19:44 +0200)]
Revert "ManagedStatic: remove from DebugCounter"
This reverts commit
51d82502d98d3c5d60606e63b6c23bb5759fdb91.
There is a regression in the flang-aarch64-dylib buildbot which is most
likely caused by this change. Reverting until I can investigate.
Maryam Moghadas [Thu, 25 Aug 2022 16:41:17 +0000 (11:41 -0500)]
Revert "[PowerPC] Remove extra swap for extract+vperm on LE"
This reverts commit
f7294ac8093a2fbd8c00254580eaac6c4e1f7b24.
Nicolai Hähnle [Wed, 3 Aug 2022 08:56:10 +0000 (10:56 +0200)]
[Timer][Statistics] Make global constructor ordering more robust
It was observed in D129117 that the subtle dependency between statistic
and timer code is not entirely robust: the global destructor
~StatisticInfo indirectly calls CreateInfoOutputFile, which requires
the LibSupportInfoOutputFilename to not have been destructed.
By constructing LibSupportInfoOutputFilename before the StatisticInfo
object, the order of destruction is guaranteed.
Differential Revision: https://reviews.llvm.org/D131059
Nicolai Hähnle [Mon, 4 Jul 2022 10:52:08 +0000 (12:52 +0200)]
ManagedStatic: remove from DebugCounter
Follow the pattern used in MLIR for the cl::opt instances.
v2:
- make DebugCounter::isCountingEnabled public so that the
DebugCounterOwner doesn't have to be a nested class. This simplifies
later changes
Differential Revision: https://reviews.llvm.org/D129116
Markus Böck [Thu, 25 Aug 2022 17:09:10 +0000 (19:09 +0200)]
[mlir][ODS] Automatically create `result_segment_sizes` in builder
When using multiple variadic results of differing sizes, using `AttrSizedResultSegments` is currently a requirement. Unlike `AttrSizedOperandSegments` however, it is not created within the default builders created by tablegen. Instead, one has to explicitly add `DenseI32ArrayAttr:$result_segments_sizes` as argument and then also explicitly specify all the sizes when using the builder from C++.
This patch fixes that redundancy, by making the builder generate the attribute in similar fashion as it already does for `AttrSizedOperandSegments`. The sizes required are simply gathered from the result type arguments of the builder.
Differential Revision: https://reviews.llvm.org/D132656
Stephen Long [Thu, 25 Aug 2022 17:04:11 +0000 (10:04 -0700)]
[MC] Omit fill value if it's zero when emitting code alignment
Previously, we were generating zeroes when generating code alignments for AArch64, but now we should omit the value and let the assembler choose to generate nops or zeroes.
Reviewed By: efriedma, MaskRay
Differential Revision: https://reviews.llvm.org/D132508
Peiming Liu [Tue, 23 Aug 2022 21:15:10 +0000 (21:15 +0000)]
[mlir][sparse] Folding operations that try to insert zero into an all-zero sparse tensor
The operations to fill zero into newly allocated sparse tensor are redundant, plus it failed
to lowering the test cases provided in the patch as well.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D132500
Philip Reames [Thu, 25 Aug 2022 16:25:26 +0000 (09:25 -0700)]
[RISCV] Add empirical costs for integer min/max and saturing add/sub
All of these are lowered to a single instruction for all legal vector types.
Chris Bieneman [Wed, 24 Aug 2022 19:46:04 +0000 (14:46 -0500)]
[HLSL] Initial codegen for SV_GroupIndex
Semantic parameters aren't passed as actual parameters, instead they are
populated from intrinsics which are generally lowered to reads from
dedicated hardware registers.
This change modifies clang CodeGen to emit the intrinsic calls and
populate the parameter's LValue with the result of the intrinsic call
for SV_GroupIndex.
The result of this is to make the actual passed argument ignored, which
will make it easy to clean up later in an IR pass.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D131203
Gabriel Ravier [Thu, 25 Aug 2022 16:10:02 +0000 (18:10 +0200)]
[flang] Fixed a number of typos
I went over the output of the following mess of a command:
`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`
and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).
Reviewed By: awarzynski, clementval
Differential Revision: https://reviews.llvm.org/D130844
Philip Reames [Thu, 25 Aug 2022 16:10:22 +0000 (09:10 -0700)]
[RISCV][CostModel] Correct typo in saturating intrinsic names
The fact that we silently accept unrecognized intrinsic names is sometimes a bit annoying.
Philip Reames [Thu, 25 Aug 2022 15:42:32 +0000 (08:42 -0700)]
[RISCV][CostModel] Add test coverage for all the vectorizable binary intrinsics
Craig Topper [Wed, 24 Aug 2022 22:37:48 +0000 (15:37 -0700)]
[RISCV] Apply DeMorgan's law to (and/or (xor X, 1), (xor Y, 1)) if X and Y are 0/1.
This optimizes xors that appear due to legalizing setge/setle which
require an xor with 1. This reduces the number of xors and may
allow the xor to fold with a beqz or bnez.
Differential Revision: https://reviews.llvm.org/D132614
Simon Pilgrim [Thu, 25 Aug 2022 15:49:06 +0000 (16:49 +0100)]
[CostModel][X86] Support cost kind specific look up tables (REAPPLIED)
Most of our cost model tables have been created assuming cost kind == recip-throughput. But we're starting to see passes wanting to get accurate costs for the other kinds as well. Some of these can be determined procedurally (e.g. codesize by default could just be the split count after type legalization), but others are going to need to be handled in cost tables - this is especially true for x86 which has so many ISA combinations.
I've created a 'CostKindCosts' struct which can hold cost values for the 4 cost kinds, defaulting to -1U for unknown cost, this can be used with the existing CostTblEntryT/CostTableLookup template code. I've also added a [TargetCostKind] accessor to make it much easier to look up individual <Optional> costs.
This just changes the ISD::SELECT costs to check the effect (and also to check that the ISD::SETCC are correctly handled for default/None cost kinds) - the plan would be to slowly extend this and move the CostKindTblEntry type somewhere generic to allow other targets to use it once its matured.
I'm also going to resurrect D103695 so that it can help with latency/codesize/sizelatency coverage testing.
For sizelatency - IIRC the definition was vague to let it be target specific - I've tried to use typical uop counts so they're comparable to MicroOpBufferSize etc.
REAPPLIED: Added early out to prevent getCmpSelInstrCost being used for anything but generic integer/float scalar/vector types - getTypeLegalizationCost can't handle the "exotic" TypeID enums that some passes attempt to get a costs for (aggregates etc.).
Differential Revision: https://reviews.llvm.org/D132216
Michael Buch [Thu, 25 Aug 2022 15:00:50 +0000 (16:00 +0100)]
[debuginfo-tests] Un-XFAIL no passing unused-merged-value.c test
This test would previously expect one of the parameters to have
an incorrect DW_AT_location. Stepping through `fun` with a debugger
would then no reflect updates to one of the parameters.
With a recent change to Clang's DeadArgumentEliminationPass
(see `
879f5118fc74657e4a5c4eff6810098e1eed75ac`) the generated
DWARF does not contain a location for `parama`, and stepping through
the function with `lldb` works as expected.
Differential Revision: https://reviews.llvm.org/D132664
Daniel Bertalan [Sun, 14 Aug 2022 13:42:21 +0000 (15:42 +0200)]
[lld-macho] Move adding bindings for stub targets out of Writer (NFC)
We now re-use the existing needsBinding() helper to determine if a
branch has to go through a stub. The logic for determining which type of
binding is needed is moved inside StubsSection::addEntry().
This is an NFC refactor that simplifies my diff that adds support for
chained fixups.
Differential Revision: https://reviews.llvm.org/D132476
Sanjay Patel [Thu, 25 Aug 2022 15:26:21 +0000 (11:26 -0400)]
[InstCombine] restore test for mul+add transform with constant expression; NFC
This test was added with
6cf6c05322629a17a82aa53e3931086b0,
but then made useless with D4238 /
d1bea693e20b470f0.
We still need a test to make sure transforms are not
conflicting when matching a constant expression.
Jon Chesterfield [Thu, 25 Aug 2022 15:27:51 +0000 (16:27 +0100)]
[openmp][amdgpu] Implement target_alloc_host as fine grain HSA memory
The cuda plugin maps TARGET_ALLOC_HOST onto cuMemAllocHost
which is page locked host memory. Fine grain HSA memory is not
necessarily page locked but has the same read/write from host or
device semantics.
The cuda plugin does this per-gpu and this patch makes it accessible
from any gpu, but it can be locked down to match the cuda behaviour
if preferred.
Enabling tests requires an equivalent to
// RUN: %libomptarget-compile-run-and-check-nvptx64-nvidia-cuda
for amdgpu which doesn't seem to be in use yet.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D132660
John Ericson [Thu, 25 Aug 2022 15:13:46 +0000 (11:13 -0400)]
Revert "[CMake] Avoid `LLVM_BINARY_DIR` when other more specific variable are better-suited"
This reverts commit
ad8c34bc3089d847a09bb740f7a58c96073e0959.