Tue Ly [Fri, 9 Sep 2022 02:30:37 +0000 (22:30 -0400)]
[libc][math] Implement acosf function correctly rounded for all rounding modes.
Implement acosf function correctly rounded for all rounding modes.
We perform range reduction as follows:
- When `|x| < 2^(-10)`, we use cubic Taylor polynomial:
```
acos(x) = pi/2 - asin(x) ~ pi/2 - x - x^3 / 6.
```
- When `2^(-10) <= |x| <= 0.5`, we use the same approximation that is used for `asinf(x)` when `|x| <= 0.5`:
```
acos(x) = pi/2 - asin(x) ~ pi/2 - x - x^3 * P(x^2).
```
- When `0.5 < x <= 1`, we use the double angle formula: `cos(2y) = 1 - 2 * sin^2 (y)` to reduce to:
```
acos(x) = 2 * asin( sqrt( (1 - x)/2 ) )
```
- When `-1 <= x < -0.5`, we reduce to the positive case above using the formula:
```
acos(x) = pi - acos(-x)
```
Performance benchmark using perf tool from the CORE-MATH project on Ryzen 1700:
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh acosf
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH reciprocal throughput : 28.613
System LIBC reciprocal throughput : 29.204
LIBC reciprocal throughput : 24.271
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh asinf --latency
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH latency : 55.554
System LIBC latency : 76.879
LIBC latency : 62.118
```
Reviewed By: orex, zimmermann6
Differential Revision: https://reviews.llvm.org/D133550
Nikita Popov [Fri, 9 Sep 2022 13:54:24 +0000 (15:54 +0200)]
[AST] Use BatchAA in aliasesUnknownInst() (NFCI)
Nicolas Vasilache [Fri, 9 Sep 2022 08:13:09 +0000 (01:13 -0700)]
[mlir][vector] Extend WarpExecutionOnLane0 pattern support to allow deduplicating identical yield values.
Differential Revision: https://reviews.llvm.org/D133573
Peter Steinfeld [Tue, 23 Aug 2022 20:18:04 +0000 (13:18 -0700)]
[Flang] Update build documentation
Changes to build instructions based on the latest requirements with
compiler-rt.
Differential Revision: https://reviews.llvm.org/D131041
Sebastian Neubauer [Fri, 9 Sep 2022 13:14:59 +0000 (15:14 +0200)]
Add helper func to get first non-alloca position
The LLVM performance tips suggest that allocas should be placed at the
beginning of the entry block. So far, llvm doesn’t provide any helper to
find that position.
Add BasicBlock::getFirstNonPHIOrDbgOrAlloca and IRBuilder::SetInsertPointPastAllocas(Function*)
that get an insert position after the (static) allocas at the start of a
function and use it in ShadowStackGCLowering.
Differential Revision: https://reviews.llvm.org/D132554
Carlos Alberto Enciso [Fri, 9 Sep 2022 13:36:40 +0000 (14:36 +0100)]
Add command line argument parsing to the Windows packaging script.
As discussed here:
https://discourse.llvm.org/t/build-llvm-release-bat-script-options
Add a function to parse command line arguments: `parse_args`.
The format for the arguments is:
Boolean: --option
Value: --option<separator>value
with `<separator>` being: space, colon, semicolon or equal sign
Command line usage example:
my-batch-file.bat --build --type=release --version 123
It will create 3 variables:
`build` with the value `true`
`type` with the value `release`
`version` with the value `123`
Usage:
set "build="
set "type="
set "version="
REM Parse arguments.
call :parse_args %*
if defined build (
...
)
if %type%=='release' (
...
)
if %version%=='123' (
...
)
Nikita Popov [Fri, 9 Sep 2022 13:30:05 +0000 (15:30 +0200)]
[LICM] Regenerate test checks (NFC)
Guray Ozen [Fri, 9 Sep 2022 08:19:48 +0000 (10:19 +0200)]
[mlir][linalg] Retire LinalgStrategyEnablePass
This revision retires LinalgStrategyEnablePass.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D133557
Pavel Labath [Tue, 6 Sep 2022 13:36:23 +0000 (15:36 +0200)]
[lldb-server] Report launch error in vRun packets
Uses our existing "error string" extension to provide a better
indication of why the launch failed (the client does not make use of the
error yet).
Also, fix the way we obtain the launch error message (make sure we read
the whole message, and skip trailing garbage), and reduce the size of
TestLldbGdbServer by splitting some tests into a separate file.
Differential Revision: https://reviews.llvm.org/D133352
Pavel Labath [Wed, 7 Sep 2022 09:25:44 +0000 (11:25 +0200)]
[lldb] Fix ThreadedCommunication races
The Read function could end up blocking if data (or EOF) arrived just as
it was about to start waiting for the events. This was only discovered
now, because we did not have unit tests for this functionality before.
We need to check for data *after* we start listening for incoming
events. There were no changes to the read thread code needed, as we
already use this pattern in SynchronizeWithReadThread, so I just updated
the comments to make it clear that it is used for reading as well.
Differential Revision: https://reviews.llvm.org/D133410
Simon Pilgrim [Fri, 9 Sep 2022 12:57:39 +0000 (13:57 +0100)]
[X86] Fix VPPERM load folding latency
Noticed while investigating BITREVERSE cost numbers with the D103695 script - VPPERM folded loads was using the WriteVarShuffleX defaults and was missing an override like the VPPERM reg-reg variants
Thomas Symalla [Fri, 9 Sep 2022 12:08:10 +0000 (14:08 +0200)]
[NFC][AMDGPU] Pre-commit test for D132837.
Aaron Ballman [Fri, 9 Sep 2022 11:55:12 +0000 (07:55 -0400)]
Fix LLVM sphinx build
Addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/30/builds/25791
We can use anonymous references rather than explicit ones.
Namhyung Kim [Fri, 9 Sep 2022 08:36:41 +0000 (09:36 +0100)]
[llvm-objdump] Create name for fake sections
It doesn't have a section header string table so add a vector to have
the strings and create name based on the program header type and the
index.
Differential Revision: https://reviews.llvm.org/D131290
Serge Pavlov [Fri, 9 Sep 2022 11:23:52 +0000 (18:23 +0700)]
[Clang] Use virtual FS in processing config files
Clang has support of virtual file system for the purpose of testing, but
treatment of config files did not use it. This change enables VFS in it
as well.
Differential Revision: https://reviews.llvm.org/D132867
Nikita Popov [Thu, 8 Sep 2022 12:27:31 +0000 (14:27 +0200)]
[LICM] Allow promotion with non-load/store users
If there are non-load/store users of the promoted pointer, we
currently abort promotion. However, having such users isn't really
relevant to the transform. We already separately check that a)
there are no instructions that modref the promoted pointer and
b) that a pointer capture disables store promotion.
In the affected @test_captured_in_loop test case we have a readnone
capture of the promoted pointer, which means that load promotion
can be performed (while store promotion cannot).
Differential Revision: https://reviews.llvm.org/D133485
Dmitry Preobrazhensky [Fri, 9 Sep 2022 10:10:55 +0000 (13:10 +0300)]
[AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOPD instructions
Differential Revision: https://reviews.llvm.org/D133414
Dmitry Preobrazhensky [Fri, 9 Sep 2022 10:06:44 +0000 (13:06 +0300)]
[AMDGPU][MC][GFX11][NFC] Update disassembler tests for VOP3P instructions
Differential Revision: https://reviews.llvm.org/D133412
Dmitry Preobrazhensky [Fri, 9 Sep 2022 10:01:17 +0000 (13:01 +0300)]
[AMDGPU][MC][GFX11][NFC] Correct VOPD parsing
Differential Revision: https://reviews.llvm.org/D133492
Simon Pilgrim [Fri, 9 Sep 2022 09:58:40 +0000 (10:58 +0100)]
[CostModel][X86] Add missing i8 throughput cost
Nicolas Vasilache [Fri, 9 Sep 2022 08:13:09 +0000 (01:13 -0700)]
[mlir][vector] NFC - Clean up vector patterns and propagate benefit through populate functions
Differential Revision: https://reviews.llvm.org/D133559
Serge Pavlov [Fri, 9 Sep 2022 09:42:00 +0000 (16:42 +0700)]
Revert "[Clang] Use virtual FS in processing config files"
This reverts commit
9424497e43aff088e014d65fd952ec557e28e6cf.
Some buildbots failed, reverted for investigation.
Brad Smith [Fri, 9 Sep 2022 09:31:44 +0000 (05:31 -0400)]
[mlir] Bump building CRunnerUtils from C++11 to C++17
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D133553
Serge Pavlov [Mon, 29 Aug 2022 05:50:36 +0000 (12:50 +0700)]
[Clang] Use virtual FS in processing config files
Clang has support of virtual file system for the purpose of testing, but
treatment of config files did not use it. This change enables VFS in it
as well.
Differential Revision: https://reviews.llvm.org/D132867
Graham Hunter [Fri, 9 Sep 2022 09:07:39 +0000 (10:07 +0100)]
[NFC][LV] Convert masked call tests to use update script
Djordje Todorovic [Fri, 9 Sep 2022 07:44:10 +0000 (09:44 +0200)]
"Recommit "[AggressiveInstCombine] Lower Table Based CTTZ""
This reverts commit
053841c5624ca7eacd108a26071d8a1cefe1bebd.
We faced a use-after-free after pushing the D113291, since the
foldSqrt() has a call to eraseFromParent(). The function
should be at the end of the main loop that folds the patterns.
This patch fixes that.
serge-sans-paille [Wed, 7 Sep 2022 12:48:10 +0000 (14:48 +0200)]
[OpenMP] Install ompt-multiplex.h alongside omp.h
The default install direction may not be in the compiler search path.
Differential Revision: https://reviews.llvm.org/D133420
Vitaly Buka [Fri, 9 Sep 2022 06:33:07 +0000 (23:33 -0700)]
[msan] Insert simplification passes after instrumentation
This resolves TODO from D96406.
InstCombine issue is fixed with D133394.
Save 4.5% of .text on CTMark.
Benjamin Kramer [Fri, 9 Sep 2022 07:31:13 +0000 (09:31 +0200)]
[bazel] Port
7fa1d743d073
Alvin Wong [Fri, 9 Sep 2022 06:18:02 +0000 (09:18 +0300)]
[clang][MinGW] Add `-mguard=cf` and `-mguard=cf-nochecks`
This option can be used to enable Control Flow Guard checks and
generation of address-taken function table. They are equivalent to
`/guard:cf` and `/guard:cf,nochecks` in clang-cl. Passing this flag to
the Clang driver will also pass `--guard-cf` to the MinGW linker.
This feature is disabled by default. The option `-mguard=none` is also
available to explicitly disable this feature.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D132810
Alvin Wong [Fri, 9 Sep 2022 06:17:33 +0000 (09:17 +0300)]
[LLD][MinGW] Add --[no-]guard-cf and --[no-]guard-longjmp
These will be LLD-specific options to support Control Flow Guard for the
MinGW target. They are disabled by default, but enabling `--guard-cf`
will also enable `--guard-longjmp` unless `--no-guard-longjmp` is also
specified. These options maps to `-guard:cf,[no]longjmp`.
Note that these features require the `_load_config_used` symbol to
contain the load config directory and be filled with the required
symbols. While current versions of mingw-w64 do not supply this symbol,
the user can provide their own version of it.
Reviewed By: MaskRay, rnk
Differential Revision: https://reviews.llvm.org/D132808
Thomas Raoux [Thu, 8 Sep 2022 22:57:54 +0000 (22:57 +0000)]
[mlir][vector] Don't duplicate transfer_read during vector distribution
Only apply the pattern if the transfer_read can be distributed for all
its uses.
Differential Revision: https://reviews.llvm.org/D133538
gonglingqin [Fri, 9 Sep 2022 06:12:07 +0000 (14:12 +0800)]
[LoongArch] Add codegen support for frint
According to the revised description in `LoongArch Reference Manual v1.02`,
frint.[s/d] does not judge whether floating-point inexact exceptions are
allowed indicated by FCSR, i.e. always executes roundToIntegralExact(x).
What's more, the manual also specifically defines that frint.s/d is only
necessary to be defined in LA64. So ISD::FRINT is legal for LA64.
Differential Revision: https://reviews.llvm.org/D133337
Craig Topper [Fri, 9 Sep 2022 05:56:46 +0000 (22:56 -0700)]
[DAGCombiner][X86] Fold (sub (subcarry X, 0, Carry), Y) -> (subcarry X, Y, Carry)
Fixes PR57576.
Differential Revision: https://reviews.llvm.org/D133471
Jakub Kuderski [Thu, 8 Sep 2022 18:17:53 +0000 (14:17 -0400)]
[mlir][arith] Support wide integer constant emulation
Reviewed By: antiagainst, Mogball
Differential Revision: https://reviews.llvm.org/D133136
Christopher Bate [Thu, 8 Sep 2022 21:21:57 +0000 (15:21 -0600)]
[mlir][Tensor] Add rewrites to extract slices through `tensor.collape_shape`
This change adds a set of utilities to replace the result of a
`tensor.collapse_shape -> tensor.extract_slice` chain with the
equivalent result formed by aggregating slices of the
`tensor.collapse_shape` source. In general, it is not possible to
commute `extract_slice` and `collapse_shape` if linearized dimensions
are sliced. The i-th dimension of the `tensor.collapse_shape`
result is a "linearized sliced dimension" if:
1) Reassociation indices of tensor.collapse_shape in the i'th position
is greater than size 1 (multiple dimensions of the input are collapsed)
2) The i-th dimension is sliced by `tensor.extract_slice`.
We can work around this by stitching together the result of
`tensor.extract_slice` by iterating over any linearized sliced dimensions.
This is equivalent to "tiling" the linearized-and-sliced dimensions of
the `tensor.collapse_shape` operation in order to manifest the result
tile (the result of the `tensor.extract_slice`). The user of the
utilities must provide the mechanism to create the tiling (e.g. a loop).
In the tests, it is demonstrated how to apply the utilities using either
`scf.for` or `scf.foreach_thread`.
The below example illustrates the pattern using `scf.for`:
```
%0 = linalg.generic ... -> tensor<3x7x11x10xf32>
%1 = tensor.collapse_shape %0 [[0, 1, 2], [3]] : ... to tensor<341x10xf32>
%2 = tensor.extract_slice %1 [13, 0] [10, 10] [2, 1] : .... tensor<10x10xf32>
```
We can construct %2 by generating the following IR:
```
%dest = linalg.init_tensor() : tensor<10x10xf32>
%2 = scf.for %iv = %c0 to %c10 step %c1 iter_args(%arg0) -> tensor<10x10xf32> {
// Step 1: Map this output idx (%iv) to a multi-index for the input (%3):
%linear_index = affine.apply affine_map<(d0)[]->(d0*2 + 11)>(%iv)
%3:3 = arith.delinearize_index %iv into (3, 7, 11)
// Step 2: Extract the slice from the input
%4 = tensor.extract_slice %0 [%3#0, %3#1, %3#2, 0] [1, 1, 1, 10] [1, 1, 1, 1] :
tensor<3x7x11x10xf32> to tensor<1x1x1x10xf32>
%5 = tensor.collapse_shape %4 [[0, 1, 2], [3]] :
tensor<1x1x1x10xf32> into tensor<1x10xf32>
// Step 3: Insert the slice into the destination
%6 = tensor.insert_slice %5 into %arg0 [%iv, 0] [1, 10] [1, 1] :
tensor<1x10xf32> into tensor<10x10xf32>
scf.yield %6 : tensor<10x10xf32>
}
```
The pattern was discussed in the RFC here: https://discourse.llvm.org/t/rfc-tensor-extracting-slices-from-tensor-collapse-shape/64034
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D129699
Jakub Kuderski [Fri, 9 Sep 2022 03:23:44 +0000 (23:23 -0400)]
Reland "[mlir][arith] Add wide integer emulation pass"
This reverts commit
45b5e8abe56d7f28c88b0c6cdd60ff741874fb1d.
Relands https://reviews.llvm.org/D133135 after fixing shared libs
builds.
Sheng [Fri, 9 Sep 2022 02:57:37 +0000 (10:57 +0800)]
[NFC][M68k] Correct debug message.
Phoebe Wang [Fri, 9 Sep 2022 02:38:02 +0000 (10:38 +0800)]
[LLD] Imply "longjmp" in `/guard:cf`
This is MSVC's behaviour. LLD was matching it before D99078. Let's go back this way.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D132901
Vitaly Buka [Fri, 9 Sep 2022 00:26:53 +0000 (17:26 -0700)]
[sanitizers] Add experimental flag to insert sanitizers earlier
jacquesguan [Tue, 6 Sep 2022 08:06:48 +0000 (16:06 +0800)]
[mlir][Math] Add TruncOp.
This patch adds TruncOp for Math, it returns the operand rounded to the nearest integer not larger in magnitude than the operand. And this patch also adds the correspond llvm intrinsic op.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D133342
Alex Bradbury [Fri, 9 Sep 2022 01:40:21 +0000 (18:40 -0700)]
[RISCV] Add the GlobalMerge pass (disabled by default)
Split out from D129178, this just adds the GlobalMerge tests (other than global-merge-minsize.ll which is testing a specific configuration of the pass when it's enabled) and exposes `-riscv-enable-global-merge` and //doesn't enable it by default//.
Note that the comment "// FIXME: Unify control over GlobalMerge." is copied from the Arm and AArch64 backends, which expose the same flag. Presumably the author is imagining some later refactoring that provides a target-independent flag.
Reviewed By: craig.topper, reames, hiraditya
Differential Revision: https://reviews.llvm.org/D130481
Fangrui Song [Fri, 9 Sep 2022 01:27:16 +0000 (18:27 -0700)]
[AArch64] Fix -Wunused-variable. NFC
Kai Sasaki [Thu, 8 Sep 2022 23:59:18 +0000 (08:59 +0900)]
[mlir][math] Canonicalization for math.floor op
Support constant folding for math.floor op as well as math.ceil.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D133398
zhongyunde [Fri, 9 Sep 2022 01:00:20 +0000 (09:00 +0800)]
[Peephole] rewrite INSERT_SUBREG to SUBREG_TO_REG if upper bits zero
Restrict the 32-bit form of an instruction of integer as too many test cases
will be clobber as the register number updated.
From %reg = INSERT_SUBREG %reg, %subreg, subidx
To %reg:subidx = SUBREG_TO_REG 0, %subreg, subidx
Try to prefix the redundant mov instruction at D132325 as the SUBREG_TO_REG should not generate code.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D132939
Peiming Liu [Thu, 8 Sep 2022 20:48:26 +0000 (20:48 +0000)]
[mlir][sparse] fix a bug in sparse2sparse reshape.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D133521
Aart Bik [Thu, 8 Sep 2022 21:41:18 +0000 (14:41 -0700)]
[mlir][sparse] rename lex_insert into insert
This change goes not impact any semantics yet, but it
is in preparation for implementing the unordered and not-unique
properties. Changing lex_insert to insert is a first step.
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D133531
Fabian Parzefall [Fri, 9 Sep 2022 00:10:36 +0000 (17:10 -0700)]
[BOLT] Add test checking LP trampolines in multi-split
This adds a test to verify that when splitting all blocks, landing pad
trampolines are inserted in all blocks.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132426
Fabian Parzefall [Fri, 9 Sep 2022 00:10:27 +0000 (17:10 -0700)]
[BOLT] Emit LSDA call sites for all fragments
For exception handling, LSDA call sites have to be emitted for each
fragment individually. With this patch, call sites and respective LSDA
symbols are generated and associated with each fragment of their
function, such that they can be used by the emitter.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132052
Fabian Parzefall [Fri, 9 Sep 2022 00:10:11 +0000 (17:10 -0700)]
[BOLT] Fragment all blocks (not just outlineable blocks)
To enable split strategies that require view of the entire CFG (e.g. to
estimate cost of path from entry block), with this patch, all blocks of
a function are passed to `SplitStrategy::fragment`. Because this might
move non-outlineable blocks into a split fragment, these blocks are
moved back into the main fragment after fragmenting. This also gives
strategies the option to specify whether empty fragments should be
kept or removed.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132423
Fangrui Song [Fri, 9 Sep 2022 00:09:18 +0000 (17:09 -0700)]
Revert D111509 "[clang] use getCommonSugar in an assortment of places"
This reverts commit
d42122cd5db021e6b14a90a98ad1dd09412efb4c.
`clang++ gcc/libstdc++-v3/src/c++98/complex_io.cc` (all language modes) crashes.
Also see https://reviews.llvm.org/D111509#3777980
Stanley Winata [Thu, 8 Sep 2022 23:44:30 +0000 (19:44 -0400)]
[mlir][linalg] add conv_1d_ncw_fcw
Reviewed By: hanchung, antiagainst
Differential Revision: https://reviews.llvm.org/D133465
Philip Reames [Thu, 8 Sep 2022 23:35:36 +0000 (16:35 -0700)]
[docs][RISCV] Add links to respective notes
Fangrui Song [Thu, 8 Sep 2022 23:31:45 +0000 (16:31 -0700)]
[cc1as] Support --compress-debug-sections=zstd
`clang -gz=zstd -c a.s` generates ELFCOMPRESS_ZSTD compressed debug info
sections if compression decreases size.
Philip Reames [Thu, 8 Sep 2022 23:22:44 +0000 (16:22 -0700)]
Fix a warning caught by llvm-sphinx-docs
Joe Loser [Thu, 8 Sep 2022 20:26:11 +0000 (14:26 -0600)]
[clang] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.
Change call sites to use `std::size` instead. Leave the few call sites that
use a locally defined `array_lengthof` that are meant to test previous bugs
with NTTPs in clang analyzer and SemaTemplate.
Differential Revision: https://reviews.llvm.org/D133520
Fangrui Song [Thu, 8 Sep 2022 23:14:31 +0000 (16:14 -0700)]
[Driver] Rename Z to Zlib
Fangrui Song [Thu, 8 Sep 2022 23:11:29 +0000 (16:11 -0700)]
[Support] Rename DebugCompressionType::Z to Zlib
"Z" was so named when we had both gABI ELFCOMPRESS_ZLIB and the legacy .zdebug support.
Now we have just one zlib format, we should use the more descriptive name.
Philip Reames [Thu, 8 Sep 2022 23:04:03 +0000 (16:04 -0700)]
[docs] Fix a rebase error in 194900f
Philip Reames [Thu, 8 Sep 2022 22:54:14 +0000 (15:54 -0700)]
[docs][RISCV] Document status of scalar crypto extensions
This is based on a somewhat subjective review of the in-tree support, and where I thought further work was needed before I'd consider these "done". See the review for some discussion around what is left in terms of pattern matching.
Differential Revision: https://reviews.llvm.org/D133373
Philip Reames [Thu, 8 Sep 2022 22:50:34 +0000 (15:50 -0700)]
[docs][RISCV] Document status of assorted extensions
Sorry, there's no real theme to this. It's simply the rest of the extensions we implement which don't need individual discussion.
Differential Revision: https://reviews.llvm.org/D133529
Amir Ayupov [Thu, 8 Sep 2022 22:50:25 +0000 (15:50 -0700)]
[BOLT] Restrict ICP for functions with unknown control flow
ICP has two modes: jump table promotion and indirect call promotion.
The selection is based on whether an instruction has a jump table or not.
An instruction with unknown control flow doesn't have a jump table and will
fall under indirect call promotion policy which might be incorrect/unsafe
(if an instruction is not a tail call, i.e. has local jump targets).
Prevent ICP for functions containing instructions with unknown control flow.
Follow-up to https://reviews.llvm.org/D128870.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132882
Amir Ayupov [Thu, 8 Sep 2022 22:48:20 +0000 (15:48 -0700)]
[BOLT] Change reorder-blocks deprecated option warning output
Revert to using `BOLT-WARNING`
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D132778
Christopher Bate [Thu, 8 Sep 2022 20:33:57 +0000 (14:33 -0600)]
[mlir] NFC - move declaration of `Range` to StaticValueUtils.h
`ViewLikeInterface.h` defines a struct `Range`, and it also depends on
`StaticValueUtils.h/cpp`. This change moves the definition of `Range` to
`StaticValueUtils.h`, which should not violate any existing dependency
requirement. This is done to support adding utilities using `Range`
under `Dialect/Utils` without creating a circular dependency on
`ViewLikeInterface`. It is possible that some targets depend on
`ViewLikeInterface` just for the `Range` struct. These can be later
updated to depend on the `MLIRDialectUtils` target.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D133523
Nicolas Vasilache [Thu, 8 Sep 2022 21:50:09 +0000 (14:50 -0700)]
[mlir][memref] Add support for 0-D transfer / subview fold.
The 0-d case simply forwards the indexing from the source memref and
works out of the box.
Differential Revision: https://reviews.llvm.org/D133536
rdzhabarov [Thu, 8 Sep 2022 22:11:44 +0000 (22:11 +0000)]
Revert "Fix bazel deps.". Original change has been reverted.
This reverts commit
b3999fd261805a2c8fc14f9421b7d9e8af251a13.
Louis Dionne [Thu, 8 Sep 2022 13:53:49 +0000 (09:53 -0400)]
[libc++] Fix compilation error on platforms that don't implement std::tm
Instead of mentioning tm directly in the definition of __convert_to_tm,
take it as a template argument. As a fly-by also fix incorrect Lit feature
(should have been no-localization instead of libcpp-has-no-localization).
Differential Revision: https://reviews.llvm.org/D133490
Fangrui Song [Thu, 8 Sep 2022 22:09:39 +0000 (15:09 -0700)]
Revert D130308 "[clang] extend getCommonSugaredType to merge sugar nodes"
This reverts commit
16e5d6d7f98f1119aab3d10ec4f9e59b5aacd359.
There are multiple complaints on the review.
In addition, it may cause spurious
```
error: invalid operands to binary expression ('SinkPrinter' and 'char[cluster_name_length]')
note: candidate template ignored: substitution failure: variably modified type 'char *' cannot be used as a template argument SinkPrinter operator<<(const SinkPrinter &s, T) {
```
for some C++ code
Nicolas Vasilache [Thu, 8 Sep 2022 20:40:30 +0000 (13:40 -0700)]
[mlir][vector] NFC - Add rewriter.notifyMatchFailure messages for better debugging
Add rewriter.notifyMatchFailure messages for better debugging
Differential Revision: https://reviews.llvm.org/D133532
Fabian Parzefall [Thu, 8 Sep 2022 21:46:57 +0000 (14:46 -0700)]
[BOLT] Introduce SplitStrategy ABC
This introduces an abstract base class for splitting strategies to
document the interface a strategy needs to implement, and also to avoid
code bloat of the `splitFunction` method.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132054
Zequan Wu [Wed, 7 Sep 2022 23:24:45 +0000 (16:24 -0700)]
[LLDB][NativePDB] Set block address range.
The block address range was missing before.
Differential Revision: https://reviews.llvm.org/D133461
Jakub Kuderski [Thu, 8 Sep 2022 21:34:24 +0000 (17:34 -0400)]
[mlir][func] Remove unnecessary link dependencies for MLIRFuncTransforms
This is so that FuncTransforms can be used by other dialects without introducing cyclic dependencies.
Tested by building with `BUILD_SHARED_LIBS=ON`
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D133527
rdzhabarov [Thu, 8 Sep 2022 21:17:42 +0000 (21:17 +0000)]
Fix bazel deps.
Jonathan Peyton [Mon, 1 Aug 2022 19:12:29 +0000 (14:12 -0500)]
[OpenMP][libomp] Cleanup __kmpc_flush() code
Have it be simple KMP_MFENCE() which incorporates x86-specific logic and
reduces to KMP_MB() for other architectures.
Differential Revision: https://reviews.llvm.org/D130928
Vitaly Buka [Fri, 2 Sep 2022 20:27:34 +0000 (13:27 -0700)]
[msan] Disambiguate warnings debug location
If multiple warnings created on the same instruction (debug location)
it can be difficult to figure out which input value is the cause.
This patches chains origins just before the warning using last origins
update debug information.
To avoid inflating the binary unnecessarily, do this only when uncertainty is
high enough, 3 warnings by default. On average it adds 0.4% to the
.text size.
Reviewed By: kda, fmayer
Differential Revision: https://reviews.llvm.org/D133232
bixia1 [Wed, 7 Sep 2022 21:34:04 +0000 (14:34 -0700)]
[mlir][sparse] Add codegen for expand op.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D133454
Vitaly Buka [Wed, 7 Sep 2022 02:20:59 +0000 (19:20 -0700)]
[sanitizers] Invalidate GlobalsAA
GlobalsAA is considered stateless as usually transformations do not introduce
new global accesses, and removed global access is not a problem for GlobalsAA
users.
Sanitizers introduce new global accesses:
- Msan and Dfsan tracks origins and parameters with TLS, and to store stack origins.
- Sancov uses global counters. HWAsan store tag state in TLS.
- Asan modifies globals, but I am not sure if invalidation is required.
I see no evidence that TSan needs invalidation.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D133394
Fangrui Song [Thu, 8 Sep 2022 20:49:07 +0000 (13:49 -0700)]
[AST/Interp] Fix left shift overflow bug in D64146
Noticed by Dmitri Gribenko
Fangrui Song [Thu, 8 Sep 2022 20:39:30 +0000 (13:39 -0700)]
[AST/Interp] Fix latent unitialized use of memory bug in D64146
Exposed by D132727: clang/test/AST/Interp/arrays.cpp fails with --config=msan
Tom Honermann [Sat, 23 Jul 2022 03:17:32 +0000 (20:17 -0700)]
[clang] NFC: Add a missing const qualifier to Decl::isLocalExternDecl().
Joe Loser [Thu, 8 Sep 2022 15:05:04 +0000 (09:05 -0600)]
[lldb] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.
Change call sites to use `std::size` instead.
Differential Revision: https://reviews.llvm.org/D133501
Emilio Cota [Thu, 8 Sep 2022 19:04:39 +0000 (15:04 -0400)]
[mlir] ConvertAsyncToLLVM: add missing dependence on async dialect
Differential Revision: https://reviews.llvm.org/D133516
Diego Caballero [Thu, 8 Sep 2022 20:11:37 +0000 (20:11 +0000)]
[mlir][tosa] Add apply scale flags to TosaToArith creation API
TosaToArith has two flags to enable/disable 'tosa.apply_scale' ops and
to use a 64-bit/32-bit implementation for it. This patch makes the flags
available from the pass creation API.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D133515
Aart Bik [Thu, 8 Sep 2022 18:41:29 +0000 (11:41 -0700)]
[mlir][sparse] improve dimop rewriting during conversion
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D133512
Dominic Chen [Tue, 16 Aug 2022 23:41:26 +0000 (16:41 -0700)]
[clang][ARM][NFC] Clean up signed conversion and undefined macros in builtin header
These warnings were identified while debugging modules with Wsystem-headers.
Differential Revision: https://reviews.llvm.org/D132003
Craig Topper [Thu, 8 Sep 2022 19:34:59 +0000 (12:34 -0700)]
[RISCV] Add RecurKind::FMulAdd to isLegalToVectorizeReduction for scalable vectors.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D133511
Jakub Kuderski [Thu, 8 Sep 2022 19:31:31 +0000 (15:31 -0400)]
Revert "[mlir][arith] Attempt to fix shared libs build for EmulateWideInt"
This reverts commit
4902c3b7f89a3351512b679cd6220fc55c8b3d2d.
Revert "[mlir][arith] Add wide integer emulation pass"
This reverts commit
fa8eb2708814a406261588fafe922047095b0db0.
Revert https://reviews.llvm.org/D133135 due to link errors with shared
libs on.
Philip Reames [Thu, 8 Sep 2022 19:25:07 +0000 (12:25 -0700)]
[docs][RISCV] Document experimental extensions
This adds a description of the currently existing experimental extensions. I took all information about versions and specifications from either the original commits, or current code. I'm not terribly familiar with any of these, so double checking my facts is much appreciated.
Differential Revision: https://reviews.llvm.org/D133214
Mircea Trofin [Thu, 8 Sep 2022 19:10:56 +0000 (12:10 -0700)]
[mlgo][nfc] Set logging level to warning or higher for TFLite
Jakub Kuderski [Thu, 8 Sep 2022 19:02:55 +0000 (15:02 -0400)]
[mlir][arith] Attempt to fix shared libs build for EmulateWideInt
Add missing CMake dependencies.
Original change: https://reviews.llvm.org/D133135
David Green [Thu, 8 Sep 2022 18:54:12 +0000 (19:54 +0100)]
[AArch64] Fix formatting of the Shuffle Cost tables. NFC
Quentin Colombet [Thu, 8 Sep 2022 18:49:47 +0000 (18:49 +0000)]
[mlir] Add missing dependency in bazel build
The MemRefTransform library now depends on ArithmeticUtils because
of the newly added SimplifyExtractStridedMetadata pass.
Felipe de Azevedo Piovezan [Thu, 8 Sep 2022 18:37:46 +0000 (14:37 -0400)]
Revert "[lldb] Use just-built libcxx for tests when available"
This reverts commit
c38eeecbc7d929c9601f2189214a7a90d3982a47.
River Riddle [Thu, 1 Sep 2022 17:36:00 +0000 (10:36 -0700)]
[mlir][PDL] Infer result types from a `replace` as the last resort
This prevents situations where explicit results types were provided,
which have different types than the operation being replaced. This
is useful for supporting dialect conversion, which will have proper
support added in a followup.
Differential Revision: https://reviews.llvm.org/D133141
Paul Robinson [Wed, 7 Sep 2022 19:45:35 +0000 (12:45 -0700)]
Make llvm-tli-checker support static libraries
The original implementation assumed dynamic libraries and so looked
only at the dynamic symbol table. Use the regular symbol table for
ET_REL files.
Differential Revision: https://reviews.llvm.org/D133448
Jakub Kuderski [Thu, 8 Sep 2022 17:50:21 +0000 (13:50 -0400)]
[mlir][arith] Add wide integer emulation pass
In this first patch in a series to add wide integer emulation:
* Set up the initial pass structure
* Add a custom type converter
* Handle func ops
The initial implementation supports power-of-two integers types only. We
emulate wide integer operations by splitting original i2N integer types
into two iN halves
My immediate use case is to emulate i64 operations using i32 ones
on mobile GPUs that do not support i64.
Reviewed By: antiagainst, Mogball
Differential Revision: https://reviews.llvm.org/D133135
Felipe de Azevedo Piovezan [Tue, 30 Aug 2022 13:28:14 +0000 (09:28 -0400)]
[lldb] Use just-built libcxx for tests when available
This commit improves upon
cc0b5ebf7fc8, which added support for
specifying which libcxx to use when testing LLDB. That patch honored
requests by tests that had `USE_LIBCPP=1` defined in their makefiles.
Now, we also use a non-default libcxx if all conditions below are true:
1. The test is not explicitly requesting the use of libstdcpp
(USE_LIBSTDCPP=1).
2. The test is not explicitly requesting the use of the system's
library (USE_SYSTEM_STDLIB=1).
3. A path to libcxx was either provided by the user through CMake flags
or libcxx was built together with LLDB.
Condition (2) is new and introduced in this patch in order to support
tests that are either:
* Cross-platform (such as API/macosx/macCatalyst and
API/tools/lldb-server). The just-built libcxx is usually not built for
platforms other than the host's.
* Cross-language (such as API/lang/objc/exceptions). In this case, the
Objective C runtime throws an exceptions that always goes through the
system's libcxx, instead of the just built libcxx. Fixing this would
require either changing the install-name of the just built libcxx in Mac
systems, or tuning the DYLD_LIBRARY_PATH variable at runtime.
Some other tests exposes limitations of LLDB when running with a debug
standard library. TestDbgInfoContentForwardLists had an assertion
removed, as it was checking for buggy LLDB behavior (which now
crashes). TestFixIts had a variable renamed, as the old name clashes
with a standard library name when debug info is present. This is a known
issue: https://github.com/llvm/llvm-project/issues/34391.
For `TestSBModule`, the way the "main" module is found was changed to
look for the "a.out" module, instead of relying on the index being 0. In
some systems, the index 0 is dyld when a custom standard library is
used.
Differential Revision: https://reviews.llvm.org/D132940
Zequan Wu [Tue, 6 Sep 2022 22:38:54 +0000 (15:38 -0700)]
[LLDB][NativePDB] Fix PdbAstBuilder::GetParentDeclContext when ICF happens.
Removed `GetParentDeclContextForSymbol` as this is not necesssary. We can get
the demangled names from CVSymbol and then using it to create tag decl or
namespace decl. This also fixed a bug when icf applied.
Differential Revision: https://reviews.llvm.org/D133243
Filipp Zhinkin [Thu, 8 Sep 2022 13:19:43 +0000 (16:19 +0300)]
[ARM] Add tests on instructions fusion with comparison with zero; NFC
Baseline tests for D131786
Matheus Izvekov [Tue, 19 Jul 2022 09:02:32 +0000 (11:02 +0200)]
[clang] extend getCommonSugaredType to merge sugar nodes
This continues D111283 by extending the getCommonSugaredType
implementation to also merge non-canonical type nodes.
We merge these nodes by going up starting from the canonical
node, calculating their merged properties on the way.
If we reach a pair that is too different, or which we could not
otherwise unify, we bail out and don't try to keep going on to
the next pair, in effect striping out all the remaining top-level
sugar nodes. This avoids mismatching 'companion' nodes, such as
ElaboratedType, so that they don't end up elaborating some other
unrelated thing.
Depends on D111509
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D130308