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.
Jakub Kuderski [Thu, 25 Aug 2022 15:06:44 +0000 (11:06 -0400)]
[mlir] Add arith.addui_carry conversion to LLVM
This covers the scalar and 1-D vector case.
I haven't implemented conversion for the multidimensional vector case yet because
the current LLVM conversion infrastructure (`handleMultidimensionalVectors`) does
not seem to support ops with multiple results.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D132613
Nicolai Hähnle [Wed, 29 Jun 2022 14:47:51 +0000 (16:47 +0200)]
ManagedStatic: remove from DynamicLibrary
v2:
- fix Windows build issues
Differential Revision: https://reviews.llvm.org/D129127
Jakub Kuderski [Thu, 25 Aug 2022 14:48:38 +0000 (10:48 -0400)]
[mlir] Clean up ArithToLLVM. NFC.
Based on @Mogball's feedback in https://reviews.llvm.org/D132613.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D132627
David Majnemer [Wed, 24 Aug 2022 19:56:31 +0000 (19:56 +0000)]
[clang-cl] /kernel should toggle bit 30 in @feat.00
The linker is supposed to detect when an object with /kernel is linked
with another object which is not compiled with /kernel. The linker
detects this by checking bit 30 in @feat.00.
Ben Langmuir [Wed, 24 Aug 2022 22:31:55 +0000 (15:31 -0700)]
[clang][deps] Minor ModuleDepCollector refactorings NFC
* Factor module map and module file path functions out
* Use a secondary mapping to lookup module deps by ID instead of the
preprocessor module map.
* Sink DirectPrebuiltModularDeps into MDC.
Differential Revision: https://reviews.llvm.org/D132617
Benjamin Kramer [Thu, 25 Aug 2022 13:42:44 +0000 (15:42 +0200)]
Revert "[CostModel][X86] Support cost kind specific look up tables"
This reverts commit
45846854a2c1414c27bc819033f6de588dea56fe.
This triggers an assertion failure during Clang selfhost
Unknown type!
UNREACHABLE executed at llvm/lib/CodeGen/ValueTypes.cpp:548!
*** SIGABRT received by PID 6107 (TID 6107) on cpu 218 from PID 6107; stack trace: ***
@ 0x556c8827c2d1 64 llvm::llvm_unreachable_internal()
@ 0x556c82a5542a 32 llvm::MVT::getVT()
@ 0x556c82a54a28 80 llvm::EVT::getEVT()
@ 0x556c7dda1526 80 llvm::TargetLoweringBase::getValueType()
@ 0x556c8174dd38 112 llvm::BasicTTIImplBase<>::getTypeLegalizationCost()
@ 0x556c81755e72 144 llvm::X86TTIImpl::getCmpSelInstrCost()
@ 0x556c8174cadf 512 llvm::TargetTransformInfoImplCRTPBase<>::getInstructionCost()
@ 0x556c84ab4dd2 32 llvm::TargetTransformInfo::getInstructionCost()
@ 0x556c82ead283 1968 llvm::sinkRegion()
Mats Petersson [Wed, 24 Aug 2022 14:43:00 +0000 (15:43 +0100)]
[FLANG]Remove experimental flag from SUM simplification
The SUM function does appear to be safe to use, so remove the
experimental flag for the SUM operation.
Reviewed By: vzakhari, awarzynski
Differential Revision: https://reviews.llvm.org/D132567
Simon Pilgrim [Thu, 25 Aug 2022 12:43:28 +0000 (13:43 +0100)]
[CostModel][X86] Add CodeSize handling for fdiv ops
Eventually this will be part of the cost table lookup
Matt Devereau [Fri, 29 Jul 2022 14:07:31 +0000 (14:07 +0000)]
[AArch64][SVE] Extend LD1RQ ISel patterns to cover missing addressing modes
Add some missing patterns for ld1rq's scalar + scalar addressing mode.
Also, adds the scalar + imm and scalar + scalar addressing modes for
the patterns added in https://reviews.llvm.org/D130010
Differential Revision: https://reviews.llvm.org/D130993
Louis Dionne [Wed, 24 Aug 2022 19:39:07 +0000 (15:39 -0400)]
[libc++] Fix .compile.fail.cpp tests that should have been marked as UNSUPPORTED in C++03/11
Differential Revision: https://reviews.llvm.org/D132595
Benjamin Kramer [Thu, 25 Aug 2022 12:50:28 +0000 (14:50 +0200)]
Add a missing override keyword. NFC.
clang/lib/Basic/Targets/X86.h:293:8: warning: 'shouldEmitFloat16WithExcessPrecision' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
bool shouldEmitFloat16WithExcessPrecision() const {
^
clang/include/clang/Basic/TargetInfo.h:915:16: note: overridden virtual function is here
virtual bool shouldEmitFloat16WithExcessPrecision() const { return false; }
^
Guillaume Chatelet [Thu, 25 Aug 2022 09:09:10 +0000 (09:09 +0000)]
[NFC][libc] Move Uint implementation to parent directory
Differential Revision: https://reviews.llvm.org/D132638
Zahira Ammarguellat [Mon, 30 May 2022 11:52:56 +0000 (07:52 -0400)]
Support of expression granularity for _Float16.
Differential Revision: https://reviews.llvm.org/D113107
Timm Bäder [Thu, 18 Aug 2022 08:15:20 +0000 (10:15 +0200)]
[clang][Interp] Implement pointer (de)ref operators
Implement pointer references, dereferences and assignments.
Differential Revision: https://reviews.llvm.org/D132111
Tres Popp [Mon, 22 Aug 2022 13:47:44 +0000 (15:47 +0200)]
[mlir] Add math.roundeven and llvm.intr.roundeven
This is similar to math.round, but rounds to even instead of rounding away from
zero in the case of halfway values. This CL also adds lowerings to libm and
to the LLVM intrinsic.
Differential Revision: https://reviews.llvm.org/D132375
Benjamin Kramer [Thu, 25 Aug 2022 11:30:29 +0000 (13:30 +0200)]
[NVPTX] Lower llvm.roundeven to cvt.rni
Benjamin Kramer [Thu, 25 Aug 2022 11:21:40 +0000 (13:21 +0200)]
[NVPTX] Factor rounding patterns into a multiclass. NFCI.
Simon Pilgrim [Thu, 25 Aug 2022 11:23:26 +0000 (12:23 +0100)]
[CostModel][X86] Support cost kind specific look up tables
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.
Differential Revision: https://reviews.llvm.org/D132216
zhongyunde [Thu, 25 Aug 2022 11:14:58 +0000 (19:14 +0800)]
[AArch64] Fix sched model for tsv110
Update three changes:
1.Split the Load/Store resources into two, Ld0St and Ld1,
since only one of them is capable of stores.
2.Integer ADD and SUB instructions have different latencies
and processor resource usage (pipeline) when they have a shift of
zero vs. non-zero, refer to D8043
3.The throughout of scalar DIV instruction.
Reviewed By: dmgreen, bryanpkc
Differential Revision: https://reviews.llvm.org/D132529
Max Kazantsev [Thu, 25 Aug 2022 10:48:50 +0000 (17:48 +0700)]
[IRCE] Drop SCEV of a Phi after adding a new input. PR57335
Since SCEV learned to look through single value phis with
20d798bd47ec5191de1b2a8a031da06a04e612e1, whenever we add
a new input to a Phi, we should make sure that the old cached
value is dropped. Otherwise, it may lead to various miscompiles,
such as breach of dominance as shown in the bug
https://github.com/llvm/llvm-project/issues/57335
Nico Weber [Thu, 25 Aug 2022 11:08:44 +0000 (07:08 -0400)]
Revert "[gn build] port
bc39d7bdd497 (libclang.map -> libclang.exports)"
This reverts commit
94c00c10e837aded6a6b15fe84c12f1ced4d856d.
bc39d7bdd497 was reverted in
0f28d4856630.
Sockke [Thu, 25 Aug 2022 10:23:57 +0000 (18:23 +0800)]
[clang-tidy] Ignore other members in a union if any member of it is initialized in cppcoreguidelines-pro-type-member-init
If a union member is initialized, the other members of the union are still suggested to be initialized in this check. This patch fixes this behavior.
Reference issue: https://github.com/llvm/llvm-project/issues/54748
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D127293
Felipe de Azevedo Piovezan [Wed, 24 Aug 2022 20:03:29 +0000 (16:03 -0400)]
[lldb] Add more dylib paths for exception breakpoints
When setting a breakpoint upon throwing exceptions, LLDB only
searches for the libc++abi code inside dylibs named:
1. libc++abi.dylib
2. libSystem.B.dylib
However, this fails to account for libs with a version number. For
example, when building the libcxx and libcxxabi runtimes, the following
dylibs are generated:
build/lib/libc++abi.1.0.dylib
build/lib/libc++abi.1.dylib -> libc++abi.1.0.dylib
build/lib/libc++abi.dylib -> libc++abi.1.dylib
If we are debugging a program linked against any of the "versioned"
libs, the breakpoint doesn't work. This commit adds these names to the
search list.
Differential Revision: https://reviews.llvm.org/D132598
isuckatcs [Mon, 22 Aug 2022 12:43:54 +0000 (14:43 +0200)]
[analyzer] Fix for incorrect handling of 0 length non-POD array construction
Prior to this patch when the analyzer encountered a non-POD 0 length array,
it still invoked the constructor for 1 element, which lead to false positives.
This patch makes sure that we no longer construct any elements when we see a
0 length array.
Differential Revision: https://reviews.llvm.org/D131501
Felipe de Azevedo Piovezan [Wed, 24 Aug 2022 19:30:31 +0000 (15:30 -0400)]
[lldb][nfc] Remove unused makefile test variables
The variables LLDB_USING_LIBCPP and LLDB_USING_LIBSTDCPP are no longer
used anywhere.
Differential Revision: https://reviews.llvm.org/D132596
Dmitry Preobrazhensky [Thu, 25 Aug 2022 10:16:21 +0000 (13:16 +0300)]
[AMDGPU][MC][GFX11][NFC] Add missing tests for SOP instructions
Differential Revision: https://reviews.llvm.org/D132549
Dmitry Preobrazhensky [Thu, 25 Aug 2022 09:48:13 +0000 (12:48 +0300)]
[AMDGPU][MC][GFX11][NFC] Update tests for FLAT instructions
Update assembler tests for FLAT instructions; remove redundant gfx11_asm_flat_mnemonic.s.
Differential Revision: https://reviews.llvm.org/D132556
ZHU Zijia [Thu, 25 Aug 2022 08:59:34 +0000 (16:59 +0800)]
[RISCV][test] Update branch-relaxation.ll with update_llc_test_checks.py [NFC]
Update `llvm/test/CodeGen/RISCV/branch-relaxation.ll` with
`update_llc_test_checks.py`, according to
https://reviews.llvm.org/D130560#3746417:
>>! In D130560#3746417, @luismarques wrote:
>>>! In D130560#3746379, @luismarques wrote:
>> The tests don't seem to have been properly updated with
>> `update_llc_test_checks.py`.
>> `llvm/test/CodeGen/RISCV/branch-relaxation.ll` contains RV64 RUN
>> lines but the corresponding CHECK lines are missing in
>> some functions.
>
> Looking more closely at this, I guess you tried to only include the
> `CHECK-RV64` and `CHECK-RV32` checks when relevant. That's a good
> instinct but I guess it goes a bit against how we normally use
> `update_llc_test_checks.py`. My understanding of the trade-off of
> using that tool is that the test updates are much easier, even if
> sometimes the CHECKs aren't as tight as something more tailormade.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D132625
ZHU Zijia [Thu, 25 Aug 2022 08:59:08 +0000 (16:59 +0800)]
Revert "[RISCV][test] Update branch-relaxation.ll with update_llc_test_checks.py [NFC]"
This reverts commit
c374789fba484af62a327a9337c7c9107461ee51.
Martin Storsjö [Mon, 22 Aug 2022 08:48:08 +0000 (11:48 +0300)]
[LLD] [COFF] Fix export directives in object files from -includeoptional
When an object file contains an export directive, we normally do some
amount of deferred processing of them at the end of the linking
process. The -includeoptional option was handled after this, and
any object files (defining new exports) weren't handled.
Move the handling of the -includeoptional into the same late loop
which does the fixups for e.g. export directives.
Ideally, this would also be done for object files that are pulled
in by the wrap options, and for mingw autoimports, but those changes
require more modifications, to make them safe for potentially
being executed multiple times.
This fixes https://github.com/llvm/llvm-project/issues/57243.
Differential Revision: https://reviews.llvm.org/D132361
Martin Storsjö [Tue, 23 Aug 2022 13:14:42 +0000 (16:14 +0300)]
[flang] [runtime] Fix build warnings if built with mingw
Check whether `F_OK` et al are defined before redefining them; mingw
headers do define them, so check before providing the windows fallback
defines.
Also check `_WIN32` instead of `WIN32`; this is how it's consistently
done in the rest of llvm. (The former is a compiler builtin define,
while the latter isn't, but it's commonly set by e.g. build systems.)
Differential Revision: https://reviews.llvm.org/D132481
ZHU Zijia [Thu, 25 Aug 2022 08:52:20 +0000 (16:52 +0800)]
[RISCV][test] Update branch-relaxation.ll with update_llc_test_checks.py [NFC]
Update `llvm/test/CodeGen/RISCV/branch-relaxation.ll` with
`update_llc_test_checks.py`, according to
https://reviews.llvm.org/D130560#3746417:
>>! In D130560#3746417, @luismarques wrote:
>>>! In D130560#3746379, @luismarques wrote:
>> The tests don't seem to have been properly updated with
>> `update_llc_test_checks.py`.
>> `llvm/test/CodeGen/RISCV/branch-relaxation.ll` contains RV64 RUN
>> lines but the corresponding CHECK lines are missing in
>> some functions.
>
> Looking more closely at this, I guess you tried to only include the
> `CHECK-RV64` and `CHECK-RV32` checks when relevant. That's a good
> instinct but I guess it goes a bit against how we normally use
> `update_llc_test_checks.py`. My understanding of the trade-off of
> using that tool is that the test updates are much easier, even if
> sometimes the CHECKs aren't as tight as something more tailormade.
Alexander Potapenko [Wed, 24 Aug 2022 09:49:52 +0000 (11:49 +0200)]
[compiler-rt][hwasan] Factor out CanUseTaggingAbi() and EnableTaggingAbi()
Simplify InitializeOsSupport() by separating code for detecting and
enabling the tagged address ABI.
Also drop the unnecessary errno checks (regardless of errno value, we
cannot assume that tagging works if the system call failed) and ensure
prctl(PR_SET_TAGGED_ADDR_CTRL) is only called on Android, not on x86
(where arch_prctl(ARCH_ENABLE_TAGGED_ADDR, kTagBits) is used).
Depends on D132544
Differential Revision: https://reviews.llvm.org/D132545
Denis Revunov [Thu, 25 Aug 2022 08:27:42 +0000 (04:27 -0400)]
[BOLT][AArch64] Handle references to the middle of Constant Islands
Fix BinaryContext::handleAddressRef to properly detect references to
other function's Constant islands.
Revieved By: rafauler, yota9
Differential Revision: https://reviews.llvm.org/D132376
Alexander Potapenko [Wed, 24 Aug 2022 09:20:23 +0000 (11:20 +0200)]
[compiler-rt][hwasan] Introduce MaybeDieIfNoTaggingAbi()
Use a helper function to print an error message and die in the case
flags()->fail_without_syscall_abi is set.
Because x86 doesn't have `sysctl abi.tagged_addr_disabled`, do not
mention it in the error message for non-Android runtime.
Depends on D132543
Differential Revision: https://reviews.llvm.org/D132544
Matthias Springer [Thu, 25 Aug 2022 08:12:50 +0000 (10:12 +0200)]
[mlir][tensor] Add getMixedSizes helper
This helper function computes the dimensions of a tensor value as OpFoldResults.
Differential Revision: https://reviews.llvm.org/D132475