platform/upstream/llvm.git
22 months 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)

22 months 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)

22 months 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)

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

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

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

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

22 months 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.

22 months 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.

22 months 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.

22 months 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 :-(

22 months 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

22 months 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

22 months 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

22 months 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.

22 months 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.

22 months 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

22 months 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

22 months 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.

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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.

22 months 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.

22 months 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

22 months 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.

22 months 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.

22 months 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.

22 months 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

22 months 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'

22 months 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

22 months 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.

22 months 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.

22 months 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

22 months 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.

22 months 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

22 months 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.

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

22 months 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

22 months 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

22 months 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

22 months 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".

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

22 months 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.

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

22 months 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

22 months 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.

22 months 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

22 months 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

22 months 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.

22 months 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.

22 months 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

22 months 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

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

22 months 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

22 months 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

22 months 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.

22 months 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

22 months 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.

22 months 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)

22 months 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.

22 months 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.

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

22 months 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

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

22 months 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

22 months 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

22 months 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

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

22 months 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

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

22 months 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

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

22 months 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

22 months 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

22 months ago[Driver] Remove cc1 Separate form -fvisibility
Fangrui Song [Fri, 2 Sep 2022 19:40:00 +0000 (12:40 -0700)]
[Driver] Remove cc1 Separate form -fvisibility

22 months ago[libc++] Remove noexcept specifier from operator""s
Nikolas Klauser [Fri, 2 Sep 2022 14:20:28 +0000 (16:20 +0200)]
[libc++] Remove noexcept specifier from operator""s

For some reason `operator""s(const char8_t*, size_t)` was marked `noexcept`. Remove it and add regression tests.

Reviewed By: ldionne, huixie90, #libc

Spies: libcxx-commits

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

22 months ago[test] Change cc1 -fvisibility to -fvisibility=
Fangrui Song [Fri, 2 Sep 2022 19:36:44 +0000 (12:36 -0700)]
[test] Change cc1 -fvisibility to -fvisibility=

22 months ago[libc++] Make the naming of private member variables consistent and enforce it throug...
Nikolas Klauser [Fri, 2 Sep 2022 14:19:07 +0000 (16:19 +0200)]
[libc++] Make the naming of private member variables consistent and enforce it through readability-identifier-naming

Reviewed By: ldionne, #libc

Spies: aheejin, sstefan1, libcxx-commits

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

22 months ago[libc++] Enable [[nodiscard]] extensions by default
Nikolas Klauser [Thu, 1 Sep 2022 10:02:58 +0000 (12:02 +0200)]
[libc++] Enable [[nodiscard]] extensions by default

Adding `[[nodiscard]]` to functions is a conforming extension and done extensively in the MSVC STL.

Reviewed By: ldionne, EricWF, #libc

Spies: #libc_vendors, cjdb, mgrang, jloser, libcxx-commits

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

22 months ago[mlir][cmake] Don't add dependencies on mlir-(generic-)headers
Jeff Niu [Thu, 1 Sep 2022 18:06:46 +0000 (11:06 -0700)]
[mlir][cmake] Don't add dependencies on mlir-(generic-)headers

Every dialect was dependent on `mlir-headers`, which was causing the
build of any single MLIR dialect to pull in a bunch of extra
dependencies that aren't needed. Now, MLIR dialects will need to
explicitly depend on `MLIR*IncGen` targets to pull in any needed
headers.

This does not impact the actual `mlir-header` target.

Consider the "simple" Arithmetic dialect. Before:

```
% ninja MLIRArithmeticDialect
[151/812] Building CXX object lib/TableGen/CMakeFiles/LLVMTableGen.dir/JSONBackend.cpp.o
```

After:

```
% ninja MLIRArithmeticDialect
[207/374] Building CXX object tools/mlir/lib/TableGen/CMakeFiles/MLIRTableGen.dir/GenInfo.cpp.o
```

(Both clean builds)

Reviewed By: rriddle, jpienaar

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

22 months ago[mlir][cf-to-llvm] Fix error message
Jeff Niu [Fri, 2 Sep 2022 19:13:07 +0000 (12:13 -0700)]
[mlir][cf-to-llvm] Fix error message

22 months ago[libc][NFC] Use no_sanitize("all")
Alex Brachet [Fri, 2 Sep 2022 19:07:32 +0000 (19:07 +0000)]
[libc][NFC] Use no_sanitize("all")

This function cannot have any instrumentation because it's
assembly must match exactly what the debugger is expecting.

Previously it was just a list of what sanitizers we expect
libc would be sanitized with but this is untenable.

22 months ago[NFC] Make MultiplexExternalSemaSource own sources
Chris Bieneman [Thu, 1 Sep 2022 21:31:23 +0000 (16:31 -0500)]
[NFC] Make MultiplexExternalSemaSource own sources

This change refactors the MuiltiplexExternalSemaSource to take ownership
of the underlying sources. As a result it makes a larger cleanup of
external source ownership in Sema and the ChainedIncludesSource.

Reviewed By: aaron.ballman, aprantl

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

22 months ago[clang] Change cc1 -fvisibility's canonical spelling to -fvisibility=
Fangrui Song [Fri, 2 Sep 2022 18:49:38 +0000 (11:49 -0700)]
[clang] Change cc1 -fvisibility's canonical spelling to -fvisibility=

22 months ago[flang][docs] Add lowering design doc for parameterized derived-type
Valentin Clement [Fri, 2 Sep 2022 18:45:30 +0000 (20:45 +0200)]
[flang][docs] Add lowering design doc for parameterized derived-type

This document aims to give insights at the representation of parameterized
derived-type (PDTs) in FIR and how PDTs are lowered to FIR and interact
with the runtime.

Reviewed By: jeanPerier, klausler

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

22 months ago[flang] Use APInt to lower 128 bits integer constants
Valentin Clement [Fri, 2 Sep 2022 18:44:44 +0000 (20:44 +0200)]
[flang] Use APInt to lower 128 bits integer constants

Lowering was truncating 128 bits integer to 64 bits. This
patch makes use of APInt to lower 128 bits integer correctly.

```
program bug
  print *, 170141183460469231731687303715884105727_16
end

! Before patch: 18446744073709551615
! With patch: 170141183460469231731687303715884105727
```

Reviewed By: vdonaldson

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

22 months ago[flang] Make sure allocatable components are initialzed for temp derived-type
Valentin Clement [Fri, 2 Sep 2022 18:43:18 +0000 (20:43 +0200)]
[flang] Make sure allocatable components are initialzed for temp derived-type

Runtime functions expect clean unallocated state for descriptor. This
patch adds a call to the runtime function to initialize the temporary
derived-type created.

Reviewed By: vdonaldson

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

22 months ago[HLSL] Restrict to supported targets
Chris Bieneman [Fri, 2 Sep 2022 15:45:53 +0000 (10:45 -0500)]
[HLSL] Restrict to supported targets

Someday we would like to support HLSL on a wider range of targets, but
today targeting anything other than `dxil` is likly to cause lots of
headaches. This adds an error and tests to validate that the expected
target is `dxil-?-shadermodel`.

We will continue to do a best effort to ensure the code we write makes
it easy to support other targets (like SPIR-V), but this error will
prevent users from hitting frustrating errors for unsupported cases.

Reviewed By: jcranmer-intel, Anastasia

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

22 months ago[mlir][sparse] extend codegen test cases with an additional step after storage expansion
Peiming Liu [Fri, 2 Sep 2022 17:31:54 +0000 (17:31 +0000)]
[mlir][sparse] extend codegen test cases with an additional step after storage expansion

Reviewed By: aartbik

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