Mitch Phillips [Sat, 17 Dec 2022 01:55:48 +0000 (17:55 -0800)]
Revert "[AAPointerInfo] handle multiple offsets in PHI"
This reverts commit
88db516af69619d4326edea37e52fc7321c33bb5.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:55:38 +0000 (17:55 -0800)]
Revert "Revert "[AAPointerInfo] handle multiple offsets in PHI""
This reverts commit
12696d302d146ffe616eecab3feceba9d29be2db.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Mitch Phillips [Sat, 17 Dec 2022 01:54:44 +0000 (17:54 -0800)]
Revert "[AAPointerInfo] handle multiple offsets in PHI"
This reverts commit
179ed8871101cd197e0a719a3629cd5077b1a999.
Reason: This change is dependent on a commit that needs to be rolled
back because it broke the ASan buildbot. See
https://reviews.llvm.org/rGfc21f2d7bae2e0be630470cc7ca9323ed5859892 for
more information.
Fangrui Song [Sat, 17 Dec 2022 01:42:39 +0000 (01:42 +0000)]
std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This fixes check-llvm.
ziqingluo-90 [Sat, 17 Dec 2022 00:21:57 +0000 (16:21 -0800)]
[-Wunsafe-buffer-usage] Add warnings for unsafe buffer accesses by array subscript operations
Add an unsafe Gadget in the Unsafe Buffer Usage anslysis to represent
(and search (via matchers) for) unsafe buffer-accessing array subscript operations.
Reviewed By: NoQ, jkorous, aaron.ballman, xazax.hun
Differential Revision: https://reviews.llvm.org/D137379
Nico Weber [Sat, 17 Dec 2022 01:09:25 +0000 (20:09 -0500)]
Peter Klausler [Fri, 16 Dec 2022 23:10:50 +0000 (15:10 -0800)]
[flang] Prevent crash in error case: elemental with alternate return
When an ELEMENTAL subroutine is erroneously declared with alternate return
arguments, don't crash when checking the ranks of the actual arguments.
Differential Revision: https://reviews.llvm.org/D140143
Kevin Sala [Sat, 17 Dec 2022 00:37:21 +0000 (01:37 +0100)]
[NFC][OpenMP] Fix format for recent changes on OMPGridValues
This patch applies the clang-format to the recent changes on OMPGridValues
introduced by commit
2e9c3fe6fcfd7b4672facec87dceb76ff3c83566.
Fangrui Song [Sat, 17 Dec 2022 00:42:05 +0000 (00:42 +0000)]
std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This fixes clang.
Kevin Sala [Wed, 21 Sep 2022 19:25:39 +0000 (19:25 +0000)]
[OpenMP] Increase max teams in OMPGridValues
Differential Revision: https://reviews.llvm.org/D140174
Siva Chandra Reddy [Sat, 17 Dec 2022 00:20:01 +0000 (00:20 +0000)]
[libc][Obvious] Add missing deps for a few targets.
Mircea Trofin [Sat, 17 Dec 2022 00:10:22 +0000 (16:10 -0800)]
Revert "[InlineAdvisor] Allow loading advisors as plugins"
This reverts commit
a00aaf2b1317fbc224dc6606ef7c2a10d617f28f.
Example failures:
https://lab.llvm.org/buildbot#builders/68/builds/44933
https://lab.llvm.org/buildbot#builders/230/builds/6938
ibricchi [Fri, 16 Dec 2022 22:11:52 +0000 (14:11 -0800)]
[InlineAdvisor] Allow loading advisors as plugins
Adds the ability to load InlineAdvisors as plugins. This allows developing and distributing inlining heuristics outside of tree.
The PluginInlineAdvisorAnalysis class serves as the entry point for dynamic advisors. Plugins must register instances of this class to provide their own InliningAdvisor.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D139644
Mircea Trofin [Fri, 16 Dec 2022 23:44:27 +0000 (15:44 -0800)]
[NFC] Add llvm-config.h def for LLVM_ENABLE_PLUGINS
Snatched from D139644, but because it'd also need a fix in
Passes/CMakeLists.txt, decided to peel it off.
Fangrui Song [Fri, 16 Dec 2022 23:43:32 +0000 (23:43 +0000)]
-Wunsafe-buffer-usage: fix build when -DLLVM_ENABLE_ASSERTIONS=off
Fangrui Song [Fri, 16 Dec 2022 23:41:36 +0000 (23:41 +0000)]
[CodeGen] std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This fixes LLVMMIRParser, LLVMGlobalISel, LLVMAsmPrinter, LLVMSelectionDAG.
David Blaikie [Fri, 16 Dec 2022 23:39:28 +0000 (23:39 +0000)]
Ensure clang test doesn't write out to the source directory
Fangrui Song [Fri, 16 Dec 2022 23:21:27 +0000 (23:21 +0000)]
[Transforms,CodeGen] std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
David Blaikie [Fri, 16 Dec 2022 23:13:47 +0000 (23:13 +0000)]
clang/test/CodeCompletion: Simplify/fix some `touch` commands
These were inconsistent (one `touch` line listed all the files in a
single `touch` invocation, but the other listed them as separate
commands with `&&`) and incorrect (one `&&` was missing, causing `touch`
to try to touch a file called `touch` in the cwd, which might not be
accessible/relevant to test execution)
So make them consistent and simpler by using the "list all the files on
a line in a single `touch` invocation" reducing the visual
noise/clutter/etc.
Arthur Eubanks [Fri, 16 Dec 2022 23:16:52 +0000 (15:16 -0800)]
[lldb][NFC] Remove unused/unimplemented Type methods
Murali Vijayaraghavan [Fri, 16 Dec 2022 04:49:45 +0000 (04:49 +0000)]
[mlir][linalg] Creating named 1D pooling ops
This is mostly going to be used for linalg transformations - to make pooling ops similar to convolution ops.
Differential Revision: https://reviews.llvm.org/D140186
Peter Klausler [Fri, 16 Dec 2022 21:48:13 +0000 (13:48 -0800)]
[flang][runtime] Allow CLASS(*) components when creating descriptors
Extend the descriptor creation function for components to allow
unlimited polymorphic components (CLASS(*)) and to also properly set
the attributes of the established descriptors.
Differential Revision: https://reviews.llvm.org/D140141
Artem Dergachev [Fri, 16 Dec 2022 22:46:05 +0000 (14:46 -0800)]
[-Wunsafe-buffer-usage] NFC: Introduce an abstraction for fixable code patterns.
This patch introduces a hierarchy of Gadget classes, which are going to be
the core concept in the somewhat sophisticated machine behind the upcoming
-Wunsafe-buffer-usage fix-it hints.
A gadget is a rigid code pattern that constitutes an operation that
the fixit machine "understands" well enough to work with. A gadget may be
"unsafe" (i.e., constitute a raw buffer access) or "safe" (constitute
a use of a pointer or array variable that isn't unsafe per se,
but may need fixing if the participating variable changes type
to a safe container/view).
We'll be able to make decisions about how to fix the code depending on
the set of gadgets that we've enumerated. Basically, in order to fix a type
of a variable, each use of that variable has to participate in a gadget,
and each such gadget has to consent to fixing itself according to
the variable's new type.
Differential Revision: https://reviews.llvm.org/D137348
Kevin Sala [Fri, 16 Dec 2022 14:26:46 +0000 (15:26 +0100)]
[OpenMP][libomptarget] Add AMDGPU NextGen plugin with asynchronous behavior
This commit adds the AMDGPU NextGen plugin inheriting from PluginInterface's classes.
It also implements the asynchronous behavior in the plugin operations: kernel launches
and memory transfers. To this end, it implements the concept of streams of asynchronous
operations. The streams are implemented using the HSA signals to define input and output
dependencies between asynchronous operations.
Missing features:
- Retrieve the maximum number of threads per group that a kernel can run. This requires
reading the image.
- Implement __tgt_rtl_sync_event, not used on the libomptarget side.
Differential Revision: https://reviews.llvm.org/D138389
Kevin Sala [Fri, 16 Dec 2022 14:23:34 +0000 (15:23 +0100)]
[OpenMP][libomptarget] Add missing symbols in dynamic_hsa
This patch prepares for the new AMDGPU NextGen plugin.
Differential Revision: https://reviews.llvm.org/D140213
Fangrui Song [Fri, 16 Dec 2022 22:57:55 +0000 (22:57 +0000)]
[Transforms,InstCombine] std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
Fangrui Song [Fri, 16 Dec 2022 22:44:08 +0000 (22:44 +0000)]
std::optional::value => operator*/operator->
value() has undesired exception checking semantics and calls
__throw_bad_optional_access in libc++. Moreover, the API is unavailable without
_LIBCPP_NO_EXCEPTIONS on older Mach-O platforms (see
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
This commit fixes LLVMAnalysis and its dependencies.
Adrian Prantl [Fri, 16 Dec 2022 21:50:09 +0000 (13:50 -0800)]
Temporarily skip test under ASAN
Dave Lee [Wed, 14 Dec 2022 21:53:15 +0000 (13:53 -0800)]
[lldb] Report clang module build remarks
Update the Clang diagnostic consumer (in ClangModulesDeclVendor) to report
progress on Clang module builds, as both progress events and expression logs.
Module build remarks are enabled by with clang's `-Rmodule-build` flag.
With this change, command line users of lldb will see progress events showing
which modules are being built, and - by how long they stay on screen - how much
time it takes to build them. IDEs that show progress events can show these
updates if desired.
This does not show module-import remarks, although that may be added as a
future change.
Differential Revision: https://reviews.llvm.org/D140056
Peter Klausler [Fri, 16 Dec 2022 19:44:51 +0000 (11:44 -0800)]
[flang] Correct folding of EXTENDS_TYPE_OF()
There was a falsely known case with a polymorphic type.
Differential Revision: https://reviews.llvm.org/D140140
Jacques Pienaar [Fri, 16 Dec 2022 21:36:15 +0000 (13:36 -0800)]
[mlir-c] Add method to create unmanaged dense resource elements attr
Following DenseElementsAttr pattern.
Differential Revision: https://reviews.llvm.org/D140189
Emilia Dreamer [Fri, 16 Dec 2022 21:25:52 +0000 (23:25 +0200)]
[clang-format] Don't require deduction guides to be templates
The C++ standard doesn't require that class template deduction guides
be templates themselves, but previously `isDeductionGuide` would assert
for the existence of a template closer or requires clause closer before
the deduction guide declaration.
This patch simply removes that check. Because of this, a test which
asserted that `x()->x<1>;` *isn't* a deduction guide failed, as it is
now formatted as a deduction guide. However, as @JohelEGP demonstrated,
it is [possible to make that a viable deduction guide][1].
Thus, that test has been removed, but other tests related to
non-template class template deduction guides have been added.
Fixes https://github.com/llvm/llvm-project/issues/55142
[1]: https://compiler-explorer.com/z/Wx3K6d5K9
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D139416
Hanhan Wang [Fri, 2 Dec 2022 21:25:48 +0000 (13:25 -0800)]
[mlir][tensor] Implement TilingInterface for unpack op
The main issue of tiling unpack op is about incomplete tile. Since all
the dimensions are orthogonal, discussing 1-d unpack case is enough. The
core idea is to make the input slice have complete tiles. In this case,
a larger unpacked tile will be created. We'll need an extract_slice op
to shift and truncate the output.
Take Nn_to_N as an example. Say that N=32, n=8, and tiling_size=15. The
coordinates of second tile (i.e., result[15..31]) are [(1, 7), (2, 0,),
(2, 1) ... (3, 6), (3, 7)]. The first row and the last row are
incomplete in terms of inputs. It's impossible to represent an unpack op
using the coordinates. Because the input has higher rank and the math
computation of coordinate is using mod and ceilDiv. That's very tricky.
To represent the unpack op, we have to complete the rows. I.e., the
input coordinates would start with (1, 0); end with (3, 7). In this
context, the tiled unpack produces a (3 * n) elements because there are
3 rows in total. Follow by a tensor.extract_slice op, we can get the
actual result.
If the tiling sizes are multiple of inner tile sizes, it is a perfect
tiling case. In this context, the larger input and output is not needed.
Reviewed By: chelini
Differential Revision: https://reviews.llvm.org/D139362
Adrian Prantl [Fri, 16 Dec 2022 21:02:59 +0000 (13:02 -0800)]
Fix a syntax error
Paul Robinson [Fri, 16 Dec 2022 20:47:54 +0000 (12:47 -0800)]
[fuzzer] Fix UNSUPPORTED criteria for two tests
Fuzzer might decide on a target arch different from the triple.
Fangrui Song [Fri, 16 Dec 2022 20:31:47 +0000 (20:31 +0000)]
Error: Replace value() with operator*
Some older macOS libc++ report:
error: 'value' is unavailable: introduced in macOS 10.13
Fangrui Song [Fri, 16 Dec 2022 20:24:35 +0000 (20:24 +0000)]
[mlir] Drop uses of operator<<(raw_ostream &OS, const Optional<T> &O)
Valentin Clement [Fri, 16 Dec 2022 20:21:00 +0000 (21:21 +0100)]
[flang] Fix fir.dispatch_table generation with derived-type parameter with kind type parameter
When generating the `fir.dispatch_table` operation, the name of the parent
derived-type needs to be mangled. For this the type instantiation
DerivedTypeSpec needs to be retrieved to have the correct kind type parameters.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D140209
Valentin Clement [Fri, 16 Dec 2022 20:19:55 +0000 (21:19 +0100)]
[flang] Unlimited polymoprhic allocation with intrinsic type spec
An unlimited polymoprhic entity can be allocated with a derived type
spec or an intrinsic type spec. This patch add the generation of the
runtime function call when the allocation is done with an intrinsic
type spec.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D140207
Jeffrey Byrnes [Thu, 8 Dec 2022 21:26:59 +0000 (13:26 -0800)]
[AMDGPU][SIFrameLowering] Mark VGPR used for AGPR spills as reserved
Presently, there is an issue on MI100 (and probably other architecture) where the VGPR used for AGPR copies clobbers VGPR used for AGPR spill. AFAICT this is because in processFunctionBeforeFrameIndicesReplaced we think the VGPR register for AGPR spill is unused. This patch aims to correct that. This is a WIP while I work out issues with producing a good test. For now, I'm curious if this is generally a good / bad idea.
Differential Revision: https://reviews.llvm.org/D139673
Roman Lebedev [Fri, 16 Dec 2022 19:53:58 +0000 (22:53 +0300)]
Revert "[SROA] `isVectorPromotionViable()`: memory intrinsics operate on vectors of bytes (take 3)"
While the PPC litte-endian miscompile did get addressed
by https://reviews.llvm.org/D140046
the PPV big-endian bots are still unhappy.
https://lab.llvm.org/buildbot/#/builders/93/builds/12560
This reverts commit
7bd358bcb4e358b4351c69e02ef76939e08acdc7.
Fangrui Song [Fri, 16 Dec 2022 19:57:30 +0000 (19:57 +0000)]
[mlir] Drop uses of operator<<(raw_ostream &OS, const Optional<T> &O)
Fangrui Song [Fri, 16 Dec 2022 19:46:00 +0000 (19:46 +0000)]
[clangd] Migrate uses of operator<<(raw_ostream &OS, const Optional<T> &O) to std::optional
Haowei Wu [Fri, 4 Nov 2022 23:40:10 +0000 (16:40 -0700)]
[vfs] Allow root paths relative to the vfsoverlay YAML file
This change adds 'root-relative' option in vfsoverlay YAML file format
so the root patchs can be relative to the YAML file directory instead of
the current working directory.
Differential Revision: https://reviews.llvm.org/D137473
Nathan Ridge [Wed, 14 Dec 2022 08:18:57 +0000 (03:18 -0500)]
[clangd] Remove ReferenceFinder::Reference::Target
No one was using it
Differential Revision: https://reviews.llvm.org/D139998
Peter Klausler [Sun, 11 Dec 2022 23:17:41 +0000 (15:17 -0800)]
[flang] Don't crash attempting to fold absurdly large TRANSFER()
Apply some sanity checking to the type size and SIZE= values and
avoid crashing on stress tests that attempt to create excessively
large results.
Differential Revision: https://reviews.llvm.org/D140138
Craig Topper [Fri, 16 Dec 2022 18:22:55 +0000 (10:22 -0800)]
[InstCombine] Remove code duplication between InstCombiner.h and InstCombineInternal.h.
The class in InstCombineInternal.h inherits from InstCombiner.h.
I think this split was created when target specific InstCombines
were moved to go through TTI.
I had to update some of the code in InstCombiner.h to match changes
that had been made to InstCombineInternal.h.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D140230
Paul Robinson [Fri, 16 Dec 2022 19:41:28 +0000 (11:41 -0800)]
[fuzzer] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
Nathan Ridge [Fri, 16 Dec 2022 08:35:42 +0000 (03:35 -0500)]
[CodeComplete] Offer completions for headers with extension .hxx in include directives
Fixes https://github.com/clangd/clangd/issues/1379
Differential Revision: https://reviews.llvm.org/D140191
Fangrui Song [Fri, 16 Dec 2022 19:30:47 +0000 (19:30 +0000)]
[trace] Migrate uses of operator<<(raw_ostream &OS, const Optional<T> &O) to std::optional
Matt Arsenault [Sat, 3 Dec 2022 00:22:54 +0000 (19:22 -0500)]
Function: Respect IgnoreLLVMUsed with addrspacecasted functions
Try to respect IgnoreLLVMUsed if the function was addrspacecasted to
match llvm.used's type.
Paul Robinson [Fri, 16 Dec 2022 19:09:53 +0000 (11:09 -0800)]
[compiler-rt/cfi] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
David Goldblatt [Fri, 16 Dec 2022 18:52:32 +0000 (10:52 -0800)]
[AA][Intrinsics] Add separate_storage assumptions.
This operand bundle on an assume informs alias analysis that the
arguments point to regions of memory that were allocated separately
(i.e. different heap allocations, different allocas, or different
globals).
As a safety measure, we leave the analysis flag-disabled by default.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D136514
Paul Robinson [Fri, 16 Dec 2022 19:03:30 +0000 (11:03 -0800)]
[compiler-rt/builtins] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
Sprite [Fri, 16 Dec 2022 18:51:26 +0000 (10:51 -0800)]
Correct typos (NFC)
Just found some typos while reading the llvm/circt project.
compliment -> complement
emitsd -> emits
Peter Klausler [Fri, 16 Dec 2022 17:54:55 +0000 (09:54 -0800)]
[flang] Expunge needless semantics::ProcInterface
The ProcInterface structure is used only by ProcEntityDetails; it represents
what a program might have put in parentheses in a procedure-declaration-stmt,
either the name of a procedure interface or a declaration-type-spec.
If a procedure entity has an implicit interface, the function result
type (if any) can be kept in EntityDetails::type_, which already exists
and is currently redundant for ProcEntityDetails symbols.
All that is really needed is a nullable Symbol pointer in ProcEntityDetails
to point to the procedure's explicit interface, when it has one.
Also, catch the case where a procedure has an explicit interface
and a program attempts to also give it a type.
Differential Revision: https://reviews.llvm.org/D140134
Paul Robinson [Fri, 16 Dec 2022 18:35:06 +0000 (10:35 -0800)]
[asan] Convert more tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
Peiming Liu [Fri, 16 Dec 2022 18:12:05 +0000 (18:12 +0000)]
[mlir][sparse] avoid unnecessary tmp COO buffer and convert when lowering ConcatentateOp.
When concat along dim 0, and all inputs/outputs are ordered with identity dimension ordering,
the concatenated coordinates will be yield in lexOrder, thus no need to sort.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D140228
Vasileios Porpodas [Wed, 7 Dec 2022 21:10:23 +0000 (13:10 -0800)]
[IR][NFC] Cleanup: Remove non-const block iterators to force all updates go through an interface function
Differential Revision: https://reviews.llvm.org/D140154
Peter Klausler [Fri, 16 Dec 2022 17:48:51 +0000 (09:48 -0800)]
[flang] Check for elemental finalizer when defined object has vector subscript
When a defined object is an array with a vector subscript, and it has a
finalizable type, it may have a final subroutine with a matching or
assumed rank dummy argument that cannot be called. Unless there is
also a suitable elemental final subroutine, diagnose such a case
with an error message.
Differential Revision: https://reviews.llvm.org/D140131
Florian Hahn [Fri, 16 Dec 2022 17:52:15 +0000 (17:52 +0000)]
[VPlan] Use macro to define recipe classof implementation (NFC).
Add a VP_CLASSOF_IMPL macro to define common classof implementations for
recipes. This reduces duplication and also adds missing implementations
to existing recipes.
Paul Robinson [Fri, 16 Dec 2022 17:40:51 +0000 (09:40 -0800)]
Undo one llvm::Optional => std::optional
Using std::optional in Support/TypeTraitsTest.cpp causes gcc 7.5 to
complain. No public bots run a gcc that old, but we have internal bots
that do.
/home/probinson/projects/llvm-org/llvm-project/llvm/unittests/Support/TypeTraitsTest.cpp: In instantiation of ‘void {anonymous}::triviality::TrivialityTester() [with T = std::optional<int>; bool IsTriviallyCopyConstructible = true; bool IsTriviallyMoveConstructible = true]’:
/home/probinson/projects/llvm-org/llvm-project/llvm/unittests/Support/TypeTraitsTest.cpp:121:52: required from here
/home/probinson/projects/llvm-org/llvm-project/llvm/unittests/Support/TypeTraitsTest.cpp:29:3: error: static assertion failed: Mismatch in expected trivial copy construction!
static_assert(llvm::is_trivially_copy_constructible<T>::value ==
^~~~~~~~~~~~~
/home/probinson/projects/llvm-org/llvm-project/llvm/unittests/Support/TypeTraitsTest.cpp:32:3: error: static assertion failed: Mismatch in expected trivial move construction!
static_assert(llvm::is_trivially_move_constructible<T>::value ==
^~~~~~~~~~~~~
Matt Arsenault [Fri, 16 Dec 2022 17:13:47 +0000 (12:13 -0500)]
AArch64: Stop storing MachineFunction in MachineFunctionInfo
The constructor should not depend on the MachineFunction
Roman Lebedev [Fri, 16 Dec 2022 17:28:08 +0000 (20:28 +0300)]
[NFC] Adjust adjusted manual checklines in DebugInfo to be less sensitive to the Value name
The test was passing for me locally, but fails on bots:
https://lab.llvm.org/buildbot/#/builders/98/builds/29290/steps/10/logs/stdio
Roman Lebedev [Fri, 16 Dec 2022 16:40:16 +0000 (19:40 +0300)]
[NFC][InstCombine] Add miscompile reproducer from https://reviews.llvm.org/D139275#4001580
SimplifyCFG change is correct and not at fault here.
The actual miscompile appears to be happening in InstCombine.
```
$ /builddirs/llvm-project/build-Clang15/bin/opt -load /repositories/alive2/build-Clang-release/tv/tv.so -load-pass-plugin /repositories/alive2/build-Clang-release/tv/tv.so -passes='tv,instcombine,tv' -o /dev/null /repositories/llvm-project/llvm/test/Transforms/InstCombine/D139275_c4001580.ll
----------------------------------------
define float @D139275_c4001580(float %arg) {
%0:
%i = fcmp ugt float %arg, 0.000000
%i1 = fcmp ult float %arg, 1.000000
%i2 = and i1 %i, %i1
%i3 = fcmp uge float %arg, 0.100000
%i4 = xor i1 %i, %i2
%i5 = select i1 %i4, float 0.100000, float 0.000000
%i6 = and i1 %i3, %i2
%i7 = fadd float %arg, -0.100000
%i8 = select i1 %i6, float %i7, float %i5
ret float %i8
}
=>
define float @D139275_c4001580(float %arg) {
%0:
%i = fcmp ugt float %arg, 0.000000
%i1 = fcmp ult float %arg, 1.000000
%i2 = and i1 %i, %i1
%i3 = fcmp uge float %arg, 0.100000
%i7 = fadd float %arg, -0.100000
%i5 = select i1 %i3, float %i7, float 0.100000
%i8 = select i1 %i2, float %i5, float 0.000000
ret float %i8
}
Transformation doesn't verify! (unsound)
ERROR: Value mismatch
Example:
float %arg = #x3dcbb820 (0.
099472284317?)
Source:
i1 %i = #x1 (1)
i1 %i1 = #x1 (1)
i1 %i2 = #x1 (1)
i1 %i3 = #x0 (0)
i1 %i4 = #x0 (0)
float %i5 = #x00000000 (+0.0)
i1 %i6 = #x0 (0)
float %i7 = #xba0a5680 (-0.
000527717173?)
float %i8 = #x00000000 (+0.0)
Target:
i1 %i = #x1 (1)
i1 %i1 = #x1 (1)
i1 %i2 = #x1 (1)
i1 %i3 = #x0 (0)
float %i7 = #xba0a5680 (-0.
000527717173?)
float %i5 = #x3dcccccd (0.
100000001490?)
float %i8 = #x3dcccccd (0.
100000001490?)
Source value: #x00000000 (+0.0)
Target value: #x3dcccccd (0.
100000001490?)
Pass: (anonymous namespace)::TVPass
Command line: '/builddirs/llvm-project/build-Clang15/bin/opt' '-load' '/repositories/alive2/build-Clang-release/tv/tv.so' '-load-pass-plugin' '/repositories/alive2/build-Clang-release/tv/tv.so' '-passes=tv,instcombine,tv' '-o' '/dev/null' '/repositories/llvm-project/llvm/test/Transforms/InstCombine/D139275_c4001580.ll'
Alive2: Transform doesn't verify!
```
Florian Hahn [Fri, 16 Dec 2022 17:19:54 +0000 (17:19 +0000)]
[llvm-profgen] Fix build failure after
5d7950a403bec25e52.
This fixes a build failure with libc++
(`error: no matching function for call to 'max')`
Paul Robinson [Fri, 16 Dec 2022 17:08:01 +0000 (09:08 -0800)]
[asan] Convert tests to check 'target=...'
Part of the project to eliminate special handling for triples in lit
expressions.
Peter Klausler [Sat, 10 Dec 2022 18:59:52 +0000 (10:59 -0800)]
[flang] Catch bad usage of POINTER attribute
Most attributes apply to only object or only procedure entities,
and attempts to apply them to other kinds of symbol table entries
are caught in name resolution when ConvertToObjectEntity() or
ConvertToProcEntity() fails. However, the POINTER attribute can
be applied to both, and name resolution can't perform that conversion
yet, and as a result we don't catch many kinds of silly errors.
Fix by ensuring that the symbol is of a type that could eventually
become an object or procedure entity if it is not one already.
Differential Revision: https://reviews.llvm.org/D140137
LLVM GN Syncbot [Fri, 16 Dec 2022 16:45:18 +0000 (16:45 +0000)]
[gn build] Port
5d7950a403be
Hongtao Yu [Fri, 16 Dec 2022 02:36:52 +0000 (18:36 -0800)]
[CSSPGO][llvm-profgen] Missing frame inference.
This change introduces a missing frame inferrer aiming at fixing missing frames. It current only handles missing frames due to the compiler tail call elimination (TCE) but could also be extended to supporting other scenarios like frame pointer omission. When a tail called function is sampled, the caller frame will be missing from the call chain because the caller frame is reused for the callee frame. While TCE is beneficial to both perf and reducing stack overflow, a workaround being made in this change aims to find back the missing frames as much as possible.
The idea behind this work is to build a dynamic call graph that consists of only tail call edges constructed from LBR samples and DFS-search for a unique path for a given source frame and target frame on the graph. The unique path will be used to fill in the missing frames between the source and target. Note that only a unique path counts. Multiple paths are treated unreachable since we don't want to overcount for any particular possible path.
A switch --infer-missing-frame is introduced and defaults to be on.
Some testing results:
- 0.4% perf win according to three internal benchmarks.
- About 2/3 of the missing tail call frames can be recovered, according to an internal benchmark.
- 10% more profile generation time.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D139367
Kai Nacke [Fri, 16 Dec 2022 14:21:10 +0000 (14:21 +0000)]
[PowerPC][NFC] Fix typos in PPCISelDAGToDAG
Change:
negtive -> negative
is -> are
Thanks to tschuett for finding these.
Roman Lebedev [Fri, 9 Dec 2022 13:25:09 +0000 (16:25 +0300)]
[SROA] `isVectorPromotionViable()`: memory intrinsics operate on vectors of bytes (take 3)
* This is a recommit of
3c4d2a03968ccf5889bacffe02d6fa2443b0260f,
* which was reverted in
25f01d593ce296078f57e872778b77d074ae5888,
because it exposed a miscompile in PPC backend, which was resolved
in https://reviews.llvm.org/D140089 /
cb3f415cd2019df7d14683842198bc4b7a492bc5.
* which was a recommit of
cf624b23bc5d5a6161706d1663def49380ff816a,
* which was reverted in
5cfc22cafe3f2465e0bb324f8daba82ffcabd0df,
because the cut-off on the number of vector elements was not low enough,
and it triggered both SDAG SDNode operand number assertions,
5and caused compile time explosions in some cases.
Let's try with something really *REALLY* conservative first,
just to get somewhere, and try to bump it later.
FIXME: should this respect TTI reg width * num vec regs?
Original commit message:
Now, there's a big caveat here - these bytes
are abstract bytes, not the i8 we have in LLVM,
so strictly speaking this is not exactly legal,
see e.g. https://github.com/AliveToolkit/alive2/issues/860
^ the "bytes" "could" have been a pointer,
and loading it as an integer inserts an implicit ptrtoint.
But at the same time,
InstCombine's `InstCombinerImpl::SimplifyAnyMemTransfer()`
would expand a memtransfer of 1/2/4/8 bytes
into integer-typed load+store,
so this isn't exactly a new problem.
Note that in memory, poison is byte-wise,
so we really can't widen elements,
but SROA seems to be inconsistent here.
Fixes #59116.
Alexander Kornienko [Fri, 16 Dec 2022 15:43:58 +0000 (16:43 +0100)]
Revert "[SimplifyCFG] `FoldBranchToCommonDest()`: deal with mismatched IV's in PHI's in common successor block"
This reverts commit
1bd0b82e508d049efdb07f4f8a342f35818df341, since it leads to
miscompiles. See https://reviews.llvm.org/D139275#3993229 and
https://reviews.llvm.org/D139275#4001580.
Roy Sundahl [Thu, 15 Dec 2022 19:31:44 +0000 (11:31 -0800)]
Revert "[Driver] Remove Joined -X"
This change is breaking internal builds. We use the -Xfoo pattern but can
now no longer manage whether we allow an unused -Xfoo option to pass as a
warning or promote it to an error.
This reverts commit
98615fd376cea15af21e120e0e3ffa5ba68c2b6d.
Reviewed By: davide
Differential Revision: https://reviews.llvm.org/D139717
Nikolas Klauser [Thu, 15 Dec 2022 00:42:12 +0000 (01:42 +0100)]
[libc++] Install llvm-16-dev explicitly until LLVM16 is stable
The clang-tidy checks can't be properly implemented before LLVM16 because the Clang CMake files don't provide the version before.
Reviewed By: Mordante, #libc
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D140071
Sjoerd Meijer [Fri, 16 Dec 2022 09:20:37 +0000 (09:20 +0000)]
[TTI] [AArch64] getMemoryOpCost for ptr types
Opaque ptr types have a size in bits of 0. The legalised type is an i64 or
vector of i64s, which do have a size. Because of this difference in size, target
hook getMemoryOpCost modelled stores of ptr types as extending/truncating
load/stores. Now we just check for opaque ptr types and return the legalised
cost. This makes stores of pointers cheaper, and as a result we now SLP
vectorise the changed test case.
Differential Revision: https://reviews.llvm.org/D140193
Lorenzo Chelini [Fri, 9 Dec 2022 17:50:36 +0000 (18:50 +0100)]
[MLIR][Linalg] Use `DenseI64ArrayAttr` in `InterchangeOp` (NFC)
Use op separator to improve code navigation.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D139917
Sjoerd Meijer [Tue, 13 Dec 2022 14:50:03 +0000 (14:50 +0000)]
[CostModel][AArch64] Precommit opaque ptr store tests. NFC.
HanSheng Zhang [Fri, 16 Dec 2022 15:04:35 +0000 (16:04 +0100)]
[reg2mem] Add special handling to CatchSwitchInst
When promoting a phi in a catchswitch block to memory, we cannot
insert load/store instruction in that block, and need to insert
them inside all successors instead.
Fixes https://github.com/llvm/llvm-project/issues/59185.
Differential Revision: https://reviews.llvm.org/D138641
Nikita Popov [Fri, 16 Dec 2022 08:45:36 +0000 (09:45 +0100)]
[InstCombine] Preserve instruction name in replaceInstUsesWith()
Currently InstCombine folds using the
`return replaceInstUsesWith(V, Builder.CreateFoo())`
pattern do not preserve the original name of the instruction.
To preserve the name, you either have to use something like
`return FooInst::Create(...)` which is usually less nice, or go
out of the way to preserve the name with takeName(). We often
don't do that.
This patch instead preserves the name in replaceInstUsesWith()
when replacing a named instruction with an unnamed instruction.
To be conservative, I also added a zero-use check, which is a
proxy for the case where the instruction was just created, rather
than an existing one reused. Possibly we could drop that part.
As InstCombine tests are robust against renames this does not
cause any test diffs, so I regenerated a random test to show the
effects.
Differential Revision: https://reviews.llvm.org/D140192
Nemanja Ivanovic [Fri, 16 Dec 2022 14:57:11 +0000 (08:57 -0600)]
[PowerPC] Fix up memory ordering after combining BV to a load
The combiner for BUILD_VECTOR that merges consecutive
loads into a wide load had two issues:
- It didn't check that the input loads all have the
same input chain
- It didn't update nodes that are chained to the original
loads to be chained to the new load
This caused issues with bootstrap when
3c4d2a03968ccf5889bacffe02d6fa2443b0260f was committed.
This patch fixes the issue so it can unblock this commit.
Differential revision: https://reviews.llvm.org/D140046
Nikita Popov [Fri, 16 Dec 2022 14:49:50 +0000 (15:49 +0100)]
[SCEV] Add SCEV::operands() method (NFC)
Add an operands() method on SCEV, which forwards to the operands()
method of individual SCEV expressions.
Archibald Elliott [Wed, 7 Dec 2022 10:04:30 +0000 (10:04 +0000)]
[AArch64] Support SLC in ACLE prefetch intrinsics
This change:
- Modifies the ACLE code to allow the new SLC value (3) for the prefetch
target.
- Introduces a new intrinsic, @llvm.aarch64.prefetch which matches the
PRFM family instructions much more closely, and can represent all
values for the PRFM immediate.
The target-independent @llvm.prefetch intrinsic does not have enough
information for us to be able to lower to it from the ACLE intrinsics
correctly.
- Lowers the acle calls to the new intrinsic on aarch64 (the ARM
lowering is unchanged).
- Implements code generation for the new intrinsic in both SelectionDAG
and GlobalISel. We specifically choose to continue to support lowering
the target-independent @llvm.prefetch intrinsic so that other
frontends can continue to use it.
Differential Revision: https://reviews.llvm.org/D139443
Dani Ferreira Franco Moura [Fri, 16 Dec 2022 14:39:15 +0000 (15:39 +0100)]
[clang][dataflow] Remove unused lambda capture
Reviewed By: krasimir
Differential Revision: https://reviews.llvm.org/D140211
Archibald Elliott [Tue, 13 Dec 2022 15:32:54 +0000 (15:32 +0000)]
[AArch64] RASv2 Assembly Support
This feature adds upstream support for FEAT_RASv2 and FEAT_PFAR. Both
are system-register-only, but FEAT_RAS is behind the command-line
extension "+ras", so FEAT_RASv2 is behind "+rasv2".
This patch includes support for ID_AA64MMFR4_EL1. This is an ID system
register so it is not behind any feature flags.
Differential Revision: https://reviews.llvm.org/D139936
Michael Buch [Fri, 16 Dec 2022 14:33:51 +0000 (14:33 +0000)]
[libcxx][Test] Fix expected diagnostics for std types with default integral arguments
The `clang::TypePrinter` has recently been changed to suppress
defaulted integral template parameters in D139986.
Differential Revision: https://reviews.llvm.org/D139986
Nikita Popov [Fri, 16 Dec 2022 14:29:47 +0000 (15:29 +0100)]
[SCEV] Return ArrayRef for SCEV operands() (NFC)
Use a consistent type for the operands() methods of different SCEV
types. Also make the API consistent by only providing operands(),
rather than also providin op_begin() and op_end() for some of them.
serge-sans-paille [Fri, 16 Dec 2022 14:10:34 +0000 (15:10 +0100)]
Use range based loop to iterate over OptTable::PrefixesUnion
And sneak in a small storage optimization of OptTable::PrefixChars
Backl1ght [Fri, 16 Dec 2022 12:53:58 +0000 (20:53 +0800)]
[clang-format] add config parse test for short lambda
Reviewed By: HazardyKnusperkeks, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D140105
Nikita Popov [Fri, 16 Dec 2022 13:14:51 +0000 (14:14 +0100)]
[SCEV] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 16 Dec 2022 13:30:40 +0000 (14:30 +0100)]
[SCEV] Name instructions in test (NFC)
Joseph Huber [Fri, 16 Dec 2022 13:04:01 +0000 (07:04 -0600)]
[libomptarget] Add HSA definitions for memory faults to dynamic_hsa
Summary:
We use the dynamic HSA file to forward declare needed definitions from
the HSA runtime if not present at build time. These definitions were not
included so using them caused problems on systems without it if used.
Just add them.
Nikita Popov [Fri, 16 Dec 2022 12:09:05 +0000 (13:09 +0100)]
[SCEV] Convert some tests to opaque pointers (NFC)
Guillaume Chatelet [Thu, 1 Dec 2022 14:50:29 +0000 (14:50 +0000)]
[Alignment] Use Align in SectionRef::getAlignment()
Differential Revision: https://reviews.llvm.org/D139110
Jean Perier [Fri, 16 Dec 2022 11:59:12 +0000 (12:59 +0100)]
[flang] Lower procedure ref to user defined elemental procedures (part 1)
Lower procedure ref to user defined elemental procedure when:
- there are no arguments that may be dynamically optional
- for functions, the result has no length parameters
- the reference can be unordered
- there are not character by value arguments
This uses the recently added hlfir.elemental operation and tools.
The "core" of the argument preparation is shared between elemental
and non elemental calls (genUserCalls is code moved without any
functional changes)
Differential Revision: https://reviews.llvm.org/D140118
Nikita Popov [Fri, 16 Dec 2022 11:22:07 +0000 (12:22 +0100)]
[LAA] Convert tests to opaque pointers (NFC)
Michael Buch [Fri, 16 Dec 2022 11:22:15 +0000 (11:22 +0000)]
[clang][DebugInfo] Add DW_AT_default_value support for template template parameters
After this patch, in the following snippet:
```
template <typename T> Foo {};
template <template <typename T> class CT = Foo> Bar {};
Bar<> b;
```
The debug-info entry for the `CT` template parameter will have
a `DW_AT_default_value (true)` attached to it.
Differential Revision: https://reviews.llvm.org/D139989
Michael Buch [Fri, 16 Dec 2022 11:26:08 +0000 (11:26 +0000)]
[llvm][DebugInfo] Add IsDefault parameter to DIBuilder::createTemplateTemplateParameter
This is in preparation for Clang to emit `DW_AT_default_value`
for defaulted template template parameters.
Differential Revision: https://reviews.llvm.org/D139989
Michael Buch [Tue, 13 Dec 2022 12:15:09 +0000 (12:15 +0000)]
[clang][DebugInfo] Simplify logic to determine DW_AT_default_value for template parameters
DWARFv5 added support for labelling template parameters with
DW_AT_default_value to indicate whether the particular instantiation
defaulted parameter. The current implementation only supports a limited
set of possible cases. Namely for non-value-dependent integral template
parameters and simple type template parameters.
Useful cases that don't work are:
1. Type template parameters with defaults that are
themselves templates. E.g.,
```
template<typename T1, typename T2 = Foo<T1>> class C1;
template<typename T = Foo<int>> class C2;
etc.
```
2. Template template parameters
`clang::isSubstitutedDefaultArgument` already implement the required logic
to determine whether a template argument is defaulted. This patch re-uses
this logic for DWARF CodeGen.
Differential Revision: https://reviews.llvm.org/D139988
Michael Buch [Tue, 13 Dec 2022 14:30:17 +0000 (14:30 +0000)]
[clang][TypePrinter] Teach isSubstitutedDefaultArgument about integral types
This patch handles default integral non-type template parameters.
After this patch the clang TypePrinter will omit default integral
template arguments when the `PrintingPolicy::SuppressDefaultTemplateArgs`
option is specified and sets us up to be able to re-use
`clang::isSubstitutedDefaultArgument` from the DWARF CodeGen
component.
Differential Revision: https://reviews.llvm.org/D139986