platform/upstream/llvm.git
2 years ago[ADT] Use std::add_pointer_t (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:18 +0000 (23:27 -0700)]
[ADT] Use std::add_pointer_t (NFC)

2 years ago[ADT] Use std::add_lvalue_reference_t (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:16 +0000 (23:27 -0700)]
[ADT] Use std::add_lvalue_reference_t (NFC)

2 years ago[Support] Simplify reverseBits with constexpr if (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:15 +0000 (23:27 -0700)]
[Support] Simplify reverseBits with constexpr if (NFC)

Differential Revision: https://reviews.llvm.org/D132814

2 years ago[Support] Simplify isInt and isUInt with constexpr if (NFC)
Kazu Hirata [Sun, 4 Sep 2022 06:27:13 +0000 (23:27 -0700)]
[Support] Simplify isInt and isUInt with constexpr if (NFC)

Differential Revision: https://reviews.llvm.org/D132813

2 years ago[test] Make tests pass regardless of gnu++14/gnu++17 default
Fangrui Song [Sun, 4 Sep 2022 05:29:32 +0000 (05:29 +0000)]
[test] Make tests pass regardless of gnu++14/gnu++17 default

GCC from 11 onwards defaults to -std=gnu++17 for C++ source files. We want to do the same
(https://discourse.llvm.org/t/c-objc-switch-to-gnu-17-as-the-default-dialect/64360).
Split RUN lines, adjust `-verify`, or add `__cplusplus < 201703L` or `-Wno-dynamic-exception-spec`,
so that tests will pass regardless of gnu++14/gnu++17 default.

We have a desire to mark a test compatible with multiple language standards.
There are ongoing discussions how to add markers in the long term:

* https://discourse.llvm.org/t/iterating-lit-run-lines/62596
* https://discourse.llvm.org/t/lit-run-a-run-line-multiple-times-with-different-replacements/64932

As a workaround in the short term, add lit substitutions `%std_cxx98-`,
`%std_cxx11-14`, etc. They can be used for tests which work across multiple
language standards. If a range has `n` standards, run lit multiple times, with
`LIT_CLANG_STD_GROUP=0`, `LIT_CLANG_STD_GROUP=1`, etc to cover all `n` standards.

Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D131464

2 years ago[mlir][sparse] Expose SparseTensor passes as enums instead of opaque numbers for...
Nick Kreeger [Sun, 4 Sep 2022 01:39:35 +0000 (01:39 +0000)]
[mlir][sparse] Expose SparseTensor passes as enums instead of opaque numbers for vectorization and parallelization options.

The SparseTensor passes currently use opaque numbers for the CLI, despite using an enum internally. This patch exposes the enums instead of numbered items that are matched back to the enum.

Fixes https://github.com/llvm/llvm-project/issues/53389

Differential Revision: https://reviews.llvm.org/D123876

Please also see:
https://reviews.llvm.org/D118379
https://reviews.llvm.org/D117919

2 years ago[SanitizerCoverage] Simplify pc-table and improve test. NFC
Fangrui Song [Sat, 3 Sep 2022 21:29:21 +0000 (14:29 -0700)]
[SanitizerCoverage] Simplify pc-table and improve test. NFC

2 years ago[test][mlir] Restore used attributes deleted by D132726
Vitaly Buka [Sat, 3 Sep 2022 21:07:28 +0000 (14:07 -0700)]
[test][mlir] Restore used attributes deleted by D132726

2 years agoRevert "[mlir][sparse] Expose SparseTensor passes as enums instead of opaque"
Nick Kreeger [Sat, 3 Sep 2022 20:47:40 +0000 (15:47 -0500)]
Revert "[mlir][sparse] Expose SparseTensor passes as enums instead of opaque"

This reverts commit ef25b5d93d0b5621eb5d0482abd30a4e127e9223.

2 years ago[mlir][sparse] Expose SparseTensor passes as enums instead of opaque
Nick Kreeger [Sat, 3 Sep 2022 20:45:49 +0000 (15:45 -0500)]
[mlir][sparse] Expose SparseTensor passes as enums instead of opaque
numbers for vectorization and parallelization options.

The SparseTensor passes currently use opaque numbers for the CLI,
despite using an enum internally. This patch exposes the enums instead
of numbered items that are matched back to the enum.

Fixes https://github.com/llvm/llvm-project/issues/53389

Differential Revision: https://reviews.llvm.org/D123876

Please also see:
https://reviews.llvm.org/D118379
https://reviews.llvm.org/D117919

2 years agoRevert "[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is...
Vitaly Buka [Sat, 3 Sep 2022 20:12:49 +0000 (13:12 -0700)]
Revert "[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type"

Breakes windows bot.

This reverts commit 3ad2fe913ae08ca062105731ad2da2eae825c731.

2 years ago[OpenMP] add a offload test involving std::complex
Ye Luo [Sat, 3 Sep 2022 18:27:33 +0000 (13:27 -0500)]
[OpenMP] add a offload test involving std::complex

Taken from the https://github.com/llvm/llvm-project/issues/57064 reproducer.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D133258

2 years ago[llvm] Qualify auto in range-based for loops (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:49 +0000 (11:17 -0700)]
[llvm] Qualify auto in range-based for loops (NFC)

Identified with readability-qualified-auto.

2 years agoDrop empty string literals from static_assert (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:47 +0000 (11:17 -0700)]
Drop empty string literals from static_assert (NFC)

Identified with modernize-unary-static-assert.

2 years ago[llvm] Use std::remove_const_t (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:45 +0000 (11:17 -0700)]
[llvm] Use std::remove_const_t (NFC)

2 years ago[llvm] Use std::enable_if_t (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:44 +0000 (11:17 -0700)]
[llvm] Use std::enable_if_t (NFC)

2 years ago[ADT] Use std::add_const_t (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:42 +0000 (11:17 -0700)]
[ADT] Use std::add_const_t (NFC)

2 years ago[llvm] Use range-based for loops (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:40 +0000 (11:17 -0700)]
[llvm] Use range-based for loops (NFC)

2 years agoUse llvm::upper_bound (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:38 +0000 (11:17 -0700)]
Use llvm::upper_bound (NFC)

2 years agoUse llvm::lower_bound (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:37 +0000 (11:17 -0700)]
Use llvm::lower_bound (NFC)

2 years agoUse llvm::count_if (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:35 +0000 (11:17 -0700)]
Use llvm::count_if (NFC)

2 years ago[CodeGen] Use std::lcm (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:33 +0000 (11:17 -0700)]
[CodeGen] Use std::lcm (NFC)

2 years ago[BOLT] Use range-based for loops (NFC)
Kazu Hirata [Sat, 3 Sep 2022 18:17:32 +0000 (11:17 -0700)]
[BOLT] Use range-based for loops (NFC)

LLVM Coding Standards discourage for_each unless callable objects
already exist.

2 years ago[Driver] Remove unused -Ttext -Tdata -Tbss
Fangrui Song [Sat, 3 Sep 2022 17:57:29 +0000 (10:57 -0700)]
[Driver] Remove unused -Ttext -Tdata -Tbss

They lead to -Wunused-command-line-argument and should be written as -Ttext=
instead, but the driver options end with a space. -Ttext=0 can be accepted by
the JoinedOrSeparate -T, so the JoinedOrSeparate -Ttext/etc are unneeded.

2 years ago[Driver] Change some cc1 only JoinedOrSeparate long options to Separate
Fangrui Song [Sat, 3 Sep 2022 17:45:30 +0000 (10:45 -0700)]
[Driver] Change some cc1 only JoinedOrSeparate long options to Separate

They are error-prone as they do not end with `=`.
Note: for driver -isystem/etc, we have to support the Joined form.

2 years ago[CostModel][X86] Adjust mul v4i32/v8i32 throughput cost
Simon Pilgrim [Sat, 3 Sep 2022 17:45:04 +0000 (18:45 +0100)]
[CostModel][X86] Adjust mul v4i32/v8i32 throughput cost

Based off the numbers from AMD SoG + Agner - vXi32 are both half-rate, and znver1 double-pumps the v8i32 op

We should have caught this earlier as many Intel models have half-rate pmulld already :-(

2 years ago[CostModel][X86] Add CostKinds handling for add/sub ops
Simon Pilgrim [Sat, 3 Sep 2022 16:18:26 +0000 (17:18 +0100)]
[CostModel][X86] Add CostKinds handling for add/sub ops

This was achieved using the 'cost-tables vs llvm-mca' script D103695

2 years ago[lldb][bindings] Fix module_access handling of regex
Dave Lee [Thu, 1 Sep 2022 17:30:38 +0000 (10:30 -0700)]
[lldb][bindings] Fix module_access handling of regex

Fixes broken support for: `target.module[re.compile("libFoo")]`

There were two issues:
1. The type check was expecting `re.SRE_Pattern`
2. The expression to search the module path had a typo

In the first case, `re.SRE_Pattern` does not exist in Python 3, and is replaced
with `re.Pattern`.

While editing this code, I changed the type checks to us `isinstance`, which is
the conventional way of type checking.

From the docs on `type()`:

> The `isinstance()` built-in function is recommended for testing the type of an object, because it takes subclasses into account.

Differential Revision: https://reviews.llvm.org/D133130

2 years ago[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type
yronglin [Sat, 3 Sep 2022 15:24:37 +0000 (23:24 +0800)]
[Clang][CodeGen] Avoid __builtin_assume_aligned crash when the 1st arg is array type

Avoid __builtin_assume_aligned crash when the 1st arg is array type(or string literal).

Open issue: https://github.com/llvm/llvm-project/issues/57169

Reviewed By: rjmccall

Differential Revision: https://reviews.llvm.org/D133202

2 years ago[CostModel][X86] Add CostKinds handling for fdiv ops
Simon Pilgrim [Sat, 3 Sep 2022 14:48:33 +0000 (15:48 +0100)]
[CostModel][X86] Add CostKinds handling for fdiv ops

This was achieved with an updated version of the 'cost-tables vs llvm-mca' script D103695

As we're using 'typical' worst case values, not all cost entries come from a single CPU - e.g. the latency/throughput from haswell but the size-latency(uops) from zen1/alderlake-e due to 'double pumping'

As the uop count (used for TCK_SizeAndLatency) for divss/divps is typically so low, we need to override isExpensiveToSpeculativelyExecute to ensure we keep fdiv calls behind branches - although for some very recent cpu targets it might not be necessary any more and could be relaxed.

2 years ago[SCCP] add helper function for replacing signed operations; NFC
Sanjay Patel [Sat, 3 Sep 2022 14:12:13 +0000 (10:12 -0400)]
[SCCP] add helper function for replacing signed operations; NFC

Preliminary refactoring for planned enhancement in D133198.

2 years ago[X86] Fix fdiv throughput/latency/uops counts
Simon Pilgrim [Sat, 3 Sep 2022 14:23:41 +0000 (15:23 +0100)]
[X86] Fix fdiv throughput/latency/uops counts

Matches znver1/2 numbers from AMD SoG + Agner - no additional uops for folded instructions and znver1 double pumps 256-bit vectors

Matches skylake/icelake throughput numbers from Intel AoM + Agner/instlatx64

Noticed while adding fdiv CostKinds support

2 years ago[MLIR] Single lit config attribute for CMAKE_LIBRARY_OUTPUT_DIRECTORY
Christian Sigg [Sat, 3 Sep 2022 07:15:34 +0000 (09:15 +0200)]
[MLIR] Single lit config attribute for CMAKE_LIBRARY_OUTPUT_DIRECTORY

Replace the following config attributes with `mlir_lib_dir`:
- `mlir_runner_utils_dir`
- `linalg_test_lib_dir`
- `spirv_wrapper_library_dir`
- `vulkan_wrapper_library_dir`
- `mlir_integration_test_dir`

I'm going to clean up substitutions in separate changes.

Reviewed By: aartbik, mehdi_amini

Differential Revision: https://reviews.llvm.org/D133217

2 years ago[InstCombine] reduce another or-xor bitwise logic pattern
Sanjay Patel [Sat, 3 Sep 2022 12:57:00 +0000 (08:57 -0400)]
[InstCombine] reduce another or-xor bitwise logic pattern

~(A & ?) | (A ^ B) --> ~((A & ?) & B)
https://alive2.llvm.org/ce/z/mxex6V

This is similar to 9d218b61cc50 where we peeked through
another logic op to find a common operand.

2 years ago[InstCombine] add tests for or-xor-nand; NFC
Sanjay Patel [Fri, 2 Sep 2022 19:03:13 +0000 (15:03 -0400)]
[InstCombine] add tests for or-xor-nand; NFC

2 years ago[CostModel][X86] Add fdiv(double) throughput x87 costs for
Simon Pilgrim [Sat, 3 Sep 2022 13:08:25 +0000 (14:08 +0100)]
[CostModel][X86] Add fdiv(double) throughput x87 costs for

2 years ago[AMDGPU] Add -verify-machineinstrs to attr-amdgpu-flat-work-group-size* tests
Simon Pilgrim [Sat, 3 Sep 2022 12:47:41 +0000 (13:47 +0100)]
[AMDGPU] Add -verify-machineinstrs to attr-amdgpu-flat-work-group-size* tests

These were affected by D131825 (and reported on Issue #57149) - adding the verification will help ensure that we don't hit this again on builds with EXPENSIVE_CHECKS enabled

2 years ago[DAG] canCreateUndefOrPoison - add freeze(insert_subvector(x,y,c)) -> insert_subvecto...
Simon Pilgrim [Sat, 3 Sep 2022 12:41:33 +0000 (13:41 +0100)]
[DAG] canCreateUndefOrPoison - add freeze(insert_subvector(x,y,c)) -> insert_subvector(freeze(x),freeze(y),c) support

We already have plenty of assertions in place to ensure that the insertion index is constant and inrange

2 years ago[X86] Add test showing failure to fold freeze(insert_subvector(x,y,c)) -> insert_subv...
Simon Pilgrim [Sat, 3 Sep 2022 12:27:08 +0000 (13:27 +0100)]
[X86] Add test showing failure to fold freeze(insert_subvector(x,y,c)) -> insert_subvector(freeze(x),freeze(y),c)

If at least one of x and y are known never poison.

2 years ago[TTI] Add isExpensiveToSpeculativelyExecute wrapper
Simon Pilgrim [Sat, 3 Sep 2022 12:12:15 +0000 (13:12 +0100)]
[TTI] Add isExpensiveToSpeculativelyExecute wrapper

CGP uses a raw `getInstructionCost(I, TargetTransformInfo::TCK_SizeAndLatency) >= TCC_Expensive` check to see if its better to move an expensive instruction used in a select behind a branch instead.

This is causing issues with upcoming improvements to TCK_SizeAndLatency costs on X86 as we need to use TCK_SizeAndLatency as an uop count (so its compatible with various target-specific buffer sizes - see D132288), but we can have instructions that have a low TCK_SizeAndLatency value but should still be treated as 'expensive' (FDIV for example) - by adding a isExpensiveToSpeculativelyExecute wrapper we can keep the current behaviour but still add an x86 override in a future patch when the cost tables are updated to compensate.

2 years ago[libc++] Implement P2273R3 (`constexpr` `unique_ptr`)
Igor Zhukov [Sat, 3 Sep 2022 11:49:50 +0000 (18:49 +0700)]
[libc++] Implement P2273R3 (`constexpr` `unique_ptr`)

Reviewed By: mordante, #libc

Differential Revision: https://reviews.llvm.org/D131315

2 years ago[NFC][libc++] Uses the new way to mark Standard includes.
Mark de Wever [Sat, 3 Sep 2022 11:35:48 +0000 (13:35 +0200)]
[NFC][libc++] Uses the new way to mark Standard includes.

2 years ago[NFC][libc++][format] Removes unused code.
Mark de Wever [Sat, 3 Sep 2022 11:34:14 +0000 (13:34 +0200)]
[NFC][libc++][format] Removes unused code.

The code was for backwards compatibility with code no longer present in
format.

2 years ago[NFC][libc++] Removes GCC-11 support.
Mark de Wever [Sat, 3 Sep 2022 11:20:10 +0000 (13:20 +0200)]
[NFC][libc++] Removes GCC-11 support.

GCC-11 isn't supported in libc++ so remove UNSUPPORTED directives.

2 years ago[X86] Fix fmul throughput/latency/uops counts
Simon Pilgrim [Sat, 3 Sep 2022 10:10:51 +0000 (11:10 +0100)]
[X86] Fix fmul throughput/latency/uops counts

Matches numbers from AMD SoG + Agner - should always be on FPU Pipes 0+1, no additional uops for folded instructions and znver1 double pumps 256-bit vectors and is always latency = 4cy for f64 multiplies

Noticed while adding fmul CostKinds support to the x86 cost models in rG0735200e3f50 and znver1 wasn't being flagged as requiring 2uop for 256-bit vectors

2 years ago[CostModel][X86] Add CostKinds handling for fmul ops
Simon Pilgrim [Sat, 3 Sep 2022 09:42:20 +0000 (10:42 +0100)]
[CostModel][X86] Add CostKinds handling for fmul ops

This was achieved with an updated version of the 'cost-tables vs llvm-mca' script D103695

As we're using 'typical' worst case values, not all cost entries come from a single CPU - e.g. the latency/throughput from haswell but the size-latency(uops) from zen1/alderlake-e due to 'double pumping'

2 years ago[CostModel][X86] Remove unused float x87 costs
Simon Pilgrim [Sat, 3 Sep 2022 08:59:14 +0000 (09:59 +0100)]
[CostModel][X86] Remove unused float x87 costs

We only need the double costs for SSE1 fallback

2 years agoRevert "[Clang] change default storing path of `-ftime-trace`"
Junduo Dong [Sat, 3 Sep 2022 08:38:37 +0000 (01:38 -0700)]
Revert "[Clang] change default storing path of `-ftime-trace`"

This reverts commit 38941da066a7b785ba4771710189172e94e37824.

2 years agoRevert "[driver][clang] remove the check-time-trace test on the platform "PS4/PS5...
Junduo Dong [Sat, 3 Sep 2022 08:37:55 +0000 (01:37 -0700)]
Revert "[driver][clang] remove the check-time-trace test on the platform "PS4/PS5/Hexagon""

This reverts commit 39221ad55752c246bb8448a181847103432e12b2.

2 years ago[DWARFLinker] Refactor clang modules loading code.
Alexey Lapshin [Wed, 31 Aug 2022 12:13:26 +0000 (15:13 +0300)]
[DWARFLinker] Refactor clang modules loading code.

Current implementation of registerModuleReference() function not only
"registers" module reference, but also clones referenced module
(inside loadClangModule()). That may lead to cloning the module with
incorrect options (registerModuleReference() examines module references
and additionally accumulates MaxDwarfVersion and accel tables info).
Since accumulated options may differ from the current values,
it is incorrect to clone modules before options are fully accumulated.

This patch separates "cloning" code from "registering" code. So,
that accumulating option is done in the "registering stage" and
"cloning" is done after all modules are registered and options accumulated.
It also adds a callback for loaded compile units which can be used for
D132755 and D132371(to allow doing options accumulation outside
of DWARFLinker).

Differential Revision: https://reviews.llvm.org/D133047

2 years ago[libc++] Fixes generated output CI job.
Mark de Wever [Sat, 3 Sep 2022 08:19:35 +0000 (10:19 +0200)]
[libc++] Fixes generated output CI job.

It seems there was another file with the same issue, which didn't show
up initially.

2 years ago[NFC][libc++] Moves transitive includes location.
Mark de Wever [Fri, 2 Sep 2022 15:53:28 +0000 (17:53 +0200)]
[NFC][libc++] Moves transitive includes location.

As discussed in D132284 they will be moved to the end.

Reviewed By: #libc, Mordante

Differential Revision: https://reviews.llvm.org/D133212

2 years ago[libc++] Fixes generated output CI job.
Mark de Wever [Sat, 3 Sep 2022 08:04:44 +0000 (10:04 +0200)]
[libc++] Fixes generated output CI job.

2 years ago[bazel] Port f7b8a70e7a1738e0fc6574e3cf8faa4fa1f34eba
Benjamin Kramer [Sat, 3 Sep 2022 07:55:20 +0000 (09:55 +0200)]
[bazel] Port f7b8a70e7a1738e0fc6574e3cf8faa4fa1f34eba

2 years agoResubmit "[MLIR] Remove unused config attributes from lit.site.cfg.py"
Christian Sigg [Sat, 3 Sep 2022 06:49:51 +0000 (08:49 +0200)]
Resubmit "[MLIR] Remove unused config attributes from lit.site.cfg.py"

This resubmits commit 0816b62, reverted in commit 328bbab, but without removing the config.target_triple.

Lit checks UNSUPPORTED tags in the input against the config.target_triple (https://llvm.org/docs/TestingGuide.html#constraining-test-execution).

The original commit made the following bots start failing, because unsupported tests were no longer skipped:
- s390x: https://lab.llvm.org/buildbot/#/builders/199/builds/9247
- Windows: https://lab.llvm.org/buildbot/#/builders/13/builds/25321
- Sanitizer: https://lab.llvm.org/buildbot/#/builders/5/builds/27187

2 years ago[clang-format] Fix a bug in merging blocks with a wrapped l_brace
owenca [Thu, 1 Sep 2022 06:19:08 +0000 (23:19 -0700)]
[clang-format] Fix a bug in merging blocks with a wrapped l_brace

When the opening brace of a control statement block is wrapped, we
must check the previous line to determine whether to try to merge
the block.

Fixes #38639.
Fixes #48007.
Fixes #57421.

Differential Revision: https://reviews.llvm.org/D133093

2 years ago[ORC-RT] Refactor ORC runtime CMake for future test tool(s).
Lang Hames [Sat, 3 Sep 2022 03:55:35 +0000 (20:55 -0700)]
[ORC-RT] Refactor ORC runtime CMake for future test tool(s).

We want to move functionality from the LLVM ORCTargetProcess library into the
ORC runtime, and this will mean implementing remote-executor testing tools
(like llvm-jitlink-executor and lli-child-target) in the ORC runtime.

This patch refactors the ORC runtime build system to introduce an
add_orc_tool function that can be used to add new test tools. The code is
modeled on existing functions for adding unit tests.

A placeholder orc-rt-executor tool and test are added to verify that the
config changes behave as expected.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D133084

2 years ago[driver][clang] remove the check-time-trace test on the platform "PS4/PS5/Hexagon"
Junduo Dong [Sat, 3 Sep 2022 02:45:26 +0000 (19:45 -0700)]
[driver][clang] remove the check-time-trace test on the platform "PS4/PS5/Hexagon"

One of the test cases in that test is designed to test the compiling
jobs with a linking stage, but the PS4/PS5/Hexagon platform requires
an external linker that isn't present.

So this test do not support the "PS4/PS5/Hexagon".

2 years ago[gn build] Port bc8fd9c6335f
LLVM GN Syncbot [Sat, 3 Sep 2022 02:43:17 +0000 (02:43 +0000)]
[gn build] Port bc8fd9c6335f

2 years agoRevert "[libc++] Granularize the rest of memory"
Vitaly Buka [Sat, 3 Sep 2022 02:35:10 +0000 (19:35 -0700)]
Revert "[libc++] Granularize the rest of memory"

Breaks buildbots.

This reverts commit 30adaa730c4768b5eb06719c808b2884fcf53cf3.

2 years ago[gn build] Port 3a49cffe3add
LLVM GN Syncbot [Sat, 3 Sep 2022 02:22:45 +0000 (02:22 +0000)]
[gn build] Port 3a49cffe3add

2 years ago[libc++] Implement P2445R1 (`std::forward_like`)
Igor Zhukov [Sun, 21 Aug 2022 15:21:08 +0000 (22:21 +0700)]
[libc++] Implement P2445R1 (`std::forward_like`)

Co-authored-by: A. Jiang <de34@live.cn>
Reviewed By: philnik, huixie90, #libc

Differential Revision: https://reviews.llvm.org/D132327

2 years agoWork around Windows buildbot failure.
Richard Smith [Sat, 3 Sep 2022 02:08:04 +0000 (19:08 -0700)]
Work around Windows buildbot failure.

-fmodules-local-submodule-visibility and -fdelayed-template-parsing
don't work properly together because the template is parsed in the
visibility context of the wrong module.

2 years ago[Clang] Fix lambda CheckForDefaultedFunction(...) so that it checks the CXXMethodDecl...
Shafik Yaghmour [Sat, 3 Sep 2022 00:45:44 +0000 (17:45 -0700)]
[Clang] Fix lambda CheckForDefaultedFunction(...) so that it checks the CXXMethodDecl is not deleted before attempting to call DefineDefaultedFunction(...)

I discovered this additional bug at the end of working on D132906

In Sema::CheckCompletedCXXClass(...)  uses a lambda CheckForDefaultedFunction to
verify each CXXMethodDecl holds to the expected invariants before passing them
on to CheckForDefaultedFunction.

It is currently missing a check that it is not deleted, this adds that check and
a test that crashed without this check.

This fixes: https://github.com/llvm/llvm-project/issues/57516

Differential Revision: https://reviews.llvm.org/D133177

2 years ago[Clang] change default storing path of `-ftime-trace`
Junduo Dong [Tue, 9 Aug 2022 05:04:38 +0000 (22:04 -0700)]
[Clang] change default storing path of `-ftime-trace`

1. This implementation change the default storing behavior of -ftime-trace only.

That is, if the compiling job contains the linking action, the executable file' s directory may be seem as the main work directory.
Thus the time trace files would be stored in the same directory of linking result.

By this approach, the user can easily get the time-trace files in the main work directory. The improved demo results:

```
$ clang++ -ftime-trace -o main.out /demo/main.cpp
$ ls .
main.out   main-[random-string].json
```

2. In addition, the main codes of time-trace files' path inference have been refactored.

* The <path> of -ftime-trace=<path> is infered in clang driver
* After that, -ftime-trace=<path> can be added into clang's options

By this approach, the dirty work of path processing and judging can be implemented in driver layer, so that the clang may focus on its main work.

 #   $ clang -ftime-trace -o xxx.out xxx.cpp

Differential Revision: https://reviews.llvm.org/D131469

2 years agoRevert "[mlir][cmake] Don't add dependencies on mlir-(generic-)headers"
Mehdi Amini [Sat, 3 Sep 2022 01:43:21 +0000 (01:43 +0000)]
Revert "[mlir][cmake] Don't add dependencies on mlir-(generic-)headers"

This reverts commit 7691b69d5b2f5e9d8b210add22926335b3541444.

Bots are broken because we're missing CMake dependencies all around now.

2 years agoAttempt to make AIX bot happier.
Richard Smith [Sat, 3 Sep 2022 01:43:27 +0000 (18:43 -0700)]
Attempt to make AIX bot happier.

2 years ago[mlir:vscode] Add support for viewing and editing a bytecode file as .mlir
River Riddle [Fri, 2 Sep 2022 23:24:17 +0000 (16:24 -0700)]
[mlir:vscode] Add support for viewing and editing a bytecode file as .mlir

This commit adds support for interacting with a (valid) bytecode file in the same
way as .mlir. This allows editing, using all of the traditional LSP features, etc. but
still using bytecode as the on-disk serialization format. Loading a bytecode file this
way will fail if the bytecode is invalid, and saving will fail if the edited .mlir is invalid.

Differential Revision: https://reviews.llvm.org/D132970

2 years agoFix out-of-bounds memory access in test
Adrian Prantl [Sat, 3 Sep 2022 01:14:12 +0000 (18:14 -0700)]
Fix out-of-bounds memory access in test

2 years ago[NFC][clang] LLVM_FALLTHROUGH => [[fallthrough]
Sheng [Sat, 3 Sep 2022 00:58:31 +0000 (08:58 +0800)]
[NFC][clang] LLVM_FALLTHROUGH => [[fallthrough]

2 years ago[DFSan] Increase size of buffer to fix possibly-flakey test.
Andrew Browne [Fri, 2 Sep 2022 19:12:16 +0000 (12:12 -0700)]
[DFSan] Increase size of buffer to fix possibly-flakey test.

Observed a test failure where "Returned length: 3054".

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D133227

2 years ago[mlir][sparse] Introduce sparse_tensor.storage operator to create a sparse tensor...
Peiming Liu [Fri, 2 Sep 2022 20:31:47 +0000 (20:31 +0000)]
[mlir][sparse] Introduce sparse_tensor.storage operator to create a sparse tensor storage tuple

Reviewed By: aartbik

Differential Revision: https://reviews.llvm.org/D133231

2 years agoRevert "[mlir][Tensor] Add rewrites to extract slices through `tensor.collape_shape`"
Mehdi Amini [Fri, 2 Sep 2022 23:34:52 +0000 (23:34 +0000)]
Revert "[mlir][Tensor] Add rewrites to extract slices through `tensor.collape_shape`"

This reverts commit 5711957875738c1318f89afd7bf4be388f85a087.

A circular dependency is introduced here from Dialect/Utils/ to the
ViewLikeInterface, but it already depends on Dialect/Utils.

Also this introduces a dependency from lib/Dialect/Tensor to Linalg,
which isn't obviously correct from a layering point of view.

2 years ago[ODRHash diagnostics] Transform method `ASTReader::diagnoseOdrViolations` into a...
Volodymyr Sapsai [Fri, 2 Sep 2022 22:37:23 +0000 (15:37 -0700)]
[ODRHash diagnostics] Transform method `ASTReader::diagnoseOdrViolations` into a class `ODRDiagsEmitter`. NFC.

Preparing to use diagnostics about ODR hash mismatches outside of ASTReader.

Differential Revision: https://reviews.llvm.org/D128490

2 years agoRevert "[AggressiveInstCombine] Lower Table Based CTTZ"
Richard Smith [Fri, 2 Sep 2022 23:18:12 +0000 (16:18 -0700)]
Revert "[AggressiveInstCombine] Lower Table Based CTTZ"

This reverts commit fec01ee3f5244bb9a04bc4310fc892c56c5b6bab.

According to asan, this patch introduces a heap use after free.

2 years ago[Matrix] Use print instead of dump for matrix-print-after-transpose-opt
Francis Visoiu Mistrih [Fri, 2 Sep 2022 23:05:31 +0000 (16:05 -0700)]
[Matrix] Use print instead of dump for matrix-print-after-transpose-opt

We should be able to use this option even if LLVM_ENABLE_DUMP is not on.

(should fix the bots too)

2 years agoAdd driver test for -fmodule-name and -fmodule-map-file use without -fmodules.
Richard Smith [Fri, 2 Sep 2022 21:47:05 +0000 (14:47 -0700)]
Add driver test for -fmodule-name and -fmodule-map-file use without -fmodules.

2 years ago[NFC] Remove duplicate code in SBTypeCategory
Jorge Gorbe Moya [Fri, 2 Sep 2022 19:59:39 +0000 (12:59 -0700)]
[NFC] Remove duplicate code in SBTypeCategory

TypeCategoryImpl has its own implementation of these, so it makes no
sense to have the same logic inlined in SBTypeCategory.

There are other methods in SBTypeCategory that are directly implemented
there, instead of delegating to TypeCategoryImpl (which IMO kinda
defeats the point of having an "opaque" member pointer in the SB type),
but they don't have equivalent implementations in TypeCategoryImpl, so
this patch only picks the low-hanging fruit for now.

2 years ago[Matrix] Simplify matmuls with scalars
Francis Visoiu Mistrih [Thu, 1 Sep 2022 19:06:59 +0000 (12:06 -0700)]
[Matrix] Simplify matmuls with scalars

If one of the operands is a transposed splat, the transpose can be
removed.

This is useful to simplify when transposes are distributed to operands
of a matmul:

* k^T -> k
* (A * k)^t -> A^t * k

Differential Revision: https://reviews.llvm.org/D130177

2 years ago[clang-tidy] Skip copy assignment operators with nonstandard return types
Alexander Shaposhnikov [Wed, 31 Aug 2022 09:13:21 +0000 (09:13 +0000)]
[clang-tidy] Skip copy assignment operators with nonstandard return types

Skip copy assignment operators with nonstandard return types
since they cannot be defaulted.

Test plan: ninja check-clang-tools

Differential revision: https://reviews.llvm.org/D133006

2 years ago[analyzer] Add more information to the Exploded Graph
isuckatcs [Thu, 4 Aug 2022 17:49:05 +0000 (19:49 +0200)]
[analyzer] Add more information to the Exploded Graph

This patch dumps every state trait in the egraph. Also
the empty state traits are no longer dumped, instead
they are treated as null by the egraph rewriter script,
which solves reverse compatibility issues.

Differential Revision: https://reviews.llvm.org/D131187

2 years ago[clang-tidy] Restrict use-equals-default to c++11-or-later
Alexander Shaposhnikov [Fri, 2 Sep 2022 22:19:06 +0000 (22:19 +0000)]
[clang-tidy] Restrict use-equals-default to c++11-or-later

Restrict use-equals-default to c++11-or-later.

Test plan: ninja check-all

Differential revision: https://reviews.llvm.org/D132998

2 years ago[CostModel][AArch64] Fix ctpop intrinsic cost when NEON is disabled.
Eli Friedman [Fri, 2 Sep 2022 22:17:55 +0000 (15:17 -0700)]
[CostModel][AArch64] Fix ctpop intrinsic cost when NEON is disabled.

If we don't have NEON, we use the generic fallback, which takes 12
instructions. Make sure the costs reflect that.

(On a related note, we could optimize the generic fallback a bit. It
currently uses sequences like lsr+and+add; if we use and+lsr+add
instead, we can fold the lsr into the add.)

Differential Revision: https://reviews.llvm.org/D133154

2 years ago[clang-format] Fix annotating when deleting array of pointers
jackh [Tue, 30 Aug 2022 05:56:45 +0000 (13:56 +0800)]
[clang-format] Fix annotating when deleting array of pointers

Fixes https://github.com/llvm/llvm-project/issues/57418

The token `*` below should be annotated as `UnaryOperator`.

```
delete[] *ptr;
```

Reviewed By: owenpan, MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D132911

2 years ago[mlir][spirv] Convert some 0-D vector extract/insertelement ops
Lei Zhang [Fri, 2 Sep 2022 21:47:31 +0000 (17:47 -0400)]
[mlir][spirv] Convert some 0-D vector extract/insertelement ops

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D133183

2 years agoRevert "[MLIR] Remove unused config attributes from lit.site.cfg.py"
Mitch Phillips [Fri, 2 Sep 2022 21:39:05 +0000 (14:39 -0700)]
Revert "[MLIR] Remove unused config attributes from lit.site.cfg.py"

This reverts commit 0816b629c9da5aa8885c4cb3fbbf5c905d37f0ee.

Reason: Broke the sanitizer buildbots. More information available in the
original phabricator review: https://reviews.llvm.org/D132726

2 years ago [mlir][NVGPU] Adding Support for cp_async_zfill via Inline Asm
Manish Gupta [Fri, 2 Sep 2022 21:20:11 +0000 (21:20 +0000)]
 [mlir][NVGPU] Adding Support for cp_async_zfill via Inline Asm

`cp_async_zfill` is currently not present in the nvvm backend, this patch adds `cp_async_zfill` support by adding inline asm when lowering from `nvgpu` to `nvvm`.

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D132269

2 years ago[mlir][spirv] Support more max/min vector.reduction
Lei Zhang [Fri, 2 Sep 2022 21:21:57 +0000 (17:21 -0400)]
[mlir][spirv] Support more max/min vector.reduction

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D133168

2 years ago[mlir][spirv] Add some folders for spv.CompositeExtract
Lei Zhang [Fri, 2 Sep 2022 21:17:45 +0000 (17:17 -0400)]
[mlir][spirv] Add some folders for spv.CompositeExtract

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D133167

2 years ago[libc][NFC] clang-format
Alex Brachet [Fri, 2 Sep 2022 21:17:07 +0000 (21:17 +0000)]
[libc][NFC] clang-format

2 years ago[mlir][spirv] Add support for converting gpu.shuffle xor
Lei Zhang [Fri, 2 Sep 2022 21:14:53 +0000 (17:14 -0400)]
[mlir][spirv] Add support for converting gpu.shuffle xor

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D133054

2 years ago[mlir][spirv] Define various spv.GroupNonUniformShuffle ops
Lei Zhang [Fri, 2 Sep 2022 21:06:52 +0000 (17:06 -0400)]
[mlir][spirv] Define various spv.GroupNonUniformShuffle ops

Reviewed By: kuhar

Differential Revision: https://reviews.llvm.org/D133041

2 years ago[mlir][spirv] Fix MaxVersion for ops after supporting v1.6
Lei Zhang [Fri, 2 Sep 2022 21:02:00 +0000 (17:02 -0400)]
[mlir][spirv] Fix MaxVersion for ops after supporting v1.6

Reviewed By: ThomasRaoux

Differential Revision: https://reviews.llvm.org/D133234

2 years ago[mlir][openacc][NFC] Fix typo
Valentin Clement [Fri, 2 Sep 2022 21:00:59 +0000 (23:00 +0200)]
[mlir][openacc][NFC] Fix typo

2 years agouse LLVM_USE_STATIC_ZSTD
Cole [Fri, 2 Sep 2022 21:00:07 +0000 (21:00 +0000)]
use LLVM_USE_STATIC_ZSTD

removes LLVM_PREFER_STATIC_ZSTD in favor of using a LLVM_USE_STATIC_ZSTD

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D133222

2 years ago[TEST][msan] Reformat RUN lines
Vitaly Buka [Fri, 2 Sep 2022 20:24:56 +0000 (13:24 -0700)]
[TEST][msan] Reformat RUN lines

2 years ago[HLSL] Generate buffer subscript operators
Chris Bieneman [Fri, 2 Sep 2022 19:32:24 +0000 (14:32 -0500)]
[HLSL] Generate buffer subscript operators

In HLSL buffer types support array subscripting syntax for loads and
stores. This change fleshes out the subscript operators to become array
accesses on the underlying handle pointer. This will allow LLVM
optimization passes to optimize resource accesses the same way any other
memory access would be optimized.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D131268

2 years ago[gn build] Port 30adaa730c47
LLVM GN Syncbot [Fri, 2 Sep 2022 19:47:21 +0000 (19:47 +0000)]
[gn build] Port 30adaa730c47

2 years ago[libc++][NFC] Copy the whole union instead of a member; also remove __zero()
Nikolas Klauser [Tue, 30 Aug 2022 15:43:14 +0000 (17:43 +0200)]
[libc++][NFC] Copy the whole union instead of a member; also remove __zero()

This doesn't affect code-gen

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D132951

2 years ago[libc++] Granularize the rest of memory
Nikolas Klauser [Fri, 2 Sep 2022 14:24:11 +0000 (16:24 +0200)]
[libc++] Granularize the rest of memory

Reviewed By: ldionne, #libc

Spies: libcxx-commits, mgorny

Differential Revision: https://reviews.llvm.org/D132790