Florian Hahn [Fri, 8 Apr 2022 18:34:16 +0000 (20:34 +0200)]
[LV] Add test case for wrong debug location with replicate recipe.
Matt Arsenault [Fri, 8 Apr 2022 17:22:23 +0000 (13:22 -0400)]
lld/AMDGPU: Fix asserts if no object files are involved in link
Fixes issue 47690. The reproduction steps produced a shared object
from clang directly, and then fed the shared object back into
lld. With no regular object files, this assert was hit. I'm not sure
if we need to or should be looking for equivalent fields in shared
objects.
Tue Ly [Thu, 7 Apr 2022 20:02:10 +0000 (16:02 -0400)]
[libc] Add support for x86-64 targets that do not have FMA instructions.
Make FMA flag checks more accurate for x86-64 targets, and refactor
polyeval to use multiply and add instead when FMA instructions are not
available.
Reviewed By: michaelrj, sivachandra
Differential Revision: https://reviews.llvm.org/D123335
Mark de Wever [Wed, 30 Mar 2022 15:34:17 +0000 (17:34 +0200)]
[libc++][test] Use the Japanese locale.
This change is done to see whether all platforms have a CI with the
Japanese locale installed.
This wires in the locale in the tests and uses it in one test. This is
a preparation for the tests of the chrono formatters.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D122738
Jorge Gorbe Moya [Fri, 8 Apr 2022 17:57:20 +0000 (10:57 -0700)]
Use writable temporary file for test compiler output instead of hardcoded name. NFCI.
Jonas Devlieghere [Fri, 8 Apr 2022 17:36:16 +0000 (10:36 -0700)]
[lldb] Skip a bunch of tests that shouldn't run remotely
Skip a bunch of tests that don't really make sense to run remotely.
Jonas Devlieghere [Fri, 8 Apr 2022 17:10:17 +0000 (10:10 -0700)]
[lldb] Fix TestQuoting when run remotely
Jonas Devlieghere [Fri, 8 Apr 2022 17:04:15 +0000 (10:04 -0700)]
[lldb] Import Foundation in TestConflictingDefinition.py
We need to import foundation to get a 'NSLog' declaration when building
against the iOS SDK. This doesn't appear necessary when building against
the macOS SDK, presumable because it gets transitively imported by
objc/NSObject.h
Jorge Gorbe Moya [Fri, 8 Apr 2022 17:43:20 +0000 (10:43 -0700)]
Use portable formatting specified in test. NFCI.
Chris Bieneman [Thu, 7 Apr 2022 04:13:56 +0000 (23:13 -0500)]
[Clang] [Docs] Add HLSLSupport page
This document is a first-stab at addressing some of the questions about
HLSL support in Clang.
Differential Revision: https://reviews.llvm.org/D123278
Siu Chi Chan [Fri, 8 Apr 2022 17:09:31 +0000 (17:09 +0000)]
[clang-offload-bundler] fix "no output file" issue with -outputs
Fix backward compatibility issue due to D120662.
Change-Id: I7cd0f704aabbaac7dcf59fd4b73b4f0e0cdfa69f
Reviewed By: yaxunl, saiislam
Differential Revision: https://reviews.llvm.org/D123387
Arthur Eubanks [Thu, 7 Apr 2022 22:39:53 +0000 (15:39 -0700)]
[CaptureTracking] Ignore ephemeral values in EarliestEscapeInfo
And thread DSE's ephemeral values to EarliestEscapeInfo.
This allows more precise analysis in DSEState::isReadClobber() via BatchAA.
Followup to D123162.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D123342
Fangrui Song [Fri, 8 Apr 2022 17:06:43 +0000 (10:06 -0700)]
[MC][ELF] Improve st_size propagation rule
`.symver foo, foo@ver` creates the MCSymbolELF `foo@ver` whose almost all
attributes (including st_size) should inherit from `foo` (GNU as behavior).
a041ef1bd8905f0d58e301c6830b183002ff1847 added st_size propagation which works
for many cases but fails for the following one:
```
.set __GLIBC_2_12_sys_errlist, _sys_errlist_internal
.type __GLIBC_2_12_sys_errlist,@object
.size __GLIBC_2_12_sys_errlist, 1080
.symver __GLIBC_2_12_sys_errlist, sys_errlist@GLIBC_2.12
...
_sys_errlist_internal:
.size _sys_errlist_internal, 1072
```
`sys_errlist@GLIBC_2.12`'s st_size is 1072 (incorrect), which does not match
`__GLIBC_2_12_sys_errlist`'s st_size: 1080.
The problem is that `Base` is (the final) `_sys_errlist_internal` while we want
to respect (the intermediate) `__GLIBC_2_12_sys_errlist`'s st_size.
Fix this by following the MCSymbolRefExpr assignment chain and finding
the closest non-null `getSize()`, which covers most needs. Notably MCBinaryExpr
is not handled, but it is rare enough to matter.
Reviewed By: peter.smith
Differential Revision: https://reviews.llvm.org/D123283
Fangrui Song [Fri, 8 Apr 2022 16:58:04 +0000 (09:58 -0700)]
[MC][test] Improve offset.s
Kevin Athey [Fri, 8 Apr 2022 16:44:27 +0000 (09:44 -0700)]
Add one more definition for symbols in prctl unit test.
one more follow up to: https://reviews.llvm.org/D122851
Differential Revision: https://reviews.llvm.org/D123404
Daniel Grumberg [Fri, 8 Apr 2022 14:58:14 +0000 (15:58 +0100)]
[clang][extract-api] Emit "navigator" property of "name" in SymbolGraph
Differential Revision: https://reviews.llvm.org/D123391
PeixinQiao [Fri, 8 Apr 2022 16:27:53 +0000 (00:27 +0800)]
[flang] Fix semantic analysis for "forall" targeted by "label"
As Fortran 2018 3.18 states, the branch target statement can be
`forall-construct-stmt`, but cannot be `forall-stmt`. `forall-stmt` is
wrapped by `Statement` in `action-stmt` and `action-stmt` can be one
branch target statement. Fix the semantic analysis and add two
regression test cases in lowering.
Reviewed By: Jean Perier
Differential Revision: https://reviews.llvm.org/D123373
Fraser Cormack [Thu, 7 Apr 2022 08:32:32 +0000 (09:32 +0100)]
[RISCV] Select unmasked FP setcc insts via ISel post-process
Similar to D123217 but for the floating-point patterns. No change in
generated output, while reducing the generated table size.
Reviewed By: arcbbb
Differential Revision: https://reviews.llvm.org/D123291
Vang Thao [Fri, 8 Apr 2022 00:51:47 +0000 (17:51 -0700)]
[AMDGPU] Fix inline asm causing assert during PreRARematerialize stage in scheduler pass
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D123348
Snehasish Kumar [Tue, 22 Mar 2022 02:39:24 +0000 (19:39 -0700)]
[memprof] Deduplicate and outline frame storage in the memprof profile.
The current implementation of memprof information in the indexed profile
format stores the representation of each calling context fram inline.
This patch uses an interned representation where the frame contents are
stored in a separate on-disk hash table. The table is indexed via a hash
of the contents of the frame. With this patch, the compressed size of a
large memprof profile reduces by ~22%.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D123094
kristina [Fri, 8 Apr 2022 16:04:35 +0000 (17:04 +0100)]
NFC: Avoid unused variable warning in UnwindLevel1.c
Craig Topper [Thu, 7 Apr 2022 23:10:30 +0000 (16:10 -0700)]
[RISCV] Always select (and (srl X, C), Mask) as (srli (slli X, C2), C3).
SLLI is always compressible to C.SLLI as long as the source and dest
register is the same.
ANDI and SRLI are only compressible if the register is x8-x15. By
using SLLI we have a better chance of generating shorter code.
I had to exclude one exclusion for the BEXTI case so that it's
pattern match could still fire.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D123336
Simon Pilgrim [Fri, 8 Apr 2022 15:55:44 +0000 (16:55 +0100)]
[InstCombine] Add sub(add(x,y),minmax(x,y)) -> maxmin(x,y) tests
Based on Issue #37628
Kevin Athey [Fri, 8 Apr 2022 15:49:25 +0000 (08:49 -0700)]
Add definitions for symbols in unit test for prctl.
Follow up to: https://reviews.llvm.org/D122851
Differential Revision: https://reviews.llvm.org/D123395
Nikita Popov [Fri, 8 Apr 2022 15:26:29 +0000 (17:26 +0200)]
[Loads] Check type size in bits during store to load forwarding
Rather than checking the rounded type store size, check the type
size in bits. We don't want to forward a store of i1 to a load
of i8 for example, even though they have the same type store size.
The padding bits have unspecified contents.
This is a partial fix for the issue reported at
https://reviews.llvm.org/D115924#inline-1179482,
the problem also needs to be addressed more generally in the
constant folding code.
Florian Hahn [Fri, 8 Apr 2022 15:22:38 +0000 (17:22 +0200)]
[VPlan] Preserve debug location when creating branch.
Update createEmptyBasicBlock to preserve the debug location of the
previous terminator.
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