Adrian Kuegel [Wed, 24 Aug 2022 08:13:28 +0000 (10:13 +0200)]
[mlir][Bazel] Fix bazel build.
Petr Hosek [Thu, 18 Aug 2022 08:25:13 +0000 (08:25 +0000)]
[runtimes] Use a response file for runtimes test suites
We don't know which test suites are going to be included by runtimes
builds so we cannot include those before running the sub-build, but
that's not possible during the LLVM build configuration. We instead use
a response file that's populated by the runtimes build as a level of
indirection.
This addresses the issue described in:
https://discourse.llvm.org/t/cmake-regeneration-is-broken/62788
Differential Revision: https://reviews.llvm.org/D132438
Petr Hosek [Mon, 15 Aug 2022 17:59:39 +0000 (17:59 +0000)]
[lit] Support reading arguments from a file
This allows reading arguments from file using the response file syntax.
We would like to use this in the LLVM build to pass test suites from
subbuilds.
Differential Revision: https://reviews.llvm.org/D132437
Michele Scuttari [Wed, 24 Aug 2022 07:59:50 +0000 (09:59 +0200)]
[MLIR] Split autogenerated pass declarations & C++ controllable pass options
The pass tablegen backend has been reworked to remove the monolithic nature of the autogenerated declarations.
The pass public header can be generated with the -gen-pass-decls option. It contains options structs and registrations: the inclusion of options structs can be controlled individually for each pass by defining the GEN_PASS_DECL_PASSNAME macro; the declaration of the registrations have been kept together and can still be included by defining the GEN_PASS_REGISTRATION macro.
The private code used for the pass implementation (i.e. the pass base class and the constructors definitions, if missing from tablegen) can be generated with the -gen-pass-defs option. Similarly to the declarations file, the definitions of each pass can be enabled by defining the GEN_PASS_DEF_PASNAME variable.
While doing so, the pass base class has been enriched to also accept a the aformentioned struct of options and copy them to the actual pass options, thus allowing each pass to also be configurable within C++ and not only through command line.
Reviewed By: rriddle, mehdi_amini, Mogball, jpienaar
Differential Revision: https://reviews.llvm.org/D131839
Pavel Samolysov [Wed, 29 Jun 2022 10:46:10 +0000 (13:46 +0300)]
[Pipelines] Introduce DAE after ArgumentPromotion
The ArgumentPromotion pass uses Mem2Reg promotion at the end to cutting
down generated `alloca` instructions as well as meaningless `store`s and
this behavior can leave unused (dead) arguments. To eliminate the dead
arguments and therefore let the DeadCodeElimination remove becoming dead
inserted `GEP`s as well as `load`s and `cast`s in the callers, the
DeadArgumentElimination pass should be run after the ArgumentPromotion
one.
Differential Revision: https://reviews.llvm.org/D128830
Tobias Hieta [Wed, 24 Aug 2022 07:33:58 +0000 (09:33 +0200)]
[docs] Add LICENSE.txt to the root of the mono-repo
This will make it easier to find the LICENSE and some
software also looks in the root to automatically find it.
Reviewed By: kristof.beyls, lattner
Differential Revision: https://reviews.llvm.org/D132018
David Green [Wed, 24 Aug 2022 07:18:01 +0000 (08:18 +0100)]
[AArch64][X86] Add some fixed-order-recurrence tests to check the costmodel of fixed order recurrences. NFC
David Green [Wed, 17 Aug 2022 10:16:59 +0000 (11:16 +0100)]
[AArch64][SVE] Remove -O1 from SVE intrinsic tests.
This removes -O1 from the SVE ACLE intrinsics tests and replaces it with
-O0 and "opt -mem2reg -instcombine -tailcallelim". Instrcombine and
TailCallElim are only added to keep the differences smaller and can be
removed in a followup patches. The only remaining differences in the
tests are tbaa nodes not being emitted under -O0, and the removable of
some tailcall flags.
Adrian Kuegel [Wed, 24 Aug 2022 06:51:44 +0000 (08:51 +0200)]
[mlir][Bazel] Fix bazel build.
To avoid a dependency cycle, add BytecodeImplementation.h header to the
"IR" target.
Mahesh Ravishankar [Wed, 24 Aug 2022 06:36:40 +0000 (06:36 +0000)]
Alex [Mon, 22 Aug 2022 09:50:19 +0000 (17:50 +0800)]
[RISCV] Add zihintntl compressed instructions
Add zihintntl compressed instructions and some files related to zihintntl.
This patch is base on {D121670}.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D121779
Paweł Bylica [Tue, 23 Aug 2022 11:35:40 +0000 (13:35 +0200)]
[DAGCombine] Add more tests for cmp to sbb combination; NFC
Add 2 more tests for potential DAG combine of cmp into sbb.
Differential Revision: https://reviews.llvm.org/D132463
Mahesh Ravishankar [Wed, 24 Aug 2022 05:56:13 +0000 (05:56 +0000)]
[mlir][Linalg] Handle multi-result operations in Elementwise op fusion.
This drops the artificial requirement of producers having a single
result value to be able to fuse with consumers.
The current default also only fuses producer with consumer when the
producer has a single use. This is a simplifying assumption. There are
legitimate use cases where a producer can be fused with consumer and
the fused o pcould be used to replace the uses of the producer as
well. This needs to be done with care to avoid use-def violations. To
allow for downstream users to explore more fusion opportunities, the
core transformation method is exposed as a utility function.
This patch also modifies the control function to take just the fused
operand as the argument. This is enough information for the callers to
get the producer and the consumer operations being considered to
fuse. It also provides information of which producer result is used.
Differential Revision: https://reviews.llvm.org/D132301
esmeyi [Wed, 24 Aug 2022 05:36:40 +0000 (01:36 -0400)]
[AIX] use the original name as the input to create the new symbol for TLS symbol.
Summary: Currently, an error was reported when a thread local symbol has an invalid name. D100956 create a new symbol to prefix the TLS symbol name with a dot. When the symbol name is renamed, the error occurs. This patch uses the original symbol name (name in the symbol table) as the input for the symbol for TOC entry.
Reviewed By: shchenz, lkail
Differential Revision: https://reviews.llvm.org/D132348
ZHU Zijia [Wed, 24 Aug 2022 05:27:56 +0000 (13:27 +0800)]
[RISCV] Handle register spill in branch relaxation
In branch relaxation pass, `j`'s with offset over 1MiB will be relaxed
to `jump` pseudo-instructions.
This patch allocates a stack slot for functions with a size greater than
1MiB. If the register scavenger cannot find a scratch register for
`jump`, spill a register to the slot before the jump and restore it
after the jump.
.mbb:
foo
j .dest_bb
bar
bar
bar
.dest_bb:
baz
The above code will be relaxed to the following code.
.mbb:
foo
sd s11, 0(sp)
jump .restore_bb, s11
bar
bar
bar
j .dest_bb
.restore_bb:
ld s11, 0(sp)
.dest_bb:
baz
Depends on D129999.
Reviewed By: StephenFan
Differential Revision: https://reviews.llvm.org/D130560
ZHU Zijia [Wed, 24 Aug 2022 05:23:38 +0000 (13:23 +0800)]
[RISCV][TableGen] Mark MachineInstr with FrameIndex as not compressible
If a MachineInstr's operand should be Reg in compiler's output but is
currently FrameIndex, `isCompressibleInst()` will terminate at
`MachineOperandType::getReg()`.
This patch adds `.isReg()` checks to make `isCompressibleInst()` return
false for these MachineInstr, allowing `getInstSizeInBytes()` to return
a value and `EstimateFunctionSizeInBytes()` to work as intended.
See https://reviews.llvm.org/D129999#3694222 for details.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D129999
Kai Sasaki [Wed, 24 Aug 2022 01:58:01 +0000 (10:58 +0900)]
[mlir][math] Lower math.floor,ceil to libm
Lower math.floor and math.ceil to libm
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D131876
Che-Yu Wu [Wed, 24 Aug 2022 04:12:50 +0000 (04:12 +0000)]
Reland "[MLIR]Extend vector.gather to support n-D result"
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D132507
Keno Fischer [Wed, 24 Aug 2022 03:23:36 +0000 (03:23 +0000)]
[MSAN] Handle array alloca with non-i64 size specification
The array size specification of the an alloca can be any integer,
so zext or trunc it to intptr before attempting to multiply it
with an intptr constant.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D131846
Keno Fischer [Wed, 24 Aug 2022 03:23:31 +0000 (03:23 +0000)]
[MSAN] Correct shadow type for atomicrmw instrumentation
We were passing the type of `Val` to `getShadowOriginPtr`, rather
than the type of `Val`'s shadow resulting in broken IR. The fix
is simple.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D131845
John Ericson [Sat, 20 Aug 2022 21:38:05 +0000 (17:38 -0400)]
[Polly] Don't use `llvm-config` anymore (in CMake sad path)
If `LLVM_BUILD_MAIN_SRC_DIR` is not defined, just assume we are in
regular monorepo layout. Non-standard (and not really supported) layouts
can still be configured manually.
Reviewed By: beanz
Differential Revision: https://reviews.llvm.org/D132314
Bing1 Yu [Wed, 24 Aug 2022 01:41:40 +0000 (09:41 +0800)]
[X86] Emulate _rdrand64_step with two rdrand32 if it is 32bit
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D132141
Simon Pilgrim [Wed, 24 Aug 2022 02:04:59 +0000 (03:04 +0100)]
[DAG] MatchRotate - bail if we fail to match a shl/srl pair
extractShiftForRotate may fail to return canonicalized shifts due to constant folding or other simplification that can occur in getNode()
Fixes Issue #57283
Chris Bieneman [Wed, 24 Aug 2022 01:52:29 +0000 (20:52 -0500)]
[HLSL] Infer language from file extension
This allows the language mode for HLSL to be inferred from the file
extension.
Chris Bieneman [Wed, 24 Aug 2022 01:49:56 +0000 (20:49 -0500)]
[NFC] Fix warning
This change came in a few hours ago and introduced a warning. The fix
is trivial, so I'm providing it. The original change was reviewed here:
https://reviews.llvm.org/D132331
Bing1 Yu [Wed, 24 Aug 2022 01:38:46 +0000 (09:38 +0800)]
Revert "[X86] Emulate _rdrand64_step with two rdrand32 if it is 32bit"
This reverts commit
07e34763b02728857e1d6e8ccd2b82820eb3c0cc.
Bing1 Yu [Tue, 23 Aug 2022 08:25:48 +0000 (16:25 +0800)]
[X86] Emulate _rdrand64_step with two rdrand32 if it is 32bit
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D132141
River Riddle [Wed, 24 Aug 2022 00:43:41 +0000 (17:43 -0700)]
[mlir:Bytecode] Move variable to inside of the lambda to fix MSVC build
MSVC is not picking up a variable capture somehow, try moving it inside.
Amir Ayupov [Tue, 23 Aug 2022 23:08:01 +0000 (16:08 -0700)]
[BOLT][NFC] Move out handleAArch64IndirectCall
Move the large lambda out of BinaryFunction::disassemble, reducing its size from
255 to 233 LoC.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132104
Amir Ayupov [Tue, 23 Aug 2022 23:07:58 +0000 (16:07 -0700)]
[BOLT][NFC] Move out handleIndirectBranch
Move the large lambda out of BinaryFunction::disassemble, reducing its size from
295 to 255 LoC.
Differential Revision: https://reviews.llvm.org/D132101
Amir Ayupov [Tue, 23 Aug 2022 23:07:52 +0000 (16:07 -0700)]
[BOLT][NFC] Move out handleExternalReference
Move the large lambda out of BinaryFunction::disassemble, reducing its size from
338 to 295 LoC.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132100
Amir Ayupov [Tue, 23 Aug 2022 23:07:46 +0000 (16:07 -0700)]
[BOLT][NFC] Move out handlePCRelOperand
Move the large lambda out of BinaryFunction::disassemble, reducing its size from
377 to 338 LoC.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D132099
Petr Hosek [Tue, 23 Aug 2022 07:26:37 +0000 (07:26 +0000)]
[Clang] Avoid using unwind library in the MSVC environment
We're seeing the following warnings with --rtlib=compiler-rt:
lld-link: warning: ignoring unknown argument '--as-needed'
lld-link: warning: ignoring unknown argument '-lunwind'
lld-link: warning: ignoring unknown argument '--no-as-needed'
MSVC doesn't use the unwind library, so just omit it.
Differential Revision: https://reviews.llvm.org/D132440
River Riddle [Tue, 23 Aug 2022 23:33:47 +0000 (16:33 -0700)]
[mlir:Bytecode] Use UNSUPPORTED instead of XFAIL for s390x
Some tests still pass even though we don't claim big-endian support. Using
UNSUPPORTED is a better indicator than XFAIL that we don't guarantee that
the tests work.
River Riddle [Tue, 23 Aug 2022 19:56:02 +0000 (12:56 -0700)]
[mlir:Bytecode] Add initial support for dialect defined attribute/type encodings
Dialects can opt-in to providing custom encodings by implementing the
`BytecodeDialectInterface`. This interface provides hooks, namely
`readAttribute`/`readType` and `writeAttribute`/`writeType`, that will be used
by the bytecode reader and writer. These hooks are provided a reader and writer
implementation that can be used to encode various constructs in the underlying
bytecode format. A unique feature of this interface is that dialects may choose
to only encode a subset of their attributes and types in a custom bytecode
format, which can simplify adding new or experimental components that aren't
fully baked.
Differential Revision: https://reviews.llvm.org/D132498
River Riddle [Tue, 23 Aug 2022 09:20:48 +0000 (02:20 -0700)]
[mlir:Bytecode][NFC] Cleanup Attribute/Type reading
This moves some parsing functionality from BytecodeReader to
AttrTypeReader, and removes some duplication between the attribute/type
code paths.
Differential Revision: https://reviews.llvm.org/D132497
River Riddle [Tue, 23 Aug 2022 08:28:10 +0000 (01:28 -0700)]
[mlir:Bytecode][NFC] Refactor string section writing and reading
This extracts the string section writer and reader into dedicated
classes, which better separates the logic and will also simplify future
patches that want to interact with the string section.
Differential Revision: https://reviews.llvm.org/D132496
Teresa Johnson [Tue, 23 Aug 2022 22:59:05 +0000 (15:59 -0700)]
[memprof] Correct max size and access count computations
The existing code resulted in the max size and access counts being equal
to the min. Compute the max instead (max lifetime was already correct).
Differential Revision: https://reviews.llvm.org/D132515
isuckatcs [Fri, 29 Jul 2022 00:14:57 +0000 (02:14 +0200)]
[analyzer] Process non-POD array element destructors
The constructors of non-POD array elements are evaluated under
certain conditions. This patch makes sure that in such cases
we also evaluate the destructors.
Differential Revision: https://reviews.llvm.org/D130737
Slava Zakharin [Thu, 18 Aug 2022 21:06:19 +0000 (14:06 -0700)]
[flang] Keep original data type for do-variable value.
Keep the original data type of integer do-variables
for structured loops. When do-variable's data type
is an integer type shorter than IndexType, processing
the do-variable separately from the DoLoop's iteration index
allows getting rid of type casts, which can make backend
optimizations easier.
For example,
```
do i = 2, n-1
do j = 2, n-1
... = a(j-1, i)
end do
end do
```
If value of 'j' is computed by casting the DoLoop's iteration
index to 'i32', then Flang will produce the following LLVM IR:
```
%1 = trunc i64 %iter_index to i32
%2 = sub i32 %1, 1
%3 = sext i32 %2 to i64
```
LLVM's InstCombine may try to get rid of the sign extension,
and may transform this into:
```
%1 = shl i64 %iter_index, 32
%2 = add i64 %1, -
4294967296
%3 = ashr exact i64 %2, 32
```
The extra computations for the element address applied on top
of this awkward pattern confuse LLVM vectorizer so that
it does not recognize the unit-strided access of 'a'.
Measured performance improvements on `SPEC CPU2000@IceLake`:
```
168.wupwise: 11.96%
171.swim: 11.22%
172.mrgid: 56.38%
178.galgel: 7.29%
301.apsi: 8.32%
```
Differential Revision: https://reviews.llvm.org/D132176
Louis Dionne [Thu, 18 Aug 2022 21:41:13 +0000 (17:41 -0400)]
[libc++] Extend check for non-ASCII characters to src/, test/ and benchmarks/
Differential Revision: https://reviews.llvm.org/D132180
Louis Dionne [Thu, 18 Aug 2022 20:49:06 +0000 (16:49 -0400)]
[libc++] Remove trailing whitespace from libcxx includes, source, tests and benchmarks
Differential Revision: https://reviews.llvm.org/D132175
Siva Chandra [Tue, 23 Aug 2022 20:58:59 +0000 (13:58 -0700)]
[libc][Obvious] Fix typo is chmod implementation.
This now allows enabling the chmod function on aarch64.
Eli Friedman [Tue, 23 Aug 2022 21:51:32 +0000 (14:51 -0700)]
Print more information when JSON parsing fails for unittests.
Trying to figure out intermittent failure on reverse-iteration buildbot.
Sanjay Patel [Tue, 23 Aug 2022 21:45:59 +0000 (17:45 -0400)]
[SDAG] expand more is-power-of-2 patterns that use popcount
(ctpop x) == 1 --> (x != 0) && ((x & x-1) == 0)
Adjust the legality check to avoid the poor codegen on AArch64.
We probably only want to use popcount on this pattern when it
is a single instruction.
fixes #57225
Differential Revision: https://reviews.llvm.org/D132237
Sanjay Patel [Tue, 23 Aug 2022 21:44:43 +0000 (17:44 -0400)]
[AArch64] add test for popcount i32; NFC
More coverage for D132237
Sanjay Patel [Tue, 23 Aug 2022 13:09:22 +0000 (09:09 -0400)]
[InstCombine] adjust tests for mul+add common factor; NFC
The existing tests were added with
2880d7b9e4c9a0, but
discussion in D132412 suggests that we should start
with a simpler pattern (the more complicated pattern
may not be a real problem).
Vitaly Buka [Tue, 23 Aug 2022 21:50:51 +0000 (14:50 -0700)]
[symbolizer] Fix build after 342e0eb
342e0eb reverted LLVM_ENABLE_RUNTIMES incompletly and missed /runtimes
part. This target has no issues with LLVM_ENABLE_RUNTIMES, so we can
keep it.
Vitaly Buka [Tue, 23 Aug 2022 21:49:05 +0000 (14:49 -0700)]
[symbolizer] Remove check if it's monorepo
Vitaly Buka [Tue, 23 Aug 2022 21:27:41 +0000 (14:27 -0700)]
[test][openmp] Relax condition in test
It runs 8 threads. Sometimes tsan is able to detect more than one of the
same race.
Louis Dionne [Tue, 23 Aug 2022 17:27:03 +0000 (13:27 -0400)]
[CMake] Move cxx-headers to RUNTIME_DISTRIBUTION_COMPONENTS in Apple-stage2.cmake
We build libcxx using LLVM_ENABLE_RUNTIMES during Stage2, which requires
cxx-headers to be part of LLVM_RUNTIME_DISTRIBUTION_COMPONENTS instead
of LLVM_DISTRIBUTION_COMPONENTS.
rdar://
99028431
Differential Revision: https://reviews.llvm.org/D132488
Vitaly Buka [Sat, 20 Aug 2022 04:11:59 +0000 (21:11 -0700)]
[clang] Create alloca to pass into static lambda
"this" parameter of lambda if undef, notnull and differentiable.
So we need to pass something consistent.
Any alloca will work. It will be eliminated as unused later by optimizer.
Otherwise we generate code which Msan is expected to catch.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D132275
Peter Steinfeld [Thu, 18 Aug 2022 21:39:26 +0000 (14:39 -0700)]
[Flang] Make the TODO messages for intrinsics more consistent
This title says it all.
Differential Revision: https://reviews.llvm.org/D132179
Philip Reames [Tue, 23 Aug 2022 20:45:59 +0000 (13:45 -0700)]
[slp] Pull out a getOperandInfo variant helper [nfc]
Alvin Wong [Tue, 23 Aug 2022 20:09:50 +0000 (23:09 +0300)]
[llvm] Mark CFGuard fn ptr symbol as DSO local and add tests for mingw
For mingw target, if a symbol is not marked DSO local, a `.refptr` is
generated for it. This makes CFG check calls use an extra pointer
dereference, which adds extra overhead compared to the MSVC version,
so mark the CFG guard check funciton pointer DSO local to stop it.
This should have no effect on MSVC target.
Also adapt the existing cfguard tests to run for mingw targets, so that
this change is checked.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D132331
Alvin Wong [Tue, 23 Aug 2022 20:08:05 +0000 (23:08 +0300)]
[clang] Add support for __attribute__((guard(nocf)))
To support using Control Flow Guard with mingw-w64, Clang needs to
accept `__declspec(guard(nocf))` also for the GNU target. Since mingw
has `#define __declspec(a) __attribute__((a))` as built-in, the simplest
solution is to accept `__attribute__((guard(nocf)))` to be compatible with
MSVC and Clang's msvc target.
As a side effect, this also adds `[[clang::guard(nocf)]]` for C++.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D132302
William Huang [Tue, 23 Aug 2022 18:58:31 +0000 (18:58 +0000)]
[Sample Profile Reader] Fix potential integer overflow/infinite loop bug in sample profile reader
Change loop induction variable type to match the type of "SIZE" where it's compared against, to prevent infinite loop caused by overflow wraparound if there are more than 2^32 samples
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D132493
Mehdi Amini [Tue, 23 Aug 2022 20:26:38 +0000 (20:26 +0000)]
Revert "[MLIR]Extend vector.gather to support n-D result"
This reverts commit
0cbfd6fd1633a075dcfd1bcd8a11e1c6d2785fa8.
A test is crashing with the shared_lib config.
Alexander Shaposhnikov [Tue, 23 Aug 2022 20:09:40 +0000 (20:09 +0000)]
[clang-tidy] Skip unions in use-equals-default
For unions constructors with empty bodies behave differently
(in comparison with structs/classes) and clang-tidy's fix
might break the code. This diff adjusts the check to skip unions
for now (it seems to be a relatively rare case).
Test plan: ninja check-all
Differential revision: https://reviews.llvm.org/D132290
Stanley Winata [Tue, 23 Aug 2022 19:56:29 +0000 (15:56 -0400)]
[mlir][spirv] Map memory space to OpenCL/Kernel storage class
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D132428
Alexander Shaposhnikov [Tue, 23 Aug 2022 19:48:11 +0000 (19:48 +0000)]
[tools][llvm-lipo] Fix off-by-one error in command-line argument parsing
makeArrayRef(argv + 1, argc) -> makeArrayRef(argv + 1, argc - 1)
The previous behavior resulted in propagation of the null pointer
into later stages of arguments parsing instead of being automatically
handled by the existing check of MissingArgumentCount.
Test plan: ninja check-all
Differential revision: https://reviews.llvm.org/D132418
Siva Chandra [Tue, 23 Aug 2022 19:23:13 +0000 (12:23 -0700)]
[libc] Enable a few entrypoints on aarch64 which are now available on x86_64.
Stephen Tozer [Mon, 20 Jun 2022 15:39:28 +0000 (16:39 +0100)]
[DebugInfo] Extend the InstrRef LDV to support DbgValues with many Ops
This patch builds on prior support patches to enable support for
variadic debug values in InstrRefLDV, allowing DBG_VALUE_LISTs to
have their ranges extended.
Differential Revision: https://reviews.llvm.org/D128212
Joseph Huber [Wed, 17 Aug 2022 21:39:12 +0000 (17:39 -0400)]
[OpenMP] Add option to assert no nested OpenMP parallelism on the GPU
The OpenMP device runtime needs to support the OpenMP standard. However
constructs like nested parallelism are very uncommon in real application
yet lead to complexity in the runtime that is sometimes difficult to
optimize out. As a stop-gap for performance we should supply an argument
that selectively disables this feature. This patch adds the
`-fopenmp-assume-no-nested-parallelism` argument which explicitly
disables the usee of nested parallelism in OpenMP.
Reviewed By: carlo.bertolli
Differential Revision: https://reviews.llvm.org/D132074
Simon Pilgrim [Tue, 23 Aug 2022 19:00:37 +0000 (20:00 +0100)]
[TTI] Add SK_Splice shuffle mask detection and X86 costs
Enables fixed sized vectors to detect SK_Splice shuffle patterns and provides basic X86 cost support
Differential Revision: https://reviews.llvm.org/D132374
Philip Reames [Tue, 23 Aug 2022 18:54:57 +0000 (11:54 -0700)]
[RISCV] Add cost model coverage for trig, log, and exp unary routines
Simon Pilgrim [Tue, 23 Aug 2022 18:50:52 +0000 (19:50 +0100)]
[ADT] Add llvm::has_single_bit helper similar to the c++20 std::has_single_bit implementation
Converted the llvm::isPowerOf2_32/64 helpers into wrappers
Roy Jacobson [Mon, 22 Aug 2022 17:45:03 +0000 (20:45 +0300)]
[Clang] Implement P0848 (Conditionally Trivial Special Member Functions)
This patch implements P0848 in Clang.
During the instantiation of a C++ class, in `Sema::ActOnFields`, we evaluate constraints for all the SMFs and compare the constraints to compute the eligibility. We defer the computation of the type's [copy-]trivial bits from addedMember to the eligibility computation, like we did for destructors in D126194. `canPassInRegisters` is modified as well to better respect the ineligibility of functions.
Note: Because of the non-implementation of DR1734 and DR1496, I treat deleted member functions as 'eligible' for the purpose of [copy-]triviallity. This is unfortunate, but I couldn't think of a way to make this make sense otherwise.
Reviewed By: #clang-language-wg, cor3ntin, aaron.ballman
Differential Revision: https://reviews.llvm.org/D128619
Zahira Ammarguellat [Tue, 23 Aug 2022 18:35:57 +0000 (14:35 -0400)]
Adding a note about the macro __FLT_EVAL_METHOD__; NFC
This is to clarify that the macro __FLT_EVAL_METHOD__ is not pre-
defined like other preprocessor macros. It will not appear when
preprocessor macros are dumped.
Differential Revision: https://reviews.llvm.org/D124033
Stefan Pintilie [Mon, 22 Aug 2022 16:49:56 +0000 (11:49 -0500)]
[NFC][PowerPC] Clean up a couple of lambdas from the PPCMIPeephole.
There were two sections of code that had a lot of lambdas and in the patch
D40554 it was suggested that we clean them up as a follow-up NFC patch.
Reviewed By: nemanjai, #powerpc
Differential Revision: https://reviews.llvm.org/D132394
Raghav [Tue, 16 Aug 2022 15:08:17 +0000 (11:08 -0400)]
AMDGPU/MetaData: Restrict address space key to only be emitted for "global_buffer" and "dynamic_shared_pointer"
This matches .address_space docs at https://llvm.org/docs/AMDGPUUsage.html#amdgpu-amdhsa-code-object-kernel-argument-metadata-map-table-v3
Differential Revision: https://reviews.llvm.org/D132145
Yuanfang Chen [Tue, 23 Aug 2022 17:25:02 +0000 (10:25 -0700)]
[Clang] follow-up D128745, use ClangABICompat15 instead of ClangABICompat14
Since the patch missed release 15.x and will be included in release 16.x. Also, simplify related tests.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D132414
Igor Kudrin [Tue, 23 Aug 2022 17:39:27 +0000 (21:39 +0400)]
[ubsan-minimal][NFC] Use GET_CALLER_PC() to get the return address
This is a preparation step for D131914.
Simon Pilgrim [Tue, 23 Aug 2022 17:27:03 +0000 (18:27 +0100)]
[Support] MathExtras.h - use llvm::bitcast<> for float-bits cast helpers. NFCI.
Siva Chandra Reddy [Mon, 22 Aug 2022 19:02:25 +0000 (19:02 +0000)]
[libc] Add Linux implementations of POSIX chdir, fchdir, chmod and fchmod.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D132445
Jeff Niu [Tue, 23 Aug 2022 17:00:10 +0000 (10:00 -0700)]
[mlir][LLVMIR] Add `sym_name` attribute to LLVMFuncOp in ODS
This is a required attribute for FunctionOpInterface. Add an ODS
definition so that a more efficient accessor is generated.
Che-Yu Wu [Tue, 23 Aug 2022 16:45:43 +0000 (16:45 +0000)]
[MLIR]Extend vector.gather to support n-D result
Currently vector.gather only supports reading memory into a 1-D result vector.
This patch extends it to support an n-D result vector with the indices, masks,
and passthroughs in n-D vectors.
As we are trying to vectorize tensor.extract with vector.gather
(https://github.com/iree-org/iree/issues/9198), it will need to gather the
elements into an n-D vector. Having vector.gather with n-D results allows us
to avoid flatten and reshape at the vectorization stage. The backends can then
decide the optimal ways to lower the vector.gather op.
Note that this is different from n-D gathering, which is about reading n-D
memory with the n-D indices. The indices here are still only 1-D offsets on
the base.
Reviewed By: dcaballe
Differential Revision: https://reviews.llvm.org/D131905
Balazs Benics [Tue, 23 Aug 2022 16:39:21 +0000 (18:39 +0200)]
[analyzer] Drop deprecated flags
As proposed in D126215 (
ffe7950ebc62380c3afc7c71f454a1db3f6f5c76),
I'm dropping the `-analyzer-store` and
`-analyzer-opt-analyze-nested-blocks` clang frontend flags.
I'm also dropping the corresponding commandline handlers of `scanbuild`.
This behavior is planned to be part of `clang-16`.
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D132289
Fred Tingaud [Tue, 23 Aug 2022 16:33:26 +0000 (18:33 +0200)]
[analyzer] Deadstore static analysis: Fix false positive on C++17 assignments
Dead store detection automatically checks that an expression is a
CXXConstructor and skips it because of potential side effects. In C++17,
with guaranteed copy elision, this check can fail because we actually
receive the implicit cast of a CXXConstructor.
Most checks in the dead store analysis were already stripping all casts
and parenthesis and those that weren't were either forgotten (like the
constructor) or would not suffer from it, so this patch proposes to
factorize the stripping.
It has an impact on where the dead store warning is reported in the case
of an explicit cast, from
auto a = static_cast<B>(A());
^~~~~~~~~~~~~~~~~~~
to
auto a = static_cast<B>(A());
^~~
which we think is an improvement.
Patch By: frederic-tingaud-sonarsource
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D126534
Kadir Cetinkaya [Tue, 23 Aug 2022 16:17:44 +0000 (18:17 +0200)]
[clangd] Bump timeout for a flaky test
This has been failing on some build bots with timeout, increasing it to
5 seconds.
Thomas Symalla [Sat, 20 Aug 2022 13:09:17 +0000 (15:09 +0200)]
[NFC][AMDGPU] Some cleanups in the SIOptimizeExecMasking pass.
Fix typos and remove an unused argument.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D132292
Arthur Eubanks [Fri, 19 Aug 2022 00:59:38 +0000 (17:59 -0700)]
[FastISel] Respect musttail over "disable-tail-calls"
musttail should be honored even in the presence of attributes like "disable-tail-calls". SelectionDAG properly handles this.
Update LangRef to explicitly mention that this is the semantics of musttail.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D132193
Philip Reames [Tue, 23 Aug 2022 15:45:01 +0000 (08:45 -0700)]
[TTI] Kill last couple uses of OperandValueKind in targets [nfc]
Use the accessor methods on the containing class instead so that we can change the representation.
Jakub Kuderski [Tue, 23 Aug 2022 15:36:12 +0000 (11:36 -0400)]
[ADT] Deprecate is_splat and replace all uses with all_equal
See the discussion thread for more details:
https://discourse.llvm.org/t/adt-is-splat-and-empty-ranges/64692
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D132335
Michael Liao [Tue, 23 Aug 2022 15:13:10 +0000 (11:13 -0400)]
[SPIRV] Fix the wrong patch from https://reviews.llvm.org/D131886
- The body of that predicate lambda is removed by mistake.
Ben Langmuir [Mon, 22 Aug 2022 22:42:52 +0000 (15:42 -0700)]
[clang] Pull some utility functions into CompilerInvocation NFC
Move copying compiler arguments to a vector<string> and modifying
common module-related options into CompilerInvocation in preparation for
using some of them in more places and to avoid duplicating this code
accidentally in the future.
Differential Revision: https://reviews.llvm.org/D132419
Joseph Huber [Tue, 23 Aug 2022 15:00:53 +0000 (10:00 -0500)]
[OffloadPackager] Resolve copy elision warnings
Summary:
The buildbots are giving failures on the explicit move operations here.
Previously I had problems where not perfomring an explicit move would
cause problems with older compilers so we'll see if this works as
expected.
utsumi [Tue, 23 Aug 2022 14:18:23 +0000 (07:18 -0700)]
[Clang][OpenMP] Make copyin clause on combined and composite construct work (patch by Yuichiro Utsumi (utsumi.yuichiro@fujitsu.com))
Make copyin clause on the following constructs work.
- parallel for
- parallel for simd
- parallel sections
Fixes https://github.com/llvm/llvm-project/issues/55547
Patch by Yuichiro Utsumi (utsumi.yuichiro@fujitsu.com)
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D132209
Philip Reames [Mon, 22 Aug 2022 22:26:36 +0000 (15:26 -0700)]
[TTI] Plumb through OperandValueInfo in getMemoryOpCost [NFC]
This has the effect of exposing the power-of-two property for use in memory op costing, but no target actually uses it yet. The main point of this change is simple consistency with the recently changes getArithmeticInstrCost, and to remove the last (interface) use of OperandValueKind.
David Majnemer [Tue, 23 Aug 2022 14:18:24 +0000 (14:18 +0000)]
[clang-cl] Expose the /volatile:{iso,ms} choice via _ISO_VOLATILE
MSVC allows interpreting volatile loads and stores, when combined with
/volatile:iso, as having acquire/release semantics. MSVC also exposes a
define, _ISO_VOLATILE, which allows users to enquire if this feature is
enabled or disabled.
Martin Storsjö [Tue, 19 Jul 2022 21:47:02 +0000 (00:47 +0300)]
[flang] Allow configuring building the flang runtime standalone
This allows building the flang runtime and libFortranDecimal standalone,
without setting up the full llvm build, by pointing cmake to these
directories.
This is the other one out of two essential steps for building the flang runtimes
for a foreign target, i.e. setting up cross compiling with flang.
Differential Revision: https://reviews.llvm.org/D130352
Martin Storsjö [Wed, 20 Jul 2022 13:32:31 +0000 (16:32 +0300)]
[flang] Make runtimes headers independent of the main llvm headers
llvm/Support/Compiler.h requires llvm-config.h, i.e. to include it,
you'd need to actually set up building llvm for that target.
If using flang to cross compile code for a different target, we need
the runtimes built for that target, but we might not want to build
llvm itself for that target.
This is one out of two essential steps for building the flang runtimes
for a foreign target, i.e. setting up cross compiling with flang.
Differential Revision: https://reviews.llvm.org/D130351
Nico Weber [Mon, 22 Aug 2022 17:34:42 +0000 (13:34 -0400)]
[clang/test] Correctly specify simulator env in target flag in fsanitize.c
Putting "simulator" in the `-target` flag requires putting it in the
"environment" part of the triple, which is the 4th `-`-separated component.
Some places in the tests currently use "iossimulator" which puts it in the
OS field. The triple parsing code in llvm::Triple uses startswith("ios")
in parseOS(), so that successfully sets the OS to "iOS", and all these
triples use an intel arch, and iOS + intel triple implicitly make the
driver convert the environment to "simulator", so this happened to work --
but it led to the somewhat strange "simulator-simulator" in the diag
in the test.
No behavior change.
Differential Revision: https://reviews.llvm.org/D132399
Nico Weber [Mon, 22 Aug 2022 17:42:46 +0000 (13:42 -0400)]
[clang] Remove a FIXME that we can't fix
I added this recently, but it looks like several tests very intentionally
check that `-mios-version-min=foo --target=x86_64-apple-ios` does simulator
builds. So we can't easily remove this hack, even though it makes little
sense in an arm mac world. (Here, you _have_ to say
`-mios-simulator-version-min=` or `--target=arm64-apple-ios-simulator`.)
The tests that check this:
Clang :: Driver/darwin-ld.c
Clang :: Driver/darwin-simulator-macro.c
Clang :: Driver/darwin-version.c
No behavior change.
Differential Revision: https://reviews.llvm.org/D132400
Aditya Kumar [Mon, 22 Aug 2022 00:19:37 +0000 (17:19 -0700)]
[NFC] LoopAccess: Move expressions close to usage
Avoids useless evaluation of these expressions.
Reviewed By: michaelmaitland, fhahn
Differential Revision: https://reviews.llvm.org/D132337
Louis Dionne [Tue, 23 Aug 2022 14:06:15 +0000 (10:06 -0400)]
[libc++] Update oss-fuzz.sh to use LLVM_ENABLE_RUNTIMES
Stephen Tozer [Mon, 20 Jun 2022 11:06:00 +0000 (12:06 +0100)]
[DebugInfo][InstrRef] Handle transfers of variadic debug values in LDV
This patch adds the last of the changes required to enable
DBG_VALUE_LIST handling in InstrRefLDV, handling variadic debug values
during the transfer tracking step. Most of the changes are fairly
straightforward, and based around tracking multiple locations per
variable in TransferTracker::VLocTracker.
Differential Revision: https://reviews.llvm.org/D128211
Louis Dionne [Tue, 23 Aug 2022 13:48:36 +0000 (09:48 -0400)]
Revert the removal of LLVM_ENABLE_PROJECTS for libc++ and libc++abi
This commit reverts the following commits:
-
952f90b72b3546d6b6b038d410f07ce520c59b48
-
e6a0800532bb409f6d1c62f3698bdd6994a877dc (D132298)
-
176db3b3ab25ff8a9b2405f50ef5a8bd9304a6d5 (D132324)
These commits caused CI instability and need to be reverted in order
to figure things out again. See the discussion in https://llvm.org/D132324
for more information.
Amaury Séchet [Tue, 23 Aug 2022 13:40:01 +0000 (13:40 +0000)]
[PowerPC] Autogenerate crbits.ll . NFC
Michał Górny [Mon, 22 Aug 2022 16:59:08 +0000 (18:59 +0200)]
[lldb] [gdb-remote] Use Communication::WriteAll() over Write()
Replace the uses of Communication::Write() with WriteAll() to avoid
partial writes. None of the call sites actually accounted for that
possibility and even if it is unlikely to actually happen, there doesn't
seem to be any real harm from using WriteAll() instead.
Ideally, we'd remove Write() from the public API. However, that would
change the API of SBCommunication. The alternative would be to alias it
to WriteAll().
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D132395