Simon Pilgrim [Tue, 27 Apr 2021 14:39:06 +0000 (15:39 +0100)]
Revert rG9b7a0a50355d5 - Revert "[X86] Add support for reusing ZF etc. from locked XADD instructions (PR20841)"
Still causing some sanitizer buildbot failures.
David Sherwood [Wed, 10 Mar 2021 08:34:19 +0000 (08:34 +0000)]
[LoopVectorize] Simplify scalar cost calculation in getInstructionCost
This patch simplifies the calculation of certain costs in
getInstructionCost when isScalarAfterVectorization() returns a true value.
There are a few places where we multiply a cost by a number N, i.e.
unsigned N = isScalarAfterVectorization(I, VF) ? VF.getKnownMinValue() : 1;
return N * TTI.getArithmeticInstrCost(...
After some investigation it seems that there are only these cases that occur
in practice:
1. VF is a scalar, in which case N = 1.
2. VF is a vector. We can only get here if: a) the instruction is a
GEP/bitcast/PHI with scalar uses, or b) this is an update to an induction
variable that remains scalar.
I have changed the code so that N is assumed to always be 1. For GEPs
the cost is always 0, since this is calculated later on as part of the
load/store cost. PHI nodes are costed separately and were never previously
multiplied by VF. For all other cases I have added an assert that none of
the users needs scalarising, which didn't fire in any unit tests.
Only one test required fixing and I believe the original cost for the scalar
add instruction to have been wrong, since only one copy remains after
vectorisation.
I have also added a new test for the case when a pointer PHI feeds directly
into a store that will be scalarised as we were previously never testing it.
Differential Revision: https://reviews.llvm.org/D99718
David Goldman [Fri, 19 Mar 2021 20:23:15 +0000 (16:23 -0400)]
[clangd] Improve handling of Objective-C protocols in types
Improve support for Objective-C protocols for types/type locs
Differential Revision: https://reviews.llvm.org/D98984
Martin Storsjö [Tue, 6 Apr 2021 08:37:52 +0000 (11:37 +0300)]
[libcxx] [test] Convert a couple of LIBCXX-WINDOWS-FIXME into XFAIL: windows-dll for known bugs
These are caused due to inconsistencies regarding always inline in
combination with dllimport. A bug report reference is added next to
each XFAIL line.
Differential Revision: https://reviews.llvm.org/D100789
Martin Storsjö [Tue, 6 Apr 2021 07:44:52 +0000 (10:44 +0300)]
[libcxx] [test] Add a separate 'windows-dll' feature to check for
This allows distinguishing failures in tests that only fail when libcxx
is linked as a DLL, allowing narrowing down XFAILs (avoiding XPASS errors
if not built as a DLL).
If both enable_shared and enable_static are set, the tests link and use
the shared version of the lib.
Differential Revision: https://reviews.llvm.org/D100221
David Goldman [Mon, 26 Apr 2021 21:58:35 +0000 (17:58 -0400)]
[clangd] run clang-format on FindTargetTests.cpp's FindExplicitReferencesTest
Addressing comments in https://reviews.llvm.org/D98984
Differential Revision: https://reviews.llvm.org/D101328
Yaxun (Sam) Liu [Tue, 27 Apr 2021 13:35:20 +0000 (09:35 -0400)]
[HIP] Fix help text for -fgpu-allow-device-init
Add 'experimental' to help text.
Simon Pilgrim [Tue, 27 Apr 2021 14:00:57 +0000 (15:00 +0100)]
[X86] Add support for reusing ZF etc. from locked XADD instructions (PR20841)
XADD has the same EFLAGS behaviour as ADD
Reapplies rG2149aa73f640 (after it was reverted at rG535df472b042) - AFAICT rG029e41ec9800 should ensure we correctly tag the LXADD* ops as load/stores - I haven't been able to repro the sanitizer buildbot fails locally so this is a speculative commit.
Joachim Protze [Tue, 27 Apr 2021 13:50:53 +0000 (15:50 +0200)]
[OpenMP][libomptarget] Separate lit tests for different offloading targets (2/2)
This patch fuses the RUN lines for most libomptarget tests. The previous patch
D101315 created separate test targets for each supported offloading triple.
This patch updates the RUN lines in libomptarget tests to use a generic run
line independent of the offloading target selected for the lit instance.
In cases, where no RUN line was defined for a specific offloading target,
the corresponding target is declared as XFAIL. If it turns out that a test
actually supports the target, the XFAIL line can be removed.
Differential Revision: https://reviews.llvm.org/D101326
Gabor Marton [Tue, 27 Apr 2021 12:57:12 +0000 (14:57 +0200)]
[analyzer][StdLibraryFunctionsChecker] Track dependent arguments
When we report an argument constraint violation, we should track those
other arguments that participate in the evaluation of the violation. By
default, we depend only on the argument that is constrained, however,
there are some special cases like the buffer size constraint that might
be encoded in another argument(s).
Differential Revision: https://reviews.llvm.org/D101358
Jay Foad [Tue, 27 Apr 2021 13:03:42 +0000 (14:03 +0100)]
[AMDGPU] Minor refactoring in AMDGPUUnifyDivergentExitNodes. NFC.
Make unifyReturnBlockSet a member function so we don't have to pass TTI
around as an argument.
Simon Pilgrim [Tue, 27 Apr 2021 13:11:05 +0000 (14:11 +0100)]
[X86] Ensure multiclass ATOMIC_RMW_BINOP is tagged as MayLoad and MayStore
These are RMW ops and should be tagged as both loads and stores.
Frederik Gossen [Tue, 27 Apr 2021 13:02:47 +0000 (15:02 +0200)]
[MLIR] Debug log IR after pattern applications
Like `print-ir-after-all` and `-before-all`, this allows to inspect IR for
debug purposes. While the former allow to inspect only between passes, this
change allows to follow the rewrites that happen within passes.
Differential Revision: https://reviews.llvm.org/D100940
Alexey Bataev [Fri, 23 Apr 2021 19:33:41 +0000 (12:33 -0700)]
[SLP]Improved isGatherShuffledEntry, NFC.
Reworked isGatherShuffledEntry function, simplified and moved
common code to the lambda (it shall go away when non-power-2 patch will
be landed).
Frederik Gossen [Tue, 27 Apr 2021 12:50:52 +0000 (14:50 +0200)]
[MLIR][Shape] Remove empty extent tensor operands
Empty extent tensor operands were only removed when they were defined as a
constant. Additionally, we can remove them if they are known to be empty by
their type `tensor<0xindex>`.
Differential Revision: https://reviews.llvm.org/D101351
Florian Hahn [Mon, 26 Apr 2021 12:18:34 +0000 (13:18 +0100)]
[LV,LAA] Add test cases with pointer phis in loops.
Pre-commits tests for D101286.
Frederik Gossen [Tue, 27 Apr 2021 12:47:39 +0000 (14:47 +0200)]
[MLIR][Shape] Replace single operand broadcasts with appropriate cast
Differential Revision: https://reviews.llvm.org/D101350
Petar Avramovic [Tue, 27 Apr 2021 12:44:59 +0000 (14:44 +0200)]
AMDGPU/GlobalISel: Fix negative offset folding for buffer_load
Buffer_load does unsigned offset calculations. Don't fold
operands of 32-bit add that are likely to cause unsigned add
overflow (common case is when one of the operands is negative).
Differential Revision: https://reviews.llvm.org/D91336
Petar Avramovic [Tue, 27 Apr 2021 12:40:26 +0000 (14:40 +0200)]
AMDGPU/GlobalISel: Add test for buffer_load with negative offset
Pre-commit test for D91336.
Florian Hahn [Tue, 27 Apr 2021 12:28:27 +0000 (13:28 +0100)]
[LV] Hoist code to get vector loop latch (NFC).
Address suggestion from D99294.
Sanjay Patel [Tue, 27 Apr 2021 12:02:44 +0000 (08:02 -0400)]
[IndVars] avoid crash in LFTR when assuming an add recurrence
The test is a crasher reduced from:
https://llvm.org/PR49993
linearFunctionTestReplace() assumes that we have an add recurrence,
so check for that as a condition of matching a loop counter.
Differential Revision: https://reviews.llvm.org/D101291
Nicholas Guy [Thu, 4 Mar 2021 14:36:13 +0000 (14:36 +0000)]
[AArch64] Enable runtime unrolling for in-order sched models
Differential Revision: https://reviews.llvm.org/D97947
Anastasia Stulova [Tue, 27 Apr 2021 10:03:26 +0000 (11:03 +0100)]
[C++4OpenCL] Add diagnostics for OpenCL types in templates.
Refactored diagnostics for OpenCL types to allow their
reuse for templates.
Patch by olestrohm (Ole Strohm)!
Differential Revision: https://reviews.llvm.org/D100860
Florian Hahn [Tue, 27 Apr 2021 11:21:27 +0000 (12:21 +0100)]
[VPlan] Use recursive traversal iterator in VPSlotTracker.
This patch simplifies VPSlotTracker by using the recursive traversal
iterator to traverse all blocks in a VPlan in reverse post-order when
numbering VPValues in a plan.
This depends on a fix to RPOT (D100169). It also extends the traversal
unit tests to check RPOT.
Reviewed By: a.elovikov
Differential Revision: https://reviews.llvm.org/D100176
Zarko Todorovski [Mon, 26 Apr 2021 14:50:16 +0000 (10:50 -0400)]
[AIX] Allow safe for 32bit P9 VSX extract and insert pattern matches
In https://reviews.llvm.org/D92789 PPC64 checks were added that disallowed most
VSX pattern matching. We enable some safe ones for 32bit in this patch.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D97503
Dmitry Vyukov [Fri, 23 Apr 2021 11:10:39 +0000 (13:10 +0200)]
tsan: fix deadlock in pthread_atfork callbacks
We take report/thread_registry locks around fork.
This means we cannot report any bugs in atfork handlers.
We resolved this by enabling per-thread ignores around fork.
This resolved some of the cases, but not all.
The added test triggers a race report from a signal handler
called from atfork callback, we reset per-thread ignores
around signal handlers, so we tried to report it and deadlocked.
But there are more cases: a signal handler can be called
synchronously if it's sent to itself. Or any other report
types would cause deadlocks as well: mutex misuse,
signal handler spoiling errno, etc.
Disable all reports for the duration of fork with
thr->suppress_reports and don't re-enable them around
signal handlers.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D101154
Pushpinder Singh [Tue, 27 Apr 2021 10:47:05 +0000 (10:47 +0000)]
Reapply "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
This reverts commit
93604305bb72201641f31cc50a6e7b2fe65d3af3.
Kadir Cetinkaya [Thu, 22 Apr 2021 14:08:48 +0000 (16:08 +0200)]
[clangd] Dont index deeply nested symbols
This is fix for some timeouts and OOM problems faced while indexing an
auto-generated file with thousands of nested lambdas.
Differential Revision: https://reviews.llvm.org/D101066
Alexander Belyaev [Tue, 27 Apr 2021 10:27:04 +0000 (12:27 +0200)]
[mlir] Add a pass to tile Linalg ops using `linalg.tiled_loop`.
Differential Revision: https://reviews.llvm.org/D101084
Joachim Protze [Tue, 27 Apr 2021 10:23:18 +0000 (12:23 +0200)]
[OpenMP][libomptarget] Separate lit tests for different offloading targets (1/2)
This patch creates a separate test directory for each offloading target to be
tested. This allows to test multiple architectures in one configuration, while
still see all failing tests separately. The lit test names include the target
triple, so that it will be easier to spot the failing target.
This patch also allows to mark expected failing tests based on the
target-triple, as the currently used triple is added to the lit "features":
```
// XFAIL: nvptx64-nvidia-cuda
```
Differential Revision: https://reviews.llvm.org/D101315
Petar Avramovic [Tue, 27 Apr 2021 10:21:57 +0000 (12:21 +0200)]
AMDGPU/GlobalISel: Remove redundant G_FCANONICALIZE
Add basic version of isCanonicalized for global-isel. Copied from sdag.
Add post legalizer combine that deletes G_FCANONICALIZE when its input
is already Canonicalized.
Differential Revision: https://reviews.llvm.org/D96605
Marek Kurdej [Tue, 27 Apr 2021 10:22:56 +0000 (12:22 +0200)]
[libc++] Fix set-but-not-used warning. NFC.
Sven van Haastregt [Tue, 27 Apr 2021 10:15:47 +0000 (11:15 +0100)]
[NFC] Workaround MSVC2019 32-bit compiler crash
As reported on D100492, this restructuring should stop the internal
compiler error from happening.
Fixes PR50128.
Petar Avramovic [Tue, 27 Apr 2021 09:51:22 +0000 (11:51 +0200)]
AMDGPU/GlobalISel: Add integer med3 combines
Add signed and unsigned integer version of med3 combine.
Source pattern is min(max(Val, K0), K1) or max(min(Val, K1), K0)
where K0 and K1 are constants and K0 <= K1. Destination is med3
that corresponds to signedness of min/max in source.
Differential Revision: https://reviews.llvm.org/D90050
David Zarzycki [Tue, 27 Apr 2021 09:44:17 +0000 (05:44 -0400)]
[llvm] Unbreak no-asserts testing after
18839be9c5c8b9f882dd241769784035b082d4e1
Petar Avramovic [Tue, 27 Apr 2021 09:37:42 +0000 (11:37 +0200)]
[MIPatternMatch]: Add matchers for binary instructions
Add matchers that support commutative and non-commutative binary opcodes.
Differential Revision: https://reviews.llvm.org/D99736
Petar Avramovic [Tue, 27 Apr 2021 09:08:16 +0000 (11:08 +0200)]
[MIPatternMatch]: Add mi_match for MachineInstr
This utility allows more efficient start of pattern match.
Often MachineInstr(MI) is available and instead of using
mi_match(MI.getOperand(0).getReg(), MRI, ...) followed by
MRI.getVRegDef(Reg) that gives back MI we now use
mi_match(MI, MRI, ...).
Differential Revision: https://reviews.llvm.org/D99735
Petar Avramovic [Tue, 27 Apr 2021 08:53:17 +0000 (10:53 +0200)]
[MIPatternMatch]: Add ICstRegMatch
Matches G_CONSTANT and returns its def register.
Differential Revision: https://reviews.llvm.org/D99734
Petar Avramovic [Tue, 27 Apr 2021 08:52:07 +0000 (10:52 +0200)]
[GlobalISel]: Add a getConstantIntVRegVal utility
Returns ConstantInt from G_CONSTANT instruction given its def register.
Differential Revision: https://reviews.llvm.org/D99733
Luo, Yuanke [Thu, 22 Apr 2021 12:51:46 +0000 (20:51 +0800)]
[X86][AMX] Add description for AMX new interface.
Differential Revision: https://reviews.llvm.org/D101059
David Sherwood [Fri, 16 Apr 2021 11:11:48 +0000 (12:11 +0100)]
[NFC][SVE] Add tests for inserting subvectors into illegal scalable vectors
A previous commit fixed some issues with inserting subvectors into
illegal scalable vectors:
0035decae7ab9ab1c988fdcede46598540afd1a0
I've created a patch that simply adds some of those same tests for SVE.
Differential Revision: https://reviews.llvm.org/D100641
Marek Kurdej [Tue, 27 Apr 2021 07:32:09 +0000 (09:32 +0200)]
[clang-format] Merge SpacesInAngles tests. NFC.
Marek Kurdej [Tue, 27 Apr 2021 07:10:58 +0000 (09:10 +0200)]
[clang-format] Reformat. NFC.
Frederik Gossen [Mon, 26 Apr 2021 15:37:15 +0000 (17:37 +0200)]
[MLIR][Linalg] Generalize splat constant folding
Splat constant folding was limited to `std.constant` operations. Instead, use
the constant matcher and apply splat constant folding to any constant-like
operation that holds a splat attribute.
Differential Revision: https://reviews.llvm.org/D101301
Petr Hosek [Tue, 27 Apr 2021 06:35:04 +0000 (23:35 -0700)]
[Fuchsia] Use correct target triple for ARM
The Debian multiarch triple is arm-linux-gnueabihf, but the target
is armv7-linux-gnueabihf because some builtins require armv7.
Mikael Holmen [Tue, 27 Apr 2021 04:26:27 +0000 (06:26 +0200)]
Only ignore -Wdeprecated-copy if the used compiler supports the warning
This is needed after
https://reviews.llvm.org/rG9658d045926545e62cc3f963fe611d7c5d0c9d98
which introduced code that at least didn't compile clean with clang 8.
Differential Revision: https://reviews.llvm.org/D101288
LLVM GN Syncbot [Tue, 27 Apr 2021 05:57:29 +0000 (05:57 +0000)]
[gn build] Port
51495fd2855c
Lang Hames [Tue, 27 Apr 2021 05:54:31 +0000 (22:54 -0700)]
[ORC] Temporarily remove the ORC C API test.
This should get the builders green again until I have time to look into the
outstanding failures.
dfukalov [Thu, 22 Apr 2021 09:41:01 +0000 (12:41 +0300)]
[TTI] NFC: Change getScalarizationOverhead and getOperandsScalarizationOverhead to return InstructionCost.
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D101283
Lang Hames [Tue, 27 Apr 2021 05:30:09 +0000 (22:30 -0700)]
[ORC] Disable Orc C API test for armv8l targets.
The https://lab.llvm.org/buildbot/#/builders/107 builder is failing on this
testcase, but doesn't produce a helpful error message yet. Disabling for now
until I have time to dig in further.
Lang Hames [Tue, 27 Apr 2021 05:25:26 +0000 (22:25 -0700)]
[ORC] Make LLVMOrcLLJITBuilderSetJITTargetMachineBuilder consume as advertised.
This should fix some of the memory leaks seen in the ORC C API test case.
Lang Hames [Tue, 27 Apr 2021 05:13:08 +0000 (22:13 -0700)]
[ORC] Remove unused headers in C API test.
Petr Hosek [Thu, 22 Apr 2021 20:44:46 +0000 (13:44 -0700)]
[Driver] Push multiarch path setup to individual drivers
Different platforms use different rules for multiarch triples so
it's difficult to provide a single method for all platforms. We
instead move the getMultiarchTriple to the ToolChain class and let
individual platforms override it and provide their custom logic.
Differential Revision: https://reviews.llvm.org/D101194
Vitaly Buka [Tue, 27 Apr 2021 05:09:10 +0000 (22:09 -0700)]
[NFC] Fix "not used" warning
Alok Kumar Sharma [Sun, 25 Apr 2021 14:20:58 +0000 (19:50 +0530)]
[DebugInfo][llvm-dwarfdump] Fix printing of Unit header with DW_UT_partial type
llvm-dwarfdump crashed for Unit header with DW_UT_partial type.
-------------
llvm-dwarfdump: /tmp/llvm/include/llvm/ADT/Optional.h:197: T& llvm::optional_detail::OptionalStorage<T, true>::getValue() &
[with T = long unsigned int]: Assertion `hasVal' failed.
PLEASE submit a bug report to the technical support section of https://developer.amd.com/amd-aocc and include the crash backtrace.
Stack dump:
0. Program arguments: llvm-dwarfdump -v /tmp/test/DebugInfo/X86/Output/dwarfdump-he
ader.s.tmp.o
#0 0x00007f37d5ad8838 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /tmp/llvm/lib/Support/Unix/Signals.inc:565:0
#1 0x00007f37d5ad88ef PrintStackTraceSignalHandler(void*) /tmp/llvm/lib/Support/Unix/Signals.inc:632:0
#2 0x00007f37d5ad65bd llvm::sys::RunSignalHandlers() /tmp/llvm/lib/Support/Signals.cpp:71:0
#3 0x00007f37d5ad81b9 SignalHandler(int) /tmp/llvm/lib/Support/Unix/Signals.inc:407:0
#4 0x00007f37d4c26040 (/lib/x86_64-linux-gnu/libc.so.6+0x3f040)
#5 0x00007f37d4c25fb7 raise /build/glibc-S9d2JN/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#6 0x00007f37d4c27921 abort /build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c:81:0
#7 0x00007f37d4c1748a __assert_fail_base /build/glibc-S9d2JN/glibc-2.27/assert/assert.c:89:0
#8 0x00007f37d4c17502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
#9 0x00007f37d7576b81 llvm::optional_detail::OptionalStorage<unsigned long, true>::getValue() & /tmp/llvm/include/llvm/ADT/Optional.h:198:0
#10 0x00007f37d75726ac llvm::Optional<unsigned long>::operator*() && /tmp/llvm/include/llvm/ADT/Optional.h:309:0
#11 0x00007f37d7582968 llvm::DWARFCompileUnit::dump(llvm::raw_ostream&, llvm::DIDumpOptions) /tmp/llvm/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp:30:0
--------------
Patch by: @jini.susan
Reviewed By: @probinson
Differential Revision: https://reviews.llvm.org/D101255
Lang Hames [Tue, 27 Apr 2021 04:44:26 +0000 (21:44 -0700)]
[ORC] Fix more missing LLVMConsumeError calls.
Lang Hames [Tue, 27 Apr 2021 04:37:57 +0000 (21:37 -0700)]
[ORC] Record target triple in C API testcase, print it on failure.
This will simplify identification of unsupported triples when we see builder
failures in this test case.
Lang Hames [Tue, 27 Apr 2021 04:30:21 +0000 (21:30 -0700)]
[ORC] Add missing LLVMConsumeError calls.
LLVM GN Syncbot [Tue, 27 Apr 2021 04:24:09 +0000 (04:24 +0000)]
[gn build] Port
d122d80b3d1c
Jessica Clarke [Tue, 27 Apr 2021 04:22:50 +0000 (05:22 +0100)]
[ORC] Fix build after
1798f2289aaa
Chen Zheng [Mon, 26 Apr 2021 05:31:23 +0000 (01:31 -0400)]
[XCOFF] make .file directive have directory info
The .file directive is changed to only have basename in D36018 for
ELF.
But on AIX, we require the .file directive to also contain the
directory info. This aligns with other AIX compiler like XLC and is
required by some AIX tool like DBX.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/D99785
Lang Hames [Tue, 27 Apr 2021 04:10:11 +0000 (21:10 -0700)]
[ORC] Initialize the native asm printer and parser in Orc C-API unit test.
Lang Hames [Mon, 26 Apr 2021 22:37:07 +0000 (15:37 -0700)]
Reapply "[ORC] Add unit tests for parts of the ..." with fixes and improvements.
This reapplies
8740360093b, which was reverted in
bbddadd46e4 due to buildbot
errors.
This version checks that a JIT instance can be safely constructed, skipping
tests if it can not be. To enable this it introduces new C API to retrieve and
set the target triple for a JITTargetMachineBuilder.
Vitaly Buka [Tue, 27 Apr 2021 03:06:34 +0000 (20:06 -0700)]
[asan][NFC] Fix "not used" warning in test
River Riddle [Tue, 27 Apr 2021 02:33:50 +0000 (19:33 -0700)]
[mlir] Refactor the forward dataflow propagation in SCCP into a generic framework
This revision takes the forward value propagation engine in SCCP and refactors it into a more generalized forward dataflow analysis framework. This framework allows for propagating information about values across the various control flow constructs in MLIR, and removes the need for users to reinvent the traversal (often not as completely). There are a few aspects of the traversal, that were conservative for SCCP, that should be relaxed to support the needs of different value analyses. To keep this revision simple, these conservative behaviors will be left in (Note that this won't produce an incorrect result, but may produce more conservative results than necessary in certain edge cases. e.g. region entry arguments for non-region branch interface operations). The framework also only focuses on computing lattices for values, given the SCCP origins, but this is something to relax as needed in the future.
Given that this logic is already in SCCP, a majority of this commit is NFC. The more interesting parts are the interface glue that clients interact with.
Differential Revision: https://reviews.llvm.org/D100915
Wang, Pengfei [Tue, 27 Apr 2021 01:51:46 +0000 (09:51 +0800)]
Reapply "[X86][AMX] Try to hoist AMX shapes' def"
We request no intersections between AMX instructions and their shapes'
def when we insert ldtilecfg. However, this is not always ture resulting
from not only users don't follow AMX API model, but also optimizations.
This patch adds a mechanism that tries to hoist AMX shapes' def as well.
It only hoists shapes inside a BB, we can improve it for cases across
BBs in future. Currently, it only hoists shapes of which all sources' def
above the first AMX instruction. We can improve for the case that only
source that moves an immediate value to a register below AMX instruction.
Reviewed By: xiangzhangllvm
Differential Revision: https://reviews.llvm.org/D101067
Pushpinder Singh [Tue, 27 Apr 2021 02:23:44 +0000 (02:23 +0000)]
Revert "Reapply "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed""
This reverts commit
15be0c41d2e59fb4599c9aebf21ede498c61f51d.
Reid Kleckner [Tue, 27 Apr 2021 01:28:01 +0000 (18:28 -0700)]
Move Sema's key function around and add more comments
The previous comment was pretty obscure.
Aart Bik [Tue, 27 Apr 2021 00:03:35 +0000 (17:03 -0700)]
[mlir][tensors] Introduce attribute interface/attribute for tensor encoding
The new "encoding" field in tensor types so far had no meaning. This revision introduces:
1. an encoding attribute interface in IR: for verification between tensors and encodings in general
2. an attribute in Tensor dialect; #tensor.sparse<dict> + concrete sparse tensors API
Active discussion:
https://llvm.discourse.group/t/rfc-introduce-a-sparse-tensor-type-to-core-mlir/2944/
Reviewed By: silvas, penpornk, bixia
Differential Revision: https://reviews.llvm.org/D101008
Yonghong Song [Wed, 14 Apr 2021 20:08:39 +0000 (13:08 -0700)]
BPF: generate BTF info for LD_imm64 loaded function pointer
For an example like below,
extern int do_work(int);
long bpf_helper(void *callback_fn);
long prog() {
return bpf_helper(&do_work);
}
The final generated codes look like:
r1 = do_work ll
call bpf_helper
exit
where we have debuginfo for do_work() extern function:
!17 = !DISubprogram(name: "do_work", ...)
This patch implemented to add additional checking
in processing LD_imm64 operands for possible function pointers
so BTF for bpf function do_work() can be properly generated.
The original llvm function name processReloc() is renamed to
processGlobalValue() to better reflect what the function is doing.
Differential Revision: https://reviews.llvm.org/D100568
Arthur Eubanks [Mon, 26 Apr 2021 19:53:09 +0000 (12:53 -0700)]
[Inliner] Make ModuleInlinerWrapperPass return PreservedAnalyses::all()
The ModulePassManager should already have taken care of all analysis
invalidation. Without this change, upcoming changes will cause more
invalidation than necessary.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D101320
LLVM GN Syncbot [Tue, 27 Apr 2021 00:18:13 +0000 (00:18 +0000)]
[gn build] Port
7aa3cad46ac3
William S. Moses [Thu, 22 Apr 2021 02:26:10 +0000 (22:26 -0400)]
[MLIR] Add SCF.if Condition Canonicalizations
Add two canoncalizations for scf.if.
1) A canonicalization that allows users of a condition within an if to assume the condition
is true if in the true region, etc.
2) A canonicalization that removes yielded statements that are equivalent to the condition
or its negation
Differential Revision: https://reviews.llvm.org/D101012
William S. Moses [Mon, 15 Mar 2021 18:27:06 +0000 (14:27 -0400)]
[NVPTX] Enable lowering of atomics on local memory
LLVM does not have valid assembly backends for atomicrmw on local memory. However, as this memory is thread local, we should be able to lower this to the relevant load/store.
Differential Revision: https://reviews.llvm.org/D98650
Alex Lorenz [Tue, 27 Apr 2021 00:01:51 +0000 (17:01 -0700)]
[clang] Don't crash when loading invalid VFS for the module dep collector
The VFS is null when it's invalid so return early in collectVFSFromYAML.
Yonghong Song [Wed, 14 Apr 2021 17:43:22 +0000 (10:43 -0700)]
BPF: emit debuginfo for Function of DeclRefExpr if requested
Commit
e3d8ee35e4ad ("reland "[DebugInfo] Support to emit debugInfo
for extern variables"") added support to emit debugInfo for
extern variables if requested by the target. Currently, only
BPF target enables this feature by default.
As BPF ecosystem grows, callback function started to get
support, e.g., recently bpf_for_each_map_elem() is introduced
(https://lwn.net/Articles/846504/) with a callback function as an
argument. In the future we may have something like below as
a demonstration of use case :
extern int do_work(int);
long bpf_helper(void *callback_fn, void *callback_ctx, ...);
long prog_main() {
struct { ... } ctx = { ... };
return bpf_helper(&do_work, &ctx, ...);
}
Basically bpf helper may have a callback function and the
callback function is defined in another file or in the kernel.
In this case, we would like to know the debuginfo types for
do_work(), so the verifier can proper verify the safety of
bpf_helper() call.
For the following example,
extern int do_work(int);
long bpf_helper(void *callback_fn);
long prog() {
return bpf_helper(&do_work);
}
Currently, there is no debuginfo generated for extern function do_work().
In the IR, we have,
...
define dso_local i64 @prog() local_unnamed_addr #0 !dbg !7 {
entry:
%call = tail call i64 @bpf_helper(i8* bitcast (i32 (i32)* @do_work to i8*)) #2, !dbg !11
ret i64 %call, !dbg !12
}
...
declare dso_local i32 @do_work(i32) #1
...
This patch added support for the above callback function use case, and
the generated IR looks like below:
...
declare !dbg !17 dso_local i32 @do_work(i32) #1
...
!17 = !DISubprogram(name: "do_work", scope: !1, file: !1, line: 1, type: !18, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
!18 = !DISubroutineType(types: !19)
!19 = !{!20, !20}
!20 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
The TargetInfo.allowDebugInfoForExternalVar is renamed to
TargetInfo.allowDebugInfoForExternalRef as now it guards
both extern variable and extern function debuginfo generation.
Differential Revision: https://reviews.llvm.org/D100567
Hongtao Yu [Mon, 26 Apr 2021 16:12:29 +0000 (09:12 -0700)]
[CSSPGO] Unblock optimizations with pseudo probe instrumentation part 2.
As a follow-up to D95982, this patch continues unblocking optimizations that are blocked by pseudu probe instrumention.
The optimizations unblocked are:
- In-block load propagation.
- In-block dead store elimination
- Memory copy optimization that turns stores to consecutive memories into a memset.
These optimizations are local to a block, so they shouldn't affect the profile quality.
Reviewed By: wmi
Differential Revision: https://reviews.llvm.org/D100075
Fangrui Song [Mon, 26 Apr 2021 23:47:32 +0000 (16:47 -0700)]
[ADT] Remove StatisticBase and make NoopStatistic empty
In LLVM_ENABLE_STATS=0 builds, `llvm::Statistic` maps to `llvm::NoopStatistic`
but has 3 mostly unused pointers. GlobalOpt considers that the pointers can
potentially retain allocated objects, so GlobalOpt cannot optimize out the
`NoopStatistic` variables (see D69428 for more context), wasting 23KiB for stage
2 clang.
This patch makes `NoopStatistic` empty and thus reclaims the wasted space. The
clang size is even smaller than applying D69428 (slightly smaller in both .bss and
.text).
```
# This means the D69428 optimization on clang is mostly nullified by this patch.
HEAD+D69428: size(.bss) = 0x0725a8
HEAD+D101211: size(.bss) = 0x072238
# bloaty - HEAD+D69428 vs HEAD+D101211
# With D101211, we also save a lot of string table space (.rodata).
FILE SIZE VM SIZE
-------------- --------------
-0.0% -32 -0.0% -24 .eh_frame
-0.0% -336 [ = ] 0 .symtab
-0.0% -360 [ = ] 0 .strtab
[ = ] 0 -0.2% -880 .bss
-0.0% -2.11Ki -0.0% -2.11Ki .rodata
-0.0% -2.89Ki -0.0% -2.89Ki .text
-0.0% -5.71Ki -0.0% -5.88Ki TOTAL
```
Note: LoopFuse is a disabled pass. For now this patch adds
`#if LLVM_ENABLE_STATS` so `OptimizationRemarkMissed` is skipped in
LLVM_ENABLE_STATS==0 builds. If these `OptimizationRemarkMissed` are useful in
LLVM_ENABLE_STATS==0 builds, we can replace `llvm::Statistic` with
`llvm::TrackingStatistic`, or use a different abstraction to keep track of the strings.
Similarly, skip the code in `mlir/lib/Pass/PassStatistics.cpp` which
calls `getName`/`getDesc`/`getValue`.
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D101211
William S. Moses [Mon, 26 Apr 2021 23:33:01 +0000 (19:33 -0400)]
Revert "[NVPTX] Enable lowering of atomics on local memory"
This reverts commit
fede99d386ec9e7bab2762aa16cb10c0513ae464.
William S. Moses [Mon, 15 Mar 2021 18:27:06 +0000 (14:27 -0400)]
[NVPTX] Enable lowering of atomics on local memory
LLVM does not have valid assembly backends for atomicrmw on local memory. However, as this memory is thread local, we should be able to lower this to the relevant load/store.
Differential Revision: https://reviews.llvm.org/D98650
Fangrui Song [Mon, 26 Apr 2021 23:04:22 +0000 (16:04 -0700)]
[test] Fix tools/gold/X86/weak.ll after D94202
The order regressed after D94202: after `a b`, when adding `a c`, we may reorder
`a` to the right of `b`, causing the final order to be `b a c`.
Craig Topper [Mon, 26 Apr 2021 22:29:34 +0000 (15:29 -0700)]
[RISCV] Use stack slot to handle SPLAT_VECTOR_PARTS on RV32.
Reduces the amount of vector ALU operations and reduces vector
register pressure.
Lei Zhang [Mon, 26 Apr 2021 22:27:41 +0000 (18:27 -0400)]
Revert "[ADT] Remove StatisticBase and make NoopStatistic empty"
This reverts commit
b5403117814a7c39b944839e10492493f2ceb4ac
because it breaks MLIR build:
https://buildkite.com/mlir/mlir-core/builds/13299#
ad0f8901-dfa4-43cf-81b8-
7940e2c6c15b
Hubert Tong [Mon, 26 Apr 2021 22:18:35 +0000 (18:18 -0400)]
[AIX] Avoid use of mtim.tv_nsec member of stat structure on AIX
The value observed for the `mtim.tv_nsec` member is erroneous in some
AIX environments. Avoid using this member by forcing
`HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC` to `0`.
This resolves "mtime changed" errors such as the one
http://lab.llvm.org:8014/#/builders/126/builds/330/steps/5/logs/FAIL__Clang__test_c
has.
Reviewed By: daltenty, jsji
Differential Revision: https://reviews.llvm.org/D101323
Michael Kruse [Mon, 26 Apr 2021 22:04:00 +0000 (17:04 -0500)]
[SimplifyCFG] Preserve metadata when unconditionalizing branches (same target).
When replacing a conditional branch by an unconditional one because the targets are identical, transfer the metadata to the new branch instruction.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D101226
Fangrui Song [Mon, 26 Apr 2021 22:17:28 +0000 (15:17 -0700)]
Revert D76519 "[NFC] Refactor how CFI section types are represented in AsmPrinter"
This reverts commit
0ce723cb228bc1d1a0f5718f3862fb836145a333.
D76519 was not quite NFC. If we see a CFISection::Debug function before a
CFISection::EH one (-fexceptions -fno-asynchronous-unwind-tables), we may
incorrectly pick CFISection::Debug and emit a `.cfi_sections .debug_frame`.
We should use .eh_frame instead.
This scenario is untested.
LLVM GN Syncbot [Mon, 26 Apr 2021 22:16:25 +0000 (22:16 +0000)]
[gn build] Port
bbddadd46e46
Lang Hames [Mon, 26 Apr 2021 22:15:27 +0000 (15:15 -0700)]
Revert "[ORC] Add unit tests for parts of the Orc and LLJIT C APIs."
This reverts commit
8740360093b5154504f5e056596119f9566f4b06.
This commit caused failures on some builders (see e.g.
https://lab.llvm.org/buildbot/#/builders/5/builds/7071). Reverting while I
investigate.
Michael Benfield [Mon, 26 Apr 2021 20:53:21 +0000 (13:53 -0700)]
[Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable
These are intended to mimic warnings available in gcc.
-Wunused-but-set-variable is triggered in the case of a variable which
appears on the LHS of an assignment but not otherwise used.
For instance:
void f() {
int x;
x = 0;
}
-Wunused-but-set-parameter works similarly, but for function parameters
instead of variables.
In C++, they are triggered only for scalar types; otherwise, they are
triggered for all types. This is gcc's behavior.
-Wunused-but-set-parameter is controlled by -Wextra, while
-Wunused-but-set-variable is controlled by -Wunused. This is slightly
different from gcc's behavior, but seems most consistent with clang's
behavior for -Wunused-parameter and -Wunused-variable.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D100581
zoecarver [Mon, 26 Apr 2021 16:35:47 +0000 (09:35 -0700)]
[libc++][ranges] iterator.concept.sizedsentinel: sized_sentinel_for and disable_sized_sentinel_for.
Based on D100160.
Reviewed By: cjdb, ldionne, Quuxplusone, #libc, miscco
Differential Revision: https://reviews.llvm.org/D100587
Alex Lorenz [Mon, 26 Apr 2021 21:56:56 +0000 (14:56 -0700)]
Revert "[clang][driver] Use the provided arch name for a Darwin target triple"
This reverts commit
6cc62043c8bf4daa27664a2e1674abbe8d0492c6.
This caused a test failure on a M1 mac CI job (https://reviews.llvm.org/D100807#2718006),
I will recommit this with a fix.
LLVM GN Syncbot [Mon, 26 Apr 2021 21:24:36 +0000 (21:24 +0000)]
[gn build] Port
caf1294d9578
Baptiste Saleil [Mon, 26 Apr 2021 19:48:12 +0000 (15:48 -0400)]
[AMDGPU] Experiments show that the GCNRegBankReassign pass significantly impacts
the compilation time and there is no case for which we see any improvement in
performance. This patch removes this pass and its associated test cases from
the tree.
Differential Revision: https://reviews.llvm.org/D101313
Change-Id: I0599169a7609c19a887f8d847a71e664030cc141
Vineet Kumar [Mon, 26 Apr 2021 19:50:12 +0000 (19:50 +0000)]
Implementation for TargetTransformInfo::hasActiveVectorLength()
This patch adds the missing implementation for
TargetTransformInfo::hasActiveVectorLength() without which using
hasActiveVectorLength() causes linker error.
Patch by Vineet Kumar!
Differential Revision: https://reviews.llvm.org/D100941
Sterling Augustine [Mon, 19 Apr 2021 17:56:25 +0000 (10:56 -0700)]
Support leak sanitizer in libcxx.
Support leak sanitizer in libcxx.
Simple addition for leak checking when running the libcxx testsuite.
Differential Revision: https://reviews.llvm.org/D100775
Sterling Augustine [Fri, 16 Apr 2021 01:03:01 +0000 (18:03 -0700)]
Don't fail the shared_ptr test if libc++ has insufficient debug info.
Don't fail the shared_ptr test if libc++ has insufficient debug info.
This addresses https://bugs.llvm.org/show_bug.cgi?id=48937
Differential Revision: https://reviews.llvm.org/D100610
LLVM GN Syncbot [Mon, 26 Apr 2021 21:04:24 +0000 (21:04 +0000)]
[gn build] Port
8740360093b5
Lang Hames [Mon, 26 Apr 2021 20:55:26 +0000 (13:55 -0700)]
[ORC] Add unit tests for parts of the Orc and LLJIT C APIs.
Patch by Mats Larsen. Thanks Mats!
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D100506
Lang Hames [Mon, 26 Apr 2021 19:43:46 +0000 (12:43 -0700)]
[ORC] C API updates.
Adds support for creating custom MaterializationUnits in the C API with the new
LLVMOrcCreateCustomMaterializationUnit function.
Modifies ownership rules for LLVMOrcAbsoluteSymbols to make it consistent with
LLVMOrcCreateCustomMaterializationUnit. This is an ABI breaking change for any
clients of the LLVMOrcAbsoluteSymbols API.
Adds LLVMOrcLLJITGetObjLinkingLayer and LLVMOrcObjectLayerEmit functions to
allow clients to get a reference to an LLJIT instance's linking layer, then
emit an object file using it. This can be used to support construction of
custom materialization units in the common case where those units will
generate an object file that needs to be emitted to complete the
materialization.
Lang Hames [Mon, 26 Apr 2021 19:30:57 +0000 (12:30 -0700)]
[ORC] Fix type name.
Rename JITTargetSymbolFlags to JITSymbolTargetFlags. This matches the convention
used for JITSymbolGenericFlags.