Florian Hahn [Fri, 8 Apr 2022 15:20:59 +0000 (17:20 +0200)]
[LV] Add test for missing debug info on branch in vector loop.
Adds a test case where currently no debug location is added to branches
in the vector body.
Zaara Syeda [Thu, 7 Apr 2022 16:27:05 +0000 (12:27 -0400)]
[LSR] Optimize unused IVs to final values in the exit block
Loop Strength Reduce sometimes optimizes away all uses of an induction variable
from a loop but leaves the IV increments. When the only remaining use of the IV
is the PHI in the exit block, this patch will call rewriteLoopExitValues to
replace the exit block PHI with the final value of the IV to skip the updates
in each loop iteration.
Differential Revision: https://reviews.llvm.org/D118808
Mark de Wever [Mon, 27 Sep 2021 18:53:59 +0000 (20:53 +0200)]
[libc++] Adds back_insert_iterator::__get_container.
Adds a `__get_container` member as suggested by @Quuxplusone in D110497.
Includes s/_LIBCPP_INLINE_VISIBILITY/_LIBCPP_HIDE_FROM_ABI/.
Reviewed By: Quuxplusone, #libc, ldionne
Differential Revision: https://reviews.llvm.org/D110573
Mark de Wever [Sat, 2 Oct 2021 10:38:46 +0000 (12:38 +0200)]
[NFC][libc++][format] Prepare unit tests.
Before implementing P2216's format-string adjust the unit tests.
After P2216 the format* functions require a compile-time string literal.
This changes prepares the tests.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D122534
Alexandre Ganea [Fri, 8 Apr 2022 15:07:14 +0000 (11:07 -0400)]
[Support][unittests] Silence warning when building with Clang 13 on
Windows.
Joseph Huber [Fri, 8 Apr 2022 14:50:31 +0000 (10:50 -0400)]
[OpenMP] Fix linker error when building info tool
Summary:
The changes made in D123177 added new targets to the
`LIBOMPTARGET_TESTED_PLUGINS` variable which was linked against when
building the `llvm-omp-target-info` tool. This caused linker errors on
the export scripts. This patch removes that dependency, it still builds
and runs as expected so I will assume it's correct.
Nikita Popov [Fri, 8 Apr 2022 14:31:40 +0000 (16:31 +0200)]
[ConstantFold] Add test for load of i8 from i1 (NFC)
Semantics here are a bit unclear, but the store-to-load forwarding
case at least should be a miscompile.
Shraiysh Vaishay [Fri, 8 Apr 2022 14:11:15 +0000 (19:41 +0530)]
[flang][OpenMP] Added allocate clause translation for OpenMP block constructs
This patch adds translation for allocate clause for parallel and single
constructs.
Also added tests for block constructs.
This patch also adds tests for parallel construct which were not added earlier.
Reviewed By: NimishMishra, peixin
Differential Revision: https://reviews.llvm.org/D122483
Co-authored-by: Sourabh Singh Tomar <SourabhSingh.Tomar@amd.com>
Aaron Ballman [Fri, 8 Apr 2022 14:22:09 +0000 (10:22 -0400)]
Clarify language option default value behavior; NFC
The LANGOPT macro allows you to specify a default value for the
langauge option. However, it's expected that these values be constant
rather than depending on other language options (because the
constructor setting the default values does not know the language mode
at the time it's being constructed).
Some of our language options were abusing this and passing in other
language mode options which were then set correctly by other parts of
frontend initialization. This removes the default values for the
language options, and then ensures they're consistently set from the
same place when setting language standard defaults.
Joseph Huber [Fri, 8 Apr 2022 14:15:15 +0000 (10:15 -0400)]
[OpenMP] Remove help and documentation for old flag
Summary:
The `-fopenmp-target-new-runtime` flag has not been used for awhile. It
was present in a previous release so we shouldn't remove it for
backwards compatibility, but we shouldn't have documentation or a help
message for it.
Christudasan Devadasan [Fri, 8 Apr 2022 13:59:54 +0000 (19:29 +0530)]
[AMDGPU][SIMachineFunctionInfo] Code cleanup (NFC).
Nikita Popov [Thu, 31 Mar 2022 15:02:38 +0000 (17:02 +0200)]
[X86][FastISel] Fix with.overflow + select eflags clobber (PR54369)
Don't try to directly use the with.overflow flag result in a cmov
if we need to materialize constants between the instruction
producing the overflow flag and the cmov. The current code is
careful to check that there are no other instructions in between,
but misses the constant materialization case (which may clobber
eflags via xor or constant expression evaluation).
Fixes https://github.com/llvm/llvm-project/issues/54369.
Differential Revision: https://reviews.llvm.org/D122825
Carlos Alberto Enciso [Fri, 8 Apr 2022 13:18:13 +0000 (14:18 +0100)]
[llvm-pdbutil] Move global state (Filters) inside LinePrinter class.
The changes described by:
https://reviews.llvm.org/D121801
https://reviews.llvm.org/D122226
Moved some llvm-pdbutil functionality to the debug PDB library.
This patch addresses one outstanding issue concerning the global
state (Filters) created in the PDB library.
- Move 'Filters' inside the 'LinePrinter' class.
- Omit 'Optional' and just pass 'PrintScope &HeaderScope' everywhere.
Reviewed By: aganea
Differential Revision: https://reviews.llvm.org/D122887
Benjamin Kramer [Fri, 8 Apr 2022 13:52:56 +0000 (15:52 +0200)]
Fix another g++ incompatibility. Same issue as
932f27dc1f03.
Jean Perier [Fri, 8 Apr 2022 13:51:32 +0000 (15:51 +0200)]
[flang] Handle dynamically optional argument in EXIT
The actual argument passed to STATUS may be a dummy OPTIONAL or a
disassociated POINTER/unallocated ALLOCATABLE.
Differential Revision: https://reviews.llvm.org/D123380
Nikita Popov [Fri, 8 Apr 2022 13:40:02 +0000 (15:40 +0200)]
[Sanitizer] Add -no-opaque-pointers to IR test (NFC)
This test is currently looking for specific typed-pointer IR,
so explicitly disable opaque pointers.
Nikita Popov [Fri, 8 Apr 2022 13:35:18 +0000 (15:35 +0200)]
[Profile] Add -no-opaque-pointers to IR tests (NFC)
The output differs slightly with opaque pointers (no GEP constexpr),
add -no-opaque-pointers for now.
Nikita Popov [Fri, 8 Apr 2022 13:16:03 +0000 (15:16 +0200)]
[CGCall] Make findDominatingStoreToReturnValue() more robust
This was skipping specific lifetime + bitcast patterns, but with
opaque pointers the bitcast will not be present, and we did not
perform this fold.
Instead skip over lifetime.end and bitcasts generally, without
trying to correlate them.
Nathan James [Fri, 8 Apr 2022 13:17:37 +0000 (14:17 +0100)]
[clang-tidy] Make performance-inefficient-vector-operation work on members
Fixes https://llvm.org/PR50157
Adds support for when the container being read from in a range-for is a member of a struct.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D101624
Vivek Khandelwal [Fri, 8 Apr 2022 12:26:26 +0000 (17:56 +0530)]
[mlir][Linalg] Add pooling_nchw_sum op.
This commit adds pooling_nchw_sum as a yaml op.
Reviewed By: cathyzhyi, gysit
Differential Revision: https://reviews.llvm.org/D123013
Jean Perier [Fri, 8 Apr 2022 11:49:13 +0000 (13:49 +0200)]
[flang][NFC] rename isAbsent to isStaticallyAbsent in IntrinsicCall.cpp
isAbsent/isPresent helpers only give information about static presence
of intrinsic arguments. Many intrinsic arguments optionality is dynamic
(an absent dummy can legally be passed to these intrinsics). This
requires a different handling (like `handleDynamicOptional`).
Rename the helpers to avoid misleading coder/reader into thinking all
optionality cases are covered by them.
Differential Revision: https://reviews.llvm.org/D123378
Fraser Cormack [Thu, 7 Apr 2022 16:58:59 +0000 (17:58 +0100)]
[VP] Explicitly map from VP intrinsic to ISD opcode
This patch aims to overcome an issue in these mappings where, when an ISD
node was registered with BEGIN_REGISTER_VP_SDNODE but outwidth the scope
of a pair of BEGIN_REGISTER_VP_INTRINSIC/END_REGISTER_VP_INTRINSIC
macros, the switch cases fell apart. This in particular happened with
VP_SETCC, where we'd end up with something along the lines of:
case Intrinsic::vp_fcmp:
break;
case Intrinsic::vp_icmp:
break;
ResOpc = ISD::VP_SETCC;
case Intrinsic::vp_store:
...
To remedy this, we introduce a special-purpose mapping macro which can
map any number of VP intrinsic opcodes to an ISD opcode.
As a result, we no longer need to special-case the mapping from vp.icmp
and vp.fcmp to VP_SETCC, as the new helper macro does it for us.
Thanks to @craig.topper for noticing this and to @rogfer01 for the idea.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D123324
LLVM GN Syncbot [Fri, 8 Apr 2022 11:20:14 +0000 (11:20 +0000)]
[gn build] Port
08920cc04343
David Green [Fri, 8 Apr 2022 11:16:34 +0000 (12:16 +0100)]
[AArch64] Remove always true Perfect cost check. NFC
Perfect shuffle costs are always encoded less than 4, and shouldn't
really have a cost more than 3, so it makes no sense to check it when
generating shuffles. The perfect shuffle is likely always better than a
tbl too (although that may depend on whether it is in a loop).
Aaron Ballman [Fri, 8 Apr 2022 11:11:40 +0000 (07:11 -0400)]
Fix Sphinx build
Sven van Haastregt [Fri, 8 Apr 2022 11:08:10 +0000 (12:08 +0100)]
[OpenCL] Add generic addrspace guards for get_fence
Align guards of these builtins with opencl-c.h.
Nico Weber [Fri, 8 Apr 2022 11:07:32 +0000 (07:07 -0400)]
[gn build] (manually) port
bf2dc4b37623
Abinav Puthan Purayil [Fri, 8 Apr 2022 09:07:24 +0000 (14:37 +0530)]
[AMDGPU] Use GCNPat in the buffer atomic pattern multiclasses
Benjamin Kramer [Fri, 8 Apr 2022 10:36:41 +0000 (12:36 +0200)]
Disambiguate conversion cast for GCC
GCC 9 has problems with this.
mlir/include/mlir/IR/OperationSupport.h: In member function ‘mlir::Value mlir::MutableOperandRange::operator[](unsigned int) const’:
mlir/include/mlir/IR/OperationSupport.h:912:43: error: call of overloaded ‘OperandRange(const mlir::MutableOperandRange&)’ is ambiguous
912 | return static_cast<OperandRange>(*this)[index];
|
mlir/include/mlir/IR/OperationSupport.h:789:21: note: candidate: mlir::OperandRange::OperandRange(const llvm::iterator_range<llvm::detail::indexed_accessor_
range_base<mlir::OperandRange, mlir::OpOperand*, mlir::Value, mlir::Value, mlir::Value>::iterator>&)
using RangeBaseT::RangeBaseT;
^~~~~~~~~~
mlir/include/mlir/IR/OperationSupport.h:786:7: note: candidate: constexpr mlir::OperandRange::OperandRange(const mlir::OperandRange&)
class OperandRange final : public llvm::detail::indexed_accessor_range_base<
^~~~~~~~~~~~
mlir/include/mlir/IR/OperationSupport.h:786:7: note: candidate: constexpr mlir::OperandRange::OperandRange(mlir::OperandRange&&)
Thomas Symalla [Fri, 8 Apr 2022 07:48:23 +0000 (09:48 +0200)]
[AMDGPU] Increase detection range for s_mov, v_cmpx transformation.
We found that it might be beneficial to have the SIOptimizeExecMasking
pass detect more cases where v_cmp, s_and_saveexec patterns can be
transformed to s_mov, v_cmpx patterns. Currently, the search range
for finding a fitting v_cmp instruction is 5, however, this is doubled
to 10 here.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D123367
Nikolas Klauser [Thu, 7 Apr 2022 11:40:53 +0000 (13:40 +0200)]
[libc++] Add __is_callable type trait and begin granularizing type_traits
`__is_callable` is required to ensure that the classic algorithms are only called with functions or functors. I also begin to granularize `<type_traits>`.
Reviewed By: ldionne, #libc
Spies: libcxx-commits, mgorny
Differential Revision: https://reviews.llvm.org/D123114
Nikolas Klauser [Fri, 8 Apr 2022 10:20:56 +0000 (12:20 +0200)]
[libc++] Add tests for std::string default constructor and destructor
Reviewed By: ldionne, var-const, #libc, nilayvaish
Spies: nilayvaish, libcxx-commits
Differential Revision: https://reviews.llvm.org/D123129
Matthias Gehre [Fri, 8 Apr 2022 09:55:35 +0000 (10:55 +0100)]
compiler-rt/lib/builtins/udivmodei5.c: Fix missing macro argument
Simon Pilgrim [Fri, 8 Apr 2022 09:37:03 +0000 (10:37 +0100)]
[InstCombine] Add various other modulo-by-constant tests for Issue #22303
Matthias Springer [Fri, 8 Apr 2022 09:04:00 +0000 (18:04 +0900)]
[mlir][tensor] Fix verifier and bufferization of collapse_shape
Insert a buffer copy unless the dims are guaranteed to be collapsible. In the verifier, accept collapses unless they are guaranteed to be non-collapsible.
Differential Revision: https://reviews.llvm.org/D123316
Matthias Springer [Fri, 8 Apr 2022 09:03:39 +0000 (18:03 +0900)]
[mlir][bufferize] Do not insert useless casts for newly allocated buffers
Differential Revision: https://reviews.llvm.org/D123369
Matthias Springer [Fri, 8 Apr 2022 09:03:18 +0000 (18:03 +0900)]
[mlir][arith][bufferize] Fix tensors with different layouts after bufferization
Insert a cast if the two tensors with identical layout (that are passed to `arith.select`) have different layout maps after bufferization.
Differential Revision: https://reviews.llvm.org/D123321
Simon Pilgrim [Fri, 8 Apr 2022 09:07:01 +0000 (10:07 +0100)]
[X86] Fix SLM scheduler model for PMULLD (PR37059)
Adjust the PMULLD entry to match the Intel AoM numbers - PMULLD is a uop nightmare on SLM and we should model it as such.
We had reports of internal regressions the last time this was attempted (rG13a0f83a05ff), but no public repros, and tests I did last year when I had access to a SLM box failed to see anything. My hunch is that the more aggressive PMULLD -> PMADDWD folds we now perform might have helped. We can revisit this again if we ever receive an actual repro.
Fixes #36407
Benjamin Kramer [Fri, 8 Apr 2022 08:54:58 +0000 (10:54 +0200)]
[spirv] Make header self-contained. NFC.
Nikita Popov [Fri, 8 Apr 2022 08:39:43 +0000 (10:39 +0200)]
[X86] Add additional test for PR54369 (NFC)
From this comment: https://reviews.llvm.org/D123014#3436522
Nikita Popov [Thu, 7 Apr 2022 09:30:08 +0000 (11:30 +0200)]
[gold] Remove support for legacy pass manager
This removes support for performing LTO using the legacy pass
manager in LLVMgold.so. Explicitly enabling the new pass manager
is retained as a no-op.
Differential Revision: https://reviews.llvm.org/D123294
Kito Cheng [Fri, 8 Apr 2022 08:18:50 +0000 (16:18 +0800)]
Revert "Reland "[RISCV][NFC] Moving RVV intrinsic type related util to llvm/Support""
This reverts commit
fc2d8326ae4d6e05c1aa2db7e7dbd8e759bf4d51.
Kristóf Umann [Thu, 14 Oct 2021 12:30:58 +0000 (14:30 +0200)]
[analyzer] Don't track function calls as control dependencies
I recently evaluated ~150 of bug reports on open source projects relating to my
GSoC'19 project, which was about tracking control dependencies that were
relevant to a bug report.
Here is what I found: when the condition is a function call, the extra notes
were almost always unimportant, and often times intrusive:
void f(int *x) {
x = nullptr;
if (alwaysTrue()) // We don't need a whole lot of explanation
// here, the function name is good enough.
*x = 5;
}
It almost always boiled down to a few "Returning null pointer, which participates
in a condition later", or similar notes. I struggled to find a single case
where the notes revealed anything interesting or some previously hidden
correlation, which is kind of the point of condition tracking.
This patch checks whether the condition is a function call, and if so, bails
out.
The argument against the patch is the popular feedback we hear from some of our
users, namely that they can never have too much information. I was specifically
fishing for examples that display best that my contribution did more good than
harm, so admittedly I set the bar high, and one can argue that there can be
non-trivial trickery inside functions, and function names may not be that
descriptive.
My argument for the patch is all those reports that got longer without any
notable improvement in the report intelligibility. I think the few exceptional
cases where this patch would remove notable information are an acceptable
sacrifice in favor of more reports being leaner.
Differential Revision: https://reviews.llvm.org/D116597
Nikita Popov [Fri, 8 Apr 2022 08:13:37 +0000 (10:13 +0200)]
[MemoryBuiltins] Remove unnecessary lambda capture (NFC)
Nikita Popov [Fri, 8 Apr 2022 08:09:44 +0000 (10:09 +0200)]
[SafeStack] Move test to X86 directory
This test requires the X86 target to be available.
Nikita Popov [Fri, 8 Apr 2022 08:08:10 +0000 (10:08 +0200)]
[LICM] Pass MemorySSAUpdater by referene (NFC)
Make it clearer that this is a required dependency.
Iain Sandoe [Tue, 4 May 2021 08:56:02 +0000 (09:56 +0100)]
[C++20][Modules] Adjust handling of exports of namespaces and using-decls.
This adjusts the handling for:
export module M;
export namespace {};
export namespace N {};
export using namespace N;
In the first case, we were allowing empty anonymous namespaces
as part of an extension allowing empty top-level entities, but that seems
inappropriate in this case, since the linkage would be internal for the
anonymous namespace. We now report an error for this.
The second case was producing a warning diagnostic that this was
accepted as an extension - however the C++20 standard does allow this
as well-formed.
In the third case we keep the current practice that this is accepted with a
warning (as an extension). The C++20 standard says it's an error.
We also ensure that using decls are only applied to items with external linkage.
This adjusts error messages for exports involving redeclarations in modules to
be more specific about the reason that the decl has been rejected.
Differential Revision: https://reviews.llvm.org/D122119
jacquesguan [Fri, 8 Apr 2022 02:56:34 +0000 (02:56 +0000)]
[mlir][Vector] Fold extractelement splat.
This revision supports to fold vector.extractelement (splat X) -> X.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D122960
Nikita Popov [Thu, 7 Apr 2022 07:49:21 +0000 (09:49 +0200)]
[LoopSink] Require MemorySSA
This makes MemorySSA in LoopSink required, and removes the AST-based
implementation, as well as the related support code in LICM.
Differential Revision: https://reviews.llvm.org/D123288
Nikita Popov [Thu, 7 Apr 2022 13:20:21 +0000 (15:20 +0200)]
[SafeStack] Don't create SCEV min between pointer and integer (PR54784)
Rather than rewriting the alloca pointer to zero, use
removePointerBase() to drop the base pointer. This will simply bail
if the base pointer is not the alloca. We could try doing something
more fancy here (like dropping the sources not based on the alloca
on the premise that they aren't SafeStack-relevant), but I don't
think that's worthwhile.
Fixes https://github.com/llvm/llvm-project/issues/54784.
Differential Revision: https://reviews.llvm.org/D123309
jacquesguan [Fri, 8 Apr 2022 07:06:34 +0000 (07:06 +0000)]
[mlir][Arithmetic] Add constant folder for negf.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D123293
serge-sans-paille [Thu, 7 Apr 2022 13:21:40 +0000 (15:21 +0200)]
[Clang][Fortify] drop inline decls when redeclared
When an inline builtin declaration is shadowed by an actual declaration, we must
reference the actual declaration, even if it's not the last, following GCC
behavior.
This fixes #54715
Differential Revision: https://reviews.llvm.org/D123308
serge-sans-paille [Wed, 23 Mar 2022 10:03:40 +0000 (11:03 +0100)]
[builtin_object_size] Basic support for posix_memalign
It actually implements support for seeing through loads, using alias analysis to
refine the result.
This is rather limited, but I didn't want to rely on more than available
analysis at that point (to be gentle with compilation time), and it does seem to
catch common scenario, as showcased by the included tests.
Differential Revision: https://reviews.llvm.org/D122431
Jan Svoboda [Thu, 7 Apr 2022 15:05:54 +0000 (17:05 +0200)]
[clang][deps] Ensure deterministic filename case
The dependency scanner can reuse single FileManager instance across multiple translation units. This may lead to non-deterministic output depending on which TU gets processed first.
One of the problems is that Clang uses DirectoryEntry::getName in the header search algorithm. This function returns the path that was first used to construct the (shared) entry in FileManager. Using DirectoryEntryRef::getName instead preserves the case as it was spelled out for the current "get directory entry" request.
rdar://
90647508
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D123229
Kito Cheng [Thu, 7 Apr 2022 03:52:33 +0000 (11:52 +0800)]
Reland "[RISCV][NFC] Moving RVV intrinsic type related util to llvm/Support"
Reland Note: We've resolve the circular dependency issue on llvm/lib/Support and
llvm/TableGen.
Differential Revision: https://reviews.llvm.org/D121984
Tobias Hieta [Sat, 2 Apr 2022 14:26:14 +0000 (16:26 +0200)]
Bump minimum toolchain version
RFC: https://discourse.llvm.org/t/rfc-increasing-the-gcc-and-clang-requirements-to-support-c-17-in-llvm
Following the policy here: https://llvm.org/docs/DeveloperPolicy.html#toolchain
This forum post here will be updated with the timeline and status: https://discourse.llvm.org/t/important-new-toolchain-requirements-to-build-llvm-will-most-likely-be-landing-within-a-week-prepare-your-buildbots/61447
Reviewed By: mehdi_amini, jyknight, jhenderson, cor3ntin, MaskRay
Differential Revision: https://reviews.llvm.org/D122976
Marco Gelmi [Fri, 8 Apr 2022 06:58:48 +0000 (08:58 +0200)]
Introduce branchless sorting functions for sort3, sort4 and sort5.
We are introducing branchless variants for sort3, sort4 and sort5.
These sorting functions have been generated using Reinforcement
Learning and aim to replace __sort3, __sort4 and __sort5 variants
for integral types.
The libc++ benchmarks were run on isolated machines for Skylake, ARM and
AMD architectures and achieve statistically significant improvement in
sorting random integers on test cases from sort1 to sort262144 for
uint32 and uint64.
A full performance overview for Intel Skylake, AMD and Arm can be
found here: https://bit.ly/3AtesYf
Reviewed By: ldionne, #libc, philnik
Spies: daniel.mankowitz, mgrang, Quuxplusone, andreamichi, philnik, libcxx-commits, nilayvaish, kristof.beyls
Differential Revision: https://reviews.llvm.org/D118029
Matthias Gehre [Tue, 22 Feb 2022 15:09:54 +0000 (15:09 +0000)]
compiler-rt: Add udivmodei5 to builtins and add bitint library
According to the RFC [0], this review contains the compiler-rt parts of large integer divison for _BitInt.
It adds the functions
```
/// Computes the unsigned division of a / b for two large integers
/// composed of n significant words.
/// Writes the quotient to quo and the remainder to rem.
///
/// \param quo The quotient represented by n words. Must be non-null.
/// \param rem The remainder represented by n words. Must be non-null.
/// \param a The dividend represented by n + 1 words. Must be non-null.
/// \param b The divisor represented by n words. Must be non-null.
/// \note The word order is in host endianness.
/// \note Might modify a and b.
/// \note The storage of 'a' needs to hold n + 1 elements because some
/// implementations need extra scratch space in the most significant word.
/// The value of that word is ignored.
COMPILER_RT_ABI void __udivmodei5(su_int *quo, su_int *rem, su_int *a,
su_int *b, unsigned int n);
/// Computes the signed division of a / b.
/// See __udivmodei5 for details.
COMPILER_RT_ABI void __divmodei5(su_int *quo, su_int *rem, su_int *a, su_int *b,
unsigned int words);
```
into builtins.
In addition it introduces a new "bitint" library containing only those new functions,
which is meant as a way to provide those when using libgcc as runtime.
[0] https://discourse.llvm.org/t/rfc-add-support-for-division-of-large-bitint-builtins-selectiondag-globalisel-clang/60329
Differential Revision: https://reviews.llvm.org/D120327
River Riddle [Fri, 8 Apr 2022 06:29:25 +0000 (23:29 -0700)]
[mlir][NFC] Drop a few unnecessary includes from Pass.h
Zi Xuan Wu [Fri, 8 Apr 2022 06:34:21 +0000 (14:34 +0800)]
[CSKY] Correct the alignment of FPR register
The alignment of FPR64 and sFPR64 declared in RegisterClass should be 32 bit.
Markus Böck [Fri, 8 Apr 2022 06:17:36 +0000 (08:17 +0200)]
[mlir] Add support for operation-produced successor arguments in BranchOpInterface
This patch revamps the BranchOpInterface a bit and allows a proper implementation of what was previously `getMutableSuccessorOperands` for operations, which internally produce arguments to some of the block arguments. A motivating example for this would be an invoke op with a error handling path:
```
invoke %function(%0)
label ^success ^error(%1 : i32)
^error(%e: !error, %arg0 : i32):
...
```
The advantages of this are that any users of `BranchOpInterface` can still argue over remaining block argument operands (such as `%1` in the example above), as well as make use of the modifying capabilities to add more operands, erase an operand etc.
The way this patch implements that functionality is via a new class called `SuccessorOperands`, which is now returned by `getSuccessorOperands`. It basically contains an `unsigned` denoting how many operator produced operands exist, as well as a `MutableOperandRange`, which are the usual forwarded operands we are used to. The produced operands are assumed to the first few block arguments, followed by the forwarded operands afterwards. The role of `SuccessorOperands` is to provide various utility functions to modify and query the successor arguments from a `BranchOpInterface`.
Differential Revision: https://reviews.llvm.org/D123062
Michael Forney [Fri, 8 Apr 2022 05:35:24 +0000 (22:35 -0700)]
[asan] Always skip first object from dl_iterate_phdr
All platforms return the main executable as the first dl_phdr_info.
FreeBSD, NetBSD, Solaris, and Linux-musl place the executable name
in the dlpi_name field of this entry. It appears that only Linux-glibc
uses the empty string.
To make this work generically on all platforms, unconditionally
skip the first object (like is currently done for FreeBSD and NetBSD).
This fixes first DSO detection on Linux-musl. It also would likely
fix detection on Solaris/Illumos if it were to gain PIE support
(since dlpi_addr would not be NULL).
Additionally, only skip the Linux VDSO on linux.
Finally, use the empty string as the "seen first dl_phdr_info"
marker rather than (char *)-1. If there was no other object, we
would try to dereference it for a string comparison.
Reviewed By: MaskRay, vitalybuka
Differential Revision: https://reviews.llvm.org/D119515
Hongtao Yu [Fri, 8 Apr 2022 00:56:45 +0000 (17:56 -0700)]
[llvm-profgen] Filter out invalid LBR ranges.
The profiler can sometimes give us a LBR trace that implicates bogus code ranges. For example,
0xc5acb56/0xc66c6c0 0xc628195/0xf31fbb0 0xc611261/0xc628130 0xc5c1a21/0xc6111c0 0x1f7edfd3/0xc5c3a50 0xc5c154f/0x1f7edec0 0xe8eed07/0xc5c11e0
, note that the first two pairs are supposed to form a linear execution range, in this case, it is [0xf31fbb0, 0xc5acb56] , which doesn't make sense.
Such bogus ranges should be ruled out to avoid generating a bad profile. I'm fixing this for both CS and non-CS cases.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D123271
Zi Xuan Wu [Fri, 8 Apr 2022 02:36:11 +0000 (10:36 +0800)]
[CSKY] support select instruction in floating type
In FPUv3, there is fsel.32/64 instruction to select float/double type data.
In FPUv2, split block and use branch and move instruction to select float/double type data.
Senran Zhang [Sat, 26 Mar 2022 16:04:23 +0000 (00:04 +0800)]
[demangler] Support C23 _BitInt type
Reviewed By: #libc_abi, aaron.ballman, urnathan
Differential Revision: https://reviews.llvm.org/D122530
Stella Laurenzo [Fri, 8 Apr 2022 03:26:20 +0000 (20:26 -0700)]
NFC: Silence unused function 'scaleAndAdd' in release build.
Differential Revision: https://reviews.llvm.org/D123354
Kito Cheng [Fri, 8 Apr 2022 04:09:54 +0000 (12:09 +0800)]
[RISCV][NFC] Add missing lit.local.cfg in test/CodeGen/MIR/RISCV/
LLVM GN Syncbot [Fri, 8 Apr 2022 04:04:28 +0000 (04:04 +0000)]
[gn build] Port
690085c9b715
Ye Luo [Fri, 8 Apr 2022 02:06:09 +0000 (21:06 -0500)]
[libomptarget] Implement pointer lookup as 5.1 spec.
As described in 5.1 spec
2.21.7.2 Pointer Initialization for Device Data Environments
Reviewed By: RaviNarayanaswamy
Differential Revision: https://reviews.llvm.org/D123093
Kito Cheng [Tue, 5 Apr 2022 15:29:37 +0000 (23:29 +0800)]
[RISCV] Fixing stack offset for RVV object with vararg in stack.
We found LLVM generate wrong stack offset for RVV object when stack
having variable argument, that cause by we didn't count vaarg part during
calculate RVV stack objects.
Also update the stack layout diagram for including vaarg in the diagram.
Stack layout ref:
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/riscv/riscv.cc#L3941
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D123180
Kito Cheng [Wed, 6 Apr 2022 01:51:09 +0000 (09:51 +0800)]
[RISCV] Pre-commit for fixing stack offset for RVV object
Reviewed By: rogfer01, frasercrmck
Differential Revision: https://reviews.llvm.org/D123179
Kito Cheng [Wed, 6 Apr 2022 01:41:57 +0000 (09:41 +0800)]
[RISCV] Store/restore RISCVMachineFunctionInfo into MIR YAML file
RISCVMachineFunctionInfo has some fields like VarArgsFrameIndex and
VarArgsSaveSize are calculated at ISel lowering stage, those info are
not contained in MIR files, that cause test cases rely on those field
can't not reproduce correctly by MIR dump files.
This patch adding the MIR read/write for those fields.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D123178
Chuanqi Xu [Fri, 8 Apr 2022 03:46:08 +0000 (11:46 +0800)]
[NFC] Remove unused variable in CodeGenModules
This eliminates an unused-variable warning
Evgeniy Brevnov [Fri, 4 Feb 2022 03:54:27 +0000 (10:54 +0700)]
Add support for atomic memory copy lowering
Currently, the utility supports lowering of non atomic memory transfer routines only. This patch adds support for atomic version of memcopy. This may be useful for targets not supporting atomic memcopy.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D118443
jacquesguan [Fri, 8 Apr 2022 03:09:21 +0000 (03:09 +0000)]
[mlir][LLVMIR] Add more vector predication intrinsic ops.
This revision adds float unary, ternary and float/integer reduction intrinsic ops.
Differential Revision: https://reviews.llvm.org/D123189
Austin Kerbow [Sat, 2 Apr 2022 03:02:31 +0000 (20:02 -0700)]
[InferAddressSpaces] Fix assert on invalid bitcast placement
Similar to the problem in
0bb25b4603, bitcasts that are inserted must
dominate all uses. When rewriting "values" with "new values" that have
the updated address space, we may replace the "new value" with a bitcast
if one of the original users is an addresspace cast. This bitcast must
be inserted before ALL users, not only before the addresspace cast.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D122964
jacquesguan [Fri, 8 Apr 2022 02:51:30 +0000 (02:51 +0000)]
[RISCV][NFC] Use defvar to simplify pattern definations.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D123292
Chenbing Zheng [Fri, 8 Apr 2022 02:19:24 +0000 (10:19 +0800)]
[InstCombine] fold more constant divisor to select-of-constants divisor
By adding a parameter to function FoldOpIntoSelect, we can fold more Ops to Select.
For this example, we tend to fold the division instruction,
so we no longer care whether SelectInst is one use.
This patch slove TODO left in InstCombine/div.ll.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D122967
Jeremy Furtek [Fri, 8 Apr 2022 00:49:14 +0000 (00:49 +0000)]
[mlir] Width parameterization of BitEnum attributes
This diff contains:
- Parameterization of bit enum attributes in OpBase.td by bit width (e.g. 32
and 64). Previously, all enums were 32-bits. This brings enum functionality in
line with other integer attributes, and allows for bit enums greater than 32
bits.
- SPIRV and Vector dialects were updated to use bit enum attributes with an
explicit bit width
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D123095
Stella Laurenzo [Fri, 8 Apr 2022 01:10:31 +0000 (18:10 -0700)]
NFC: Eliminate warning for unused type alias FnTraitsT in release builds.
Differential Revision: https://reviews.llvm.org/D123351
Lang Hames [Thu, 7 Apr 2022 22:48:22 +0000 (15:48 -0700)]
[ORC] Fix handling of casts in llvm.global_ctors.
Removes a bogus dyn_cast_or_null that was breaking cast-expression handling when
parsing llvm.global_ctors.
The intent of this code was to identify Functions nested within cast
expressions, but the offending dyn_cast_or_null was actually blocking that:
Since a function is not a cast expression, we would set FuncC to null and break
the loop without finding the Function. The cast was not necessary either:
Functions are already Constants, and we didn't need to do anything
ConstantExpr-specific with FuncC, so we could just drop the cast.
Thanks to Jonas Hahnfeld for tracking this down.
http://llvm.org/PR54797
David Blaikie [Thu, 7 Apr 2022 23:59:19 +0000 (23:59 +0000)]
DebugInfo: Consider the type of NTTP when simplifying template names
Since the NTTP may need to be cast to the type when rebuilding the name,
check that the type can be rebuilt when determining whether a template
name can be simplified.
Kevin Athey [Thu, 7 Apr 2022 16:40:49 +0000 (09:40 -0700)]
[MSAN] extend prctl interceptor to support PR_SCHED_CORE
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D122851
Walter Erquinigo [Wed, 6 Apr 2022 22:17:23 +0000 (15:17 -0700)]
[trace][intel pt] Create a common accessor for live and postmortem data
Some parts of the code have to distinguish between live and postmortem threads
to figure out how to get some data, e.g. thread trace buffers. This makes the
code less generic and more error prone. An example of that is that we have
two different decoders: LiveThreadDecoder and PostMortemThreadDecoder. They
exist because getting the trace bufer is different for each case.
The problem doesn't stop there. Soon we'll have even more kinds of data, like
the context switch trace, whose fetching will be different for live and post-
mortem processes.
As a way to fix this, I'm creating a common API for accessing thread data,
which is able to figure out how to handle the postmortem and live cases on
behalf of the caller. As a result of that, I was able to eliminate the two
decoders and unify them into a simpler one. Not only that, our TraceSave
functionality only worked for live threads, but now it can also work for
postmortem processes, which might be useful now, but it might in the future.
This common API is OnThreadBinaryDataRead. More information in the inline
documentation.
Differential Revision: https://reviews.llvm.org/D123281
Walter Erquinigo [Fri, 1 Apr 2022 18:44:51 +0000 (11:44 -0700)]
[trace][intel pt] Create a class for the libipt decoder wrapper
As we soon will need to decode multiple raw traces for the same thread,
having a class that encapsulates the decoding of a single raw trace is
a stepping stone that will make the coming features easier to implement.
So, I'm creating a LibiptDecoder class with that purpose. I refactored
the code and it's now much more readable. Besides that, more comments
were added. With this new structure, it's also easier to implement unit
tests.
Differential Revision: https://reviews.llvm.org/D123106
Arthur Eubanks [Thu, 7 Apr 2022 22:37:16 +0000 (15:37 -0700)]
[test][DSE] Precommit more assume tests
Jorge Gorbe Moya [Thu, 7 Apr 2022 22:25:28 +0000 (15:25 -0700)]
Fix format specifier. NFCI.
Using a portable format specifier avoids a "format specifies type
'unsigned long long' but the argument has type 'uint64_t' (aka 'unsigned
long') [-Werror,-Wformat]" error depending on the exact definition of
`uint64_t`.
Zequan Wu [Tue, 5 Apr 2022 19:12:48 +0000 (12:12 -0700)]
[llvm-symbolizer] Fix line offset for inline site.
This fixes the issue when the current line offset is actually for next range.
Maintain a current code range with current line offset and cache next file/line
offset. Update file/line offset after finishing current range.
Differential Revision: https://reviews.llvm.org/D123151
Jez Ng [Thu, 7 Apr 2022 22:13:27 +0000 (18:13 -0400)]
[lld-macho][nfc] Give non-text ConcatOutputSections order-independent finalization
This diff is motivated by my work to add proper DWARF unwind support. As
detailed in PR50956 functions that need DWARF unwind need to have
compact unwind entries synthesized for them. These CU entries encode an
offset within `__eh_frame` that points to the corresponding DWARF FDE.
In order to encode this offset during
`UnwindInfoSectionImpl::finalize()`, we need to first assign values to
`InputSection::outSecOff` for each `__eh_frame` subsection. But
`__eh_frame` is ordered after `__unwind_info` (according to ld64 at
least), which puts us in a bit of a bind: `outSecOff` gets assigned
during finalization, but `__eh_frame` is being finalized after
`__unwind_info`.
But it occurred to me that there's no real need for most
ConcatOutputSections to be finalized sequentially. It's only necessary
for text-containing ConcatOutputSections that may contain branch relocs
which may need thunks. ConcatOutputSections containing other types of
data can be finalized in any order.
This diff moves the finalization logic for non-text sections into a
separate `finalizeContents()` method. This method is called before
section address assignment & unwind info finalization takes place. In
theory we could call these `finalizeContents()` methods in parallel, but
in practice it seems to be faster to do it all on the main thread.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D123279
Stanislav Mekhanoshin [Thu, 7 Apr 2022 20:38:02 +0000 (13:38 -0700)]
[AMDGPU] Fix handling of gfx10 LDS misaligned access bug
It was only handled for FLAT initially because we did not have
unaligned DS instructions lowering. Now it is implemented but
the bug is not handled.
Differential Revision: https://reviews.llvm.org/D123338
Pengxuan Zheng [Tue, 5 Apr 2022 01:17:03 +0000 (18:17 -0700)]
[compiler-rt][builtins] Move DMB definition to syn-ops.h
Compiler-rt cross-compile for ARMv5 fails because D99282 made it an error if DMB
is used for any pre-ARMv6 targets. More specifically, the "#error only supported
on ARMv6+" added in D99282 will cause compilation to fail when any source file
which includes assembly.h are compiled for pre-ARMv6 targets. Since the only
place where DMB is used is syn-ops.h (which is only included by
arm/sync_fetch_and_* and these files are excluded from being built for older
targets), this patch moves the definition there to avoid the issues described
above.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D123105
Quinn Pham [Thu, 7 Apr 2022 21:45:19 +0000 (16:45 -0500)]
Revert "[PowerPC] Fix EmitPPCBuiltinExpr to emit arguments once"
This reverts commit
2aae5b1fac3898afa10b550eee5e97f394aed0e6. Because it
breaks tests on windows.
Fangrui Song [Thu, 7 Apr 2022 21:34:31 +0000 (14:34 -0700)]
[ELF] Fix non-relocatable-non-emit-relocs --gc-sections to discard .L symbols
This reverts commit
764cd491b126318add093c7c8ba3884967d64b21, which I
incorrectly assumed NFC partly because there were no test coverage for the
non-relocatable non-emit-relocs case before
9d6d936243fe343abe89323a27c7241b395af541.
The interaction of {,-r,--emit-relocs} {,--discard-locals} {,--gc-sections} is
complex but without -r/--emit-relocs, --gc-sections does need to discard .L
symbols like --no-gc-sections. The behavior matches GNU ld.
Stanislav Mekhanoshin [Thu, 7 Apr 2022 18:45:37 +0000 (11:45 -0700)]
[AMDGPU] Split unaligned LDS access instead of scalarizing
There is no need to fully scalarize an unaligned operation in
some case, just split it to alignment.
Differential Revision: https://reviews.llvm.org/D123330
Fangrui Song [Thu, 7 Apr 2022 21:24:15 +0000 (14:24 -0700)]
[ELF][test] Improve discard-locals.s
Florian Hahn [Thu, 7 Apr 2022 21:21:21 +0000 (23:21 +0200)]
[LV] Add test case for PR54427.
Reduced test for #54427.
Quinn Pham [Mon, 14 Mar 2022 20:13:47 +0000 (15:13 -0500)]
[PowerPC] Fix EmitPPCBuiltinExpr to emit arguments once
This patch changes `EmitPPCBuiltinExpr` in `CGBuiltin.cpp` to remove
the loop at the beginning of the function that emits the arguments and
to delay emitting the arguments until inside the switch statement. These
changes will put `EmitPPCBuiltinExpr` in line with the strategy of the
target independent function `EmitBuiltinExpr`. Also, this patch
ensures that arguments are only emitted once.
Tests that included builtins affected by these changes have been
modified to match expected behaviour.
Reviewed By: #powerpc, nemanjai, amyk
Differential Revision: https://reviews.llvm.org/D121637
Jonas Devlieghere [Thu, 7 Apr 2022 20:43:47 +0000 (13:43 -0700)]
[lldb] Use getMainExecutable in SBDebugger::PrintStackTraceOnError
Implement Pavel's suggestion to use llvm::sys::fs::getMainExecutable to
find the executable name for llvm::sys::PrintStackTraceOnErrorSignal.
Mark de Wever [Thu, 7 Apr 2022 20:40:08 +0000 (22:40 +0200)]
Revert "[libc++][format] Use a helper constant."
This reverts commit
82427685ea3732665286d5b1c8a1424b1f96164e.
This seems to break the AIX-32 bit build.
Luboš Luňák [Sun, 3 Apr 2022 23:13:53 +0000 (01:13 +0200)]
[lldb][gui] remove the "expand" diamond for variables where expanding fails
If the variables view shows a variable that is a struct that has
MightHaveChildren(), the expand diamond is shown, but if trying to expand
it and it's not possible (e.g. incomplete type), remove the expand diamond
to visualize that it can't be in fact expanded. Otherwise it feels kinda
weird that a tree item cannot be expanded even though it "should".
I guess the MightHaveChildren() checking means that GetChildren() may
be expensive, so also do not call it for rows that are not expanded.
Differential Revision: https://reviews.llvm.org/D123008