Michael Jones [Mon, 27 Mar 2023 22:14:17 +0000 (15:14 -0700)]
[libc][bazel] add file printf targets and support
This patch adds targets for printf and fprintf to the bazel build.
Additionally, it adds support for the build system to specify where
files should be written for testing purposes. This was necessary to
enable the fprintf test under bazel.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D147008
Matt Arsenault [Fri, 23 Dec 2022 23:33:34 +0000 (18:33 -0500)]
AMDGPU: Remove invalid testcase for enqueue kernel
The call didn't have the right calling convention, but calls to
kernels are supposed to be illegal anyway.
David Green [Wed, 26 Apr 2023 21:12:00 +0000 (22:12 +0100)]
[AArch64][SVE] Generate smull/umull instead of sve v2i64 mul
A neon smull/umull should be preferred over a sve v2i64 mul with two extends.
It will be both less instructions and a lower cost multiply instruction.
Differential Revision: https://reviews.llvm.org/D148248
Vitaly Buka [Wed, 26 Apr 2023 21:01:18 +0000 (14:01 -0700)]
[test][HWASAN] Add hwasan-aliasing
Some tests of D149234 deppend on
aliasing mode.
Jan Sjodin [Wed, 26 Apr 2023 20:39:14 +0000 (16:39 -0400)]
[OpenMP][Flang][MLIR] Add lowering of TargetOp for host codegen to LLVM-IR
Fix uninitialied value use introduced in
d3f9388ffb889d2ef512a17b9c4d37d09f03c693
Craig Topper [Wed, 26 Apr 2023 20:35:20 +0000 (13:35 -0700)]
[RISCV] Remove CSR names that are not in Privileged Specification 1.12.
These are from the N extension (User-Level Interrupts) which did
not make it into 1.12 of the Privileged Specification.
D117653 also tried to remove some of these, but it was never reviewed.
Reviewed By: jrtc27
Differential Revision: https://reviews.llvm.org/D149278
Fangrui Song [Wed, 26 Apr 2023 20:18:55 +0000 (13:18 -0700)]
[ELF] Add --remap-inputs= and --remap-inputs-file=
--remap-inputs-file= can be specified multiple times, each naming a
remap file that contains `from-glob=to-file` lines or `#`-led comments.
('=' is used a separator a la -fdebug-prefix-map=)
--remap-inputs-file= can be used to:
* replace an input file. E.g. `"*/libz.so=exp/libz.so"` can replace a resolved
`-lz` without updating the input file list or (if used) a response file.
When debugging an application where a bug is isolated to one single
input file, this option gives a convenient way to test fixes.
* remove an input file with `/dev/null` (changed to `NUL` on Windows), e.g.
`"a.o=/dev/null"`. A build system may add unneeded dependencies.
This option gives a convenient way to test the result removing some inputs.
`--remap-inputs=a.o=aa.o` can be specified to provide one pattern without using
an extra file.
(bash/zsh process substitution is handy for specifying a pattern without using
a remap file, e.g. `--remap-inputs-file=<(printf 'a.o=aa.o')`, but it may be
unavailable in some systems. An extra file can be inconvenient for a build
system.)
Exact patterns are tested before wildcard patterns. In case of a tie, the first
patterns wins. This is an implementation detail that users should not rely on.
Co-authored-by: Marco Elver <elver@google.com>
Link: https://discourse.llvm.org/t/rfc-support-exclude-inputs/70070
Reviewed By: melver, peter.smith
Differential Revision: https://reviews.llvm.org/D148859
LLVM GN Syncbot [Wed, 26 Apr 2023 20:11:45 +0000 (20:11 +0000)]
[gn build] Port
244560329603
Nikolas Klauser [Fri, 21 Apr 2023 03:48:10 +0000 (05:48 +0200)]
[libc++][PSTL] Integrate the headers and add a CI job
Reviewed By: ldionne, #libc
Spies: libcxx-commits, arichardson
Differential Revision: https://reviews.llvm.org/D141780
Patrick McCormick [Wed, 26 Apr 2023 19:49:58 +0000 (13:49 -0600)]
[flang] Raise configure-time error when LLVM_ENABLE_EH is set
flang cannot be built with exceptions enabled. Doing so results in a link-time
error.
This addresses issue #59353 [https://github.com/llvm/llvm-project/issues/59353]
Differential Revision: https://reviews.llvm.org/D146173
Jason Molenda [Wed, 26 Apr 2023 20:04:38 +0000 (13:04 -0700)]
Fix off-by-one error in armv7 mach-o corefile register context
The sanity check on the size of the register context we found in
the corefile was off by one, so lldb would not add the register
contents. Add a test case to ensure it doesn't regress.
Differential Revision: https://reviews.llvm.org/D149224
rdar://
108306070
Vitaly Buka [Mon, 24 Apr 2023 04:43:32 +0000 (21:43 -0700)]
[test][HWASAN] Regenerate some HWASAN tests
Example of the command used to update tests:
```
ninja -C <build_dir> opt && llvm/utils/update_test_checks.py \
--opt-binary <build_dir>/bin/opt llvm/test/Instrumentation/HWAddressSanitizer/X86/alloca.ll
```
Reviewed By: kstoimenov
Differential Revision: https://reviews.llvm.org/D149219
Vitaly Buka [Wed, 26 Apr 2023 06:15:34 +0000 (23:15 -0700)]
[HWASAN] Run sanitizer_common tests
ninja check-sanitizer will run tests with hwasan as well
Reviewed By: kstoimenov
Differential Revision: https://reviews.llvm.org/D149234
Vitaly Buka [Wed, 26 Apr 2023 06:15:34 +0000 (23:15 -0700)]
[test][HWASAN] Add XFAILs for missing hwasan features
Reviewed By: thurston
Differential Revision: https://reviews.llvm.org/D149271
Alex Langford [Wed, 26 Apr 2023 19:38:53 +0000 (12:38 -0700)]
[lldb] Skip Watchpoint/ExpressionLanguage.test on Windows
This test fails on the aarch64-windows bots unfortunately. Mark as
unsupported.
Context: https://lab.llvm.org/buildbot/#/builders/219/builds/2389
Aaron Ballman [Wed, 26 Apr 2023 19:29:02 +0000 (15:29 -0400)]
Fix Clang sphinx bot
Addresses the issue found in:
https://lab.llvm.org/buildbot/#/builders/92/builds/43413
ipriyanshi1708 [Wed, 26 Apr 2023 19:18:40 +0000 (15:18 -0400)]
Fix the diagnostic about attribute placement for scoped enumerations
Fixed the error message for attribute placement. Earlier it was showing
'place it after "enum"' but it should be 'place it after "enum class"'
which I have fixed in this patch.
Fixes https://github.com/llvm/llvm-project/issues/61660
Differential Revision: https://reviews.llvm.org/D147989
max [Wed, 26 Apr 2023 14:55:27 +0000 (09:55 -0500)]
[MLIR][python bindings] Reimplement `replace_all_uses_with` on `PyValue`
Differential Revision: https://reviews.llvm.org/D149261
Zarko Todorovski [Wed, 26 Apr 2023 17:43:12 +0000 (13:43 -0400)]
[Clang][AIX] Add back error for -fprofile-sample-generate/use on AIX
D148177 also removed the error for sampling based profiling which is not currently
supported on AIX. Adding that error back.
Reviewed By: qiongsiwu1
Differential Revision: https://reviews.llvm.org/D148960
Florian Hahn [Wed, 26 Apr 2023 18:51:34 +0000 (19:51 +0100)]
[LV] Add extra uniformity tests with LSHR and AND.
Extra tests for D148841 based on the tests added in
95539186c82604f783.
do [Wed, 26 Apr 2023 18:02:52 +0000 (14:02 -0400)]
{Flang][OpenMP] Add support for ior, ieor, and iand reduction in worksharing-loop
Adds support for .ior., .ieor., and .iand. reductions.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D148994
Craig Topper [Wed, 26 Apr 2023 18:24:35 +0000 (11:24 -0700)]
[RISCV] Fix spelling 'Floating Pont' -> 'Floating Point'. NFC
Mingming Liu [Wed, 26 Apr 2023 17:55:43 +0000 (10:55 -0700)]
[NFC][Clang]Remove a reference on argument since 'Name' is not modified'
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D149274
Aaron Ballman [Wed, 26 Apr 2023 18:17:13 +0000 (14:17 -0400)]
Remove the empty analysis diagnostics file
This file hasn't had any diagnostics in it since 2012, so I think we're
safe to remove this file.
Craig Topper [Wed, 26 Apr 2023 18:00:54 +0000 (11:00 -0700)]
[RISCV] Add version of generateImmOutOfRangeError that takes an SMLoc.
Have the ErrorInfo version call it after looking up ErrorInfo in
the Operands.
Use the new function in a few places that don't have ErrorInfo and
were also generating out of range messages.
Kirill Stoimenov [Mon, 24 Apr 2023 19:25:45 +0000 (19:25 +0000)]
[HWASAN] Fix TLS + signal handling related crash
When a signal is raised before HWASAN has a chance to initialize it's TLS entry the program crashes. This only happens when hwasan-with-tls is true, which is default value. This patch fixes the problem by disabling signals during thread initialization time.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D149085
Emilio Cota [Wed, 26 Apr 2023 17:47:00 +0000 (13:47 -0400)]
[bazel][mlir] fix for
d3f9388ff
Craig Topper [Wed, 26 Apr 2023 17:41:57 +0000 (10:41 -0700)]
[RISCV][CSKY][Loong] Pass Twine by const reference instead of by value. NFC
I think RISCV was the original here and the CSKY and Loong copied it.
Matt Arsenault [Mon, 10 Apr 2023 23:35:19 +0000 (19:35 -0400)]
InstCombine: Use computeKnownFPClass in is.fpclass combines and pass AC
The various isKnownNever* calls can be merged into one. This also introduces
the new ability to remove zero/sub/normal checks. Also start passing the
AssumptionCache arguments.
Alex Brachet [Wed, 26 Apr 2023 16:54:38 +0000 (16:54 +0000)]
[llvm-gsymutil] Switch to OptTable
Differential Revision: https://reviews.llvm.org/D148775
Slava Zakharin [Tue, 25 Apr 2023 23:59:46 +0000 (16:59 -0700)]
[flang] Restore stack after allocas created by TargetRewrite.
This resolves issues with running out of stack on examples like
https://fortran-lang.discourse.group/t/modern-fortran-sample-code/2019/18
reported by @clementval.
When target rewrite creates alloca(s) around a call, we need to insert
stacksave/stackrestore to free the allocated stack. Better performant
code may be achieved by placing the alloca(s) outside of loops,
but the placement has to behave correctly with regards to OpenMP/OpenACC/etc.
dialect operations that have special representation for "private"
objects. This is a concervative fix for correctness issue.
Differential Revision: https://reviews.llvm.org/D149222
Alex Langford [Mon, 24 Apr 2023 23:58:18 +0000 (16:58 -0700)]
[lldb] Add support for specifying language when setting watchpoint by expression
This is useful in contexts where you have multiple languages in play:
You may be stopped in a frame for language A, but want to set a watchpoint
with an expression using language B. The current way to do this is to
use the setting `target.language` while setting the watchpoint and
unset it after the watchpoint is set, but that's kind of clunky and
somewhat error-prone. This should add a better way to do this.
rdar://
108202559
Differential Revision: https://reviews.llvm.org/D149111
Craig Topper [Wed, 26 Apr 2023 17:11:14 +0000 (10:11 -0700)]
[RISCV] Make Zicntr and Zihpm imply Zicsr.
Zicntr and Zihpm are names for groups of CSRs so they should imply
that CSRs exist.
Reviewed By: asb, kito-cheng
Differential Revision: https://reviews.llvm.org/D148962
Craig Topper [Wed, 26 Apr 2023 17:11:07 +0000 (10:11 -0700)]
[RISCV] Accept zicntr and zihpm command line options
This change adds the definition of the two extensions, but does not either a) make any register definitions conditional on them or b) enabled the extensions by default.
This is somewhat analogous to https://reviews.llvm.org/D143953, but with some key differences. The best discussion I can find on status is here: https://github.com/riscv/riscv-profiles/issues/43. These were removed between document version 2.1 and 2.2, but were not defined as new extensions in 2.2. That addition came later - in March 2022.
According to https://drive.google.com/file/d/1qa57pePesOiDOrNzxuuGFhCL4Rbi9AYB/view these were ratified in March 2023.
Reviewed By: asb, reames
Differential Revision: https://reviews.llvm.org/D144215
Matt Arsenault [Tue, 11 Apr 2023 20:08:42 +0000 (16:08 -0400)]
AMDGPU: Reduce number of calls to computeKnownFPClass and pass all arguments
Makes assumes work for this case.
Jan Sjodin [Mon, 3 Apr 2023 14:46:21 +0000 (10:46 -0400)]
[OpenMP][Flang][MLIR] Add lowering of TargetOp for host codegen to LLVM-IR
This patch adds lowering of TargetOps for the host. The lowering outlines the
target region function and uses the OpenMPIRBuilder support functions to emit
the function and call. Code generation for offloading will be done in later
patches.
Reviewed By: kiranchandramohan, jdoerfert, agozillon
Differential Revision: https://reviews.llvm.org/D147172
Matt Arsenault [Mon, 10 Apr 2023 13:24:51 +0000 (09:24 -0400)]
ValueTracking: Add baseline computeKnownFPClass tests for minimum/maximum
Matt Arsenault [Tue, 25 Apr 2023 16:16:21 +0000 (12:16 -0400)]
ValueTracking: Fix computeKnownFPClass handling for copysign
We need to expand the set of possible classes to the opposite
sign for the first operand if we don't know the sign of the second
operand.
Mingming Liu [Sun, 23 Apr 2023 19:23:33 +0000 (12:23 -0700)]
[InlineAsm][AArch64]Add backend support for flag output parameters
- The set of flag is from https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Flag-Output-Operands
Before:
- ARM64 GCC supports flag output constraints, while Clang doesn't parse condition code, as shown in https://gcc.godbolt.org/z/7jzMEK796
- LLVM ISel won't lower them either (as shown in https://gcc.godbolt.org/z/Pv4PPf56c)
After:
- Given flag output constraints in LLVM IR, condition code is parsed and flag output is lowered to 'cset'.
- Clang parse is not added in this patch.
Differential Revision: https://reviews.llvm.org/D149032
Jay Foad [Wed, 26 Apr 2023 16:09:12 +0000 (17:09 +0100)]
[AMDGPU] Add GFX11 ds_min_f32 / ds_max_f32 tests
Paul Robinson [Wed, 26 Apr 2023 15:55:51 +0000 (08:55 -0700)]
[Headers] Revise conditional for rdrand64_step
Downstream doc tooling doesn't like an #if between the doc and the
function prototype. This change also guarantees that the prototype
stays the same for 32/64 bit users.
Paul Kirth [Mon, 24 Apr 2023 21:03:21 +0000 (21:03 +0000)]
[RISCV] Make SCS prologue interrupt safe on RISC-V
Prior to this patch the SCS prologue used the following instruction
sequence.
```
s[w|d] ra, 0(gp)
addi gp, gp, [4|8]
```
The problem with this sequence is that an interrupt occurring between the
store and the increment could clobber the value just written to the SCS.
https://reviews.llvm.org/D84414#inline-813203 pointed out a similar
issues that could have affected the epilogue.
This patch changes the instruction sequence in the prologue to:
```
addi gp, gp, [4|8]
s[w|d] ra, -[4|8](gp)
```
The downside to this is that there is now a data dependency between the
add and the store.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D149099
Slava Zakharin [Wed, 26 Apr 2023 05:03:57 +0000 (22:03 -0700)]
[flang] Recognize unused dummy arguments during lowering with HLFIR.
So far we've relied on AllocaOp to represent the dummy arguments
not declared for the current entry. With HLFIR we have to account
for hlfir::DeclareOp.
Differential Revision: https://reviews.llvm.org/D149231
Teresa Johnson [Wed, 26 Apr 2023 13:35:12 +0000 (06:35 -0700)]
[IR] Add interface to remove a CallBase string function attribute
Adds an interface to remove a string function attribute attached to a
CallBase, and a corresponding unittest.
This was extracted from D141077, and will be used by a follow on patch
that removes memprof attributes when needed.
Reviewed By: snehasish
Differential Revision: https://reviews.llvm.org/D149192
Joseph Huber [Tue, 25 Apr 2023 21:23:07 +0000 (16:23 -0500)]
[libc][Docs] Begin improving documentation for the GPU libc
This patch updates some of the documentation for the GPU libc project.
There is a lot of work still to be done, but this sets the general
outline.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D149194
Sam McCall [Fri, 21 Apr 2023 19:03:43 +0000 (21:03 +0200)]
[dataflow] HTMLLogger - show the value of the current expr
Differential Revision: https://reviews.llvm.org/D148949
Mehdi Amini [Wed, 26 Apr 2023 05:21:34 +0000 (22:21 -0700)]
Make debug counters available in non-assert builds as well
Differential Revision: https://reviews.llvm.org/D149232
Paul Robinson [Tue, 25 Apr 2023 21:28:42 +0000 (14:28 -0700)]
[Headers][doc] Add "gather" intrinsic descriptions to avx2intrin.h
Differential Revision: https://reviews.llvm.org/D149205
Shivam Gupta [Wed, 26 Apr 2023 12:15:27 +0000 (17:45 +0530)]
[clang-rename] Exit gracefully when no input provided
clang-rename on a non existing file segfaults
Command to run -
$ clang-rename -offset=0 -new-name=plop asdasd
Error while processing llvm-project/asdasd.
clang-rename: llvm-project/llvm/include/llvm/Support/ErrorOr.h:237:
llvm::ErrorOr<T>::storage_type* llvm::ErrorOr<T>::getStorage()
[with T = const clang::FileEntry*; llvm::ErrorOr<T>::storage_type = const clang::FileEntry*]:
Assertion `!HasError && "Cannot get value when an error exists!"' failed.
[1] 827497 IOT instruction clang-rename -offset=0 -new-name=plop asdasd
This fixes https://github.com/llvm/llvm-project/issues/36471.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D148439
NAKAMURA Takumi [Thu, 9 Mar 2023 00:09:47 +0000 (09:09 +0900)]
TableGen: Replace `IntrinsicEmitter::ComputeFixedEncoding()` and cleanup
Depends on D146915
Differential Revision: https://reviews.llvm.org/D145937
NAKAMURA Takumi [Wed, 8 Mar 2023 23:38:52 +0000 (08:38 +0900)]
TableGen: Implement TypeSig generator in `Intrinsics.td`
This commit doesn't replace `IntrinsicEmitter::ComputeFixedEncoding()`,
but compares outputs to it, to make sure implementation correct.
Depends on D145871, D145872, D145874, and D146914
Differential Revision: https://reviews.llvm.org/D146915
NAKAMURA Takumi [Sat, 11 Mar 2023 18:46:58 +0000 (03:46 +0900)]
TableGen: Prune convertInitListSlice and VarListElementInit
They were dedicated to constant version of list slice.
Depends on D147401
Differential Revision: https://reviews.llvm.org/D145872
NAKAMURA Takumi [Sat, 4 Mar 2023 10:53:52 +0000 (19:53 +0900)]
TableGen: Let expressions available to list subscriptions and list slices
This enables indexing in `!foreach` and permutation with `list[permlist]`.
Enhancements in syntax:
- `list<int>` is applicable as a slice element.
- `list[int,]` is evaluated as not `ElemType` but `list<ElemType>`
with a single element.
Part of D145872
FIXME: I didn't apply new semantics to BitSlice.
NAKAMURA Takumi [Wed, 26 Apr 2023 13:36:40 +0000 (22:36 +0900)]
Reformat
NAKAMURA Takumi [Sat, 1 Apr 2023 22:43:18 +0000 (07:43 +0900)]
Add failure testcases as llvm/test/TableGen/ListSlices-fail.td
Differential Revision: https://reviews.llvm.org/D147401
NAKAMURA Takumi [Wed, 26 Apr 2023 13:53:57 +0000 (22:53 +0900)]
TableGen/ProgRef.rst: Fix copypasto in the description of `!range`
Joe Nash [Tue, 25 Apr 2023 19:24:35 +0000 (15:24 -0400)]
[AMDGPU] Delete test for illegal v_cndmask_b16_dpp
There are no VOP2 or VOP2 with dpp forms of v_cndmask_b16. Delete the
test. NFC.
Reviewed By: critson
Differential Revision: https://reviews.llvm.org/D149184
Victor Perez [Wed, 26 Apr 2023 08:58:13 +0000 (09:58 +0100)]
[mlir][llvm] Use cached constants when importing landingpad instructions
Not using cached constants when importing instructions may lead to
undesired results, as breaking dominance rules in the translated MLIR
module.
Signed-off-by: Victor Perez <victor.perez@codeplay.com>
Differential Revision: https://reviews.llvm.org/D149247
Janek van Oirschot [Wed, 26 Apr 2023 13:05:06 +0000 (14:05 +0100)]
[AMDGPU] Fix negative offset values interpretation in getMemOperandsWithOffset for DS
The offset values may result in an erroneous scheduling of a load before write for a memory location if the offset values are represented as negative values in MIR, despite actually being unsigned values. This representation in MIR happens as SelectionDAG::getConstant could go through APInt to represent the encoding which assumes the MSB of the encoding as a sign-bit, regardless of whether it is supposed to be a signed value. The 8-bit negative (interpreted) value gets cast to an unsigned 32 bit value in getMemOperandsWithOffset used for comparisons in areMemAccessesTriviallyDisjoint eventually leading to an erroneous schedule in the machine scheduler.
Reviewed By: arsenm, foad
Differential Revision: https://reviews.llvm.org/D149080
Donát Nagy [Fri, 14 Apr 2023 10:31:06 +0000 (12:31 +0200)]
[analyzer] Fix comparison logic in ArrayBoundCheckerV2
The prototype checker alpha.security.ArrayBoundV2 performs two
comparisons to check that in an expression like Array[Index]
0 <= Index < length(Array)
holds. These comparisons are handled by almost identical logic: the
inequality is first rearranged by getSimplifiedOffsets(), then evaluated
with evalBinOpNN().
However the simplification used "naive" elementary mathematical
schematics, but evalBinOpNN() performed the signed -> unsigned
conversions described in the C/C++ standards, and this confusion led to
wildly inaccurate results: false positives from the lower bound check
and false negatives from the upper bound check.
This commit eliminates the code duplication by moving the comparison
logic into a separate function, then adds an explicit check to this
unified code path, which handles the problematic case separately.
In addition to this, the commit also cleans up a testcase that was
demonstrating the presence of this problem. Note that while that
testcase was failing with an overflow error, its actual problem was in
the underflow handler logic:
(0) The testcase introduces a five-element array "char a[5]" and an
unknown argument "size_t len"; then evaluates "a[len+1]".
(1) The underflow check tries to determine whether "len+1 < 0" holds.
(2) This inequality is rearranged to "len < -1".
(3) evalBinOpNN() evaluates this with the schematics of C/C++ and
converts -1 to the size_t value SIZE_MAX.
(4) The engine concludes that len == SIZE_MAX, because otherwise we'd
have an underflow here.
(5) The overflow check tries to determine whether "len+1 >= 5".
(6) This inequality is rearranged to "len >= 4".
(7) The engine substitutes len == SIZE_MAX and reports that we have
an overflow.
Differential Revision: https://reviews.llvm.org/D135375
Jordan Rupprecht [Wed, 26 Apr 2023 12:28:15 +0000 (05:28 -0700)]
[NFC] Wrap entire debug logging loop in LLVM_DEBUG
Felipe de Azevedo Piovezan [Tue, 25 Apr 2023 19:06:10 +0000 (15:06 -0400)]
[DebugLocEntry][nfc] Remove redundant cast
A cast from DIExpression->DIExpression is not needed.
Differential Revision: https://reviews.llvm.org/D149178
Alexey Lapshin [Tue, 18 Apr 2023 18:22:55 +0000 (20:22 +0200)]
[Support][Parallel] Add sequential mode to TaskGroup::spawn().
This patch allows to specify that some part of tasks should be
done in sequential order. It makes it possible to not use
condition operator for separating sequential tasks:
TaskGroup tg;
for () {
if(condition) ==> tg.spawn([](){fn();}, condition)
fn();
else
tg.spawn([](){fn();});
}
It also prevents execution on main thread. Which allows adding
checks for getThreadIndex() function discussed in D142318.
The patch also replaces std::stack with std::deque in the
ThreadPoolExecutor to have natural execution order in case
(parallel::strategy.ThreadsRequested == 1).
Differential Revision: https://reviews.llvm.org/D148728
Felipe de Azevedo Piovezan [Tue, 25 Apr 2023 15:08:13 +0000 (11:08 -0400)]
[LangRef] Improve wording DW_OP_LLVM_entry_value
This commit simplifies the text of DW_OP_LLVM_entry_value by making it
terser, replacing a verbose example with a more concrete one, providing
an explicit conclusion on the meaning of N=1, and by transforming the
description of which passes generate this op into a list (which enables
future expansion of this list).
Differential Revision: https://reviews.llvm.org/D149177
Ivan Kosarev [Wed, 26 Apr 2023 11:21:50 +0000 (12:21 +0100)]
[AMDGPU][Disassembler] Fix a spurious error message in an instruction comment.
The patch prevents pollution of instruction comments with error messages
generated during unsuccessful decoding attempts.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D149049
Ivan Kosarev [Mon, 24 Apr 2023 09:16:29 +0000 (10:16 +0100)]
[AMDGPU][Disassembler] Pre-commit a test on an error message generated in an instruction comment.
Simon Pilgrim [Wed, 26 Apr 2023 11:32:57 +0000 (12:32 +0100)]
[X86] Handle multiple use freeze(undef) in LowerAVXCONCAT_VECTORS as zero vectors
Replacement for D144903
If we're concatenating freeze(undef) subvector ops with multiple uses then we can't treat them as a wider freeze(undef), but we can replace them with a zero subvector, which is cheap on AVX
Differential Revision: https://reviews.llvm.org/D149249
Dmitry Makogon [Wed, 26 Apr 2023 11:20:14 +0000 (18:20 +0700)]
[Test] Add test showing bug in SCEV::getBackedgeTakenInfo (NFC)
Test for https://github.com/llvm/llvm-project/issues/62380/.
Mats Petersson [Tue, 18 Apr 2023 17:39:33 +0000 (18:39 +0100)]
[flang]Add more tests for loop versioning
These two tests were created from little snippets added late
in the review of the loop versioning work. The code was fixed
to cope with the situation and correctly compile these samples.
This adds tests to avoid regressions in this area.
Reviewed By: tblah
Differential Revision: https://reviews.llvm.org/D148649
Haojian Wu [Wed, 26 Apr 2023 10:59:45 +0000 (12:59 +0200)]
[clangd] Fix the window buildbot test failures
Daniel Krupp [Fri, 3 Mar 2023 11:33:18 +0000 (12:33 +0100)]
[analyzer] Show taint origin and propagation correctly
This patch improves the diagnostics of the alpha.security.taint.TaintPropagation
checker and taint related checkers by showing the "Taint originated here" note
at the correct place, where the attacker may inject it. This greatly improves
the understandability of the taint reports.
In the baseline the taint source was pointing to an invalid location, typically
somewhere between the real taint source and sink.
After the fix, the "Taint originated here" tag is correctly shown at the taint
source. This is the function call where the attacker can inject a malicious data
(e.g. reading from environment variable, reading from file, reading from
standard input etc.).
This patch removes the BugVisitor from the implementation and replaces it with 2
new NoteTags. One, in the taintOriginTrackerTag() prints the "taint originated
here" Note and the other in taintPropagationExplainerTag() explaining how the
taintedness is propagating from argument to argument or to the return value
("Taint propagated to the Xth argument"). This implementation uses the
interestingess BugReport utility to track back the tainted symbols through
propagating function calls to the point where the taintedness was introduced by
a source function call.
The checker which wishes to emit a Taint related diagnostic must use the
categories::TaintedData BugType category and must mark the tainted symbols as
interesting. Then the TaintPropagationChecker will automatically generate the
"Taint originated here" and the "Taint propagated to..." diagnostic notes.
Nikita Popov [Wed, 26 Apr 2023 10:29:50 +0000 (12:29 +0200)]
[LoopDistribute] Convert tests to opaque pointers (NFC)
OCHyams [Wed, 26 Apr 2023 10:15:37 +0000 (11:15 +0100)]
[Assignment Tracking] Remove overly defensive AllocaInst assertion
Remove assert from AssignmentTrackingAnalysis that fires if a local variable
has non-alloca storage. The analysis can emit these locations but the
assignment tracking code in SelectionDAG isn't ready to handle non-alloca
storage for locals yet. The AssignmentTrackingPass (pass that adds assignment
tracking metadata) ignores non-alloca dbg.declares, so the only variables
affected are those who's backing storage is changed from an alloca during
optimisation, and the result is the variables are dropped.
Fixes: https://ci.chromium.org/ui/p/pigweed/builders/toolchain/
toolchain-ci-pigweed-linux/
b8783274592206481489/overview
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D149135
Matt Arsenault [Tue, 18 Apr 2023 22:14:21 +0000 (18:14 -0400)]
ValueTracking: Handle frem in computeKnownFPClass
I barely understand what this does, but try to
handle the last case required to delete cannotBeOrderedLessThanZeroImpl.
Also improve by following fdiv handling for nans and identical operand case.
Matt Arsenault [Tue, 25 Apr 2023 16:22:36 +0000 (12:22 -0400)]
ValueTracking: Add new tests for computeKnownFPClass copysign handling
It's currently broken
Matt Arsenault [Tue, 18 Apr 2023 11:36:37 +0000 (07:36 -0400)]
ValueTracking: fdiv sign handling in computeKnownFPClass
Copy what cannotBeOrderedLessThanZeroImpl checks for fdiv.
Matt Arsenault [Tue, 18 Apr 2023 22:57:15 +0000 (18:57 -0400)]
ValueTracking: Add baseline tests for frem computeKnownFPClass
OCHyams [Wed, 26 Apr 2023 09:53:57 +0000 (10:53 +0100)]
[Assignment Tracking] Fix faulty assertion inside std::sort predicate
The vectors being sorted here shouldn't contain duplicate entries. Prior to
this patch this was checked with an assert within the `std::sort`
predicate. However, `std::sort` may compare an element against itself which
causes the assert to fire (false positive). Move the assert outside of the sort
predicate to avoid such issues.
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D149045
Cullen Rhodes [Wed, 26 Apr 2023 08:07:44 +0000 (08:07 +0000)]
[mlir][test][Integration] Refactor Arm emulator configuration
The logic enabling the Arm SVE (and now SME) integration tests for
various dialects, that may run under emulation, is now duplicated in
several places.
This patch moves the configuration to the top-level MLIR integration
tests Lit config and renames the '%lli' substitution in contexts where
it will run exclusively (ArmSVE, ArmSME) on AArch64 (and possibly under
emulation) to '%lli_aarch64_cmd', and '%lli_host_or_aarch64_cmd' for
contexts where it may run AArch64 (also possibly under emulation). The
latter is for integration tests that have target-specific and
target-agnostic codepaths such as SparseTensor, which supports scalable
vectors.
The two substitutions have the same effect but the names are different to
convey this information. The '%lli_aarch64_cmd' substitution could be
used in the SparseTensor tests but that would be a misnomer if the host
were x86 and the MLIR_RUN_SVE_TESTS=OFF.
The reason for renaming the '%lli' substitution is to not prevent running other
target-specific integration tests at the same time, since the same substitution
'%lli' is used for lli in other integration tests:
* mlir/test/Integration/Dialect/Vector/CPU/X86Vector - (AVX emulation via Intel SDE)
* mlir/test/Integration/Dialect/Vector/CPU/AMX - (AMX emulation via Intel SDE)
* mlir/test/Integration/Dialect/LLVMIR/CPU/test-vp-intrinsic.mlir - (RISCV emulation via QEMU if supported, native otherwise)
and substituting '%lli' at the top-level with Arm specific logic would override
this.
Reviewed By: awarzynski
Differential Revision: https://reviews.llvm.org/D148929
OCHyams [Wed, 26 Apr 2023 09:51:28 +0000 (10:51 +0100)]
Fix docs bot after D140989
Commit
a93c4239719382e5b17335f3452e9095937ed6b7 broke docs buildbot:
https://lab.llvm.org/buildbot/#/builders/30/builds/34525
David Spickett [Wed, 26 Apr 2023 09:47:11 +0000 (09:47 +0000)]
[llvm][docs] Correct chose to choose in the builder docs
Simon Pilgrim [Wed, 26 Apr 2023 09:44:49 +0000 (10:44 +0100)]
[X86] LowerBUILD_VECTOR - fold build_vector(undef,freeze(undef),zero) -> zero vector
426db6b4eb2e9298598 added the build_vector(undef,freeze(undef)) -> freeze(undef) fold, but failed to account for cases where the scalar freeze(undef) had multiple uses, in those cases we can only only safely fold to a zero vector
https://alive2.llvm.org/ce/z/87jG8K
OCHyams [Wed, 26 Apr 2023 09:27:40 +0000 (10:27 +0100)]
[DebugInfo] Update SourceLevelDebugging.rst to better explain kill locations
Reviewed By: scott.linder, jryans
Differential Revision: https://reviews.llvm.org/D140989
OCHyams [Wed, 26 Apr 2023 09:24:06 +0000 (10:24 +0100)]
Fix buildbots after D140901
Commit
3feea34d77f65f0b68520bb7bf372580a72794ad (D140901) should not have
removed the debug label handling code.
Buildbot: https://lab.llvm.org/buildbot/#/builders/139/builds/39813
Matt Arsenault [Mon, 17 Apr 2023 14:18:25 +0000 (10:18 -0400)]
ValueTracking: Improve trunc handling in computeKnownFPClass
Matt Arsenault [Sun, 9 Apr 2023 11:16:04 +0000 (07:16 -0400)]
ValueTracking: Handle powi in computeKnownFPClass
Extract the handling from cannotBeOrderedLessThanZeroImpl and
avoid the mentioned -0 bug.
Matt Arsenault [Tue, 18 Apr 2023 16:32:50 +0000 (12:32 -0400)]
ValueTracking: Add baseline tests for powi computeKnownFPClass
Matt Arsenault [Sun, 9 Apr 2023 11:15:20 +0000 (07:15 -0400)]
ValueTracking: Implement computeKnownFPClass for log
Matt Arsenault [Mon, 17 Apr 2023 17:51:18 +0000 (13:51 -0400)]
ValueTracking: Add baseline tests for log computeKnownFPClass
Matt Arsenault [Mon, 10 Apr 2023 12:22:29 +0000 (08:22 -0400)]
ValueTracking: Add computeKnownFPClass baseline tests for rounding intrinsics
Alex Bradbury [Wed, 26 Apr 2023 08:56:14 +0000 (09:56 +0100)]
[RISCV][NFC] Remove outdated TODOs about extension versions in RISCVISAInfo
As was documented in D147183, we don't currently intend to support
multiple versions of specifications simultaneously. While external
circumstances might mean exceptions to this are needed, the TODOs about
reflecting version numbers in the feature strings no longer make sense.
OCHyams [Wed, 26 Apr 2023 08:11:41 +0000 (09:11 +0100)]
[DebugInfo] Do not delete debug intrinsics with empty metadata operands
A ValueAsMetadata may be replaced with nullptr for several reasons including
deleting (certain) values and value remapping a use-before-def. In the case of
a MetadataAsValue user, handleChangedOperand intercepts and replaces the
metadata with an empty tuple (!{}).
At the moment, an empty metadata operand in a debug intrinsics signals that it
can be deleted.
Given that we end up with empty metadata operands in circumstances where the
Value has been "lost" the current behaviour can lead to incorrect variable
locations. Instead, we should treat empty metadata as meaning "there is no
location for the variable" (the same as we currently treat undef operands).
This patch removes the deletion logic from wouldInstructionBeTriviallyDead.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D140901
Timm Bäder [Wed, 26 Apr 2023 08:52:01 +0000 (10:52 +0200)]
[clang[[Interp][NFC] Make some Descriptor pointers const
Richard Sandiford [Tue, 25 Apr 2023 12:16:29 +0000 (13:16 +0100)]
[Sema] Fix _Alignas/isCXX11Attribute() FIXME
When doing https://reviews.llvm.org/D148105 , I hadn't noticed that
there was also a FIXME about the misclassification of _Alignas in
ProcessDeclAttribute.
Differential Revision: https://reviews.llvm.org/D149148
Kadir Cetinkaya [Tue, 25 Apr 2023 16:50:20 +0000 (18:50 +0200)]
[clangd] Deduplicate missing-include findings
Differential Revision: https://reviews.llvm.org/D149165
Job Noorman [Wed, 26 Apr 2023 07:44:35 +0000 (09:44 +0200)]
[JITLink][AArch64] Implement R_AARCH64_CONDBR19
This relocation is used for the 19-bit immediate in conditional branch
and compare and branch instructions.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D149138
OCHyams [Tue, 25 Apr 2023 16:19:44 +0000 (17:19 +0100)]
[DebugInfo] Treat empty metadata operands the same as undef operands in SelectionDAG
Without this patch SelectionDAG silently drops dbg.values using `!{}` operands.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D140990
Zhongyunde [Wed, 26 Apr 2023 07:52:28 +0000 (15:52 +0800)]
[InstSimplify] with logical ops: (X & Y) == -1 ? X : -1 --> -1
Use simplifySelectWithICmpEq to handle the implied equalities from the icmp-and,
then both of ICMP_NE and ICMP_EQ will be addressed including vector type.
(X & Y) == -1 ? X : -1 --> -1 (commuted 2 ways)
(X & Y) != -1 ? -1 : X --> -1 (commuted 2 ways)
This is a supplement to the icmp-or scenario on D148986.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149229
Zhongyunde [Wed, 26 Apr 2023 07:48:32 +0000 (15:48 +0800)]
[tests] precommit tests for D149229
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149230
Nikita Popov [Tue, 25 Apr 2023 10:20:52 +0000 (12:20 +0200)]
[LoopVectorize] Preserve SCEV
As far as I can tell, LoopVectorize preserves SCEV, mainly by dint
of forgetting the loop being vectorized. We should mark it as
preserved in the pass manager.
This is a very small compile-time improvement.
Differential Revision: https://reviews.llvm.org/D149147