Maksim Panchenko [Tue, 13 Jun 2023 01:21:58 +0000 (18:21 -0700)]
[BOLT][NFCI] Remove redundant instance of MCAsmBackend
Use instance of MCAsmBackend from BinaryContext instead of creating a
new one.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D152849
Wenlei He [Tue, 13 Jun 2023 04:20:19 +0000 (21:20 -0700)]
[LoopSink] Allow sinking to PHI-use
This change allows sinking defs from loop preheader with PHI-use into loop body. Loop sink can now see through PHI-use and select incoming blocks of value being used as candidate sink destination.
It makes loop sink more effective so more LICM can be undone if proven unprofitable with profile info. It addresses the motivating case in D87551, without resorting to profile guided LICM which breaks canonicalization.
Differential Revision: https://reviews.llvm.org/D152772
Kelvin Li [Mon, 29 May 2023 20:10:12 +0000 (16:10 -0400)]
[flang] Add PowerPC vec_add, vec_and, vec_mul, vec_sub and vec_xor intrinsics
Differential Revision: https://reviews.llvm.org/D151857
Reid Kleckner [Mon, 12 Jun 2023 20:50:50 +0000 (13:50 -0700)]
[MS] Fix passing aligned records by value in some cases
It's not exactly clear what the meaning of TypeInfo::AlignRequirement
is, so go directly to the ASTRecordLayout for records and check the
required alignment there. Compare that number with the stack alignment
value of 4.
This fixes cases when the alignment attribute does not appear directly
on the record [1], or when the attribute on the record is underaligned
[2].
[1]: `struct Foo { int __declspec(align(16)) x; };`
[2]: `struct __declspec(align(1)) Bar { int x; };`
Fixes https://llvm.org/pr63257
Differential Revision: https://reviews.llvm.org/D152752
Craig Topper [Tue, 13 Jun 2023 19:46:26 +0000 (12:46 -0700)]
[SelectionDAG] Don't allow type legalization to create noop VP_TRUNCATE.
Type legalization may need to promote the result to the same type
as the input. Instead of forming a vp_truncate with the same
source and dest type, don't create any vp_truncate.
Handling in getNode like is done for ISD::TRUNCATE.
Fangrui Song [Tue, 13 Jun 2023 19:45:34 +0000 (12:45 -0700)]
[CMake][BLAKE3] Fix unused -mavx512vl warning when CMAKE_OSX_ARCHITECTURES=arm64
This fixes
```
% ninja -C out/play LLVMSupport
ninja: Entering directory `out/play'
[151/158] Building ASM object lib/Support/BLAKE3/CMakeFiles/LLVMSupportBlake3.dir/blake3_avx512_x86-64_unix.S.o
clang: warning: argument unused during compilation: '-mavx512vl' [-Wunused-command-line-argument]
```
and applies `disable_blake3_x86_simd()`.
This fixes the root cause of commit
5160f6fefb0021a0b23e99c7cf621a330241c211 ("broke cross-builds of llvm from x86_64 to arm64 mac"...)
Vitaly Buka [Tue, 13 Jun 2023 19:26:41 +0000 (12:26 -0700)]
[test][sanitizer] Fix test on windows
AdityaK [Tue, 13 Jun 2023 19:22:46 +0000 (12:22 -0700)]
Enable zbb for riscv android
Differential Revision: https://reviews.llvm.org/D152729
Reviewers: enh, pirama, jrtc27
Alexandre Ganea [Tue, 13 Jun 2023 19:12:55 +0000 (15:12 -0400)]
[LLD][COFF] Allow overwriting directives exports with cmd-line exports
MSVC link.exe allows overriding exports on the cmd-line with exports seen in OBJ directives. The typical case is what is described in #62329.
Before this patch, trying to override an export with `/export` or `/def` would generate a duplicate warning. This patches tries to replicate the MSVC behavior. A second override on the cmd-line would still generate the warning.
There's still a case which we don't cover: MSVC link.exe is able to demangle an exported OBJ directive function, and match it with a unmangled export function in a .def file. In the meanwhile, one can use the mangled export in the .def to cover that case.
This fixes #62329
Differential revision: https://reviews.llvm.org/D149611
Vitaly Buka [Tue, 13 Jun 2023 19:26:41 +0000 (12:26 -0700)]
[test][sanitizer] Fix test on windows
Maksim Panchenko [Sat, 6 May 2023 20:27:48 +0000 (13:27 -0700)]
[BOLT][NFC] Change signature of MCPlusBuilder::isUnsupportedBranch()
Make MCPlusBuilder::isUnsupportedBranch() take MCInst, not opcode.
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D152765
Nicolai Hähnle [Fri, 2 Dec 2022 02:15:13 +0000 (03:15 +0100)]
Scalarizer: limit scalarization for small element types
Scalarization can expose optimization opportunities for the individual
elements of a vector, and can therefore be beneficial on targets like
GPUs that tend to operate on scalars anyway.
However, notably with 16-bit operations it is often beneficial to keep
<2 x i16 / half> vectors around since there are packed instructions for
those.
Refactor the code to operate on "fragments" of split vectors. The
fragments are usually scalars, but may themselves be smaller vectors
when the scalarizer-min-bits option is used. If the split is uneven,
the last fragment is a shorter remainder.
This is almost NFC when the new option is unused, but it happens to
clean up some code in the fully scalarized case as well.
Differential Revision: https://reviews.llvm.org/D149842
LLVM GN Syncbot [Tue, 13 Jun 2023 19:06:20 +0000 (19:06 +0000)]
[gn build] Port
474a2b9367ad
AMS21 [Tue, 13 Jun 2023 18:56:54 +0000 (18:56 +0000)]
[clang-tidy] Add more checks for functions which should be noexcept
Added new checks
- `performance-noexcept-destructor`
- `performance-noexcept-swap`
Also added cppcoreguidlines aliases for the 2 new checks as well as `performance-noexcept-move-constructor`
This fixes llvm#62154
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D148697
Mike Crowe [Tue, 13 Jun 2023 18:15:13 +0000 (18:15 +0000)]
[clang-tidy] Move formatDereference to FixitHintUtils
I'd like to use RedundantStringCStrCheck's formatDereference function
from the up-coming modernize-use-std-print check. Let's move it to
FixItHintUtils so that the implementation can be shared.
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D150602
Dave Lee [Mon, 29 May 2023 01:48:32 +0000 (18:48 -0700)]
[lldb] Default can_create to true in GetChildMemberWithName (NFC)
It turns out all existing callers of `GetChildMemberWithName` pass true for `can_create`.
This change makes `true` the default value, callers don't have to pass an opaque true.
Differential Revision: https://reviews.llvm.org/D151966
Valentin Clement [Tue, 13 Jun 2023 18:16:31 +0000 (11:16 -0700)]
[mlir][openacc][NFC] Fix current gang clause parser
The custom parser for the gang values was not implemented correctly.
This patch fixes the noted issue and allows the num/static values
to appear in any order.
Reviewed By: razvanlupusoru, jeanPerier
Differential Revision: https://reviews.llvm.org/D151970
AMS21 [Tue, 13 Jun 2023 18:00:03 +0000 (18:00 +0000)]
[clang-tidy] Fix crash in `modernize-use-default-member-init`
This was causes by `getValueOfValueInit` unconditionally calling
`getScalarTypeKind` on the member type, which would then trigger an
assertions since arrays are not scalar type.
This fixes llvm#63285
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D152802
AMS21 [Tue, 13 Jun 2023 17:58:16 +0000 (17:58 +0000)]
[clang-tidy] Fix false positive in `readability-named-parameter` for defaulted out-of-line special member functions
This fixes llvm#63056
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D152825
Augusto Noronha [Wed, 7 Jun 2023 23:17:37 +0000 (16:17 -0700)]
[lldb] Never print children if the max depth has been reached
When formatting a variable, the max depth would potentially be ignored
if the current value object failed to print itself. Change that to
always respect the max depth, even if failure occurs.
rdar://
109855463
Differential Revision: https://reviews.llvm.org/D152409
Craig Topper [Tue, 13 Jun 2023 17:54:00 +0000 (10:54 -0700)]
[RISCV] Remove RISCVII::hasMergeOp. NFC
We can mostly get this from the operand info in MCInstrDesc.
The exception is the _TIED pseudos so I've added a new flag for those.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D152313
Ivan Kosarev [Tue, 13 Jun 2023 17:38:49 +0000 (18:38 +0100)]
[AMDGPU][AsmParser][NFC] Simplify the EndpgmImm operand definition.
Clears the road to eliminating custom default operand handlers. Also
unifies naming of related entities.
Part of <https://github.com/llvm/llvm-project/issues/62629>.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D151687
Craig Topper [Tue, 13 Jun 2023 16:52:26 +0000 (09:52 -0700)]
[RISCV] Change the immediate argument to Zk* intrinsics/builtins from i8 to i32.
This matches gcc. It also lets us fix a bug that the byteselect
predicate was not being evaluated in tablegen. We can't have i8
TImmLeaf in tablegen because i8 isn't a type for any register class.
I've added AutoUpgrade support for the IR intrinsics.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D152627
Noah Goldstein [Tue, 13 Jun 2023 07:42:15 +0000 (02:42 -0500)]
[FunctionAttrs] Remove errant whitespace; NFC
Louis Dionne [Mon, 12 Jun 2023 18:32:29 +0000 (11:32 -0700)]
[libc++][NFC] Reformat features.py
This file was reformatted using the Black tool, which led to entirely
unreadable code due to how lines are broken. Formatting tools are fine,
but not when they lead to code that humans have trouble reading. In the
case of features.py, a lot of it was meant to be aligned in a repetitive
but consistent way to make the structure of the code stand out.
Reformatting with the tool lost that property.
Differential Revision: https://reviews.llvm.org/D152737
Louis Dionne [Mon, 12 Jun 2023 18:21:47 +0000 (11:21 -0700)]
[libc++] Mark slow tests as unsupported on GCC
Some tests in our test suite are unbelievably slow on GCC due to the
use of the always_inline attribute. See [1] for more details.
This patch introduces the GCC-ALWAYS_INLINE-FIXME lit feature to
disable tests that are plagued by that issue. At the same time, it
moves several existing tests from ad-hoc `UNSUPPORTED: gcc-12` markup
to the new GCC-ALWAYS_INLINE-FIXME feature, and marks the slowest tests
reported by the CI as `UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME`.
[1]: https://discourse.llvm.org/t/rfc-stop-supporting-extern-instantiations-with-gcc/71277/1
Differential Revision: https://reviews.llvm.org/D152736
Alex Langford [Fri, 9 Jun 2023 18:46:00 +0000 (11:46 -0700)]
[lldb][NFCI] Remove use of ConstString from Listener
The only place ConstString was used in Listener was for filtering
broadcasters by name when looking for the next event. This functionality
is completely unused from what I can tell (even in downstream forks).
Differential Revision: https://reviews.llvm.org/D152573
Owen Pan [Tue, 13 Jun 2023 16:52:34 +0000 (09:52 -0700)]
Reland [clang-format] Add the KeepEmptyLinesAtEOF option
Haojian Wu [Tue, 13 Jun 2023 11:42:36 +0000 (13:42 +0200)]
[include-cleaner] Don't apply the PreferredHeader hint for standard headers.
Fixes https://github.com/llvm/llvm-project/issues/62635
Differential Revision: https://reviews.llvm.org/D152801
Craig Topper [Tue, 13 Jun 2023 16:51:30 +0000 (09:51 -0700)]
[RISCV] Add support for llvm.prefetch to use Zicbop instructions.
Reviewed By: asb, reames
Differential Revision: https://reviews.llvm.org/D152723
Vitaly Buka [Tue, 13 Jun 2023 16:47:36 +0000 (09:47 -0700)]
[test][sanitizer] Remove test missing include
We don't need to test with std::array anyway, as we don't use them in
sanitizers.
Sindhu Chittireddy [Mon, 12 Jun 2023 09:02:04 +0000 (02:02 -0700)]
Remove dead conditionals
Anna Thomas [Fri, 9 Jun 2023 21:09:12 +0000 (17:09 -0400)]
[Intrinsic] Introduce reduction intrinsics for minimum/maximum
This patch introduces the reduction intrinsic for floating point minimum
and maximum which has the same semantics (for NaN and signed zero) as
llvm.minimum and llvm.maximum.
Reviewed-By: nikic
Differential Revision: https://reviews.llvm.org/D152370
ManuelJBrito [Tue, 13 Jun 2023 13:59:38 +0000 (14:59 +0100)]
[IR] Update to use new shufflevector semantics
Update to use new shufflevector semantics for undefined values in the mask
Differential Revision: https://reviews.llvm.org/D149548
David Green [Tue, 13 Jun 2023 16:09:22 +0000 (17:09 +0100)]
[DAG][NFC] Update comment on min/max reduction fold.
As pointed out in D141870, this one was incorrectly referencing and.
Vitaly Buka [Tue, 13 Jun 2023 16:05:11 +0000 (09:05 -0700)]
[NFC][sanitizer] Fix build on Windows
Macro was defined twice.
Roger Ferrer Ibanez [Tue, 13 Jun 2023 15:36:11 +0000 (15:36 +0000)]
[MLIR][Tests] Update tests so they require assertions
These tests check statistics results which require assertions enabled.
Differential Revision: https://reviews.llvm.org/D152780
Vitaly Buka [Tue, 13 Jun 2023 15:58:46 +0000 (08:58 -0700)]
[clangd] Initialize local variable
desugarForDiagnostic only sets value to true.
Vitaly Buka [Tue, 13 Jun 2023 15:52:03 +0000 (08:52 -0700)]
[test][sanitizer] Unsupport test on Android
Vitaly Buka [Mon, 12 Jun 2023 23:40:48 +0000 (16:40 -0700)]
[test][sanitizer] Add ArrayRef tests
Tests are subset of llvm/unittests/ADT/ArrayRefTest.cpp.
Added more members to match tests and
make class more useful.
Reviewed By: hctim
Differential Revision: https://reviews.llvm.org/D152760
Krzysztof Parzyszek [Fri, 2 Jun 2023 23:39:14 +0000 (16:39 -0700)]
[RDF] Do not return register masks in PhysicalRegisterInfo::getAliasSet
Krzysztof Parzyszek [Fri, 2 Jun 2023 23:24:35 +0000 (16:24 -0700)]
[RDF] Print regmask index in more user-friendly way
Simon Pilgrim [Tue, 13 Jun 2023 15:12:20 +0000 (16:12 +0100)]
[SLP][X86] Add test coverage for Issue #62969
Simon Pilgrim [Tue, 13 Jun 2023 14:16:35 +0000 (15:16 +0100)]
[CostModel][X86] Add test coverage for vXi64 multiplies of sign/zero-extended vector
Part of test coverage for Issue #62969
Yaxun (Sam) Liu [Mon, 12 Jun 2023 17:45:19 +0000 (13:45 -0400)]
[HIP] Fix HIP path detection
Fix two issues:
--hip-path should not do rigorous checking, i.e. if .hipVersion exists it
will use it, otherwise it will not error out but assumes the default
HIP version. This is to be consistent with --rocm-path behavior.
when HIP_PATH is empty, it should be ignored. This is to be consistent
with ROCM_PATH behavior.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D152734
Fixes: SWDEV-404771
Nikolas Klauser [Tue, 13 Jun 2023 14:57:26 +0000 (07:57 -0700)]
[libc++] Add [[nodiscard]] extensions to the functions in <bit>
Reviewed By: #libc, ldionne, Mordante
Spies: Mordante, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D152653
LLVM GN Syncbot [Tue, 13 Jun 2023 14:55:33 +0000 (14:55 +0000)]
[gn build] Port
cd916108b4c6
Nikolas Klauser [Fri, 9 Jun 2023 20:45:34 +0000 (13:45 -0700)]
[libc++][PSTL] Implement std::generate{,_n}
Reviewed By: #libc, ldionne
Spies: ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D152581
Venkata Ramanaiah Nalamothu [Tue, 13 Jun 2023 14:36:08 +0000 (20:06 +0530)]
[RISCV][NFC] Improve encoding/decoding tests for Zbb instructions
Currently `llvm/test/MC/RISCV/rv64zbb-valid.s` doesn't cover all
the instructions e.g. `maxu` and `llvm/test/MC/RISCV/rv32zbb-valid.s`
can have rv64 run lines, similar to what Zba instruction tests have.
This patch does the following.
- Add rv64 run lines in `llvm/test/MC/RISCV/rv32zbb-valid.s`
- Keep only rv64 specific instructions in `llvm/test/MC/RISCV/rv64zbb-valid.s`
- Move rv32 instructions, with different encodings from rv64, into
`llvm/test/MC/RISCV/rv32zbb-only-valid.s`
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D152680
Raphael Isemann [Tue, 13 Jun 2023 12:27:20 +0000 (08:27 -0400)]
[Support] Remove TaskQueue
TaskQueue was added several years ago as part of D48240.
There are currently no uses of this class anywhere in LLVM and I don't see
any patch that plans to use this class, so it doesn't seem useful to keep
compiling and testing this class at the moment.
The code itself is fine, so if we actually end up having a use for this code,
then I think it's perfectly fine to just re-commit this class then.
Differential revision: https://reviews.llvm.org/D86338
Michael Buch [Tue, 13 Jun 2023 12:33:06 +0000 (13:33 +0100)]
[lldb][test] Re-XFAIL prefer-debug-over-eh-frame.test
This was un-XFAILed in `
83cb2123be487302070562c45e6eb4955b22c2b4`
due to D144999. Since then D152540 fixed emission of eh_frame's
on Darwin, causing this test to fail again.
Differential Revision: https://reviews.llvm.org/D152806
Tue Ly [Thu, 8 Jun 2023 17:25:15 +0000 (13:25 -0400)]
[libc] Add Int<> type and fix (U)Int<128> compatibility issues.
Add Int<> and Int128 types to replace the usage of __int128_t in math
functions. Clean up to make sure that (U)Int128 and __(u)int128_t are
interchangeable in the code base.
Reviewed By: sivachandra, mikhail.ramalho
Differential Revision: https://reviews.llvm.org/D152459
Jingu Kang [Wed, 31 May 2023 09:12:37 +0000 (10:12 +0100)]
[AArch64] Try to combine MULL with uzp1.
For example,
smull(trunc(x), extract_high(y))
==>
smull(extract_high(uzp1(undef,x)), extract_high(y))
-> It will be matched to smull2
Differential Revision: https://reviews.llvm.org/D150969
Younan Zhang [Fri, 9 Jun 2023 10:51:47 +0000 (18:51 +0800)]
[clangd] Unify printing policy for type hints
(This patch addresses the comment from https://reviews.llvm.org/D151785#4402460.)
Previously, we used a special printing policy that enabled `PrintCanonicalTypes`
to print type hints for structure bindings. This was intended to
eliminate type aliases like `tuple_element::type`. However, this also
caused TypePrinter to print default template arguments, which could
result in losing the ability to see types like `std::basic_string<char>`
if the fully expanded template-id exceeded the default inlay hint threshold.
Simply getting the canonical type at the call site could help us get rid of
the side effect.
This also merges overloaded `addTypeHint` into one function without
`PrintingPolicy`.
Reviewed By: nridge
Differential Revision: https://reviews.llvm.org/D152520
Simon Pilgrim [Tue, 13 Jun 2023 13:12:13 +0000 (14:12 +0100)]
[LoopVectorize][X86] Regenerate slm-no-vectorize.ll
Krzysztof Parzyszek [Fri, 2 Jun 2023 23:17:39 +0000 (16:17 -0700)]
[RDF] Add RegisterRef::idx and make toUnitId constexpr
Francesco Petrogalli [Tue, 13 Jun 2023 12:04:05 +0000 (14:04 +0200)]
[MISched][scheduleDump] Use stable_sort to prevent test failures.
When building the compiler with -DLLVM_ENABLE_EXPENSIVE_CHECKS=ON,
sometimes resources that are dumped in scheduled traces gets reordered
even if they are booked in the same cycle. Using `stable_sort`
guarantees that such occasional reordering does not happen.
This change should fix failures like the one seen in
https://lab.llvm.org/buildbot/#/builders/16/builds/49592.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D152800
Serge Pavlov [Tue, 13 Jun 2023 10:50:03 +0000 (17:50 +0700)]
Use SelectionDAGBuiler::getRoot instead of SelectionDAG::getRoot
Marco Elver [Tue, 13 Jun 2023 11:46:19 +0000 (13:46 +0200)]
[compiler-rt] Disable interceptor trampoline for SPARC
SPARC jmp requires a delay slot after, and without it will likely result
in a crash. For now, just disable interceptor trampolines on SPARC,
because the specific usecase for them (3 interceptors) does not exist on
SPARC (yet). We can revisit, and carefully implement the support for
SPARC when required.
Reported-by: ro
OCHyams [Tue, 13 Jun 2023 11:42:36 +0000 (12:42 +0100)]
Reapply D146987 "[Assignment Tracking] Enable by default"
See https://discourse.llvm.org/t/rfc-enable-assignment-tracking/69399
This sets the -Xclang -fexperimental-assignment-tracking flag to the value
enabled which means it will be enabled so long as none of the following are
true: it's an LTO build, LLDB debugger tuning has been specified, or it's an O0
build (no work is done in any case if -g is not specified or -gmlt is used).
This reverts commit
9e7f14a8211c82dca64bd6b22d1c450d4c6d3e5b which reverts
https://reviews.llvm.org/D146987
Haojian Wu [Tue, 13 Jun 2023 09:22:16 +0000 (11:22 +0200)]
[Tooling/Inclusion] Add missing PRI family macros.
Differential Revision: https://reviews.llvm.org/D152792
Dhruv Chawla [Sun, 11 Jun 2023 08:01:39 +0000 (13:31 +0530)]
[NFC][BlockFrequency] Move operator definitions into header
While BlockFrequency::operator+= is a very simple operation, it's
definition is present in another TU which means that it doesn't get
inlined in non-LTO builds. This means that there is some performance
left on the table in those builds, as this operator is called many
times.
This patch moves that operator (and a few others) into the
BlockFrequency.h header which gives a small speedup (~0.1%):
https://llvm-compile-time-tracker.com/compare.php?from=
6ee594be53e7efaa12086ad20f0d0268092a4c73&to=
6ac6cd99e211fae5ae5de41ad608604aa22f1882&stat=instructions%3Au
Differential Revision: https://reviews.llvm.org/D152781
OCHyams [Tue, 13 Jun 2023 10:07:37 +0000 (11:07 +0100)]
[NFC] Combine several DW_AT_const_value tests
Split from D151795. I'm not sure it's conclusive, but these are all the related
tests I could find easily.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D152719
Younan Zhang [Wed, 31 May 2023 06:49:32 +0000 (14:49 +0800)]
[clangd] Desugar template parameter aliases in type hints
This patch alleviates https://github.com/clangd/clangd/issues/1298.
Containers in C++ such as `std::vector` or `llvm::SmallVector`,
introduce a series of type aliases to adapt to generic algorithms.
Currently, If we write an declarator involving expressions with
these containers and `auto` placeholder, we probably obtain opaque
type alias like following:
```
std::vector<int> v = {1, 2, 3};
auto value = v[1]; // hint for `value`: value_type
auto *ptr = &v[0]; // hint for `ptr`: value_type *
```
These hints are useless for most of the time. It would be nice if we
desugar the type of `value_type` and print `int`, `int *` respectively
in this situation. But note we can't always prefer desugared type
since user might introduce type-aliases for brevity, where printing
sugared types makes more sense.
This patch introduces a heuristic method that displays the desugared
type that is an alias of template parameter. It merges
analogous method `shouldPrintCanonicalType` into `maybeDesugar` as well.
Previous commit for shouldPrintCanonicalType:
dde8a0fe91cc
Reviewed By: nridge
Differential Revision: https://reviews.llvm.org/D151785
Simon Pilgrim [Tue, 13 Jun 2023 10:55:41 +0000 (11:55 +0100)]
[X86] X86FixupVectorConstantsPass - attempt to replace full width fp vector constant loads with broadcasts on AVX+ targets (REAPPLIED)
lowerBuildVectorAsBroadcast will not broadcast splat constants in all cases, resulting in a lot of situations where a full width vector load that has failed to fold but is loading splat constant values could use a broadcast load instruction just as cheaply, and save constant pool space.
NOTE: SSE3 targets can use MOVDDUP but not all SSE era CPUs can perform this as cheaply as a vector load, we will need to add scheduler model checks if we want to pursue this.
This is an updated commit of
98061013e01207444cfd3980cde17b5e75764fbe after being reverted at
a279a09ab9524d1d74ef29b34618102d4b202e2f
Hans Wennborg [Tue, 13 Jun 2023 10:50:51 +0000 (12:50 +0200)]
Revert "[Driver] Mark m_x86_Features_Group options as TargetSpecific"
This broke cross-builds of llvm from x86_64 to arm64 mac, see
comment on
https://github.com/llvm/llvm-project/commit/
1d6c3e29f6aa45914faa7be00a939b8f550f38e9
> so that they get an error on non-x86 targets.
> Follow-up to D151590.
>
> As a workaround for https://github.com/llvm/llvm-project/issues/63270, we don't
> report an error for -msse4.2.
This reverts commit
1d6c3e29f6aa45914faa7be00a939b8f550f38e9.
Jie Fu [Tue, 13 Jun 2023 10:33:49 +0000 (18:33 +0800)]
Remove unused functions in X86LegalizerInfo.cpp (NFC)
/home/jiefu/llvm-project/llvm/lib/Target/X86/X86LegalizerInfo.cpp:48:1: error: unused function 'widen_1' [-Werror,-Wunused-function]
widen_1(const LegacyLegalizerInfo::SizeAndActionsVec &v) {
^
1 error generated.
David Green [Tue, 13 Jun 2023 10:21:18 +0000 (11:21 +0100)]
[AArch64][SVE] Extra patterns for predicated and/or/xor
Similar to the other patterns, this adds predicated and/xor/xor patterns.
Differential Revision: https://reviews.llvm.org/D151086
Elliot Goodrich [Tue, 13 Jun 2023 09:00:41 +0000 (10:00 +0100)]
[llvm] Fix include guards
Add missing include guards to LLVM header files that did not previously
have them and update existing include guards to ensure that they enclose
all non-whitespace, non-comment text to enable these headers for the
multiple-include optimization.
Differential Revision: https://reviews.llvm.org/D150511
Simon Pilgrim [Tue, 13 Jun 2023 09:15:02 +0000 (10:15 +0100)]
MachineConstantPool::getConstantPoolIndex - don't reuse mismatched constants contained undef/poison (Issue #63108)
This patch fixes an issue where we were reusing constant pool entries that contained undef elements, despite the additional uses of the 'equivalent constant' requiring some/all of the elements to be zero.
The CanShareConstantPoolEntry helper function uses ConstantFoldCastOperand to bitcast the type mismatching constants to integer representations to allow comparison, but unfortunately this treats undef elements as zero (which they will be written out as in the final asm). This caused an issue where the original constant pool entry contained undef elements, which was shared with a later constant that required the elements to be zero. This then caused a later analysis pass to incorrectly discard these undef elements.
Ideally we need a more thorough analysis/merging of the constant pool entries so the elements are forced to real zero elements, but for now we just prevent reuse of the constant pool entry entirely if the constants don't have matching undef/poison elements.
Fixes #63108
Differential Revision: https://reviews.llvm.org/D152357
Simon Pilgrim [Tue, 13 Jun 2023 08:57:23 +0000 (09:57 +0100)]
[GlobalIsel][X86] Update legalization of G_PHI/G_BRCOND
Replace the legacy legalizer versions - still WIP but matches existing features, plus handles legal vector types.
Simon Pilgrim [Mon, 12 Jun 2023 19:05:20 +0000 (20:05 +0100)]
[GlobalIsel][X86] Regenerate legalize-phi.mir
Pierre Gousseau [Tue, 13 Jun 2023 09:14:40 +0000 (10:14 +0100)]
[CMake] Enable building with UBSAN + clang-cl on windows.
Currently both ASAN and UBSAN are supported on Windows but only ASAN is enabled in LLVM build system. This patch enables the option to build LLVM with UBSAN on windows.
Tested with clang-cl released in LLVM16.
Submitting on behalf of @dwang.
Reviewed by: andrewng, pgousseau
Differential Revision: https://reviews.llvm.org/D151511
Amaury Séchet [Wed, 7 Jun 2023 11:24:38 +0000 (11:24 +0000)]
[DAGCombine] Make sure combined nodes are added back to the worklist in topological order.
Currently, a node and its users are added back to the worklist in reverse topological order after it is combined. This diff changes that order to be topological. This is part of a larger migration to get the DAGCombiner to process nodes in topological order.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D127115
Mikael Holmen [Mon, 12 Jun 2023 12:06:35 +0000 (14:06 +0200)]
[test][SLPVectorizer] Precommit testcase showing debug info affects codegen
Differential Revision: https://reviews.llvm.org/D152705
Mariya Podchishchaeva [Tue, 13 Jun 2023 07:50:10 +0000 (03:50 -0400)]
[C++20] Claim full support for consteval again
After resolving several outstanding issues now is the time to mark it as
fully supported.
Fixes https://github.com/llvm/llvm-project/issues/57094
Reviewed By: aaron.ballman, cor3ntin, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D147717
Florian Hahn [Tue, 13 Jun 2023 07:26:55 +0000 (08:26 +0100)]
[VPlan] Replace versioned stride with constant during VPlan opts.
After constructing the initial VPlan, replace VPValues for versioned
strides with their constant counterparts.
Differential Revision: https://reviews.llvm.org/D147783
rikhuijzer [Tue, 13 Jun 2023 07:05:28 +0000 (09:05 +0200)]
[MLIR][Doc] Also print `summary`s for passes on a newline
This patch is improves upon https://reviews.llvm.org/D152621. There, I pointed out some issues with D152621, which I'll repeat here.
> Passes use a different logic for generating the documentation; which I didn't update to be in-line with this change.
Fixed by defining and using `mlir::tblgen::emitSummary`. This is now used in `OpDocGen.cpp` and `PassDocGen.cpp`.
Note that the passes documentation currently prints the summary behind the pass argument. For example:
```
#### -arm-neon-2d-to-intr: Convert Arm NEON structured ops to intrinsics
```
at https://mlir.llvm.org/docs/Passes/#-promote-buffers-to-stack-promotes-heap-based-allocations-to-automatically-managed-stack-based-allocations.
This currently differs from how the summary is printed for Ops. For example:
```
#### amdgpu.lds_barrier (::mlir::amdgpu::LDSBarrierOp) ¶
**Summary:** _Barrier that includes a wait for LDS memory operations._
```
at https://mlir.llvm.org/docs/Dialects/AMDGPU/#amdgpulds_barrier-mliramdgpuldsbarrierop.
The changes in this patch ensure that:
1. The summary is always printed on a new line.
2. The summary is always printed in italic.
3. The summary always starts with a capital letter.
I've dropped the `**Summary:**`, which was introduced in D152621, because only italicization should be already clear enough.
> `amx.tdpbssd` shows **Summary:** __ meaning that apparently hasSummary does not guarantee a non-empty summary.
This is fixed by double-checking `!summary.empty()`, because the following code
```cpp
void mlir::tblgen::emitSummary(StringRef summary, raw_ostream &os) {
if (!summary.empty()) {
char first = std::toupper(summary.front());
llvm::StringRef rest = summary.drop_front();
os << "\n_" << first << rest << "_\n\n";
} else {
os << "\n_" << "foo" << "_\n\n";
}
}
```
generates the following Markdown:
```
### `amx.tdpbssd` (::mlir::amx::x86_amx_tdpbssd)
_foo_
```
in `tools/mlir/docs/Dialects/AMX.md`.
> Summary fields containing * cancel the italicization, so the * should probably be escaped to solve this. EDIT: Nope. This is because mlir-www runs Hugo 0.80 whereas 0.111 correctly parses _Raw Buffer Floating-point Atomic Add (MI-* only)_ as an italicized string.
This will be fixed by https://github.com/llvm/mlir-www/pull/152.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D152648
Kazu Hirata [Tue, 13 Jun 2023 07:24:49 +0000 (00:24 -0700)]
[Sema] Remove unused member variable MSVCGuidDecl
The last use was removed by:
commit
bab6df86aefc5ea4aa3895da7cf46be37add676d
Author: Richard Smith <richard@metafoo.co.uk>
Date: Sat Apr 11 22:15:29 2020 -0700
Kazu Hirata [Tue, 13 Jun 2023 07:24:47 +0000 (00:24 -0700)]
[StaticAnalyzer] Remove unused function hasGlobalsOrParametersStorage
The last use was removed by:
commit
e2e37b9afc0a0a66a1594377a88221e115d95348
Author: Ted Kremenek <kremenek@apple.com>
Date: Thu Jul 28 23:08:02 2011 +0000
Kazu Hirata [Tue, 13 Jun 2023 07:24:46 +0000 (00:24 -0700)]
[Driver] Remove unused declaration addTranslatorArgs
The declaration was added without a use by:
commit
49682f14bf3fb8db5e2721d9896b27bb4c2bd635
Author: Henry Linjamäki <henry.linjamaki@parmance.com>
Date: Wed Nov 17 11:23:49 2021 +0300
Kazu Hirata [Tue, 13 Jun 2023 07:24:44 +0000 (00:24 -0700)]
[StaticAnalyzer] Remove several unused declarations
The function definition of GenerateAutoTransition was removed by:
commit
b1d3d968725baf28a00b12aad760434036cbe704
Author: Anna Zaks <ganna@apple.com>
Date: Thu Oct 27 00:59:23 2011 +0000
The function definitions of enqueueEndOfPath and GenerateCallExitNode
were removed by:
commit
0ec04bf73885df3e10bd7fcd5c8ce901cad7d76c
Author: Anna Zaks <ganna@apple.com>
Date: Thu Oct 27 00:59:28 2011 +0000
Kazu Hirata [Tue, 13 Jun 2023 07:24:43 +0000 (00:24 -0700)]
[clang] Use DenseMapBase::lookup (NFC)
Kazu Hirata [Tue, 13 Jun 2023 07:24:41 +0000 (00:24 -0700)]
[ADT] Remove deprecated functions in APInt
This patch removes functions deprecated by:
commit
462b29019b20cf7b25c68ec952b1f92930f5035d
Author: Kazu Hirata <kazu@google.com>
Date: Sun Mar 5 22:48:28 2023 -0800
Differential Revision: https://reviews.llvm.org/D152657
Kazu Hirata [Tue, 13 Jun 2023 07:24:40 +0000 (00:24 -0700)]
[Sema] Remove unused isNonTypeNestedNameSpecifier
The last use was removed by:
commit
04f131da0b19abff611773c03be9bafb53c753ce
Author: Richard Smith <richard@metafoo.co.uk>
Date: Fri Jan 24 15:14:25 2020 -0800
Differential Revision: https://reviews.llvm.org/D152634
Kazu Hirata [Tue, 13 Jun 2023 07:24:38 +0000 (00:24 -0700)]
[ExecutionEngine] Remove unused functions
This patch removes:
cloneModuleFlagsMetadata
moveFunctionBody
moveGlobalVariableInitializer
Their last uses were removed by:
commit
6154c4115cd4b78d0171892aac21e340e72e32bd
Author: Lang Hames <lhames@gmail.com>
Date: Mon Sep 7 21:21:28 2020 -0700
Differential Revision: https://reviews.llvm.org/D152668
Christopher Ferris [Tue, 13 Jun 2023 06:55:26 +0000 (23:55 -0700)]
Revert "[scudo] Fix MallocIterateBoundary on 32 bit."
This reverts commit
5e691a1c9b0ad22689d4a434ddf4fed940e58dec.
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D152779
Noah Goldstein [Tue, 13 Jun 2023 05:53:31 +0000 (00:53 -0500)]
Revert "[FunctionAttrs] Propagate some func/arg/ret attributes from caller to callsite (WIP)"
Accidental commit/push!
This reverts commit
4fa971ff62c3c48c606b792c572c03bd4d5906ee.
Noah Goldstein [Tue, 13 Jun 2023 05:53:19 +0000 (00:53 -0500)]
Revert "100 checks"
Accidental commit/push!
This reverts commit
b76bd2db65b4890f1ec494fa95286533dd6b09e5.
Noah Goldstein [Tue, 13 Jun 2023 05:51:37 +0000 (00:51 -0500)]
100 checks
Noah Goldstein [Tue, 13 Jun 2023 05:43:22 +0000 (00:43 -0500)]
[FunctionAttrs] Propagate some func/arg/ret attributes from caller to callsite (WIP)
This is the consolidation of D151644 and D151943 moved from
InstCombine to FunctionAttrs. This is based on discussion in the above
patches as well as D152081 (Attributor). This patch was written in a
way so it can have an immediate impact in currently active passes
(FunctionAttrs), but should be easy to port elsewhere (Attributor or
Inliner) if that makes more sense later on.
Some function attributes imply the attribute for all/some instructions
in the function. These attributes can be safely propagated to
callsites within the function that are missing the attribute. This can
be useful when 1) analyzing individual instructions in a function
and 2) if the original caller is later inlined, as if the attributes are
not propagated, they will be lost.
This patch implements propagation in a new class/file
`InferCallsiteAttrs` which can hypothetically be included elsewhere.
At the moment this patch infers the following:
Function Attributes:
- mustprogress
- nofree
- willreturn
- All memory attributes (readnone, readonly, writeonly, argmem,
etc...)
- The memory attributes are only propagated IFF the set of
pointers available to the callsite is the same as the set
available outside the caller (i.e no local memory arguments
from alloca or local malloc like functions).
Argument Attributes:
- noundef
- nonnull
- nofree
- readnone
- readonly
- writeonly
- nocapture
- nocapture is only propagated IFF the set of pointers
available to the callsite is the same as the set available
outside the caller and its guranteed that between the
callsite and function return, the state of any capture
pointers will not change (so the nocaptured gurantee of the
caller has been met by the instruction preceding the
callsite and will not changed).
Argument are only propagated to callsite arguments that are also function
arguments, but not derived values.
Return Attributes:
- noundef
- nonnull
Return attributes are only propagated if the callsite's return value
is used as the caller's return and execution is guranteed to pass from
callsite to return.
The compile time hit of this for -O3 and -O3+thinLTO is ~[.02, .37]%
regression. Proper LTO, however, has more significant regressions (up
to 3.92%):
https://llvm-compile-time-tracker.com/compare.php?from=
94407e1bba9807193afde61c56b6125c0fc0b1d1&to=
79feb6e78b818e33ec69abdc58c5f713d691554f&stat=instructions:u
Differential Revision: https://reviews.llvm.org/D152226
Christopher Ferris [Tue, 13 Jun 2023 01:59:01 +0000 (18:59 -0700)]
[scudo] Fix MallocIterateBoundary on 32 bit.
On Android, the 32 bit value of 8 for BlockDelta results in a
failure because a valid pointer can never be found.
Change the code to always use 16 which passes on both 32 bit
and 64 bit.
Verified that re-introducing the old bug causes the test to fail
on both 32 bit and 64 with the new BlockDelta value.
Reviewed By: Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D152767
Hristo Hristov [Sun, 11 Jun 2023 19:17:19 +0000 (22:17 +0300)]
[libc++][spaceship] P1612R2: Removed `operator!=` from `locale`
Implemented parts of P1612R2:
- Removed `operator!=` from `locale`
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D152654
Hristo Hristov [Sun, 11 Jun 2023 19:45:16 +0000 (22:45 +0300)]
[libc++][spaceship][NFC] P1612R2: Mark some items "remove `operator!=` from `*_iterator`" as "Complete"
Several parts of P1612R2 are already implemented:
- `common_iterator` (new in C++20) https://reviews.llvm.org/D103335
- `unreachable_sentinel_t` (new in C++20) https://reviews.llvm.org/D107920
- `istream_iterator` (removed) https://reviews.llvm.org/D119620
- `istreambuf_iterator` (removed) https://reviews.llvm.org/D119620
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D152656
Jacques Pienaar [Wed, 7 Jun 2023 22:42:03 +0000 (15:42 -0700)]
[mlir][docgen] Enable custom prefix strip for op name.
The fully qualified name gets long in the TOC (especially on mobile),
enable specifying a prefix to be stripped.
Differential Revision: https://reviews.llvm.org/D152404
Ryan Prichard [Tue, 13 Jun 2023 03:43:00 +0000 (20:43 -0700)]
[libc++] Android temp dir is /data/local/tmp, enable Windows test
[libc++] Android temp dir is /data/local/tmp, enable Windows test
On Android, std::filesystem::temp_directory_path() should fall back to
/data/local/tmp when no environment variable is set. There is no /tmp
directory. Most apps can't access /data/local/tmp, but they do have a
"cache dir" (Context#getCacheDir()) that is usable for temporary files.
However, there is no obvious and reliable way for libc++ to query this
directory in contexts where it is available. The global fallback
/data/local/tmp is available for "adb shell", making it useful for test
suites.
On Windows, temp_directory_path falls back to the Windows directory
(e.g. "C:\Windows"), so call GetWindowsDirectoryW to do the test.
Reviewed By: ldionne, #libc, enh
Differential Revision: https://reviews.llvm.org/D137131
Kun Wu [Tue, 13 Jun 2023 02:10:16 +0000 (02:10 +0000)]
[mlir][sparse][GPU] add 2:4 integration test
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D152287
Matt Arsenault [Mon, 12 Jun 2023 20:25:51 +0000 (16:25 -0400)]
AMDGPU: Correct constants used in fast math log expansion
The division between float constants was done with less
precision. Performing the divide in double and truncating to float
provides the same value as used in the library fast math expansion.
Matt Arsenault [Sat, 10 Jun 2023 20:39:32 +0000 (16:39 -0400)]
AMDGPU: Modernize log codegen tests
Matt Arsenault [Sun, 11 Jun 2023 00:03:16 +0000 (20:03 -0400)]
AMDGPU: Add basic folds for llvm.amdgcn.log