Commit Graph

434955 Commits

Author SHA1 Message Date
Kazu Hirata 3850edd9e0 Use llvm::count_if (NFC) 2022-09-03 11:17:35 -07:00
Kazu Hirata bc96b36a41 [CodeGen] Use std::lcm (NFC) 2022-09-03 11:17:33 -07:00
Kazu Hirata a0c7ca8ad4 [BOLT] Use range-based for loops (NFC)
LLVM Coding Standards discourage for_each unless callable objects
already exist.
2022-09-03 11:17:32 -07:00
Fangrui Song 89df4e4825 [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.
2022-09-03 10:57:29 -07:00
Fangrui Song a2ef7654ec [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.
2022-09-03 10:45:30 -07:00
Simon Pilgrim 444685de06 [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 :-(
2022-09-03 18:45:08 +01:00
Simon Pilgrim 114b7762a9 [CostModel][X86] Add CostKinds handling for add/sub ops
This was achieved using the 'cost-tables vs llvm-mca' script D103695
2022-09-03 18:45:08 +01:00
Dave Lee 75f05fccbb [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
2022-09-03 10:33:26 -07:00
yronglin 3ad2fe913a [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
2022-09-03 23:26:01 +08:00
Simon Pilgrim 5aee2726d8 [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.
2022-09-03 15:48:39 +01:00
Sanjay Patel 22e1f66f26 [SCCP] add helper function for replacing signed operations; NFC
Preliminary refactoring for planned enhancement in D133198.
2022-09-03 10:30:10 -04:00
Simon Pilgrim bddbd408b7 [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
2022-09-03 15:23:46 +01:00
Christian Sigg f43c81470b [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
2022-09-03 16:04:07 +02:00
Sanjay Patel 5c759edc57 [InstCombine] reduce another or-xor bitwise logic pattern
~(A & ?) | (A ^ B) --> ~((A & ?) & B)
https://alive2.llvm.org/ce/z/mxex6V

This is similar to 9d218b61cc where we peeked through
another logic op to find a common operand.
2022-09-03 09:32:08 -04:00
Sanjay Patel fbfac8e388 [InstCombine] add tests for or-xor-nand; NFC 2022-09-03 09:32:08 -04:00
Simon Pilgrim 1c12e12111 [CostModel][X86] Add fdiv(double) throughput x87 costs for 2022-09-03 14:08:25 +01:00
Simon Pilgrim e438ce5694 [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
2022-09-03 13:47:41 +01:00
Simon Pilgrim 62cdfdab4d [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
2022-09-03 13:41:33 +01:00
Simon Pilgrim 3968844bff [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.
2022-09-03 13:27:08 +01:00
Simon Pilgrim e2d140e9c3 [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.
2022-09-03 13:12:22 +01:00
Igor Zhukov 30dadaa2eb [libc++] Implement P2273R3 (`constexpr` `unique_ptr`)
Reviewed By: mordante, #libc

Differential Revision: https://reviews.llvm.org/D131315
2022-09-03 18:49:50 +07:00
Mark de Wever 4004fb6453 [NFC][libc++] Uses the new way to mark Standard includes. 2022-09-03 13:35:48 +02:00
Mark de Wever 49c3c40cc0 [NFC][libc++][format] Removes unused code.
The code was for backwards compatibility with code no longer present in
format.
2022-09-03 13:34:14 +02:00
Mark de Wever 56065c4c8e [NFC][libc++] Removes GCC-11 support.
GCC-11 isn't supported in libc++ so remove UNSUPPORTED directives.
2022-09-03 13:20:10 +02:00
Simon Pilgrim bd956b7db3 [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
2022-09-03 11:10:51 +01:00
Simon Pilgrim 0735200e3f [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'
2022-09-03 10:42:20 +01:00
Simon Pilgrim 82090cb85e [CostModel][X86] Remove unused float x87 costs
We only need the double costs for SSE1 fallback
2022-09-03 09:59:20 +01:00
Junduo Dong 5e4f69edbc Revert "[Clang] change default storing path of `-ftime-trace`"
This reverts commit 38941da066.
2022-09-03 01:38:37 -07:00
Junduo Dong 4ff2250a22 Revert "[driver][clang] remove the check-time-trace test on the platform "PS4/PS5/Hexagon""
This reverts commit 39221ad557.
2022-09-03 01:37:55 -07:00
Alexey Lapshin 79c8f51c34 [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
2022-09-03 11:23:52 +03:00
Mark de Wever ba6ad62081 [libc++] Fixes generated output CI job.
It seems there was another file with the same issue, which didn't show
up initially.
2022-09-03 10:19:35 +02:00
Mark de Wever e31c2a1b1a [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
2022-09-03 10:06:16 +02:00
Mark de Wever ff06c2ded3 [libc++] Fixes generated output CI job. 2022-09-03 10:04:44 +02:00
Benjamin Kramer 278de327d9 [bazel] Port f7b8a70e7a 2022-09-03 09:55:37 +02:00
Christian Sigg 9f358c8ef7 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
2022-09-03 09:02:37 +02:00
owenca 92d8738c38 [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
2022-09-02 21:38:36 -07:00
Lang Hames 1169586dcd [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
2022-09-02 20:59:57 -07:00
Junduo Dong 39221ad557 [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".
2022-09-02 20:27:35 -07:00
LLVM GN Syncbot e3018e4a4f [gn build] Port bc8fd9c633 2022-09-03 02:43:17 +00:00
Vitaly Buka bc8fd9c633 Revert "[libc++] Granularize the rest of memory"
Breaks buildbots.

This reverts commit 30adaa730c.
2022-09-02 19:42:49 -07:00
LLVM GN Syncbot 211817d3be [gn build] Port 3a49cffe3a 2022-09-03 02:22:45 +00:00
Igor Zhukov 3a49cffe3a [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
2022-09-03 09:17:53 +07:00
Richard Smith 632e1e9fd8 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.
2022-09-02 19:09:15 -07:00
Shafik Yaghmour 9f6b3199d3 [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
2022-09-02 18:59:15 -07:00
Junduo Dong 38941da066 [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
2022-09-02 18:49:11 -07:00
Mehdi Amini 95201fcca0 Revert "[mlir][cmake] Don't add dependencies on mlir-(generic-)headers"
This reverts commit 7691b69d5b.

Bots are broken because we're missing CMake dependencies all around now.
2022-09-03 01:45:18 +00:00
Richard Smith 220c2cb0a8 Attempt to make AIX bot happier. 2022-09-02 18:43:27 -07:00
River Riddle f7b8a70e7a [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
2022-09-02 18:16:05 -07:00
Adrian Prantl 603d5a8d63 Fix out-of-bounds memory access in test 2022-09-02 18:14:23 -07:00
Sheng a887d9efd6 [NFC][clang] LLVM_FALLTHROUGH => [[fallthrough] 2022-09-03 08:58:31 +08:00