Matt Arsenault [Fri, 6 Jan 2023 19:02:24 +0000 (14:02 -0500)]
AMDGPU: Fix opaque pointer and other bugs in printf of constant strings
Strip pointer casts to get to the global. Fixes not respecting indexed
constant strings. Tolerate non-null terminated and empty strings.
Alexander Yermolovich [Tue, 10 Jan 2023 18:33:23 +0000 (10:33 -0800)]
[llvm][dwwarf] Change CU/TU index to 64-bit
Changed contribution data structure to 64 bit. I added the 32bit and 64bit
accessors to make it explicit where we use 32bit and where we use 64bit. Also to
make sure sure we catch all the cases where this data structure is used.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D139379
Peter Ammon [Tue, 10 Jan 2023 18:21:41 +0000 (19:21 +0100)]
tsan: fix a race when assigning ThreadSignalContext
The SigCtx function lazily allocates a ThreadSignalContext, and stores it
in the ThreadState. This function may be called by various interceptors and
the signal handler itself.
If SigCtx itself is interrupted by a signal, then (prior to this fix) there
was a possibility of allocating two ThreadSignalContexts. This not only
leaks, it fails to deliver the signal to the program's signal handler, as
the recorded signal is overwritten by the new ThreadSignalContext.
Fix this by using a CAS to swap in the ThreadSignalContext, preventing the
race. Add a test for this case.
Reviewed By: dvyukov, melver
Differential Revision: https://reviews.llvm.org/D140582
Mitch Phillips [Tue, 10 Jan 2023 18:29:49 +0000 (10:29 -0800)]
[GWP-ASan] Fix up bad report for in-page underflow w/ UaF
Complex scenario, but reports when there's both a use-after-free and
buffer-underflow that is in-page (i.e. doesn't touch the guard page)
ended up generating a pretty bad report:
'Use After Free at 0x7ff392e88fef (
18446744073709551615 bytes into a
1-byte allocation at 0x7ff392e88ff0) by thread 3836722 here:'
(note the 2^64-bytes-into-alloc, very cool and good!)
Fix up that case, and add a diagnostic about when you have both a
use-after-free and a buffer-overflow that it's probably a bogus report
(assuming the developer didn't *really* screw up and have a uaf+overflow
bug at the same time).
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D139885
Mitch Phillips [Tue, 10 Jan 2023 18:16:03 +0000 (10:16 -0800)]
[GWP-ASan] Fix atfork handlers being installed multiple times in tests
We incorrectly install the atfork handlers multiple times in the test
harness, tracked down to the default parameter used by
CheckLateInitIsOK. This manifested in a hang if running the tests with
--gtest_repeat={>=2} as the atfork handler ran multiple times, causing
double-lock and double-unlock, which on my machine hung.
Add a check-fail for this case as well to prevent this from happening
again (it was difficult to track down and is an easy mistake to make).
Differential Revision: https://reviews.llvm.org/D139731
Valery N Dmitriev [Sat, 7 Jan 2023 03:42:13 +0000 (19:42 -0800)]
[SLP] Do not ignore ordering for root node when it has in-tree uses.
When rooted with PHIs, a vectorization tree may have another node with PHIs
which have roots as their operands. We cannot ignore ordering information
for root in such a case.
Differential Revision: https://reviews.llvm.org/D141309
Philip Reames [Tue, 10 Jan 2023 17:51:56 +0000 (09:51 -0800)]
[RISCV] Avoid emitting hardware fences for singlethread fences
singlethread fences only synchronize with code running on the same hardware thread (i.e. signal handlers). Because of this, we need to prevent instruction reordering, but do not need to emit hardware fence instructions.
The implementation strategy here matches many other backends. The main motivation of this patch is to introduce the MEMBARRIER node and get some test coverage for it.
Differential Revision: https://reviews.llvm.org/D141311
Matt Arsenault [Fri, 6 Jan 2023 23:34:41 +0000 (18:34 -0500)]
AMDGPU: Don't insert ptrtoint for printf lowering
Matt Arsenault [Fri, 6 Jan 2023 23:23:53 +0000 (18:23 -0500)]
AMDGPU: Stop trying to specially handle vector stores in printf lowering
This was broken for 1 element vectors and trying to create invalid
casts. We can directly store any type just fine, so don't bother with
this buggy conversion logic.
Matt Arsenault [Sat, 7 Jan 2023 21:11:42 +0000 (16:11 -0500)]
clang/AMDGPU: Add missing tests for some builtin
These were tested under opencl but need hip testing for the potential
addrspacecasts.
Matt Arsenault [Sat, 7 Jan 2023 13:39:15 +0000 (08:39 -0500)]
AMDGPU: Move intrinsic definition point
This was incorrectly listed under the block for backend internal
intrinsics only.
Matt Arsenault [Sat, 7 Jan 2023 13:28:17 +0000 (08:28 -0500)]
AMDGPU: Set some more attributes on intrinsics
Heejin Ahn [Sun, 18 Dec 2022 00:33:22 +0000 (16:33 -0800)]
[WebAssembly][LiveDebugValues] Handle target index defs
This adds the missing handling for defs for target index operands, as is
already done for registers.
There are two kinds of target indices: local indices and stack operands.
- Locals are something similar to registers in Wasm-land. For local
indices, we can check for local-defining instructions (`local.set` or
`local.tee`).
- Wasm is a stack machine, so we have values in certain Wasm value stack
location, which change when Wasm instructions produce or consume
values. So basically any value-producing instrucion, i.e., instruction
with defs, can change values in the Wasm stack. But I think we don't
need to worry about this here, because `WebAssemblyDebugFixup`, which
runs right before this analysis, makes sure to insert terminating
`DBG_VALUE $noreg` instructions whenever a stack value gets popped.
After `WebAssemblyDebugFixup`, there shouldn't be any `DBG_VALUE`s for
stack operands that don't have a terminating `DBG_VALUE $noreg` within
the same BB.
So this CL only works on `DBG_VALUE`s for locals. When we encounter a
`local.set` or `local.tee` instructions, we delete `DBG_VALUE`s for
those target index locations from the open range set, so they will not
be availble in `OutLocs`. For example,
```
bb.0:
successors: %bb.1
DBG_VALUE target-index(wasm-local) + 2, $noreg, "var", ...
...
local.set 2 ...
bb.1:
; predecessors: %bb.0
; We shouldn't add `DBG_VALUE target (wasm-local) + 2 here because
; it was killed by 'local.set' in bb.0
```
After disabling register coalescing at -O1, the average PC ranges
covered for Emscripten core benchmarks is currently 20.6% in the LLVM
tot. After applying D138943 and this CL, the coverage goes up to 57%.
This also enables LiveDebugValues analysis in the Wasm pipeline by
default.
Reviewed By: dschuff, jmorse
Differential Revision: https://reviews.llvm.org/D140373
Heejin Ahn [Wed, 21 Sep 2022 21:48:34 +0000 (14:48 -0700)]
[WebAssembly] Use LiveDebugValues analysis
This enables `LiveDebugValues` analysis for Wasm. `DBG_VALUE`s expire at
the end of a BB, and this is the analysis extends their lifetime when
possible, greatly increasing the coverage of variable debug info.
Specifically, this removes the current constraint that this analysis is
only used with physical registers, which was first introduced in D18421,
because Wasm uses only virtual registers. I don't think there's anything
inherent in this analysis that only applies to physical registers; it
was just because all targets using this analysis ran this at the end of
their compiliation pipeline, at which point all their vregs had been
allocated, and Wasm's debug info infrastructure was not really set up
yet, so it was not using it.
This adds supports to Wasm-specific target-index operands, defined in
https://github.com/llvm/llvm-project/blob/
2166d9529a60d1cdedb733d2e4134c971f0969ec/llvm/lib/Target/WebAssembly/WebAssembly.h#L87-L100.
Among these, `TI_LOCAL`, `TI_LOCAL_INDIRECT`, and `TI_OPERAND_STACK` are
used by Wasm `DBG_VALUE` instructions.
This does not yet handle mutable target indices, i.e., this does not
terminate a `DBG_VALUE` for a local index when we encounter a new
`local.set` or `local.tee`. It will be implemented as a follow-up.
Reviewed By: dschuff, jmorse
Differential Revision: https://reviews.llvm.org/D138943
Mark de Wever [Sat, 24 Dec 2022 12:33:21 +0000 (13:33 +0100)]
[NFC][libc++][test] Improves code reuse.
This applies D140115 to the new tuple tests.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D140650
Chris Cotter [Tue, 10 Jan 2023 17:37:05 +0000 (17:37 +0000)]
[NFC] [clang-tools-extra] Alphabetize clang-tidy release notes
Alphabetize order of clang-tidy release notes, and fix `:doc:` link.
Reviewed By: Eugene.Zelenko
Differential Revision: https://reviews.llvm.org/D141391
Kirill Stoimenov [Tue, 10 Jan 2023 16:57:38 +0000 (16:57 +0000)]
[HWASAN] Added empty WordIsPoisoned for LSAN support.
Currently it is just an empty implementation to allow the project to link.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141147
esmeyi [Tue, 10 Jan 2023 17:32:13 +0000 (12:32 -0500)]
[XCOFF] Fix the offset error of dwarf sections caused by D137819.
chenglin.bi [Tue, 10 Jan 2023 17:28:43 +0000 (01:28 +0800)]
[DAGCombiner] Fix issue with rot chain pattern
faa35fc87370 fix the case of negative input shift. But when `c1`, `c2` is not the same side, it will also cause negative shift amount.
And that negative shift amount can't normalize by urem. So add one more bit size to normalize the last shift amount.
Fix: https://github.com/llvm/llvm-project/issues/59898
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D141363
chenglin.bi [Tue, 10 Jan 2023 17:24:34 +0000 (01:24 +0800)]
Revert "[LSR] Hoist IVInc to loop header if its all uses are in the loop header"
The original commit seems to cause a regression in numba test.
This reverts commit
b1b4758e7f4b2ffe1faa28b00eb037832e5d26a7.
serge-sans-paille [Tue, 10 Jan 2023 10:49:15 +0000 (11:49 +0100)]
[llvm] Declare llvm::makeArrayRef as obsolete
Also cleans up a few remaining references.
This is the final commit for the series started by
https://reviews.llvm.org/D140896
Alex Brachet [Tue, 10 Jan 2023 16:41:28 +0000 (16:41 +0000)]
[libc] Fix -Wimplicit-int-conversion warnings
Differential Revision: https://reviews.llvm.org/D140492
Tobias Gysi [Tue, 10 Jan 2023 16:13:33 +0000 (17:13 +0100)]
[mlir][llvm] Improve error messages during LLVM IR import.
Use the module location instead of unknown location if the imported
LLVM IR module does not have more precise debug information.
Additionally, use the diagMD function to print the metadata instead
of just the metadata kind if the import fails.
Reviewed By: definelicht
Differential Revision: https://reviews.llvm.org/D141357
Valentin Clement [Tue, 10 Jan 2023 16:08:33 +0000 (17:08 +0100)]
[flang] Fix emboxing when input type is directly a record type
In some fir.embox cases as shown in the test, the type descriptor
was not correctly found and the descriptor was populated with a null in the
addendum. This patch fixes this issue.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D141383
Chris Cotter [Tue, 10 Jan 2023 15:23:32 +0000 (15:23 +0000)]
[clang-tidy] Match derived types in in modernize-loop-convert
This patch allows clang-tidy to replace traditional for-loops where the
container type inherits its `begin`/`end` methods from a base class.
Test plan: Added unit test cases that confirm the tool replaces the new
pattern.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D140307
Nikita Popov [Tue, 10 Jan 2023 15:20:44 +0000 (16:20 +0100)]
[Verifier] Convert tests to opaque pointers (NFC)
Some tests are removed because they check conditions that
are not relevant with opaque pointers.
Yitzhak Mandelbaum [Mon, 9 Jan 2023 22:54:53 +0000 (22:54 +0000)]
[clang][dataflow] Fix 2 bugs in `MemberExpr` interpretation.
There were two (small) bugs causing crashes in the analysis. This patch fixes both of them.
1. An enum value was accessed as a class member. Now, the engine gracefully
ignores such member expressions.
2. Field access in `MemberExpr` of struct/class-typed global variables. Analysis
didn't interpret fields of global vars, because the vars were initialized before
the fields were added to the "allowlist". Now, the allowlist is set _before_
init of globals.
Differential Revision: https://reviews.llvm.org/D141384
Aaron Ballman [Tue, 10 Jan 2023 15:43:33 +0000 (10:43 -0500)]
Remove a stale FIXME comment; NFC
Also regenerates the AST matcher documentation. This matcher is tested
in TEST(HasImplicitDestinationType, MatchesSimpleCase) and
TEST(HasImplicitDestinationType, DoesNotMatchIncorrectly) in
ASTMatchersTraversalTest.cpp.
Alex Brachet [Tue, 10 Jan 2023 15:37:58 +0000 (15:37 +0000)]
Reland: "[libc] Templatize str{,n}cmp"
This will be used to implement the case insensitive str{,n}casecmp
This was initially reverted because it broke tests on arm platforms.
Unfortunately, it didn't break on my arm machine, but I suspect the
problem was the old comparator returned char and not int.
Differential Revision: https://reviews.llvm.org/D141235
Aaron Ballman [Tue, 10 Jan 2023 15:38:07 +0000 (10:38 -0500)]
Fix the documentation for the hasBody AST matcher
The problem was whitespace between the comment and the code for the
matcher. Rather than fix the script, I went the easier route and
removed the offending newline. If this problem comes up again though,
we should consider making the script less fragile.
Sanjay Patel [Tue, 10 Jan 2023 14:54:54 +0000 (09:54 -0500)]
[InstCombine] remove zext-of-icmp fold that may conflict with other folds
This bit-hack transform would cause the new test to infinite loop
after
21d3871b7c90f85b3ae.
The deleted transform has existed for a very long time,
but the profitable parts appear to be handled by other
folds now. This fold could replace 2 instructions with
4 instructions, so it was always in danger of going
overboard.
No tests regress by removing the whole thing.
Nico Weber [Tue, 10 Jan 2023 15:20:39 +0000 (10:20 -0500)]
[lld] Fix comment typos to cycle bots
Aaron Ballman [Tue, 10 Jan 2023 14:53:19 +0000 (09:53 -0500)]
Correct documentation for the hasBody() AST matcher; NFC
Note, when regenerating the documentation for this change, no changes
were made to the HTML file. There is an existing bug with the AST
matcher python script that fails to handle hasBody() specifically. So
this commit is to correct the internal documentation but another change
will be needed to fix the public documentation.
Aaron Ballman [Tue, 10 Jan 2023 14:51:57 +0000 (09:51 -0500)]
Update dump_ast_matchers.py to Python 3
Also regenerates the documentation and fixed a validation diagnostic
about use of 'is' vs '=='.
Matthias Springer [Tue, 10 Jan 2023 14:30:49 +0000 (15:30 +0100)]
[mlir] Fix worklist bug in MultiOpPatternRewriteDriver
When `strict = true`, only pre-existing and newly-created ops are rewritten and/or folded. Such ops are stored in `strictModeFilteredOps`.
Newly-created ops were previously added to `strictModeFilteredOps` after calling `addToWorklist` (via `GreedyPatternRewriteDriver::notifyOperationInserted`). Therefore, newly-created ops were never added to the worklist.
Also fix a test case that should have gone into an infinite loop (`test.replace_with_new_op` was replaced with itself, which should have caused the op to be rewritten over and over), but did not due to this bug.
Differential Revision: https://reviews.llvm.org/D141141
Yitzhak Mandelbaum [Mon, 9 Jan 2023 20:13:16 +0000 (20:13 +0000)]
[clang][dataflow][NFC] Refine names and comments for field filtering.
Tweaks elements of the new API for filtering the set of modeled fields.
Differential Revision: https://reviews.llvm.org/D141319
Shoaib Meenai [Sat, 7 Jan 2023 07:35:15 +0000 (23:35 -0800)]
[libc++] Fix aligned_alloc usage for Android
Android only provides this function on API 28+; fix libc++ builds when
targeting older API levels.
Reviewed By: arichardson, #libc, philnik
Differential Revision: https://reviews.llvm.org/D141184
Dinar Temirbulatov [Tue, 10 Jan 2023 14:23:29 +0000 (14:23 +0000)]
Move isAllInactivePredicate and isAllActivePredicate definition upwards, NFC
Andrew Ng [Tue, 10 Jan 2023 14:03:48 +0000 (14:03 +0000)]
[lld][COFF] Fix bug causing assertion in Chunk::setAlignment
Reinstate use of FakeSection class to avoid constructing SectionChunk
from unintialised coff_section in FakeSectionChunk constructor.
Issue was caused by commit
5a58b19f9c93f3ac51bcde318508131ae78aa10c,
"[LLD] Remove global state in lld/COFF".
Yitzhak Mandelbaum [Tue, 27 Dec 2022 17:34:30 +0000 (17:34 +0000)]
[clang][dataflow] Unify `TransferOptions` and `DataflowAnalysisContext::Options`.
Merges `TransferOptions` into the newly-introduced
`DataflowAnalysisContext::Options` and removes explicit parameter for
`TransferOptions`, relying instead on the common options carried by the analysis
context. Given that there was no intent to allow different options between calls
to `transfer`, a common value for the options is preferable.
Differential Revision: https://reviews.llvm.org/D140703
Jay Foad [Tue, 10 Jan 2023 14:13:16 +0000 (14:13 +0000)]
[AMDGPU] Add GFX10/GFX11 wave64 test coverage in huge-private-buffer.ll
Jens Massberg [Tue, 10 Jan 2023 11:20:09 +0000 (12:20 +0100)]
Avoid u8"" literals in tests, their type changes in C++20
Just specify the encoded bytes instead, which causes less confusion anyway.
Differential Revision: https://reviews.llvm.org/D141368
Jay Foad [Tue, 10 Jan 2023 14:06:59 +0000 (14:06 +0000)]
[AMDGPU] Fix duplicate -verify-machineinstrs option
Tomas Matheson [Tue, 6 Dec 2022 11:18:16 +0000 (11:18 +0000)]
[AArch64] Comprehensive tests for atomic operations
There are a lot of variants of atomic operations, and AArch64 has several
distinct options to codegen them, and does different things depending on
available features, architecture version and optimisation level. The current
testing for atomic operations has been added gradually over time and does not
give full coverate. Given how complex the codegen for atomic operations is, it
is valuable to cover the entire parameter space, i.e. test them all. The
resulting set of tests serve also as a reference for how each is codegened.
In order to keep the test files readable and avoid constant updating for
unrelated codegen changes, the test outputs are filtered to only include the
relevant instructions. This shows for each operation and feature which codegen
approach is taken (e.g. ll/sc loop, atomic instruction, library call).
The following parameter space is tested:
- feature: +lse, +rcpc, etc
- optimisation level: O0, O1 (covers GISel and SelectionDAG)
- atomic instruction: load, store, cmpxchg, atomirmw*
- size: i8, i16, i32, i64, i128
- aligned/unaligned accesses
- endianness: big, little
- atomic ordering: release, acquire, etc
- load atomic only: const/non-const
- cmpxchg only: weak/strong
- atomicrmw: update operation (add, sub, etc)
Notably not covered:
- volatility: there should be no difference between volatile/non-volatile
- atomicrmw fadd/fsub
The files are split by triple, LLVM instruction, and feature. This makes it
easy to diff between features and endianness for a given instruction.
The file that generates the tests is included.
There are 70 test files with an average of 2800 lines each.
Differential Revision: https://reviews.llvm.org/D141064
Alex Zinenko [Tue, 10 Jan 2023 12:19:53 +0000 (12:19 +0000)]
[mlir] verify that transform ops have memory effects
Add a verifier to the TransformOpInterface ensuring that operations
implementing the interface define memory effects on their operands and
results.
Add the missing effects to TileToForeachThreadOp, specifically for
operands that were added at a later version of the op without modifying
`getEffects` accordingly.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D141371
Ganesh Gopalasubramanian [Tue, 10 Jan 2023 13:41:25 +0000 (19:11 +0530)]
Revert "[X86] Add RMPQUERY to SNP instructions"
This reverts commit
313b747c5bf293aa86caf0da57b978a9758cd57b.
It wasn't reviwed as yet.
Ganesh Gopalasubramanian [Tue, 10 Jan 2023 13:31:12 +0000 (19:01 +0530)]
[X86] Add RMPQUERY to SNP instructions
Tobias Gysi [Tue, 10 Jan 2023 13:16:38 +0000 (14:16 +0100)]
[mlir][llvm] Call the instruction builders from a static method (NFC).
Extract a static method to call the MLIR builders that translate LLVM IR
instructions to MLIR LLVM dialect operations. This change ensures the
MLIR builders have to use the moduleImport argument rather than calling
the import methods directly. As a result, both the intrinsic and the
instruction MLIR builders have to use a moduleImport argument and none
of them has direct access to private moduleImport methods. The revision
thus enforces consistent MLIR builder implementations for instructions
and intrinsics.
The revision also moves parseDataLayoutAlignment closer to its use.
Reviewed By: Dinistro
Differential Revision: https://reviews.llvm.org/D141265
Sam McCall [Mon, 9 Jan 2023 19:36:05 +0000 (20:36 +0100)]
[Support] avoid u8"" literals in tests, their type changes in C++20
Just specify the encoded bytes instead, which causes less confusion anyway.
Differential Revision: https://reviews.llvm.org/D141312
Sam McCall [Tue, 10 Jan 2023 09:51:34 +0000 (10:51 +0100)]
[AST] include decls owned by FriendDecl in -ast-dump
Differential Revision: https://reviews.llvm.org/D141362
Jay Foad [Tue, 10 Jan 2023 12:02:55 +0000 (12:02 +0000)]
[AMDGPU] Add GFX11 test coverage for FeatureBackOffBarrier
Jay Foad [Tue, 10 Jan 2023 12:16:43 +0000 (12:16 +0000)]
[AMDGPU] Regenerate checks in waitcnt-preexisting-vscnt.mir
Alexey Bataev [Tue, 10 Jan 2023 12:34:16 +0000 (04:34 -0800)]
[X86][NFC]Move and rephrase the comment, NFC
Pavel Kopyl [Mon, 9 Jan 2023 14:59:47 +0000 (17:59 +0300)]
[NVPTX] Enforce minumum alignment of 4 for byval parametrs in a function prototype
As a result, we have identical alignment calculation of byval
parameters for:
- LowerCall() - getting alignment of an argument (.param)
- emitFunctionParamList() - getting alignment of a
parameter (.param) in a function declaration
- getPrototype() - getting alignment of a parameter (.param) in a
function prototypes that is used for indirect calls
This change is required to avoid ptxas error: 'Alignment of argument
does not match formal parameter'. This error happens even in cases
where it logically shouldn't.
For instance:
.param .align 4 .b8 param0[4];
...
callprototype ()_ (.param .align 2 .b8 _[4]);
...
Here we allocate 'param0' with alignment of 4 and it should be fine to
pass it to a function that requires minimum alignment of 2.
At least ptxas v12.0 rejects this code.
Differential Revision: https://reviews.llvm.org/D140581
Pavel Kopyl [Mon, 9 Jan 2023 14:55:55 +0000 (17:55 +0300)]
[NVPTX] Set default version of architecture to SM_30, PTX to 6.0.
Support of variadic functions triggers an assertion on several tests
from llvm/test/CodeGen/Generic/ if nvptx64-* is specified as a default
triplet:
Support for variadic functions (unsized array parameter) introduced in
PTX ISA version 6.0 and requires target sm_30.
That happens because those tests contain variadic function calls and
default versions of both PTX ISA (3.2) and architecture (sm_20) are
below the minimally required.
There were no observable problems with these tests before adding
support of variadic functions, because nvptx backend just didn't
handle them properly generating invalid PTX code.
Differential Revision: https://reviews.llvm.org/D141054
Nikita Popov [Tue, 10 Jan 2023 11:45:06 +0000 (12:45 +0100)]
[GVNSink] Convert tests to opaque pointers (NFC)
Keeping bitcasts in the common_bitcast() test, otherwise sinking
no longer occurs there. GVNSink seems to have a silly cost model
where sinking just the stores is considered non-profitable, but
sinking the stores and bitcasts (which are free...) is profitable.
As this is not a default-enabled pass, and this problem would exist
without opaque pointers as well, I'm not trying to do anything
about this.
Ties Stuij [Tue, 10 Jan 2023 11:12:19 +0000 (11:12 +0000)]
[AArch64] lower abs intrinsic to new ABS instruction in GIsel
When feature CSSC is available, the abs intrinsic should map to the
new scalar ABS instruction when using GlobalIsel
spec:
https://developer.arm.com/documentation/ddi0602/2022-09/Base-Instructions/ABS--Absolute-value-
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D139419
Nikita Popov [Tue, 10 Jan 2023 11:39:36 +0000 (12:39 +0100)]
[GVNSink] Make tests more robust (NFC)
Avoid use of no-op GEPs.
Jens Massberg [Mon, 9 Jan 2023 16:56:10 +0000 (17:56 +0100)]
Remove unnecessary template specifiers from truct constructors in tests.
As far as I can see they are unnecessary and in C++20 they lead to errors.
Removing them the tests pass with C++20 and the default version.
Example error message:
```
llvm-project/llvm/unittests/IR/PassBuilderCallbacksTest.cpp:275:30: error: expected unqualified-id before ‘)’ token
275 | MockAnalysisHandle<Module>() { setDefaults(); }
```
Differential Revision: https://reviews.llvm.org/D141358
Nikita Popov [Tue, 10 Jan 2023 11:33:04 +0000 (12:33 +0100)]
[GlobalMerge] Convert tests to opaque pointers (NFC)
Sjoerd Meijer [Tue, 10 Jan 2023 11:10:42 +0000 (11:10 +0000)]
[CostModel][AArch64] Add insert/extract element tests for neoverse cores. NFC.
Matthias Springer [Tue, 10 Jan 2023 11:02:33 +0000 (12:02 +0100)]
[mlir] GreedyPatternRewriter: fix counting of iterations
The GreedyPatternRewriteDriver did previously not count the first iteration. I.e., when setting `config.maxIterations = 1`, two iterations were performed. In pratice, this number is not really important; we usually just need a limit in some reasonable order of magnitude. However, this fix allows us to write better convergence/worklist tests with carefully crafted test patterns to purposely trigger edge cases in the driver.
Similarly, the first rewrite was previously not counted towards `config.maxNumRewrites`.
For consistency, `OpPatternRewriteDriver` now uses `config.maxNumRewrites` instead of `config.maxIterations`; this driver does not have "iterations", it consists of a single loop (corresponding to the inner loop in the GreedyPatternRewriteDriver).
Differential Revision: https://reviews.llvm.org/D141365
Nikita Popov [Fri, 6 Jan 2023 15:56:34 +0000 (16:56 +0100)]
Reapply [Dominators] Add findNearestCommonDominator() for Instructions (NFC)
Reapply with checks for instructions in unreachable blocks. A test
case for this was added in
1ee4a93b15bb.
-----
This is a recurring pattern: We want to find the nearest common
dominator (instruction) for two instructions, but currently only
provide an API for the nearest common dominator of two basic blocks.
Add an overload that accepts and return instructions.
Nikita Popov [Tue, 10 Jan 2023 11:12:52 +0000 (12:12 +0100)]
[DSE] Add test with different unreachable block order (NFC)
Sam Clegg [Wed, 4 Jan 2023 19:28:55 +0000 (11:28 -0800)]
[lld][WebAssembly] Fix memory.fill argument in 64-bit mode
This only effects folks building with wasm64 + shared memory which
is not currently a supported configuration in emscripten or any other
wasm toolchain.
Differential Revision: https://reviews.llvm.org/D141005
Luke Lau [Fri, 6 Jan 2023 13:55:28 +0000 (13:55 +0000)]
[UpdateTestChecks] Add wasm64 target
wasm32 was already supported, so here I've just reused the same regex. I'm not sure if this is actually correct: I don't know for certain if wasm32 and wasm64 have different output formats, but it seems to work.
Reviewed By: dschuff, asb
Differential Revision: https://reviews.llvm.org/D141130
Dmitri Gribenko [Tue, 10 Jan 2023 10:37:49 +0000 (11:37 +0100)]
Revert "[JumpThreading] Preserve profile metadata during select unfolding"
This reverts commit
957952dbf2f34ed552e8e1f8c35eed17eee2ea38.
Addition in the newly added code can overflow. As a result, the
constructor of `BranchProbability()` can trigger an assertion. See
the discussion on https://reviews.llvm.org/D138132 for more details.
Simon Pilgrim [Tue, 10 Jan 2023 10:49:23 +0000 (10:49 +0000)]
[AArch64] Add Issue #59898 test case for D141363
serge-sans-paille [Mon, 9 Jan 2023 17:11:07 +0000 (18:11 +0100)]
Move from llvm::makeArrayRef to ArrayRef deduction guides - last part
This is a follow-up to https://reviews.llvm.org/D140896, split into
several parts as it touches a lot of files.
Differential Revision: https://reviews.llvm.org/D141298
Simon Pilgrim [Tue, 10 Jan 2023 10:44:26 +0000 (10:44 +0000)]
[AArch64] Regenerate rotate.ll test
Simplifies diff for D141363
chenglin.bi [Tue, 10 Jan 2023 10:33:33 +0000 (18:33 +0800)]
[LSR] Hoist IVInc to loop header if its all uses are in the loop header
When the latch block is different from header block, IVInc will be expanded in the latch loop. We can't generate the post index load/store this case.
But if the IVInc only used in the loop, actually we still can use the post index load/store because when exit loop we don't care the last IVInc value.
So, trying to hoist IVInc to help backend to generate more post index load/store.
Fix #53625
Reviewed By: eopXD
Differential Revision: https://reviews.llvm.org/D138636
eopXD [Sun, 8 Jan 2023 15:55:06 +0000 (07:55 -0800)]
[Clang][RISCV] Expose vlenb to user
This commit adds function `vlenb` into riscv_vector.h. `vlenb` is defined
through builtin function `__builtin_rvv_vlenb`, which is lowered to
`llvm.read_register`.
Reviewed By: kito-cheng, pcwang-thead
Differential Revision: https://reviews.llvm.org/D141032
esmeyi [Tue, 10 Jan 2023 10:18:53 +0000 (05:18 -0500)]
[XCOFF][NFC] Update the test aix-xcoff-huge-relocs.ll
Jessica Del [Tue, 10 Jan 2023 10:05:00 +0000 (11:05 +0100)]
[AMDGPU] adding test for partially masked operands
This test is testing whether the compiler behaves correctly when only
parts of an operand are masked.
In this case, no optimization is supposed to happen, since neither
the upper nor the lower half is
fully masked. Therefore, none
of the halves can be known to be zero.
The result is a regular multiplication.
Krasimir Georgiev [Tue, 10 Jan 2023 09:23:44 +0000 (09:23 +0000)]
Revert "[clang-format] Add an option for breaking after C++11 attributes"
This reverts commit
a28f0747c2f3728bd8a6f64f7c8ba80b4e0cda9f.
It appears that this regresses some function definitions, added an
example as a comment over at https://reviews.llvm.org/D140956.
Ben Shi [Sun, 8 Jan 2023 03:50:50 +0000 (11:50 +0800)]
[AVR] Do not select unimplemented pseudo instructions
Reviewed By: aykevl, Miss_Grape
Differential Revision: https://reviews.llvm.org/D141210
Pierre van Houtryve [Fri, 6 Jan 2023 13:33:49 +0000 (08:33 -0500)]
[InstCombine] Combine lshr of add -> (a + b < a)
Tries to perform
(lshr (add (zext X), (zext Y)), K)
-> (icmp ult (add X, Y), X)
where
- The add's operands are zexts from a K-bits integer to a bigger type.
- The add is only used by the shr, or by iK (or narrower) truncates.
- The lshr type has more than 2 bits (other types are boolean math).
- K > 1
This seems to be a pattern that just comes from OpenCL front-ends, so adding DAG/GISel combines doesn't seem to be worth the complexity.
Original patch D107552 by @abinavpp - adapted to use (a + b < a) instead of uaddo following discussion on the review.
See this issue https://github.com/RadeonOpenCompute/ROCm/issues/488
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D138814
Jean Perier [Tue, 10 Jan 2023 08:28:08 +0000 (09:28 +0100)]
[flang] Lower addresses inside global initializers in HLFIR
Move the code to lower an expression to address or a box in HLFIR from
Bridge.cpp to ConvertExpr.cpp so that it can be used inside
ConvertVariable.cpp (that needs to use a different symbol map that the
one held in the bridge).
Lower NULL to hlfir.null.
This allows lowering derived type constant structure constructors with
pointer components into fir.global.
Differential Revision: https://reviews.llvm.org/D141276
Pierre van Houtryve [Tue, 6 Dec 2022 08:29:08 +0000 (03:29 -0500)]
[InstCombine] Precommit D138814 tests
Separate commit for D138814's testcases to make review easier.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D139011
Jean Perier [Tue, 10 Jan 2023 08:01:38 +0000 (09:01 +0100)]
[flang] Allow and use fir.rebox in fir.global
The current lowering of initial target in fir.global is relying
on how fir.box are created: instead of using a fir.rebox to add
the POINTER attribute to the created descriptor, it is looking
for a fir.embox defining operation and creating a copy of
it with a different result types.
The rational for doing so was that fir.rebox codegen was not possible
inside fir.global because it expects to manipulate the input fir.box
in memory, while objects cannot be manipulated in memory inside
a fir.global region that must be constant foldable.
But this approach has two problems:
- it won't work with hlfir where fir.box may be created by more
operations than fir.embox (e.g. hlfir.delcare or hlfir.designate).
In general, looking for a precise defining op for a value is
fragile.
- manually copying and modifying an operation is risky: it is easy
to forget copying some default operands (that could be added later).
This patch modifies the helpers to get descriptor fields so that they
can both operate on fir.box lowered in memory or in an llvm.struct
value. This enables the usage of fir.rebox in fir.global op.
The fallout in FIR tests is caused by the usage of constant index
when creating GEP (because extractOp requires constant indices).
MLIR builder uses i32 bit constant indices when non mlir::Value
indices are passed to the MLIR GEP op builder. Previously,
an 64 nist mlir constant value was created and passed to the GEP
builder. In this case, the builder respect the value type when
later generating the GEP.
Given this changes impact the "dimension" index that can, per
Fortran requirement, not be greated than 15, using a 32 bit index
is just fine and actually simplify the MLIR LLVM IR generation.
The fallout in lowering tests is caused by the introduction
of the fir.rebox everytime an initial target is created.
Differential Revision: https://reviews.llvm.org/D141136
Douglas Yung [Tue, 10 Jan 2023 07:53:14 +0000 (23:53 -0800)]
Revert "[llvm-profdata] Add option to cap profile output size"
This reverts commit
5b72d0e4f5eeb8f90c744cac8e0728cffeca61a9.
The test added is failing on Mac/Windows. See review for buildbot failure links.
Douglas Yung [Tue, 10 Jan 2023 07:52:06 +0000 (23:52 -0800)]
Revert "[ProfileData] Fix a warning"
This reverts commit
9f4a9d3f44501fa755eb71fe855e15cf0e59e8b8.
Reverting this change which was a follow-up to
5b72d0e4f5eeb8f90c744cac8e0728cffeca61a9 which is being reverted due to test failures on Mac/Windows.
esmeyi [Tue, 10 Jan 2023 07:39:02 +0000 (02:39 -0500)]
[XCOFF] support the overflow section (only relocation overflow is handled).
Summary: This patch handles relocation field overflows in an XCOFF32 file. (XCOFF64 files may not have overflow section headers.) If a section has more than 65,534 relocation entries or line number entries, both of these fields are set to a value of 65535. In this case, an overflow section header with the s_flags field equal to STYP_OVRFLO is used to contain the relocation and line-number count information. Since line number is not supported, this patch only handles the relocation overflow.
Reviewed By: shchenz
Differential Revision: https://reviews.llvm.org/D137819
Johannes Doerfert [Fri, 23 Dec 2022 02:18:40 +0000 (18:18 -0800)]
[OpenMP] Use Attributor to find underlying objects of stores
When we see a store in generic mode we need to decide if we should guard
it for SPMDzation. This patch changes the getUnderlyingObjects call to
the more optimistic getAssumedUnderlyingObjects call to identify more
thread local pointers.
Yi Kong [Tue, 10 Jan 2023 05:56:03 +0000 (14:56 +0900)]
Fix build when LLVM_BUILTIN_TARGETS is not set
If LLVM_BUILTIN_TARGETS is not set, no OS specific variants will be
created, causing CMake build failure. Depend on the generic builtins
target if LLVM_BUILTIN_TARGETS is not set.
Differential Revision: https://reviews.llvm.org/D141273
Alexandre Ganea [Tue, 10 Jan 2023 04:45:20 +0000 (23:45 -0500)]
[Clang] Silence a "unused variable" warning when building with MSVC
Amy Huang [Tue, 10 Jan 2023 04:37:28 +0000 (23:37 -0500)]
[LLD] Remove global state in lld/COFF
Remove globals from the lldCOFF library, by moving globals into a context class.
This patch mostly moves the config object into COFFLinkerContext.
See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151184.html for
context about removing globals from LLD.
Reviewed By: aganea
Differential Revision: https://reviews.llvm.org/D110450
Owen Anderson [Tue, 10 Jan 2023 04:21:38 +0000 (21:21 -0700)]
Revert "Remove the ThreadLocal template from LLVM."
This reverts commit
54d78b639b9c18b42abd4fac5c6e76105f06b3ef.
Owen Anderson [Tue, 10 Jan 2023 04:21:29 +0000 (21:21 -0700)]
Revert "Fix warning when building with GCC."
This reverts commit
971786254cc4093eb1c56625b8da0fd3544f6512.
Owen Anderson [Tue, 10 Jan 2023 04:17:51 +0000 (21:17 -0700)]
Fix warning when building with GCC.
Owen Anderson [Tue, 10 Jan 2023 03:48:20 +0000 (20:48 -0700)]
Remove the ThreadLocal template from LLVM.
This has been obsoleted by C++ thread_local for a long time.
As far as I know, Xcode was the last supported toolchain to add
support for C++ thread_local in 2016.
As a precaution, use LLVM_THREAD_LOCAL which provides even greater
backwards compatibility, allowing this to function even pre-C++11
versions of GCC.
Reviewed By: majnemer
Differential Revision: https://reviews.llvm.org/D141347
Joshua Cao [Tue, 10 Jan 2023 03:24:50 +0000 (19:24 -0800)]
[SCEV] Add llvm.experimental.guard conditions to applyLoopGuards()
Conditions for dominating branches and llvm.assumes are already
collected. This also adds conditions from guards.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D141243
hezuoqiang [Tue, 10 Jan 2023 03:03:05 +0000 (19:03 -0800)]
[BOLT] Modify the print option to a meaningful value
Using the option `-print-sorted-by=.` cause to core dump, so change to a legal value.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D140847
Chuanqi Xu [Tue, 10 Jan 2023 02:36:50 +0000 (10:36 +0800)]
[NFC] Fix a test faliing in AIX
See https://reviews.llvm.org/D140867.
The signature of the constructor/destrucor of the global variables is
different in different targets. And the CHECKs in the test is
unavailable in other targets (e.g., AIX). So the patch tries to avoid
the test failure by requiring the target type.
Guozhi Wei [Tue, 10 Jan 2023 02:35:35 +0000 (02:35 +0000)]
Revert "[GVN] Improve PRE on load instructions"
This reverts commit
1f1d501843e5cf8741599035d6ef66a3eb5e1e9e.
This patch caused several sanitizer tests failed. Revert it to unblock
others.
Jojo R [Fri, 30 Dec 2022 11:09:12 +0000 (19:09 +0800)]
[RISCV] Add codegen support for RISCV XTHeadVdot Extension
This patch adds codegen support for XTHeadVdot extension,
which is documented here, it's based on standard vector extension v1.0:
https://github.com/T-head-Semi/thead-extension-spec
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140771
jacquesguan [Thu, 5 Jan 2023 09:06:35 +0000 (17:06 +0800)]
[mlir] Avoid crash of UnsignedWhenEquivalent for no integer type.
Fixes https://github.com/llvm/llvm-project/issues/59617.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D141038
Kito Cheng [Tue, 10 Jan 2023 01:51:07 +0000 (09:51 +0800)]
[RISCV] Add H extension
`h` was the prefix of multi-letter extension name, but it become a
extension name in later RISC-V isa spec.
Fortunately we don't have any extension really defined is prefixed
with `h`, so we can just change that.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D136817
Casey Carter [Tue, 10 Jan 2023 01:18:08 +0000 (17:18 -0800)]
[libc++][test] Avoid MSVC constexpr bug
C++ constexpr allows a non-constant-expresssion lvalue to be used in a constant expression if it's not subject to lvalue-to-rvalue conversion. Subtly, this means you can make a constant-expression copy of a non-constant-expression object of empty type since the copy constructor doesn't perform lvalue-to-rvalue conversion. MSVC has had bugs with this usage forever, which will hopefully finally be mashed implementing C++23's relaxation on the use of pointers and references in constant expressions.
There's no need for this particular test to use this particular constexpr feature, we can simply make the predicates constant expressions.
Differential Revision: https://reviews.llvm.org/D141336
Philip Reames [Tue, 10 Jan 2023 01:41:31 +0000 (17:41 -0800)]
[XCore] Use the newly introduced generic MEMBARRIER node [not quite nfc]
The target node being removed did not have side effects; the generic one does. Nothing in the code indicates the lack was intentional, so this is probably fixing a bug.