Fangrui Song [Sun, 5 Jun 2022 20:29:49 +0000 (13:29 -0700)]
[bolt] Remove unneeded cl::ZeroOrMore for cl::opt options
Joe Loser [Sat, 4 Jun 2022 16:28:17 +0000 (10:28 -0600)]
[libc++][test] Mark ranges.transform.pass.cpp UNSUPPORTED for AIX
The `ranges.transform.pass.cpp` often times out on CI for AIX (32-bit and 64-bit)
only. Mark the test as `UNSUPPORTED` for `AIX` for now. It should be looked into in
the future.
Differential Revision: https://reviews.llvm.org/D127051
Stella Laurenzo [Sun, 5 Jun 2022 19:30:28 +0000 (12:30 -0700)]
[mlir] Tunnel LLVM_USE_LINKER through to the standalone example build.
When building in debug mode, the link time of the standalone sample is excessive, taking upwards of a minute if using BFD. This at least allows lld to be used if the main invocation was configured that way. On my machine, this gets a standalone test that requires a relink to run in ~13s for Debug mode. This is still a lot, but better than it was. I think we may want to do something about this test: it adds a lot of latency to a normal compile/test cycle and requires a bunch of arg fiddling to exclude.
I think we may end up wanting a `check-mlir-heavy` target that can be used just prior to submit, and then make `check-mlir` just run unit/lite tests. More just thoughts for the future (none of that is done here).
Reviewed By: bondhugula, mehdi_amini
Differential Revision: https://reviews.llvm.org/D126585
Kazu Hirata [Sun, 5 Jun 2022 19:07:14 +0000 (12:07 -0700)]
[llvm] Convert for_each to range-based for loops (NFC)
Kazu Hirata [Sun, 5 Jun 2022 18:49:13 +0000 (11:49 -0700)]
[Sparc] Fix a warning
This patch fixes:
llvm/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp:910:5: error:
default label in switch which covers all enumeration values
[-Werror,-Wcovered-switch-default]
Matheus Izvekov [Sun, 5 Jun 2022 17:00:57 +0000 (19:00 +0200)]
[NFC] Add test cases reported in PR54341
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D127074
Alexey Lapshin [Fri, 3 Jun 2022 11:11:43 +0000 (14:11 +0300)]
[Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef - remove isIndexed().
This patch is extraction from the https://reviews.llvm.org/D126883.
It removes DwarfStringPoolEntryRef::isIndexed() and isIndexed bit
since they are not used.
Differential Revision: https://reviews.llvm.org/D126958
LemonBoy [Sun, 5 Jun 2022 18:06:50 +0000 (14:06 -0400)]
[SPARC][MC] Support more relocation types
This patch introduces support for %hix, %lox, %gdop_hix22, %gdop_lox10 and %gdop.
An extra test is introduced to make sure the fixups are correctly applied.
Reviewed By: dcederman
Differential Revision: https://reviews.llvm.org/D102575
Peter Klausler [Tue, 31 May 2022 21:06:11 +0000 (14:06 -0700)]
[flang][runtime] Use __float128 where possible & needed in runtime
On targets with __float128 available and distinct from long double,
use it to support more kind=16 entry points. This affects mostly
x86-64 targets. This means that more runtime entry points are
defined for lowering to call.
Delete Common/long-double.h and its LONG_DOUBLE macro in favor of
testing the standard macro LDBL_MANT_DIG.
Differential Revision: https://reviews.llvm.org/D127025
Kazu Hirata [Sun, 5 Jun 2022 15:45:11 +0000 (08:45 -0700)]
[Scalar] Remove isValidSingle (NFC)
The last use was removed on Feb 18, 2022 in commit
00ab91b70d21f72af59e4e198c6dc819452405af.
Nathan James [Sun, 5 Jun 2022 11:03:08 +0000 (12:03 +0100)]
[ADT] Add edit_distance_insensitive to StringRef
In some instances its advantageous to calculate edit distances without worrying about casing.
Currently to achieve this both strings need to be converted to the same case first, then edit distance can be calculated.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D126159
Fangrui Song [Sun, 5 Jun 2022 08:07:50 +0000 (01:07 -0700)]
Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options
Fangrui Song [Sun, 5 Jun 2022 07:31:44 +0000 (00:31 -0700)]
Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options
Kazu Hirata [Sun, 5 Jun 2022 07:16:14 +0000 (00:16 -0700)]
[Transforms/Utils] Use predecessors (NFC)
Christian Sigg [Sat, 4 Jun 2022 10:33:42 +0000 (12:33 +0200)]
Recommit: "[MLIR][NVVM] Replace fdiv on fp16 with promoted (fp32) multiplication with reciprocal plus one (conditional) Newton iteration."
This change rolls
bcfc0a9051014437b55ab932d9aca5ecdca6776b forward (i.e., reverting
369ce54bb302f209239b8ebc77ad824add9df089) with fixed CMakeLists.txt.
Fangrui Song [Sun, 5 Jun 2022 06:51:12 +0000 (23:51 -0700)]
Remove unneeded cl::ZeroOrMore for cl::list options
Kazu Hirata [Sun, 5 Jun 2022 05:48:32 +0000 (22:48 -0700)]
Use llvm::less_second (NFC)
Kazu Hirata [Sun, 5 Jun 2022 05:41:24 +0000 (22:41 -0700)]
[Target] Use MachineBasicBlock::erase (NFC)
Kazu Hirata [Sun, 5 Jun 2022 05:26:55 +0000 (22:26 -0700)]
[CodeGen] Use a range-based for loop (NFC)
Kazu Hirata [Sun, 5 Jun 2022 05:09:27 +0000 (22:09 -0700)]
Use static_cast from SmallString to std::string (NFC)
Kazu Hirata [Sun, 5 Jun 2022 04:23:18 +0000 (21:23 -0700)]
Use llvm::less_first (NFC)
Kazu Hirata [Sun, 5 Jun 2022 03:58:58 +0000 (20:58 -0700)]
[CodeGen] Use StringRef::contains (NFC)
Kazu Hirata [Sun, 5 Jun 2022 03:48:26 +0000 (20:48 -0700)]
[Transforms] Use llvm::is_contained (NFC)
LemonBoy [Sat, 4 Jun 2022 22:26:33 +0000 (18:26 -0400)]
[SPARC] Fix type for i64 inline asm operands
Differential Revision: https://reviews.llvm.org/D101694
Florian Hahn [Sat, 4 Jun 2022 20:22:32 +0000 (21:22 +0100)]
[VPlan] Update vector latch terminator edge to exit block after execution.
Instead of setting the successor to the exit using CFG.ExitBB, set it to
nullptr initially. The successor to the exit block is later set either
through createEmptyBasicBlock or after VPlan execution (because at the
moment, no block is created by VPlan for the exit block, the existing
one is reused).
This also enables BranchOnCond to be used as terminator for the exiting
block of the topmost vector region.
Depends on D126618.
Reviewed By: Ayal
Differential Revision: https://reviews.llvm.org/D126679
Jacques Pienaar [Sat, 4 Jun 2022 19:18:51 +0000 (12:18 -0700)]
[mlir] Use context provided rather than getContext
Avoids "pass state was never initialized" assertion failure.
Peter Klausler [Fri, 3 Jun 2022 20:44:13 +0000 (13:44 -0700)]
[flang][runtime] Catch OPEN of connected file
Diagnose OPEN(FILE=f) when f is already connected by the same name to
a distinct external I/O unit.
Differential Revision: https://reviews.llvm.org/D127035
Peter Klausler [Thu, 2 Jun 2022 21:06:57 +0000 (14:06 -0700)]
[flang][runtime] Emit error message rather than crashing for MOD(ULO)(x,P=0)
Add extra arguments and checks to the runtime support library so that
a call to the intrinsic functions MOD and MODULO with "denominator"
argument P of zero will cause a crash with a source location rather
than an uninformative floating-point error or integer division by
zero signal.
Additional work is required in lowering to (1) pass source file path and
source line number arguments and (2) actually call these runtime
library APIs instead of emitting inline code for MOD &/or MODULO.
Differential Revision: https://reviews.llvm.org/D127034
Peter Klausler [Thu, 2 Jun 2022 20:33:10 +0000 (13:33 -0700)]
[flang][runtime] Fix deadlock in error recovery
When an external I/O statement is in a recoverable error
state before any data transfers take place (for example,
an unformatted transfer with ERR=/IOSTAT=/IOMSG= attempted on
a formatted unit), ensure that the unit's mutex is still
released at the end of the statement.
Differential Revision: https://reviews.llvm.org/D127032
Peter Klausler [Thu, 2 Jun 2022 00:06:01 +0000 (17:06 -0700)]
[flang] When folding FINDLOC, convert operands to a common type
For example, FINDLOC(A,X) should convert both A and X to COMPLEX(8)
if the operands are REAL(8) and COMPLEX(4), so that comparisons
can be done without losing inforation. The current implementation
unconditionally converts X to the type of the array A.
Differential Revision: https://reviews.llvm.org/D127030
Peter Klausler [Wed, 1 Jun 2022 22:32:08 +0000 (15:32 -0700)]
[flang][runtime] Fix WRITE after OPEN(.., ACCESS="APPEND")
The initial size of the file was not being captured as the file position
on which the first output buffer should be framed.
Differential Revision: https://reviews.llvm.org/D127029
Peter Klausler [Wed, 1 Jun 2022 21:39:56 +0000 (14:39 -0700)]
[flang][runtime] Fix edge case discrepancies with EN output editing
The "engineering" ENw.d output editing descriptor has some difficult
edge case behavior for values that might format into a bunch of 9's
or round up to a 1 for a given scale factor. Fix the algorithm,
and add tests to protect against regressions.
Differential Revision: https://reviews.llvm.org/D127028
Peter Klausler [Wed, 1 Jun 2022 19:16:35 +0000 (12:16 -0700)]
[flang] Don't crash on initialization with a zero-sized derived type
Avoid calls to memcpy with zero byte counts if their address argument
calculations may not be valid expressions.
Differential Revision: https://reviews.llvm.org/D127027
Peter Klausler [Tue, 31 May 2022 17:17:20 +0000 (10:17 -0700)]
[flang][runtime] Don't crash after surviving internal output overflow
After the program has survived its attempt to overflow the output buffer
with an internal WRITE using ERR=, IOSTAT=, &/or IOMSG=, don't crash
by accidentally blank-filling the next record that usually doesn't exist.
Differential Revision: https://reviews.llvm.org/D127024
Peter Klausler [Sat, 4 Jun 2022 05:58:45 +0000 (22:58 -0700)]
[flang][runtime] Don't let random seed queries change the sequence
When the current seed of the pseudo-random generator is queried
with CALL RANDOM_SEED(GET=n), that query should not change the
stream of pseudo-random numbers produced by CALL RANDOM_NUMBER().
Differential Revision: https://reviews.llvm.org/D127023
Mehdi Amini [Sat, 4 Jun 2022 08:35:45 +0000 (08:35 +0000)]
Revert "[MLIR][GPU] Replace fdiv on fp16 with promoted (fp32) multiplication with reciprocal plus one (conditional) Newton iteration."
This reverts commit
bcfc0a9051014437b55ab932d9aca5ecdca6776b.
The build is broken with shared library enabled.
Fangrui Song [Sat, 4 Jun 2022 07:10:42 +0000 (00:10 -0700)]
Remove unneeded cl::ZeroOrMore for cl::opt options
Similar to
557efc9a8b68628c2c944678c6471dac30ed9e8e.
This commit handles options where cl::ZeroOrMore is more than one line below
cl::opt.
Christian Sigg [Fri, 3 Jun 2022 21:15:52 +0000 (23:15 +0200)]
[MLIR][GPU] Replace fdiv on fp16 with promoted (fp32) multiplication with reciprocal plus one (conditional) Newton iteration.
This is correct for all values, i.e. the same as promoting the division to fp32 in the NVPTX backend. But it is faster (~10% in average, sometimes more) because:
- it performs less Newton iterations
- it avoids the slow path for e.g. denormals
- it allows reuse of the reciprocal for multiple divisions by the same divisor
Test program:
```
#include <stdio.h>
#include "cuda_fp16.h"
// This is a variant of CUDA's own __hdiv which is fast than hdiv_promote below
// and doesn't suffer from the perf cliff of div.rn.fp32 with 'special' values.
__device__ half hdiv_newton(half a, half b) {
float fa = __half2float(a);
float fb = __half2float(b);
float rcp;
asm("{rcp.approx.ftz.f32 %0, %1;\n}" : "=f"(rcp) : "f"(fb));
float result = fa * rcp;
auto exponent = reinterpret_cast<const unsigned&>(result) & 0x7f800000;
if (exponent != 0 && exponent != 0x7f800000) {
float err = __fmaf_rn(-fb, result, fa);
result = __fmaf_rn(rcp, err, result);
}
return __float2half(result);
}
// Surprisingly, this is faster than CUDA's own __hdiv.
__device__ half hdiv_promote(half a, half b) {
return __float2half(__half2float(a) / __half2float(b));
}
// This is an approximation that is accurate up to 1 ulp.
__device__ half hdiv_approx(half a, half b) {
float fa = __half2float(a);
float fb = __half2float(b);
float result;
asm("{div.approx.ftz.f32 %0, %1, %2;\n}" : "=f"(result) : "f"(fa), "f"(fb));
return __float2half(result);
}
__global__ void CheckCorrectness() {
int i = threadIdx.x + blockIdx.x * blockDim.x;
half x = reinterpret_cast<const half&>(i);
for (int j = 0; j < 65536; ++j) {
half y = reinterpret_cast<const half&>(j);
half d1 = hdiv_newton(x, y);
half d2 = hdiv_promote(x, y);
auto s1 = reinterpret_cast<const short&>(d1);
auto s2 = reinterpret_cast<const short&>(d2);
if (s1 != s2) {
printf("%f (%u) / %f (%u), got %f (%hu), expected: %f (%hu)\n",
__half2float(x), i, __half2float(y), j, __half2float(d1), s1,
__half2float(d2), s2);
//__trap();
}
}
}
__device__ half dst;
__global__ void ProfileBuiltin(half x) {
#pragma unroll 1
for (int i = 0; i <
10000000; ++i) {
x = x / x;
}
dst = x;
}
__global__ void ProfilePromote(half x) {
#pragma unroll 1
for (int i = 0; i <
10000000; ++i) {
x = hdiv_promote(x, x);
}
dst = x;
}
__global__ void ProfileNewton(half x) {
#pragma unroll 1
for (int i = 0; i <
10000000; ++i) {
x = hdiv_newton(x, x);
}
dst = x;
}
__global__ void ProfileApprox(half x) {
#pragma unroll 1
for (int i = 0; i <
10000000; ++i) {
x = hdiv_approx(x, x);
}
dst = x;
}
int main() {
CheckCorrectness<<<256, 256>>>();
half one = __float2half(1.0f);
ProfileBuiltin<<<1, 1>>>(one); // 1.001s
ProfilePromote<<<1, 1>>>(one); // 0.560s
ProfileNewton<<<1, 1>>>(one); // 0.508s
ProfileApprox<<<1, 1>>>(one); // 0.304s
auto status = cudaDeviceSynchronize();
printf("%s\n", cudaGetErrorString(status));
}
```
Reviewed By: herhut
Differential Revision: https://reviews.llvm.org/D126158
Peter Klausler [Fri, 3 Jun 2022 20:26:28 +0000 (13:26 -0700)]
[flang][runtime] Signal new I/O error on floating-point input overflow
Besides raising the IEEE floating-point overflow exception, treat
a floating-point overflow on input as an I/O error catchable with
ERR=, IOSTAT=, &/or IOMSG=.
Differential Revision: https://reviews.llvm.org/D127022
Amir Ayupov [Sat, 4 Jun 2022 05:54:32 +0000 (22:54 -0700)]
[BOLT][UTILS] Usability improvements for nfc-check-setup
# Stash local changes before checkout.
# Print a message that the source repository revision has been changed, with
instructions to switch back.
# Make the script executable.
# Print sample instructions how to run bolt tests.
# Assume that llvm-bolt-wrapper script is in the same source directory.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D126941
Peter Klausler [Mon, 30 May 2022 23:27:49 +0000 (16:27 -0700)]
[flang] Don't discard lower bounds of implicit-shape named constants
F18 preserves lower bounds of explicit-shape named constant arrays, but
failed to also do so for implicit-shape named constants. Fix.
Differential Revision: https://reviews.llvm.org/D127021
Peter Klausler [Mon, 30 May 2022 23:13:48 +0000 (16:13 -0700)]
[flang][runtime] Ensure that 0. <= RANDOM_NUMBER() < 1.
It was possible for RANDOM_NUMBER() to return 1.0.
Differential Revision: https://reviews.llvm.org/D127020
Fangrui Song [Sat, 4 Jun 2022 05:18:06 +0000 (22:18 -0700)]
Revert D126950 "[lld][WebAssembly] Retain data segments referenced via __start/__stop"
This reverts commit
dcf3368e33c3a01bd21b692d3be5dc1ecee587f4.
It breaks -DLLVM_ENABLE_ASSERTIONS=on builds. In addition, the description is
incorrect about ld.lld behavior. For wasm, there should be justification to add
the new mode.
Peter Klausler [Mon, 30 May 2022 19:47:32 +0000 (12:47 -0700)]
[flang] Distinguish intrinsic module USE in module files; correct search paths
In the USE statements that f18 emits to module files, ensure that symbols
from intrinsic modules are marked as such on their USE statements. And
ensure that the current working directory (".") cannot override the intrinsic
module search path when trying to locate an intrinsic module.
Differential Revision: https://reviews.llvm.org/D127019
Fangrui Song [Sat, 4 Jun 2022 05:04:57 +0000 (22:04 -0700)]
[Hexagon][bolt] Remove unneeded cl::ZeroOrMore for cl::opt options. NFC
Similar to
557efc9a8b68628c2c944678c6471dac30ed9e8e
Fangrui Song [Sat, 4 Jun 2022 05:02:11 +0000 (22:02 -0700)]
[clang-link-wrapper] Remove unneeded cl::ZeroOrMore for cl::opt options. NFC
Similar to
557efc9a8b68628c2c944678c6471dac30ed9e8e
Fangrui Song [Sat, 4 Jun 2022 04:59:05 +0000 (21:59 -0700)]
[llvm] Remove unneeded cl::ZeroOrMore for cl::opt options. NFC
Some cl::ZeroOrMore were added to avoid the `may only occur zero or one times!`
error. More were added due to cargo cult. Since the error has been removed,
cl::ZeroOrMore is unneeded.
Also remove cl::init(false) while touching the lines.
LiaoChunyu [Thu, 2 Jun 2022 03:50:54 +0000 (11:50 +0800)]
[RISCV] Add more patterns for FNMADD
D54205 handles fnmadd: -rs1 * rs2 - rs3
This patch add fnmadd: -(rs1 * rs2 + rs3) (the nsz flag on the FMA)
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D126852
varconst [Sat, 4 Jun 2022 03:39:00 +0000 (20:39 -0700)]
[libc++][ranges][NFC] Fix a patch link in ranges status.
varconst [Sat, 4 Jun 2022 03:02:46 +0000 (20:02 -0700)]
[libc++][ranges][NFC] Mark range algorithms that are in progress.
Yuta Saito [Sat, 4 Jun 2022 02:28:31 +0000 (02:28 +0000)]
[lld][WebAssembly] Retain data segments referenced via __start/__stop
As well as ELF linker does, retain all data segments named X referenced
through `__start_X` or `__stop_X`.
For example, `FOO_MD` should not be stripped in the below case, but it's currently mis-stripped
```llvm
@FOO_MD = global [4 x i8] c"bar\00", section "foo_md", align 1
@__start_foo_md = external constant i8*
@__stop_foo_md = external constant i8*
@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 ()* @foo_md_size to i8*)], section "llvm.metadata"
define i32 @foo_md_size() {
entry:
ret i32 sub (
i32 ptrtoint (i8** @__stop_foo_md to i32),
i32 ptrtoint (i8** @__start_foo_md to i32)
)
}
```
This fixes https://github.com/llvm/llvm-project/issues/55839
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D126950
Peter Klausler [Sun, 29 May 2022 21:18:51 +0000 (14:18 -0700)]
[flang] Correct folding of CSHIFT and EOSHIFT for DIM>1
The algorithm was wrong for higher dimensions, and so were
the expected test results. Rework.
Differential Revision: https://reviews.llvm.org/D127018
Fangrui Song [Sat, 4 Jun 2022 01:43:15 +0000 (18:43 -0700)]
[pseudo] Fix leaks after D126731
Array Operator new Cookies help lsan find allocations, while std::array
can't.
Peter Klausler [Sun, 29 May 2022 17:12:57 +0000 (10:12 -0700)]
[flang][runtime] Signal format error when input field width is zero
A data edit descriptor for input may not have a zero field width.
Differential Revision: https://reviews.llvm.org/D127017
Peter Klausler [Sun, 29 May 2022 15:36:57 +0000 (08:36 -0700)]
[flang][runtime] OPEN write-only files
If a file being opened with no ACTION= is write-only then cope with
it rather than defaulting prematurely to treating it as read-only.
Differential Revision: https://reviews.llvm.org/D127015
Craig Topper [Sat, 4 Jun 2022 00:58:22 +0000 (17:58 -0700)]
[RISCV] Support LUI+ADDIW in doPeepholeLoadStoreADDI.
This fixes an inconsistency between RV32 and RV64. Still considering
trying to do this peephole during isel, but wanted to fix the
inconsistency first.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D126986
Peter Klausler [Sun, 29 May 2022 15:21:59 +0000 (08:21 -0700)]
[flang][runtime] INQUIRE(FILE="...",SIZE=nbytes)
Implement inquire-by-file SIZE= specifier.
Differential Revision: https://reviews.llvm.org/D127014
Jake Egan [Sat, 4 Jun 2022 01:00:47 +0000 (21:00 -0400)]
[clang][test] Mark test arm-float-abi-lto.c unsupported on AIX
This test is failing after the introduction of opaque pointers (https://reviews.llvm.org/D125847). The test is flaky and fails from segmentation fault, but it's unclear why. So, mark this test unsupported while it's investigated.
Paul Pluzhnikov [Sat, 4 Jun 2022 00:54:02 +0000 (17:54 -0700)]
[test] Modify test to verify D126396 (Clean "./" from __FILE__ expansion)
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D127009
Peter Klausler [Sat, 28 May 2022 23:11:43 +0000 (16:11 -0700)]
[flang][runtime] Allow extra character for E0.0 output editing
When the digit count ('d') is zero in E0 editing, allow for one more
output character; otherwise, any - or + sign in the output causes
an output field overflow.
Differential Revision: https://reviews.llvm.org/D127013
wren romano [Fri, 3 Jun 2022 23:41:02 +0000 (16:41 -0700)]
[mlir][sparse] Adding IsSparseTensorPred and updating ops to use it
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D126994
Peter Klausler [Sat, 28 May 2022 22:36:02 +0000 (15:36 -0700)]
[flang][runtime] Fix bug with extra leading zero in octal output
Octal (O) output editing often emits an extra leading 0 digit
due to the total digit count being off by one since word sizes
aren't multiples of three bits.
Differential Revision: https://reviews.llvm.org/D127012
Peter Klausler [Sat, 28 May 2022 18:54:57 +0000 (11:54 -0700)]
[flang] Fix crash in IsSaved()
Code was accessing ProcEntityDetails in a symbol that didn't have them.
Differential Revision: https://reviews.llvm.org/D127011
Florian Mayer [Fri, 3 Jun 2022 18:45:04 +0000 (11:45 -0700)]
[NFC] [libunwind] turn assert into static_assert
Reviewed By: #libunwind, MaskRay
Differential Revision: https://reviews.llvm.org/D126987
Clemens Wasser [Fri, 3 Jun 2022 23:32:04 +0000 (16:32 -0700)]
[tools] Forward declare classes & remove includes
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D120208
Christopher Bate [Fri, 3 Jun 2022 20:23:45 +0000 (14:23 -0600)]
[mlir][linalg] fix crash in vectorization of elementwise operations
The current vectorization logic implicitly expects "elementwise"
linalg ops to have projected permutations for indexing maps, but
the precondition logic misses this check. This can result in a
crash when executing the generic vectorization transform on an op
with a non-projected permutation input indexing map. This change
fixes the logic and adds a test (which crashes without this fix).
Differential Revision: https://reviews.llvm.org/D127000
Florian Mayer [Fri, 3 Jun 2022 21:09:34 +0000 (14:09 -0700)]
[DWARF] Show which augmentation character was unrecognized.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D127003
Brad Smith [Fri, 3 Jun 2022 22:15:12 +0000 (18:15 -0400)]
[Hexagon] Enable IAS in the Hexagon backend
Reviewed By: kparzysz
Differential Revision: https://reviews.llvm.org/D123096
Anders Waldenborg [Tue, 24 May 2022 19:46:32 +0000 (21:46 +0200)]
[clang] Allow const variables with weak attribute to be overridden
A variable with `weak` attribute signifies that it can be replaced with
a "strong" symbol link time. Therefore it must not emitted with
"weak_odr" linkage, as that allows the backend to use its value in
optimizations.
The frontend already considers weak const variables as
non-constant (note_constexpr_var_init_weak diagnostic) so this change
makes frontend and backend consistent.
This commit reverses the
f49573d1 weak globals that are const should get weak_odr linkage.
commit from 2009-08-05 which introduced this behavior. Unfortunately
that commit doesn't provide any details on why the change was made.
This was discussed in
https://discourse.llvm.org/t/weak-attribute-semantics-on-const-variables/62311
Differential Revision: https://reviews.llvm.org/D126324
Joseph Huber [Fri, 3 Jun 2022 21:33:56 +0000 (17:33 -0400)]
[Clang] Change the offload packager build to be a clang tool
Summary:
This patch changes the CMake build configruation for the
`clang-offload-packager` to be a clang tool rather than an executable.
Diego Caballero [Fri, 3 Jun 2022 21:31:43 +0000 (21:31 +0000)]
[mlir] Add peeling xform to Codegen Strategy
This patch adds the knobs to use peeling in the codegen strategy
infrastructure.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D126842
Huan Nguyen [Fri, 3 Jun 2022 21:16:24 +0000 (14:16 -0700)]
[BOLT][NFC] Warning for deprecated option '-reorder-blocks=cache+'
Emit warning when using deprecated option '-reorder-blocks=cache+'.
Auto switch to option '-reorder-blocks=ext-tsp'.
Test Plan:
```
ninja check-bolt
```
Added a new test cache+-deprecated.test.
Run and verify that the upstream tests are passed.
Reviewed By: rafauler, Amir, maksfb
Differential Revision: https://reviews.llvm.org/D126722
Jacob Weightman [Fri, 3 Jun 2022 20:52:55 +0000 (15:52 -0500)]
AMDGPU: allow reordering of functions in AMDGPUResourceUsageAnalysis
The AMDGPUResourceUsageAnalysis was previously a CGSCC pass, and assumed
that a function's callees were always analyzed prior to their callees.
When it was refactored into a module pass, this assumption no longer
always holds. This results in calls being erroneously identified as
indirect, and reserving private segment space for them. This results in
significantly slower kernel launch latency.
This patch changes the order in which the module's functions are analyzed
from the order in which they occur in the module to a post-order traversal
of the call graph. Perhaps Clang always generates the module's functions
in such an order, but this is not the case for the Cray Fortran compiler.
Reviewed By: #amdgpu, arsenm
Differential Revision: https://reviews.llvm.org/D126025
Craig Topper [Fri, 3 Jun 2022 20:29:46 +0000 (13:29 -0700)]
[RISCV] Pre-commit test cases for D126986. NFC
Reid Kleckner [Fri, 3 Jun 2022 19:56:48 +0000 (12:56 -0700)]
[bazel] Update build for config.h.cmake change
Tue Ly [Sat, 9 Apr 2022 04:12:50 +0000 (00:12 -0400)]
[libc] Make expm1f correctly rounded when the targets have no FMA instructions.
Add another exceptional value and fix the case when |x| is small.
Performance tests with CORE-MATH project scripts:
With FMA instructions on Ryzen 1700:
```
$ ./perf.sh expm1f
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
CORE-MATH reciprocal throughput : 15.362
System LIBC reciprocal throughput : 53.194
LIBC reciprocal throughput : 14.595
$ ./perf.sh expm1f --latency
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
CORE-MATH latency : 57.755
System LIBC latency : 147.020
LIBC latency : 60.269
```
Without FMA instructions:
```
$ ./perf.sh expm1f
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
CORE-MATH reciprocal throughput : 15.362
System LIBC reciprocal throughput : 53.300
LIBC reciprocal throughput : 18.020
$ ./perf.sh expm1f --latency
LIBC-location: /home/lnt/experiment/llvm/llvm-project/build/projects/libc/lib/libllvmlibc.a
CORE-MATH latency : 57.758
System LIBC latency : 147.025
LIBC latency : 70.304
```
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D123440
Joe Loser [Thu, 2 Jun 2022 03:22:17 +0000 (21:22 -0600)]
[libc++][test] Skip string_view tests for other vendors on older modes
`string_view` is supported all the way back to C++03 as an extension in
`libc++`, and so many of the tests run in all standards modes for all vendors.
This is unlikely desired by other standard library vendors using our test suite.
So, disable the tests for vendors other than `libc++` in these older standards
modes.
Differential Revision: https://reviews.llvm.org/D126850
Vy Nguyen [Wed, 1 Jun 2022 16:54:41 +0000 (12:54 -0400)]
[lld-macho] Addressed additional post-commit comments from D126046
- fixed newlines
- renamed helper function for clarity
- added additional comment
Differential Revision: https://reviews.llvm.org/D126792
Martin Storsjö [Wed, 1 Jun 2022 21:12:16 +0000 (00:12 +0300)]
[ARM] Make a narrow tMOVi8 where possible in SEH prologues
We intentionally disable Thumb2SizeReduction for SEH
prologues/epilogues, to avoid needing to guess what will happen with
the instructions in a potential future pass in frame lowering.
But for this specific case, where we know we can express the
intent with a narrow instruction, change to that instruction form
directly in frame lowering.
Differential Revision: https://reviews.llvm.org/D126949
Martin Storsjö [Wed, 1 Jun 2022 19:38:41 +0000 (22:38 +0300)]
[ARM] Make narrow push/pop in SEH prologues/epilogues where applicable
We intentionally disable Thumb2SizeReduction for SEH
prologues/epilogues, to avoid needing to guess what will happen with
the instructions in a potential future pass in frame lowering.
But for this specific case, where we know we can express the
intent with a narrow instruction, change to that instruction form
directly in frame lowering.
Differential Revision: https://reviews.llvm.org/D126948
Eric Christopher [Fri, 3 Jun 2022 19:07:58 +0000 (12:07 -0700)]
Revert "[X86] combineConcatVectorOps - add support for concatenation VSELECT/BLENDV nodes"
See the original commit for a testcase.
This reverts commit
ea8fb3b6019642a3a032fd65588eb8460439d2f9.
Vadim Paretsky [Fri, 3 Jun 2022 19:10:25 +0000 (14:10 -0500)]
[OpenMP] allow loc to be NULL in __kmp_determine_reduction_method for MSVC
MSVC may not supply source location information to kmpc_reduce passing
NULL for the value. The patch adds a check for the loc value being NULL
in kmp_determine_reduction_method.
Differential Revision: https://reviews.llvm.org/D126564
Vir Narula [Fri, 3 Jun 2022 19:02:42 +0000 (20:02 +0100)]
[Matrix] Add dot product tests
LLVM LIT tests for our upcoming dot product lowering change
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D126942
Yitzhak Mandelbaum [Fri, 3 Jun 2022 16:21:27 +0000 (16:21 +0000)]
[clang][dataflow] Modify `optional` model to handle type aliases.
Previously, type aliases were not handled (and resulted in an assertion
firing). This patch generalizes the model to consider aliases everywhere (a
previous patch already considered aliases for optional-returning functions).
Differential Revision: https://reviews.llvm.org/D126972
Sam McCall [Tue, 31 May 2022 19:10:13 +0000 (21:10 +0200)]
[pseudo] Add CLANG_PSEUDO_GEN cmake cache variable to avoid nested CMake invocation
Similar to LLVM_TABLEGEN, CLANG_TABLEGEN variables
Differential Revision: https://reviews.llvm.org/D126717
Sam McCall [Tue, 31 May 2022 22:07:30 +0000 (00:07 +0200)]
[pseudo] rename pseudo-gen -> clang-pseudo-gen. NFC
This name is not namespaced. Requested in D126717
Differential Revision: https://reviews.llvm.org/D126725
Sam Clegg [Fri, 3 Jun 2022 17:47:53 +0000 (10:47 -0700)]
[lld][WebAssembly] Remove unnecessary accessor methods. NFC
This is less code, and matches more closely the ELF linker.
Differential Revision: https://reviews.llvm.org/D126979
Benjamin Kramer [Fri, 3 Jun 2022 18:43:02 +0000 (20:43 +0200)]
[bazel] Port
95aff23e2921
Sam McCall [Tue, 31 May 2022 23:02:47 +0000 (01:02 +0200)]
[pseudo] Eliminate dependencies from clang-pseudo-gen. NFC
ClangBasic dependency eliminated by replacing our usage of
tok::getPunctuatorSpelling etc with direct use of the *.def file.
Implicit dependencies on clang-tablegen-targets removed as we manage to avoid
any transitive tablegen deps.
After these changes, `ninja clean; ninja pseudo-gen` runs 169 actions only
(basically Support and Demangle).
Differential Revision: https://reviews.llvm.org/D126731
Jim Ingham [Fri, 3 Jun 2022 18:32:43 +0000 (11:32 -0700)]
CommandObjectRegexCommand shouldn't put two commands on the history stack.
It was putting the command the user typed, and then the resolved command in the
command history. That caused up-arrow not to work correctly when the regex command
was invoked from a Python-command. Plus it's just weird.
Differential Revision: https://reviews.llvm.org/D126789
Nikolas Klauser [Fri, 3 Jun 2022 10:50:39 +0000 (12:50 +0200)]
[libc++] Forward more often to memmove in copy
In D122982 I accidentally disabled the memmove optimization. This re-enables it and adds more cases where copy forwards to memmove.
Fixes https://github.com/llvm/llvm-project/issues/33687
Reviewed By: var-const, #libc, ldionne
Spies: pkasting, ayzhao, dcheng, xbolva00, libcxx-commits
Differential Revision: https://reviews.llvm.org/D124328
Kevin Athey [Fri, 3 Jun 2022 18:14:59 +0000 (11:14 -0700)]
[MSAN] Exclude dn_expand test from Android.
Depends on
1a729bce8617
Differential Revision: https://reviews.llvm.org/D126981
python3kgae [Thu, 2 Jun 2022 16:39:01 +0000 (09:39 -0700)]
[NFC] Fix issue on CMake Xcode build configuration.
add missing dependency for hlsl-resource-headers and clang-resource-headers.
Reviewed By: rastogishubham
Differential Revision: https://reviews.llvm.org/D126892
Craig Topper [Fri, 3 Jun 2022 17:53:39 +0000 (10:53 -0700)]
[RISCV] Use SelectionDAG::isBaseWithConstantOffset in scalar load/store address matching.
Test changes are because isBaseWithConstantOffset uses computeKnownBits
and that is able to see that an earlier AND instruction guaranteed
alignment so that we can treat an OR as an ADD.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D126970
Reid Kleckner [Fri, 3 Jun 2022 17:08:53 +0000 (10:08 -0700)]
[config] Remove LLVM_DEFAULT_TARGET_TRILE from config.h
It is redundant with llvm-config.h, which is always included by
config.h.
Port D12660 /
d178f4fc895b432008fcd8a0a49a13d951fecfe4 from config.h to
llvm-config.h.
Update the gn build accordingly.
NFCI
Krzysztof Drewniak [Thu, 2 Jun 2022 21:45:52 +0000 (21:45 +0000)]
Re-land "[mlir] Add integer range inference analysis""
This reverts commit
4e5ce2056e3e85f109a074e80bdd23a10ca2bed9.
This relands commit
1350c9887dca5ba80af8e3c1e61b29d6696eb240.
Reinstates the range analysis with the build issue fixed.
Differential Revision: https://reviews.llvm.org/D126926
Florian Mayer [Fri, 3 Jun 2022 01:11:42 +0000 (18:11 -0700)]
[LLVM] [NFC] remove unnecessary, confusing scope
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D126935
Kevin Athey [Thu, 2 Jun 2022 21:18:00 +0000 (14:18 -0700)]
[MSAN] add dn_expand intercept.
This interceptor only addresses writes to inputs. Reads of inputs are not checked.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D126851
Nick Desaulniers [Fri, 3 Jun 2022 16:33:04 +0000 (09:33 -0700)]
llvm: cmake: set CMP0114 to OLD to avoid warning
Building with cmake 3.23.2+ produces warnings when using
LLVM_ENABLE_RUNTIMES. Set this policy to the existing behavior for now
to silence the warnings.
Fixes: https://github.com/llvm/llvm-project/issues/50122
Fixes: https://github.com/llvm/llvm-project/issues/54944
Reviewed By: phosek, penzn
Differential Revision: https://reviews.llvm.org/D126923
Leonard Grey [Thu, 2 Jun 2022 17:30:43 +0000 (13:30 -0400)]
[Attributes] Remove AttrSyntax and migrate uses to AttributeCommonInfo::Syntax (NFC)
This is setup for allowing hasAttribute to work for plugin-provided attributes
Differential Revision: https://reviews.llvm.org/D126902