Alexey Bataev [Wed, 17 Nov 2021 16:42:33 +0000 (08:42 -0800)]
[SLP]Improve analysis/emission of vector operands for alternate nodes.
Compiler has an analysis for perfect diamond matching but it does not
support nodes with main/alternate opcodes. The problem is that the
scalars themselves are different and might not match directly with other
nodes, but operands and main/alternate opcodes might match and compiler
might reuse some previously emitted vector instructions. Need to include
this analysis in the cost model and actual vector instructions emission
process.
Differential Revision: https://reviews.llvm.org/D114101
Saleem Abdulrasool [Wed, 24 Nov 2021 18:44:38 +0000 (10:44 -0800)]
Headers: exclude `#include_next <stdatomic.h>` on MSVC
The 14.31.30818 toolset has the following in the `stdatomic.h`:
~~~
#ifndef __cplusplus
#error <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.
#endif
~~~
This results in clang failing to build existing code which relied on
`stdatomic.h` in C mode on Windows. Simply fallback to the clang header
until that header is available as a complete implementation.
Dimitry Andric [Tue, 23 Nov 2021 20:06:45 +0000 (21:06 +0100)]
cfi: fix more -Wformat warnings
Building cfi with recent clang on a 64-bit system results in the
following warnings:
compiler-rt/lib/cfi/cfi.cpp:233:64: warning: format specifies type 'void *' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
VReport(1, "Can not handle: symtab > strtab (%p > %zx)\n", symtab, strtab);
~~ ^~~~~~
%lu
compiler-rt/lib/sanitizer_common/sanitizer_common.h:231:46: note: expanded from macro 'VReport'
if ((uptr)Verbosity() >= (level)) Report(__VA_ARGS__); \
^~~~~~~~~~~
compiler-rt/lib/cfi/cfi.cpp:253:59: warning: format specifies type 'void *' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
VReport(1, "Can not handle: symtab %p, strtab %zx\n", symtab, strtab);
~~ ^~~~~~
%lu
compiler-rt/lib/sanitizer_common/sanitizer_common.h:231:46: note: expanded from macro 'VReport'
if ((uptr)Verbosity() >= (level)) Report(__VA_ARGS__); \
^~~~~~~~~~~
Since `__sanitizer::uptr` has the same size as `size_t`, consistently
use `%z` as a printf specifier.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D114466
Florian Hahn [Wed, 24 Nov 2021 20:17:43 +0000 (20:17 +0000)]
[LV] Use OrigLoop instead of induction to get function. (NFC)
Upcoming changes will result in Induction not being set/used in some
cases. Use OrigLoop to get the function instead.
Jeremy Morse [Wed, 24 Nov 2021 17:32:55 +0000 (17:32 +0000)]
[DebugInfo][InstrRef] Cope with win32 calls changing SP in LiveDebugValues
Almost all of the time, call instructions don't actually lead to SP being
different after they return. An exception is win32's _chkstk, which which
implements stack probes. We need to recognise that as modifying SP, so
that copies of the value are tracked as distinct vla pointers.
This patch adds a target frame-lowering hook to see whether stack probe
functions will modify the stack pointer, store that in an internal flag,
and if it's true then scan CALL instructions to see whether they're a
stack probe. If they are, recognise them as defining a new stack-pointer
value.
The added test exercises this behaviour: two calls to _chkstk should be
considered as producing two different values.
Differential Revision: https://reviews.llvm.org/D114443
Tobias Gysi [Wed, 24 Nov 2021 19:21:18 +0000 (19:21 +0000)]
[mlir][linalg] Simplify padding test (NFC).
The padding tests previously contained the tile loops. This revision removes the tile loops since padding itself does not consider the loops. Instead the induction variables are passed in as function arguments which promotes them to symbols in the affine expressions. Note that the pad-and-hoist.mlir test still exercises padding in the context of the full loop nest.
Depends On D114175
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D114227
Zarko Todorovski [Wed, 24 Nov 2021 19:16:47 +0000 (14:16 -0500)]
[NFC][clang]Inclusive language: remove remaining uses of sanity
Missed some uses of sanity check in previous commits.
Tobias Gysi [Wed, 24 Nov 2021 19:12:39 +0000 (19:12 +0000)]
[mlir][linalg] Add makeComposedPadHighOp.
Add the makeComposedPadHighOp method which creates a new PadTensorOp if necessary. If the source to pad is actually the result of a sequence of padded LinalgOps, the method checks if padding is needed or if we can use the padded result of the padded LinalgOp sequence directly.
Example:
```
%0 = tensor.extract_slice %arg0 [%iv0, %iv1] [%sz0, %sz1]
%1 = linalg.pad_tensor %0 low[0, 0] high[...] { linalg.yield %cst }
%2 = linalg.matmul ins(...) outs(%1)
%3 = tensor.extract_slice %2 [0, 0] [%sz0, %sz1]
```
when padding %3 return %2 instead of introducing
```
%4 = linalg.pad_tensor %3 low[0, 0] high[...] { linalg.yield %cst }
```
Depends On D114161
Reviewed By: nicolasvasilache, pifon2a
Differential Revision: https://reviews.llvm.org/D114175
Stanislav Mekhanoshin [Wed, 24 Nov 2021 18:58:05 +0000 (10:58 -0800)]
Revert "[InstCombine] (~(a | b) & c) | ~(c | (a ^ b)) -> ~((a | b) & (c | (b ^ a)))"
This reverts commit
c407769f5e6c81d56de0b251aed5750a16a7651c.
Tobias Gysi [Wed, 24 Nov 2021 19:03:41 +0000 (19:03 +0000)]
[mlir][linalg] Update failure conditions for padOperandToSmallestStaticBoundingBox.
Change the failure condition of padOperandToSmallestStaticBoundingBox to never fail if the operand is already statically sized.
In particular:
- if the padding value computation fails -> return failure if the operand shape is dynamic and success if it is static.
- if there is no extract slice op -> return failure if the operand shape is dynamic and success if it is static.
The latter change prevents padding from failure if the output operand passed by iteration argument is statically sized since in this case the extract / insert slice pairs are removed by canonicalization.
Depends On D114153
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D114161
Zarko Todorovski [Wed, 24 Nov 2021 14:52:01 +0000 (09:52 -0500)]
[NFC][Clang][test] Inclusive language: Remove and rephrase uses of sanity test/check in clang/test
Part of work to use more inclusive terms in clang/llvm.
Florian Hahn [Wed, 24 Nov 2021 19:01:47 +0000 (19:01 +0000)]
Revert "[ThreadPool] Do not return shared futures."
This reverts commit
a5fff58781f30ff3fd7a3f56948552cf7b8842bb.
The offending commit broke building with LLVM_ENABLE_THREADS=OFF.
Nemanja Ivanovic [Wed, 24 Nov 2021 18:41:06 +0000 (12:41 -0600)]
[PowerPC] Add missed clang portion of
c933c2eb3346
The clang portion of
c933c2eb3346 was missed as I made
some kind of mistake squashing the commits with git.
This patch just adds those.
The original review: https://reviews.llvm.org/D114088
MaheshRavishankar [Wed, 24 Nov 2021 17:26:11 +0000 (09:26 -0800)]
[mlir][Linalg] Remove alloc/dealloc pair as a callback.
The alloc dealloc pair generation callback is really central to the
bufferization algorithm, it modifies the state in a way that affects
correctness. This is not really a configurable option. Moving it to
BufferizationState removes what was probably the reason it was added
as a callback.
Differential Revision: https://reviews.llvm.org/D114417
Steven Wan [Wed, 24 Nov 2021 18:15:52 +0000 (13:15 -0500)]
[NFC][AIX]Disable precompiled module file tests on AIX
The PCH reader looks for `__clangast` section in the precompiled module file, which is not present in the file on AIX, and we don't support writing this custom section in XCOFF yet.
Reviewed By: daltenty
Differential Revision: https://reviews.llvm.org/D114481
Kirill Stoimenov [Tue, 23 Nov 2021 23:58:17 +0000 (15:58 -0800)]
[ASan] Moved __asan_test_only_reported_buggy_pointer to ReportGenericError, which is needed for shared optimzied callback tests.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D114486
Jeremy Morse [Wed, 24 Nov 2021 17:21:20 +0000 (17:21 +0000)]
[DebugInfo][InstrRef] Ignore SP clobbers on call instructions even more
Avoid un-necessarily recreating DBG_VALUEs on call instructions.
In LiveDebugvalues we choose to ignore any clobbers of SP by call
instructions, as they're irrelevant to our model of the machine. We
currently do so for tracking register values (MTracker); do the same for
tracking variable locations (TTracker).
Test modified to endure that a duplicate DBG_VALUE is not created after the
call in struction in this test.
Differential Revision: https://reviews.llvm.org/D114365
Jeremy Morse [Wed, 24 Nov 2021 17:05:39 +0000 (17:05 +0000)]
[DebugInfo] Reflect switched variable order from instruction referencing
Enabling instruction referencing causes a few variable locations to switch
order -- i.e., they switch position in the output DWARF, or sometimes the
order of DBG_VALUEs. Update a few tests to reflect this.
Differential Revision: https://reviews.llvm.org/D114261
Simon Pilgrim [Wed, 24 Nov 2021 16:47:42 +0000 (16:47 +0000)]
[AArch64] Add regression test for D114354
Graham Hunter [Thu, 12 Aug 2021 14:38:13 +0000 (15:38 +0100)]
[NFC][LAA] Precommit tests for forked pointers
Precommit for https://reviews.llvm.org/D108699
Balázs Kéri [Wed, 24 Nov 2021 15:46:47 +0000 (16:46 +0100)]
[clang][AST] Check context of record in structural equivalence.
The AST structural equivalence check did not differentiate between
a struct and a struct with same name in different namespace. When
type of a member is checked it is possible to encounter such a case
and wrongly decide that the types are similar. This problem is fixed
by check for the namespaces of a record declaration.
Reviewed By: martong
Differential Revision: https://reviews.llvm.org/D113118
Levon Ter-Grigoryan [Wed, 24 Nov 2021 16:13:48 +0000 (16:13 +0000)]
Fixed use of -o and -k in LLDB under Windows when statically compiled with vcruntime.
Right now if the LLDB is compiled under the windows with static vcruntime library, the -o and -k commands will not work.
The problem is that the LLDB create FILE* in lldb.exe and pass it to liblldb.dll which is an object from CRT.
Since the CRT is statically linked each of these module has its own copy of the CRT with it's own global state and the LLDB should not share CRT objects between them.
In this change I moved the logic of creating FILE* out of commands stream from Driver class to SBDebugger.
To do this I added new method: SBError SBDebugger::SetInputStream(SBStream &stream)
Command to build the LLDB:
cmake -G Ninja -DLLVM_ENABLE_PROJECTS="clang;lldb;libcxx" -DLLVM_USE_CRT_RELEASE="MT" -DLLVM_USE_CRT_MINSIZEREL="MT" -DLLVM_USE_CRT_RELWITHDEBINFO="MT" -DP
YTHON_HOME:FILEPATH=C:/Python38 -DCMAKE_C_COMPILER:STRING=cl.exe -DCMAKE_CXX_COMPILER:STRING=cl.exe ../llvm
Command which will fail:
lldb.exe -o help
See discord discussion for more details: https://discord.com/channels/
636084430946959380/
636732809708306432/
854629125398724628
This revision is for the further discussion.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D104413
Dmitry Vyukov [Wed, 24 Nov 2021 12:59:42 +0000 (13:59 +0100)]
tsan: include internal allocator into deadlock detection
Now that we lock the internal allocator around fork,
it's possible it will create additional deadlocks.
Add a fake mutex that substitutes the internal allocator
for the purposes of deadlock detection.
Depends on D114531.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D114532
Dmitry Vyukov [Wed, 24 Nov 2021 11:54:06 +0000 (12:54 +0100)]
tsan: lock internal allocator around fork
There is a small chance that the internal allocator is locked
during fork and then the new process is created with locked
internal allocator and any attempts to use it will deadlock.
For example, if detected a suppressed race in the parent during fork
and then another suppressed race after the fork.
This becomes much more likely with the new tsan runtime
as it uses the internal allocator for more things.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D114531
Nicolas Vasilache [Wed, 24 Nov 2021 15:54:25 +0000 (15:54 +0000)]
[mlir][Vector] NFC - Apply some clangd suggested fixes.
Peter Waller [Thu, 18 Nov 2021 13:27:54 +0000 (13:27 +0000)]
[LoopAccessAnalysis][SVE] Bail out for scalable vectors
The supplied test case, reduced from real world code, crashes with a
'Invalid size request on a scalable vector.' error.
Since it's similar in spirit to an existing LAA test, rename the file to
generalize it to both.
Differential Revision: https://reviews.llvm.org/D114155
LLVM GN Syncbot [Wed, 24 Nov 2021 15:48:50 +0000 (15:48 +0000)]
[gn build] Port
3b7244808405
Clement Courbet [Wed, 24 Nov 2021 15:22:54 +0000 (16:22 +0100)]
[clang-tidy] Add unit tests for `DeclRefExprUtils`.
In preparation for D114539.
Quinn Pham [Mon, 15 Nov 2021 21:42:04 +0000 (15:42 -0600)]
[NFC][X86] Inclusive language: Rename master label in x86-shrink-wrapping.ll
[NFC] As part of using inclusive language within the llvm project, this patch
renames the master label in `x86-shrink-wrapping.ll` to main.
Reviewed By: ZarkoCA
Differential Revision: https://reviews.llvm.org/D113940
Paul Robinson [Wed, 24 Nov 2021 15:17:58 +0000 (07:17 -0800)]
Have yaml2obj describe all options in --help
Differential Revision: https://reviews.llvm.org/D114538
Pavel Labath [Wed, 24 Nov 2021 14:47:20 +0000 (15:47 +0100)]
[lldb] Move GetSupportedArchitectureAtIndex to PlatformDarwin
All other platforms use GetSupportedArchitectures now.
Phoebe Wang [Wed, 24 Nov 2021 14:38:20 +0000 (22:38 +0800)]
[X86][MS] Add test cases to show wrong alignment in vector variable arguments. NFC
Roman Lebedev [Wed, 24 Nov 2021 14:23:15 +0000 (17:23 +0300)]
[X86][Costmodel] `getReplicationShuffleCost()`: promote 1 bit-wide elements to 32 bit when have AVX512DQ
I believe, this effectively completes `X86TTIImpl::getReplicationShuffleCost()`
for AVX512, other than the question of handling plain AVX512F,
where we end up with some really ugly "shuffles",
but then is there any CPU's that support AVX512, but not AVX512DQ/AVX512BW?
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D114315
Guillaume Chatelet [Wed, 24 Nov 2021 14:13:13 +0000 (14:13 +0000)]
[libc] Fix wrong type for load/store of Repeated elements
Florian Hahn [Wed, 24 Nov 2021 14:06:00 +0000 (14:06 +0000)]
[VPlan] Remove unused VPInstruction constructor. (NFC)
VPInstruction inherits from VPValue, so the constructor taking
ArrayRef<VPValue*> covers all cases that would be covered by the removed
constructor.
Bradley Smith [Mon, 22 Nov 2021 17:01:08 +0000 (17:01 +0000)]
[AArch64][SVE] Recognize all ones mask during fixed mask generation
Differential Revision: https://reviews.llvm.org/D114431
Benjamin Kramer [Wed, 24 Nov 2021 13:42:54 +0000 (14:42 +0100)]
Revert "[DAG] SimplifyDemandedBits - simplify rotl/rotr to shl/srl"
This reverts commit
3cf4a2c6203b5777d56f0c04fb743b85a041d6f9.
It makes llc hang on the following test case.
```
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-gnu"
define dso_local void @_PyUnicode_EncodeUTF16() local_unnamed_addr #0 {
entry:
br label %while.body117.i
while.body117.i: ; preds = %cleanup149.i, %entry
%out.6269.i = phi i16* [ undef, %cleanup149.i ], [ undef, %entry ]
%0 = load i16, i16* undef, align 2
%1 = icmp eq i16 undef, -10240
br i1 %1, label %fail.i, label %cleanup149.i
cleanup149.i: ; preds = %while.body117.i
%or130.i = call i16 @llvm.bswap.i16(i16 %0) #2
store i16 %or130.i, i16* %out.6269.i, align 2
br label %while.body117.i
fail.i: ; preds = %while.body117.i
ret void
}
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare i16 @llvm.bswap.i16(i16) #1
attributes #0 = { "target-features"="+neon,+v8a" }
attributes #1 = { nofree nosync nounwind readnone speculatable willreturn }
attributes #2 = { mustprogress nofree norecurse nosync nounwind readnone uwtable willreturn "frame-pointer"="non-leaf" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+neon,+v8a" }
```
Florian Hahn [Wed, 24 Nov 2021 13:32:24 +0000 (13:32 +0000)]
[LV] Use patterns in some induction tests, to make more robust. (NFC)
Simon Pilgrim [Wed, 24 Nov 2021 13:24:27 +0000 (13:24 +0000)]
[X86] Add BMI test coverage for for or-lea with no common bits tests
Ensure D113970 handles andnot patterns as well.
Omer Aviram [Wed, 24 Nov 2021 13:22:15 +0000 (13:22 +0000)]
[X86] Add D113970 tests cases for or-lea with no common bits.
Added tests are permutations of the pattern: (X & ~M) or (Y & M).
Differential Revision: https://reviews.llvm.org/D114078
Sanjay Patel [Tue, 23 Nov 2021 22:19:12 +0000 (17:19 -0500)]
[InstSimplify] fold xor logic of 2 variables, part 2
(~a & b) ^ (a | b) --> a
This is the swapped and/or (Demorgan?) sibling fold for
the fold added with D114462 (
892648b18a8c ).
This case is easier to specify because we are returning
a root value, not a 'not':
https://alive2.llvm.org/ce/z/SRzj4f
Sanjay Patel [Tue, 23 Nov 2021 22:07:31 +0000 (17:07 -0500)]
[InstSimplify] add tests for xor logic; NFC
Djordje Todorovic [Wed, 24 Nov 2021 12:46:35 +0000 (13:46 +0100)]
[llvm-dwarfdump][Statistics] Handle LTO cases with cross CU referencing
With link-time optimizations enabled, resulting DWARF mayend up containing
cross CU references (through the DW_AT_abstract_origin attribute).
Consider the following example:
// sum.c
__attribute__((always_inline)) int sum(int a, int b)
{
return a + b;
}
// main.c
extern int sum(int, int);
int main()
{
int a = 5, b = 10, c = sum(a, b);
return 0;
}
Compiled as follows:
$ clang -g -flto -fuse-ld=lld main.c sum.c -o main
Results in the following DWARF:
-- sum.c CU: abstract instance tree
...
0x000000b0: DW_TAG_subprogram
DW_AT_name ("sum")
DW_AT_decl_file ("sum.c")
DW_AT_decl_line (1)
DW_AT_prototyped (true)
DW_AT_type (0x000000d3 "int")
DW_AT_external (true)
DW_AT_inline (DW_INL_inlined)
0x000000bc: DW_TAG_formal_parameter
DW_AT_name ("a")
DW_AT_decl_file ("sum.c")
DW_AT_decl_line (1)
DW_AT_type (0x000000d3 "int")
0x000000c7: DW_TAG_formal_parameter
DW_AT_name ("b")
DW_AT_decl_file ("sum.c")
DW_AT_decl_line (1)
DW_AT_type (0x000000d3 "int")
...
-- main.c CU: concrete inlined instance tree
...
0x0000006d: DW_TAG_inlined_subroutine
DW_AT_abstract_origin (0x00000000000000b0 "sum")
DW_AT_low_pc (0x00000000002016ef)
DW_AT_high_pc (0x00000000002016f1)
DW_AT_call_file ("main.c")
DW_AT_call_line (5)
DW_AT_call_column (0x19)
0x00000081: DW_TAG_formal_parameter
DW_AT_location (DW_OP_reg0 RAX)
DW_AT_abstract_origin (0x00000000000000bc "a")
0x00000088: DW_TAG_formal_parameter
DW_AT_location (DW_OP_reg2 RCX)
DW_AT_abstract_origin (0x00000000000000c7 "b")
...
Note that each entry within the concrete inlined instance tree in
the main.c CU has a DW_AT_abstract_origin attribute which
refers to a corresponding entry within the abstract instance
tree in the sum.c CU.
llvm-dwarfdump --statistics did not properly report
DW_TAG_formal_parameters/DW_TAG_variables from concrete inlined
instance trees which had 0% location coverage and which
referred to a different CU, mainly because information about abstract
instance trees and their parameters/variables was stored
locally - just for the currently processed CU,
rather than globally - for all CUs.
In particular, if the concrete inlined instance tree from
the example above was to look like this
(i.e. parameter b has 0% location coverage, hence why it's missing):
0x0000006d: DW_TAG_inlined_subroutine
DW_AT_abstract_origin (0x00000000000000b0 "sum")
DW_AT_low_pc (0x00000000002016ef)
DW_AT_high_pc (0x00000000002016f1)
DW_AT_call_file ("main.c")
DW_AT_call_line (5)
DW_AT_call_column (0x19)
0x00000081: DW_TAG_formal_parameter
DW_AT_location (DW_OP_reg0 RAX)
DW_AT_abstract_origin (0x00000000000000bc "a")
llvm-dwarfdump --statistics would have not reported b as such.
Patch by Dimitrije Milosevic.
Differential revision: https://reviews.llvm.org/D113465
Nemanja Ivanovic [Wed, 24 Nov 2021 10:34:01 +0000 (04:34 -0600)]
[PowerPC] Provide XL-compatible vec_round implementation
The XL implementation of vec_round for vector double uses
"round-to-nearest, ties to even" just as the vector float
`version does. However clang and gcc use "round-to-nearest-away"
for vector double and "round-to-nearest, ties to even"
for vector float.
The XL behaviour is implemented under the __XL_COMPAT_ALTIVEC__
macro similarly to other instances of incompatibility.
Differential revision: https://reviews.llvm.org/D113642
Jeremy Morse [Wed, 24 Nov 2021 12:28:15 +0000 (12:28 +0000)]
[DebugInfo] Adjust x86 location-list tests for instruction referencing
This patch updates location lists in various x86 tests to reflect what
instruction referencing produces. There are two flavours of change:
* Not following a register copy immediately, because instruction
referencing can make some slightly smarter decisions,
* Extended ranges, due to having additional information.
The register changes aren't that interesting, it's just a choice between
equally legitimate registers that instr-ref does differently. The extended
ranges are largely due to following stack restores better.
Differential Revision: https://reviews.llvm.org/D114362
Dmitry Vyukov [Wed, 24 Nov 2021 08:44:08 +0000 (09:44 +0100)]
tsan: add another fork deadlock test
The test tries to provoke internal allocator to be locked during fork
and then force the child process to use the internal allocator.
This test sometimes deadlocks with the new tsan runtime.
Depends on D114514.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D114515
Dmitry Vyukov [Wed, 24 Nov 2021 08:39:05 +0000 (09:39 +0100)]
sanitizer_common: remove SANITIZER_USE_MALLOC
It was introduced in:
9cffc9550b75 tsan: allow to force use of __libc_malloc in sanitizer_common
and used in:
512a18e51819 tsan: add standalone deadlock detector
and later used for Go support.
But now both uses are gone. Nothing defines SANITIZER_USE_MALLOC.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D114514
Manuel Klimek [Wed, 24 Nov 2021 11:17:19 +0000 (12:17 +0100)]
Clean up clang-format tech debt.
Make all code go through FormatTokenSource instead of going around it, which
makes changes to TokenSource brittle.
Add LLVM_DEBUG in FormatTokenSource to be able to follow the token stream.
Jeremy Morse [Wed, 24 Nov 2021 11:45:43 +0000 (11:45 +0000)]
[DebugInfo] Check both instr-ref and DBG_VALUE modes of sdag tests
In these test updates for instruction referencing, I've added specific
instr-ref RUN lines, and kep thte DBG_VALUE-based variable location check
lines too. This is because argument handling is really fiddly, and I figure
it's worth duplicating the testing to ensure it's definitely correct.
There's also dbg-value-superreg-copy2.mir, a dtest for where varaible
locations go when virtual registers are coalesced together. I don't think
there's an instruction referencing specific test for this, so have
duplicated that to for instruction referencing.
Differential Revision: https://reviews.llvm.org/D114262
Simon Pilgrim [Wed, 24 Nov 2021 11:28:28 +0000 (11:28 +0000)]
[DAG] SimplifyDemandedBits - simplify rotl/rotr to shl/srl
If we only demand bits from one half of a rotation pattern, see if we can simplify to a logical shift.
For the ARM rev16 patterns, I had to drop a fold to prevent srl(bswap()) -> rotr(bswap) -> srl(bswap) infinite loops. I've replaced this with an isel PatFrag which should do the same task.
https://alive2.llvm.org/ce/z/iroxki (rol -> shl by amt iff demanded bits has at least as many trailing zeros as the shift amount)
https://alive2.llvm.org/ce/z/4ez_U- (ror -> shl by revamt iff demanded bits has at least as many trailing zeros as the reverse shift amount)
https://alive2.llvm.org/ce/z/cD7dR- (ror -> lshr by amt iff demanded bits has at least as many leading zeros as the shift amount)
https://alive2.llvm.org/ce/z/_XGHtQ (rol -> lshr by revamt iff demanded bits has at least as many leading zeros as the reverse shift amount)
Differential Revision: https://reviews.llvm.org/D114354
Jay Foad [Fri, 12 Nov 2021 18:02:58 +0000 (18:02 +0000)]
[AMDGPU] Implement widening multiplies with v_mad_i64_i32/v_mad_u64_u32
Select SelectionDAG ops smul_lohi/umul_lohi to
v_mad_i64_i32/v_mad_u64_u32 respectively, with an addend of 0.
v_mul_lo, v_mul_hi and v_mad_i64/u64 are all quarter-rate instructions
so it is better to use one instruction than two.
Further improvements are possible to make better use of the addend
operand, but this is already a strict improvement over what we have
now.
Differential Revision: https://reviews.llvm.org/D113986
Jay Foad [Fri, 19 Nov 2021 16:40:29 +0000 (16:40 +0000)]
[AMDGPU] Only select VOP3 forms of VOP2 instructions
Change VOP_PAT_GEN to default to not generating an instruction selection
pattern for the VOP2 (e32) form of an instruction, only for the VOP3
(e64) form. This allows SIFoldOperands maximum freedom to fold copies
into the operands of an instruction, before SIShrinkInstructions tries
to shrink it back to the smaller encoding.
This affects the following VOP2 instructions:
v_min_i32
v_max_i32
v_min_u32
v_max_u32
v_and_b32
v_or_b32
v_xor_b32
v_lshr_b32
v_ashr_i32
v_lshl_b32
A further cleanup could simplify or remove VOP_PAT_GEN, since its
optional second argument is never used.
Differential Revision: https://reviews.llvm.org/D114252
SYNOPSYS\georgiev [Wed, 24 Nov 2021 11:13:17 +0000 (11:13 +0000)]
[LLDB/test] lldbutil check_breakpoint() - check target instance
Check test.target instance type before we attempt to get the breakpoint.
This fix is suggested by 'clayborg'.
Ref: https://reviews.llvm.org/D111899#inline-1090156
Carl Ritson [Wed, 24 Nov 2021 08:57:01 +0000 (17:57 +0900)]
[AMDGPU] Only allow implicit WQM in pixel shaders
Implicit derivatives are only valid in pixel shaders,
hence only implicitly enable WQM for pixel shaders.
This avoids unintended WQM in other shader types (e.g. compute)
when image sampling instructions are used.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D114414
David Green [Wed, 24 Nov 2021 10:41:00 +0000 (10:41 +0000)]
[ARM] Fold (fadd x, (vselect c, y, -1.0)) into (vselect c, (fadd x, y), x)
This is similar to D113574, but as a DAG combine, not tablegen patterns.
Doing the fold as a DAG combine allows the fadd to be folded with a
fmul, finally producing a predicated vfma. It performs the same fold of
fadd(x, vselect(p, y, -0.0)) to vselect p, (fadd x, y), x) using -0.0 as
the identity value of a fadd.
Differential Revision: https://reviews.llvm.org/D113584
Matthias Springer [Wed, 24 Nov 2021 10:32:33 +0000 (19:32 +0900)]
[mlir][linalg][bufferize][NFC] Move vector interface impl to new build target
This makes ComprehensiveBufferize entirely independent of the vector dialect.
Differential Revision: https://reviews.llvm.org/D114218
David Sherwood [Tue, 23 Nov 2021 16:44:55 +0000 (16:44 +0000)]
[NFC] Tidy up SelectionDAGBuilder::visitIntrinsicCall to use existing sdl debug loc
In quite a few places we were calling getCurSDLoc() to get the debug
location, but this is already a local variable `sdl`.
Differential Revision: https://reviews.llvm.org/D114447
Jeremy Morse [Wed, 24 Nov 2021 10:20:03 +0000 (10:20 +0000)]
[DebugInfo][InstrRef] Avoid crash when values optimised out late in sdag
It appears that we can emit all the instructions for a function, including
debug instructions, and then optimise some of the values out late.
Specifically, in the attached test case, an argument gets optimised out
after DBG_VALUE / DBG_INSTR_REFs are created. This confuses
MachineFunction::finalizeDebugInstrRefs, which expects to be able to find a
defining instruction, and crashes instead.
Fix this by identifying when there's no defining instruction, and
translating that instead into a DBG_VALUE $noreg.
Differential Revision: https://reviews.llvm.org/D114476
David Green [Wed, 24 Nov 2021 10:22:20 +0000 (10:22 +0000)]
[ARM] Fold floating point select(binop) patterns
Similar to D84091 which added extra predicated folds for integer operations
using the identity element of the operation, this adds them for floating
point operations for the form `BinOp(x, select(p, y, Identity))`. They are
folded back to predicated versions of the operator, with fadd having the
identity -0.0, fsub using the identity 0.0 and fmul using 1.0.
Differential Revision: https://reviews.llvm.org/D113574
Dmitry Vyukov [Mon, 22 Nov 2021 14:44:00 +0000 (15:44 +0100)]
tsan: extend mmap test
Test size larger than clear_shadow_mmap_threshold,
which is handled differently.
Depends on D114348.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D114366
David Green [Wed, 24 Nov 2021 09:51:33 +0000 (09:51 +0000)]
[ARM] Add fma and update fadd/fmul predicated select tests. NFC
mydeveloperday [Wed, 24 Nov 2021 09:44:35 +0000 (09:44 +0000)]
[clang-format] NFC - recent changes caused clang-format to no longer be clang-formatted.
The following 2 commits caused files in clang-format to no longer be clang-formatted.
we would lose our "clean" status https://releases.llvm.org/13.0.0/tools/clang/docs/ClangFormattedStatus.html
c2271926a4fc - Make clang-format fuzz through Lexing with asserts enabled (https://github.com/llvm/llvm-project/commit/
c2271926a4fc )
84bf5e328664 - Fix various problems found by fuzzing. (https://github.com/llvm/llvm-project/commit/
84bf5e328664)
Reviewed By: HazardyKnusperkeks, owenpan
Differential Revision: https://reviews.llvm.org/D114430
Matthias Springer [Wed, 24 Nov 2021 09:20:00 +0000 (18:20 +0900)]
[mlir][linalg][bufferize][NFC] Move tensor interface impl to new build target
This makes ComprehensiveBufferize entirely independent of the tensor dialect.
Differential Revision: https://reviews.llvm.org/D114217
Florian Hahn [Wed, 24 Nov 2021 09:23:52 +0000 (09:23 +0000)]
[llvm-reduce] Add parallel chunk processing.
This patch adds parallel processing of chunks. When reducing very large
inputs, e.g. functions with 500k basic blocks, processing chunks in
parallel can significantly speed up the reduction.
To allow modifying clones of the original module in parallel, each clone
needs their own LLVMContext object. To achieve this, each job parses the
input module with their own LLVMContext. In case a job successfully
reduced the input, it serializes the result module as bitcode into a
result array.
To ensure parallel reduction produces the same results as serial
reduction, only the first successfully reduced result is used, and
results of other successful jobs are dropped. Processing resumes after
the chunk that was successfully reduced.
The number of threads to use can be configured using the -j option.
It defaults to 1, which means serial processing.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D113857
Pavel Labath [Wed, 24 Nov 2021 08:59:16 +0000 (09:59 +0100)]
[lldb/gdb-remote] Remove more non-stop mode remnants
The read thread handling is completely dead code now that non-stop mode
no longer exists.
Rosie Sumpter [Tue, 12 Oct 2021 08:51:42 +0000 (09:51 +0100)]
[LoopVectorize][CostModel] Update cost model for fmuladd intrinsic
This patch updates the cost model for ordered reductions so that a call
to the llvm.fmuladd intrinsic is modelled as a normal fmul instruction
plus the cost of an ordered fadd reduction.
Differential Revision: https://reviews.llvm.org/D111630
Rosie Sumpter [Tue, 16 Nov 2021 11:52:19 +0000 (11:52 +0000)]
[LoopVectorize] Print fast-math flags for VPReductionRecipe
Rosie Sumpter [Wed, 3 Nov 2021 12:40:14 +0000 (12:40 +0000)]
[LoopVectorize] Propagate fast-math flags for VPInstruction
In-loop vector reductions which use the llvm.fmuladd intrinsic involve
the creation of two recipes; a VPReductionRecipe for the fadd and a
VPInstruction for the fmul. If the call to llvm.fmuladd has fast-math flags
these should be propagated through to the fmul instruction, so an
interface setFastMathFlags has been added to the VPInstruction class to
enable this.
Differential Revision: https://reviews.llvm.org/D113125
Rosie Sumpter [Mon, 11 Oct 2021 14:50:44 +0000 (15:50 +0100)]
[LoopVectorize] Add vector reduction support for fmuladd intrinsic
Enables LoopVectorize to handle reduction patterns involving the
llvm.fmuladd intrinsic.
Differential Revision: https://reviews.llvm.org/D111555
Butygin [Fri, 19 Nov 2021 22:56:23 +0000 (01:56 +0300)]
[mlir][scf] Canonicalize scf.while with unused results
Differential Revision: https://reviews.llvm.org/D114291
Clement Courbet [Fri, 19 Nov 2021 15:42:32 +0000 (16:42 +0100)]
[clang-tidy] performance-unnecessary-copy-initialization: Fix false negative.
`isConstRefReturningMethodCall` should be considering
`CXXOperatorCallExpr` in addition to `CXXMemberCallExpr`. Clang considers
these to be distinct (`CXXOperatorCallExpr` derives from `CallExpr`, not
`CXXMemberCallExpr`), but we don't care in the context of this
check.
This is important because of
`std::vector<Expensive>::operator[](size_t) const`.
Differential Revision: https://reviews.llvm.org/D114249
Vitaly Buka [Wed, 24 Nov 2021 06:12:31 +0000 (22:12 -0800)]
[sanitizer] Add Abs<T>
Abinav Puthan Purayil [Mon, 8 Nov 2021 05:35:22 +0000 (11:05 +0530)]
[AMDGPU] Check for unneeded shift mask in shift PatFrags.
The existing constrained shift PatFrags only dealt with masked shift
from OpenCL front-ends. This change copies the
X86DAGToDAGISel::isUnneededShiftMask() function to AMDGPU and uses it in
the shift PatFrag predicates.
Differential Revision: https://reviews.llvm.org/D113448
Igor Kudrin [Wed, 24 Nov 2021 05:17:03 +0000 (12:17 +0700)]
[ELF] Support the "read-only" memory region attribute
The attribute 'r' allows (or disallows for the negative case) read-only
sections, i.e. ones without the SHF_WRITE flag, to be assigned to the
memory region. Before the patch, lld could put a section in the wrong
region or fail with "error: no memory region specified for section".
Differential Revision: https://reviews.llvm.org/D113771
Vitaly Buka [Wed, 24 Nov 2021 04:05:25 +0000 (20:05 -0800)]
[sanitizer] Fail instead of crash without real_pthread_create
Bixia Zheng [Mon, 22 Nov 2021 23:24:52 +0000 (15:24 -0800)]
Accept symmetric sparse matrix in Matrix Market Exchange Format.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D114402
Weverything [Wed, 24 Nov 2021 01:51:32 +0000 (17:51 -0800)]
Revert "tsan: new runtime (v3)"
This reverts commit
ebd47b0fb78fa11758da6ffcd3e6b415cbb8fa28.
This was causing unexpected behavior in programs.
Uday Bondhugula [Mon, 22 Nov 2021 10:52:41 +0000 (16:22 +0530)]
[MLIR] Remove duplicate `Pass` suffix from ViewOpGraph class name
Remove duplicate `Pass` suffix from view-op-graph pass class name. The
extra suffix would lead to methods like registerViewOpGraphPassPass
being generated.
Differential Revision: https://reviews.llvm.org/D114459
wren romano [Mon, 22 Nov 2021 21:14:17 +0000 (13:14 -0800)]
[mlir][sparse] Adding wrappers for constantOverheadTypeEncoding
Minor code cleanup
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D114392
Jun Ma [Wed, 24 Nov 2021 02:10:22 +0000 (10:10 +0800)]
Revert "[Taildup] Don't tail-duplicate loop header with multiple successors as its latches"
This reverts commit
1f9fa549841a2ec55aa5a131bfaf83f0383c4713.
Jun Ma [Wed, 24 Nov 2021 02:09:53 +0000 (10:09 +0800)]
Revert "Revert "Revert "Recommit "Revert "[CVP] processSwitch: Remove default case when switch cover all possible values."""""
This reverts commit
c93f93b2e3f28997f794265089fb8138dd5b5f13.
Mehdi Amini [Tue, 23 Nov 2021 06:35:37 +0000 (06:35 +0000)]
Update fir.insert_on_range syntax to make the range more explicit (NFC)
Also replace ArrayAttr with IndexElementsAttr to model subscript dimensions.
An array of attribute is a sparse inefficient storage, with an API that
requires to unpack/repack integers at every call site.
Instead we can store dense array of integer as IndexElementsAttr.
Reviewed By: clementval, kiranchandramohan
Differential Revision: https://reviews.llvm.org/D112899
Zequan Wu [Tue, 23 Nov 2021 20:27:26 +0000 (12:27 -0800)]
[LLDB][NativePDB] Allow find functions by full names
I don't see a reason why not to. If we allows lookup functions by full names,
I can change the test case in D113930 to use `lldb-test symbols --find=function --name=full::name --function-flags=full ...`,
though the duplicate method decl prolem is still there for `lldb-test symbols --dump-ast`.
That's a seprate bug, we can fix it later.
Differential Revision: https://reviews.llvm.org/D114467
Vitaly Buka [Wed, 24 Nov 2021 00:52:02 +0000 (16:52 -0800)]
[NFC][sanitizer] Limit StackStore stack size/tag to 1 byte
Nothing uses more than 8bit now. So the rest of the headers can store other data.
kStackTraceMax is 256 now, but all sanitizers by default store just 20-30 frames here.
Vitaly Buka [Sun, 21 Nov 2021 00:46:27 +0000 (16:46 -0800)]
[NFC][sanitizer] Test for
b80affb8a149
Stanislav Mekhanoshin [Fri, 19 Nov 2021 22:42:29 +0000 (14:42 -0800)]
[AMDGPU] Remove a no-op check in the gfx90a hazard recognizer
Also rename helper function accordingly.
Differential Revision: https://reviews.llvm.org/D114289
Butygin [Thu, 28 Oct 2021 16:04:35 +0000 (19:04 +0300)]
[mlir][spirv] Add math to OpenCL conversion
Differential Revision: https://reviews.llvm.org/D113780
Florian Mayer [Mon, 22 Nov 2021 23:49:54 +0000 (15:49 -0800)]
[hwasan] support python3 in hwasan_sanitize
Verified no diff exist between previous version, new version python 2, and python 3 for an example stack.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D114404
Florian Mayer [Wed, 3 Nov 2021 00:29:13 +0000 (00:29 +0000)]
[stack-safety] Check SCEV constraints at memory instructions.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D113160
Vitaly Buka [Tue, 23 Nov 2021 23:16:29 +0000 (15:16 -0800)]
[NFC][sanitizer] Reuse forEach for operator==
Vitaly Buka [Tue, 23 Nov 2021 03:38:44 +0000 (19:38 -0800)]
[sanitizer] Add DenseMap::forEach
Nemanja Ivanovic [Tue, 23 Nov 2021 22:45:34 +0000 (16:45 -0600)]
[PowerPC] Allow scalars for asm constraint "v" with VSX
Similarly to what GCC does, we should allow scalars with
the "v" constraint rather than introducing unnecessary
new constraints for scalars in Altivec registers.
Differential revision: https://reviews.llvm.org/D113635
Matt Arsenault [Thu, 4 Nov 2021 01:01:53 +0000 (21:01 -0400)]
PrologEpilogInserter: Use explicit control for scavenge slot placement
AMDGPU is unusual in that the both stack is indexed in the same
direction as stack growth (up). We therefore always need the emergency
stack slots placed as low as possible to ensure they are in range of
load/store instruction immediate offsets. The existing logic is mostly
OK, but failed if we required stack realignment.
I don't understand what the existing control isFPCloseToIncomingSP is
supposed to mean, but can only be used to stop placing the scavenge
slots earlier. Make this explicit so that targets can opt-in rather
than opt-out only.
Florian Hahn [Tue, 23 Nov 2021 22:47:26 +0000 (22:47 +0000)]
[LAA] Move visitPointers up in file (NFC).
This allows easier re-use in earlier functions.
Walter Erquinigo [Tue, 23 Nov 2021 22:23:34 +0000 (14:23 -0800)]
Fix
a48501150b9ef64fd61d24f8cef2645237facc44
Issue in https://lab.llvm.org/buildbot/#/builders/96/builds/14682.
Making the test deterministic.
Danil Stefaniuc [Tue, 23 Nov 2021 22:11:42 +0000 (14:11 -0800)]
[formatters] List and forward_list capping_size determination and application
This diff is adding the capping_size determination for the list and forward list, to limit the number of children to be displayed. Also it modifies and unifies tests for libcxx and libstdcpp list data formatter.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D114433
Rahul Joshi [Tue, 23 Nov 2021 21:25:26 +0000 (13:25 -0800)]
Move dependency llvm:AllTargetsAsmParsers from Translation to ExecutionEngine.
- Fixes a minor issue in https://reviews.llvm.org/D114338, which seems incorrectly
added the llvm:AllTargetsAsmParsers dependency to Translation in bazel build files.
Differential Revision: https://reviews.llvm.org/D114471
Danil Stefaniuc [Tue, 23 Nov 2021 22:02:05 +0000 (14:02 -0800)]
[formatters] Capping size limitation avoidance for the libcxx and libcpp bitset data formatters.
This diff is avoiding the size limitation introduced by the capping size for the libcxx and libcpp bitset data formatters.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D114461
Walter Erquinigo [Tue, 23 Nov 2021 17:32:30 +0000 (09:32 -0800)]
Make some libstd++ formatters safer
We need to add checks that ensure that some core variables are valid, so
that we avoid printing out garbage data. The worst that could happen is
that an non-initialized variable is being printed as something with
123123432 children instead of 0.
Differential Revision: https://reviews.llvm.org/D114458
Walter Erquinigo [Tue, 23 Nov 2021 17:16:59 +0000 (09:16 -0800)]
Improve optional formatter
As suggested by @labath in https://reviews.llvm.org/D114403, we should
make the formatter more resilient to corrupted data. The Libcxx version
explicitly checks for engaged = 1, so we can do that as well for safety.
Differential Revision: https://reviews.llvm.org/D114450