Med Ismail Bennani [Fri, 21 Apr 2023 20:34:56 +0000 (13:34 -0700)]
[lldb] Add an example of interactive scripted process debugging
This patch is a proof of concept that shows how a scripted process could
be used with real process to perform interactive debugging.
In this example, we run a process that spawns 10 threads.
That process gets launched by an intermediary scripted process who's job
is to intercept all of it's process events and dispatching them
back either to the real process or to other child scripted processes.
In this example, we have 2 child scripted processes, with even and odd
thread indices. The goal is to be able to do thread filtering and
explore the various interactive debugging approaches, by letting a child
process running when stopping the other process and inspecting it.
Another approach would be to have the child processes execution in-sync
to force running every child process when one of them starts running.
Differential Revision: https://reviews.llvm.org/D145297
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 15 Apr 2023 00:09:37 +0000 (17:09 -0700)]
[lldb/API] Add convenience constructor for SBError (NFC)
This patch adds a new convience constructor to the SBError to initialize
it with a string message to avoid having to create the object and call
the `SetErrorString` method afterwards.
This is very handy to report errors from lldb scripted affordances.
Differential Revision: https://reviews.llvm.org/D148401
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Fri, 14 Apr 2023 23:42:59 +0000 (16:42 -0700)]
[lldb/Plugin] Add breakpoint setting support to ScriptedProcess
This patch adds support for breakpoint setting to Scripted Processes.
For now, Scripted Processes only support setting software breakpoints.
When doing interactive scripted process debugging, it makes use of the
memory writing capability to write the trap opcodes in the memory of the
driving process. However the real process' target doesn't keep track of
the breakpoints that got added by the scripted process. This is a design
that we might need to change in the future, since we'll probably need to
do some book keeping to handle breakpoints that were set by different
scripted processes.
Differential Revision: https://reviews.llvm.org/D145296
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Mon, 24 Apr 2023 19:45:49 +0000 (12:45 -0700)]
[lldb] Improve logging for process state change (NFC)
This patch improves process state change logging messages to include to
process plugin name.
It also replaces the `LLDB_LOGF` macro by `LLDB_LOG` macro that adds the
class and method name in the log message using the compiler instead of
having to change the string litteral for every method.
This is very useful when investigating interactions between different
types of process plugins. That comes very handy when investigating bugs
related to interactive scripted process debugging.
Differential Revision: https://reviews.llvm.org/D148399
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 22 Apr 2023 00:07:29 +0000 (17:07 -0700)]
[lldb/Utility] Add opt-in shadow mode to event listeners
This patch augments lldb's event listeners with a new shadow mode.
As the name suggests, this mode allows events to be copied to an
additional listener to perform event monitoring, without interferring
with the event life cycle.
One of our use case for this, is to be able to listen to public process
events while making sure the events will still be delivered to the
default process listener (the debugger listener in most cases).
Differential Revision: https://reviews.llvm.org/D148397
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Fri, 14 Apr 2023 23:57:12 +0000 (16:57 -0700)]
[lldb] Unify default/hijack listener between Process{Attach,Launch}Info (NFC)
This patch is a simple refactor that unifies the default and hijack
listener methods and attributes between ProcessAttachInfo and
ProcessLaunchInfo.
These 2 classes are both derived from the ProcessInfo base class so this
patch moves the listeners attributes and getter/setter methods to the
base class.
Differential Revision: https://reviews.llvm.org/D148395
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Fri, 14 Apr 2023 21:54:01 +0000 (14:54 -0700)]
[lldb] Move ScriptedProcess private state update to implementation
While debugging a Scripted Process, in order to update its state and
work nicely with lldb's execution model, it needs to toggle its private
state from running to stopped, which will result in broadcasting a
process state changed event to the debugger listener.
Originally, this state update was done systematically in the Scripted
Process C++ plugin, however in order to make scripted process
interactive, we need to be able to update their state dynamically.
This patch makes use of the recent addition of the
SBProcess::ForceScriptedState to programatically, and moves the
process private state update to the python implementation of the resume
method instead of doing it in ScriptedProcess::DoResume.
This patch also removes the unused ShouldStop & Stop scripted
process APIs, and adds new ScriptedInterface transform methods for
boolean arguments. This allow the user to programmatically decide if
after running the process, we should stop it (which is the default setting).
Differential Revision: https://reviews.llvm.org/D145295
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Mon, 13 Mar 2023 22:34:29 +0000 (15:34 -0700)]
[lldb/API] Introduce SBProcess::ForceScriptedState method
This patch introduces a new method to the SBProcess API called
ForceScriptedState. As the name suggests, this affordance will allow the
user to alter the state of the scripted process programatically.
This is necessary to update the scripted process state when perform
interactive debugging.
Differential Revision: https://reviews.llvm.org/D145294
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Arthur Eubanks [Tue, 25 Apr 2023 21:34:24 +0000 (14:34 -0700)]
[LegacyPM] Remove InjectTLIMappings and AssumeSimplify passes
Vasileios Porpodas [Tue, 4 Apr 2023 20:02:05 +0000 (13:02 -0700)]
[LV][NFC] Precommit test for a follow-up patch that introduces uniformity for a specific VF.
Differential Revision: https://reviews.llvm.org/D147734
Arthur Eubanks [Tue, 25 Apr 2023 21:11:49 +0000 (14:11 -0700)]
[NFC][StructuralHash] Use hash_code
Congcong Cai [Tue, 25 Apr 2023 21:08:28 +0000 (23:08 +0200)]
[clang] add diagnose when member function contains invalid default argument
Fixed: https://github.com/llvm/llvm-project/issues/62122
This change pointer to add diagnose message for this code.
```
struct S {
static int F(int n = 0 ? 0) {
return 0;
}
};
```
For default parameter, we should set it as unparsed even if meeting
syntax error because it should be issued in real parser time instead of
set is as invalid directly without diagnose.
Reviewed By: rsmith
Differential Revision: https://reviews.llvm.org/D148372
Arthur Eubanks [Wed, 13 Jul 2022 22:51:15 +0000 (15:51 -0700)]
[clang] Don't emit type tests for dllexport/import classes
According to https://clang.llvm.org/docs/LTOVisibility.html, classes on
Windows with dllimport/export receive public LTO visibility and
therefore should not participate in WPD.
Reviewed By: pcc
Differential Revision: https://reviews.llvm.org/D129700
Paul Osmialowski [Tue, 25 Apr 2023 20:44:35 +0000 (21:44 +0100)]
[SCEV] Do not plant SCEV checks unnecessarily
The vectorisation analysis collects strides for loop invariant
pointers, which is wrong because they are not strided. We don't
need to generate SCEV checks (which are costly performancewise)
for such pointers, we just need to do the appropriate aliasing
checks.
This patch fixes the problem by changing getStrideFromPointer()
to treat loop invariant pointers as having no stride.
Originally proposed by David Sherwood with further suggestions
from Florian Hahn.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D146958
max [Tue, 25 Apr 2023 20:32:14 +0000 (15:32 -0500)]
Revert "[MLIR][python bindings] implement `replace_all_uses_with` on `PyValue`"
This reverts commit
3bab7cb089d92cc7025ebc57ef3a74d3ce94ecd8 because it breaks sanitizers.
Differential Revision: https://reviews.llvm.org/D149188
Paul Osmialowski [Tue, 25 Apr 2023 20:33:01 +0000 (21:33 +0100)]
[test] A test case for D146958
This commit introduces a test for the change introduced by the
`[SCEV] Do not plant SCEV checks unnecessarily` commit,
D146958.
Reviewed By: fhahn, david-arm
Differential Revision: https://reviews.llvm.org/D146974
Teresa Johnson [Tue, 25 Apr 2023 20:17:50 +0000 (13:17 -0700)]
[ThinLTO] Reduce pipeline clang test to avoid churn from LLVM changes
This test was added in D72538, along with multiple LLVM pipeline tests,
to ensure that distributed ThinLTO backends invoked via clang set up the
expected ThinLTO optimization pipeline. However, this introduces churn
to clang tests from LLVM pipeline changes (see recent comment in that
patch).
Since the full pipeline setup is tested by LLVM, I have changed this
test to simply look for a single pass that is only invoked during LTO
backends, to make sure that clang is provoking the an LTO backend
pipeline setup.
Valentin Clement [Tue, 25 Apr 2023 20:26:48 +0000 (13:26 -0700)]
[flang][openacc] Add initial support to lower assumed size array in data operand
Add lowering for assumed size array in data clause to the newly
added data operand operations.
Depends on D148840
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D148969
LLVM GN Syncbot [Tue, 25 Apr 2023 20:18:23 +0000 (20:18 +0000)]
[gn build] Port
b42718dcecdd
Shubham Sandeep Rastogi [Mon, 24 Apr 2023 23:01:41 +0000 (16:01 -0700)]
Factor out split-dwarf test in Generic/empty.ll
In llvm/test/DebugInfo/Generic/empty.ll, there are two RUN lines. The
second one use the option "-split-dwarf-file=foo.dwo"
Since darwin doesn't support split dwarf, there is an assertion when
running the test:
"Assertion failed: (Section && "Cannot switch to a null section!"),
function switchSection, file llvm/lib/MC/MCStreamer.cpp, line 1238"
While there is an XFAIL for darwin in the test, It is not a good
practice to run a test on darwin which causes an assertion. This
patch is a small refactoring of the test so that the split-dwarf test
can be it's own file with an explicit elf triple.
Differential Review: https://reviews.llvm.org/D149106
walter erquinigo [Tue, 25 Apr 2023 19:46:34 +0000 (14:46 -0500)]
[LLDB][REPL] Destroy the repl instances correctly
This change ensures that the REPL map inside Target is destroyed correctly when `Target::Destroy()` is invoked. Not doing so results in the REPL not finishing its job when the debugger is initialized in REPL mode reading from a file. In my particular case, my REPL doesn't print the stdout of the last expression in the input file unless I include this change.
Differential Revision: https://reviews.llvm.org/D149180
Nawal Copty [Tue, 25 Apr 2023 19:45:33 +0000 (12:45 -0700)]
Preserve the address space for llvm.used and llvm.compiler.used global variables in GlobalOpt pass.
The llvm.used (or llvm.compiler.used) global variable is an array that contains a list of pointers to global variables and functions.
The GlobalOpt (Global Variable Optimizer) pass is not preserving the address space for llvm.used and llvm.compiler.used global variables.This patch updates the setUsedInitializer() function in GlobalOpt.cpp, so the address space is preserved.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D144518
Owen Anderson [Tue, 25 Apr 2023 05:23:38 +0000 (22:23 -0700)]
Remove code only needed to detect a pre-4.0 API break.
Updated with build fix for unit tests
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D149125
Neumann Hon [Tue, 25 Apr 2023 20:03:34 +0000 (16:03 -0400)]
[SystemZ][z/OS] Create utility functions for converting between EBCDIC and UTF-8.
Differential Revision: https://reviews.llvm.org/D148821
Craig Topper [Tue, 25 Apr 2023 19:52:00 +0000 (12:52 -0700)]
[RISCV] Add test case showing failure to fold (fadd (reduce -0.0, X), Y) due to one use check. NFC"
If the -0.0 has multiple uses we won't fold the reduction.
Florian Hahn [Tue, 25 Apr 2023 19:34:14 +0000 (20:34 +0100)]
[ConstraintElim] Port `mul nuw` for unsigned to `mul nsw` to signed.
Add handling for `mul nsw` for signed systems based on the logic for
`mul nuw` for unsigned.
Florian Hahn [Tue, 25 Apr 2023 19:33:29 +0000 (20:33 +0100)]
[ConstraintElim] Split up test case to it easier for Alive2 to verify.
Split up larger test functions into 2 versions, one with the checks in
the then and one with the checks in the else block.
The original versions of the function caused timeouts even with larger
thresholds. The new versions verify very quickly.
Julian Lettner [Fri, 21 Apr 2023 22:14:42 +0000 (15:14 -0700)]
[MachO] Disable atexit()-based lowering when LTO'ing kernel/kext code
The kernel and kext environments do not provide the `__cxa_atexit()`
function, so we can't use it for lowering global module destructors.
Unfortunately, just querying for "compiling for kernel/kext?" in the LTO
pipeline isn't possible (kernel/kext identifier isn't part of the triple
yet) so we need to pass down a CodeGen flag.
rdar://
93536111
Differential Revision: https://reviews.llvm.org/D148967
Philip Reames [Tue, 25 Apr 2023 18:57:46 +0000 (11:57 -0700)]
[SCEV] Common code for computing trip count in a fixed type [NFC-ish]
This is a follow on to D147117 and D147355. In both cases, we were adding special cases to compute zext(BTC+1) instead of zext(BTC)+1 when the BTC+1 computation was known not to overflow.
Differential Revision: https://reviews.llvm.org/D148661
Florian Hahn [Tue, 25 Apr 2023 18:51:23 +0000 (19:51 +0100)]
[ConstraintElim] Add tests for mul nsw and signed predicates.
Joseph Huber [Tue, 25 Apr 2023 18:32:17 +0000 (13:32 -0500)]
[libc] Fix including 'libc_errno.h' incorrectly
Summary:
This causes problems when included. Fix this to hopefully get the bots
working again.
Joseph Huber [Tue, 25 Apr 2023 18:25:45 +0000 (13:25 -0500)]
[libc][fix] Add missing 'errno' header for the GPU libc
Summary:
The previous GPU `libc` patch added support for `atoi`. However, it
didn't also enable generating the errno header. This caused including it
to use the system's header which invariably will cause compiler
problems.
Martin Storsjö [Sun, 23 Apr 2023 19:51:59 +0000 (22:51 +0300)]
[compiler-rt] [test] Add an .exe suffix for unit test executables on MinGW
Previously, an .exe suffix was only added for MSVC configurations.
In practice, an .exe suffix is added implicitly by MinGW toolchains
if the output is a suffixless file name. However this can cause lots
of subtle build system confusion, when it's not generating the file it
expected.
Differential Revision: https://reviews.llvm.org/D149029
Craig Topper [Tue, 25 Apr 2023 17:49:57 +0000 (10:49 -0700)]
[RISCV] Rename hasNonZeroAVL->isNonZeroAVL. NFC
The argument is the AVL itself, not some operation that has an AVL.
Thus "is" instead of "has" is a better name.
Jorge Gorbe Moya [Tue, 25 Apr 2023 17:46:58 +0000 (10:46 -0700)]
Joseph Huber [Mon, 24 Apr 2023 23:28:54 +0000 (18:28 -0500)]
[libc] Ignore 'errno' on the GPU and support 'atoi'
The 'errno' value is most likely not useful on the GPU and it prevents
us from providing certain functions on the GPU that depend on it, like
`atoi`. This patch makes the necessary changes to support `errno` by
simple replacing it with a consumer class.
Supporting `errno` on the GPU is possible in some aspects. The first
approach would be to use a buffer of shared memory that has enough space
for all threads. Another option would be to change code generation to
support `thread_local` using `address_space(5)` memory allocated at
kernel launch. The former could look like the following, which could be
implemented in a later patch:
```
template <typename T>
using SharedBuffer = T[gpu::MAX_THREADS] [[clang::address_space(3)]];
template <typename T> struct ErrnoSetter {
constexpr ErrnoSetter(SharedBuffer<T> &storage) : storage(storage) {}
SharedBuffer<T> &storage;
void operator=(const T &val) { storage[gpu::get_thread_id()] = val; }
};
static SharedBuffer<int> thread_local_buffer [[clang::loader_uninitialized]];
ErrnoSetter<int> __llvmlibc_internal_errno(thread_local_buffer);
```
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D149107
Markus Mützel [Tue, 25 Apr 2023 17:09:20 +0000 (10:09 -0700)]
[flang] Avoid dependency of runtime library on pthread for MinGW
When building the Fortran runtime on MinGW, `clock_gettime` is currently used. That function is provided by the `pthread` library on that platform. That means that all programs that link `libFortranRuntime` also require to be linked with `pthread` on that platform.
There is already a code path (for MSVC) that doesn't use `clock_gettime` in the implementation of the Fortran library.
Use the same code path also on MinGW by undefining `CLOCKID`.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D149051
Slava Zakharin [Tue, 25 Apr 2023 16:45:45 +0000 (09:45 -0700)]
[flang] Account for .exe suffix in test/Driver/omp-driver-offload.f90.
I believe this test started failing pre-commit testing after D148038.
For example:
https://buildkite.com/llvm-project/premerge-checks/builds/148654#
0187b72b-7360-4c52-be94-
93eefcb269f4
https://buildkite.com/llvm-project/premerge-checks/builds/148642#
0187b691-15a7-44c4-ae23-
c7e97ec67755
On Windows the .exe suffix is used for clang-offload-packager tool:
"c:\\program files\\llvm\\bin\\clang-offload-packager.exe" ...
At the same time, I believe I have seen this test sporadically fail before,
meaning that the .exe suffix is not added consistently. I am not sure
why this might be happening. I decided just to allow the suffix.
Alex Bradbury [Tue, 25 Apr 2023 16:53:12 +0000 (17:53 +0100)]
[RISCV][NFC] Pull select->binop identities used in lowerSelect to a helper function
This will allow reusing the same logic for a select combine.
Tobias Hieta [Tue, 25 Apr 2023 07:54:33 +0000 (09:54 +0200)]
[docs] Update HowToReleaseLLVM documentation.
There was a bunch of references to bugzilla and other old
instructions in there. I have updated it to match the current
reality.
Reviewed By: tstellar
Differential Revision: https://reviews.llvm.org/D149131
Cullen Rhodes [Tue, 25 Apr 2023 16:45:38 +0000 (16:45 +0000)]
[AArch64][SME] NFC: Fix comment in enum class
Slava Zakharin [Mon, 24 Apr 2023 18:09:57 +0000 (11:09 -0700)]
[flang][runtime] Added Clang CMake modules include path.
Fortran runtime standalone build is broken after D140998
because of the missing CMake modules path. This is a fix.
Differential Revision: https://reviews.llvm.org/D149090
OCHyams [Tue, 25 Apr 2023 15:21:42 +0000 (16:21 +0100)]
[DebugInfo] Treat empty metadata operands the same as undef operands
A `ValueAsMetadata` may be replaced with nullptr for several reasons including
deleting values and value remapping a use-before-def. In the case of a
`MetadataAsValue` user, `handleChangedOperand` intercepts and replaces the
metadata with an empty tuple (`!{}`).
At the moment, an empty metadata operand in a debug intrinsics signals that it
can be deleted.
Given that we end up with empty metadata operands in circumstances where the
Value has been "lost" the current behaviour can lead to incorrect variable
locations. Instead, we should treat empty metadata as meaning "there is no
location for the variable" (the same as we currently treat undef operands).
This patch changes `isKillLocation` to take this into account.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D140902
Aaron Ballman [Tue, 25 Apr 2023 15:29:22 +0000 (11:29 -0400)]
Fix codegen for initialization of global atomics
This amends
2e275e24355cb224981f9beb2b026a3169fc7232. That commit added
a null to pointer cast kind when determining whether the expression can
be a valid constant initializer, but failed to update the constant
expression evaluator to perform the evaluation. This commit updates the
constant expression evaluator to handle that cast kind.
OCHyams [Tue, 25 Apr 2023 14:39:31 +0000 (15:39 +0100)]
[DebugInfo] Replace UndefValue with PoisonValue in DIArgList::handleChangedOperand
This helps towards the effort to remove UndefValue from LLVM.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: nlopes
Differential Revision: https://reviews.llvm.org/D140991
Emilio Cota [Tue, 25 Apr 2023 14:26:02 +0000 (10:26 -0400)]
[mlir] ActionTracing: require ASSERTS for debugcounter test
While at it, fix some typos.
Differential Revision: https://reviews.llvm.org/D149159
Jay Foad [Tue, 25 Apr 2023 09:26:46 +0000 (10:26 +0100)]
[AMDGPU] Do not handle _SGPR SMEM instructions in SILoadStoreOptimizer
After D147334 we never select _SGPR forms of SMEM instructions on
subtargets that also support the _SGPR_IMM form, so there is no need to
handle them here.
Differential Revision: https://reviews.llvm.org/D149139
Doru Bercea [Tue, 25 Apr 2023 14:05:07 +0000 (10:05 -0400)]
Disable private mapping test for AMD GPU due to intermittent fails.
Victor Perez [Mon, 24 Apr 2023 08:51:11 +0000 (09:51 +0100)]
[mlir][llvm][test] Move exception-related tests to their own file
Move mlir-translate exception-related tests from basic.ll to exception.ll.
Signed-off-by: Victor Perez <victor.perez@codeplay.com>
Differential Revision: https://reviews.llvm.org/D149043
Zhongyunde [Tue, 25 Apr 2023 13:47:41 +0000 (21:47 +0800)]
[InstSimplify] with logical ops: (X | Y) ? 0 : X --> 0
Use simplifySelectWithICmpEq to handle the implied equalities from the icmp-or,
then both of ICMP_NE and ICMP_EQ will be addressed
(X | Y) == 0 ? X : 0 --> 0 (commuted 2 ways)
(X | Y) != 0 ? 0 : X --> 0 (commuted 2 ways)
Fixes https://github.com/llvm/llvm-project/issues/62263
Reviewed By: nikic, RKSimon
Differential Revision: https://reviews.llvm.org/D148986
Nikita Popov [Mon, 24 Apr 2023 13:22:20 +0000 (15:22 +0200)]
Reapply [InstSimplify] Support all instructions in simplifyWithOpReplaced()
Relative to the previous attempt, this includes a bailout for phi
nodes, whose arguments might refer to a previous cycle iteration.
We did not hit this before by a fortunate deficiency of the
ConstantFoldInstOperands() API, which doesn't handle phi nodes,
unlike ConstantFoldInstruction().
-----
Instead of hardcoding a few instruction kinds, use the generic
interface now that we have it.
The primary effect of this is that intrinsics are now supported.
It's worth noting that this is still limited in that it does not
support vectors, so we can't remove e.g. existing fshl special
cases.
Zhongyunde [Tue, 25 Apr 2023 13:39:06 +0000 (21:39 +0800)]
[tests] precommit tests for D148986
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149115
Nikita Popov [Tue, 25 Apr 2023 13:40:43 +0000 (15:40 +0200)]
[InstSimplify] Add test for select op replacement in phi (NFC)
NAKAMURA Takumi [Wed, 1 Mar 2023 22:16:44 +0000 (07:16 +0900)]
TableGen: Introduce `!range` operator for half-opened interval
`!range(a, b)` generates a list `[a,b)`. `a` is optional and `0` by default.
- `!range(-1, 4)` generates `[-1, 0, 1, 2, 3]`
- `!range(4)` generates `[0, 1, 2, 3]`
- `!range(2, 2)` generates `[]<list<int>>`
`!range(list)` is equivalent to `!range(0, !size(list))`.
Differential Revision: https://reviews.llvm.org/D145871
NAKAMURA Takumi [Tue, 25 Apr 2023 13:35:33 +0000 (22:35 +0900)]
Reformat
OCHyams [Tue, 25 Apr 2023 13:36:38 +0000 (14:36 +0100)]
Revert "[DebugInfo] Print empty MDTuples wrapped in MetadataAsValue inline"
This reverts commit
1e6fe677f8aa98518e05218affa16e468819f5ed (D140900).
Buildbot: https://lab.llvm.org/buildbot/#/builders/196/builds/29937
Nikita Popov [Tue, 25 Apr 2023 13:20:36 +0000 (15:20 +0200)]
[LoopVectorize] Convert test to opaque pointers (NFC)
Jeremy Morse [Tue, 25 Apr 2023 13:04:41 +0000 (14:04 +0100)]
[DebugInfo][CSInfo] Avoid crash when defining super-regs
In rare situations involving AVX intrinsics, it seems LLVM can be coaxed
into generating copies to arguments that look like this:
$xmm0 = VMOVAPSrr $xmm1, implicit-def $ymm0
CALL64 @something ymm0
This particular form of copy implicitly zeros the upper lanes of ymm0,
hence there's an implicit-def for the register in the copy. The X86
implementation of describeLoadedValue doesn't attempt to describe this sort
of copy which causes the generic implementation in
TargetInstrInfo::describeLoadedValue to fire an assertion saying it
expected the target hook to handle it.
Play it safe in the generic implementation and return the "no location /
value" return value, rather than asserting.
Differential Revision: https://reviews.llvm.org/D148626
OCHyams [Tue, 25 Apr 2023 10:24:30 +0000 (11:24 +0100)]
[DebugInfo] Print empty MDTuples wrapped in MetadataAsValue inline
This improves the readability of debugging intrinsics. Instead of:
call void @llvm.dbg.value(metadata !2, ...)
!2 = !{}
We will see:
call void @llvm.dbg.value(metadata !{}, ...)
!2 = !{}
Note that we still get a numbered metadata entry for the node even if it's not
used elsewhere. This is to avoid adding more context to the print functions.
This is already legal IR - LLVM can parse and understand it - so there is no
need to update the parser.
The next patches in this stack will make such empty metadata operands more
common and semantically important.
Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value
Reviewed By: StephenTozer
Differential Revision: https://reviews.llvm.org/D140900
Benjamin Kramer [Tue, 25 Apr 2023 12:57:09 +0000 (14:57 +0200)]
[MC] Eagerly skip zero-sized .fill fragments
This doesn't change the output in any way, but we have a bunch of
emitFill for padding. When emitting an array of floats we'd end up with
DataFragment float1
FillFragment 0
DataFragment float2
FillFragment 0
... and so on
We never actually emit anything for those fills, neither in asm nor obj
emission mode, they just consume RAM for no reason.
Jay Foad [Tue, 25 Apr 2023 11:07:00 +0000 (12:07 +0100)]
[AMDGPU] Move GCN-specific stuff out of AMDGPUISelLowering. NFC.
Differential Revision: https://reviews.llvm.org/D149145
Tom Eccles [Tue, 25 Apr 2023 12:24:46 +0000 (12:24 +0000)]
[flang][hlfir] inline hlfir.transpose as hlfir.elemental
Inlining as a hlfir.elemental will allow the transpose to be inlined
into subsequent operations in some cases. For example,
y = TRANSPOSE(x)
z = y * 2
Will operate in a single loop without creating a temporary for the
TRANSPOSE (unlike the runtime call, which always allocates).
This is in a new SimplifyHLFIRIntriniscs pass. The intention is that some
day that pass might replace the FIR SimplifyIntrinsics pass.
Depends On: D149060
Reviewed By: jeanPerier, vzakhari
Differential Revision: https://reviews.llvm.org/D149067
Tom Eccles [Tue, 25 Apr 2023 12:24:08 +0000 (12:24 +0000)]
[flang][hlfir] get constant extents when possible
If we know the extent at compile time, it is better to generate an
arith.constant than hlfir.get_extent. This gives more information earlier
in compilation (before hflir.get_extent is lowered).
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D149060
Mikhail Goncharov [Tue, 25 Apr 2023 12:37:23 +0000 (14:37 +0200)]
Nikita Popov [Tue, 25 Apr 2023 12:25:57 +0000 (14:25 +0200)]
[SCEV] Regenerate test checks (NFC)
I was very confused by this change while working on a patch --
turns out that it's pre-existing, and we currently just match the
"1" part of "13".
Zhongyunde [Tue, 25 Apr 2023 11:36:12 +0000 (19:36 +0800)]
[MergeICmps] Adapt to non-eq comparisons, bugfix
Fix the last runtime issue as some sequent comparisons need be spilted.
For the origin equal comparisons chain, the new spilted Icmp chain will
still be end with equal, while for the new not-equal comparisons chain,
the new spilted Icmp chain will still be end with equal, so should address
this carefully, see detail wih case partial_sequent_ne
Thanks for @aeubanks, @glandium and @ayzhao report the runtime issue
and carefully examine.
Fix https://github.com/llvm/llvm-project/issues/59740.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D141188
Alex Bradbury [Tue, 25 Apr 2023 11:38:04 +0000 (12:38 +0100)]
[RISCV][NFC] Fix typo in comment in RISCVISelLowering
SELECT_CC is expanded to SETT and SELECT.
Alvin Wong [Sat, 22 Apr 2023 14:38:53 +0000 (22:38 +0800)]
[compiler-rt][test] Add `--large-address-aware` link flag for MinGW
The interception tests rely on the test binary being large address
aware. This has already been set for MSVC builds. Now we do the same for
MinGW.
This fixes the interception unit tests for i686-w64-windows-gnu target.
Differential Revision: https://reviews.llvm.org/D148996
Alvin Wong [Sat, 22 Apr 2023 11:33:53 +0000 (19:33 +0800)]
[compiler-rt][asan] Add report on intercept fail to more places
Use `ASAN_INTERCEPT_FUNC` instead of `INTERCEPT_FUNCTION` so it checks
the return value and reports a message if verbosity >= 1.
Differential Revision: https://reviews.llvm.org/D148989
Haojian Wu [Wed, 19 Apr 2023 21:54:22 +0000 (23:54 +0200)]
[clangd] Add support TextDocumentEdit.
This is an initial patch to add TextDocumentEdit (versioned edits) support in
clangd, the scope is minimal:
- add and extend the corresponding protocol structures
- propagate the documentChanges for diagnostic codeactions (our motivated case)
Differential Revision: https://reviews.llvm.org/D148783
Nikita Popov [Tue, 25 Apr 2023 10:55:36 +0000 (12:55 +0200)]
[LoopReroll] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 25 Apr 2023 10:55:21 +0000 (12:55 +0200)]
[LoopReroll] Regenerate test checks (NFC)
Max Kazantsev [Tue, 25 Apr 2023 09:40:37 +0000 (16:40 +0700)]
[SCEV] Support sub in and negative constants willNotOverflow
This lifts two TODOs from this function, allowing us to prove
no-overflow whether it happens through max int (up) or through
min int (down) for both and and sub.
Differential Revision: https://reviews.llvm.org/D148618
Reviewed By: dmakogon
Nikita Popov [Tue, 25 Apr 2023 08:51:25 +0000 (10:51 +0200)]
[LICM] Add additional "free instruction" tests (NFC)
Luke Lau [Fri, 21 Apr 2023 13:50:35 +0000 (14:50 +0100)]
[SLP] Deduplicate loads subkey generator. NFCI
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D148923
Luke Lau [Tue, 18 Apr 2023 17:29:20 +0000 (18:29 +0100)]
[RISCV] Fix interleave crash on unary interleaves
We were crashing when lowering interleave shuffles like
(shuffle <0,3,1,4>, x:v4i8, y:v4i8)
Where it was technically an unary shuffle (both EvenSrc and OddSrc point
to the first operand), but the resulting extract_subvectors were out of
bounds.
This checks to make sure that the vectors being extracted are within
range.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D148647
Nikita Popov [Tue, 25 Apr 2023 08:07:30 +0000 (10:07 +0200)]
[LICM] Remove redundant test (NFC)
Drop the separate opaque pointers test now that the original one
uses opaque pointers as well.
Nikita Popov [Tue, 25 Apr 2023 08:06:39 +0000 (10:06 +0200)]
[LICM] Regenerate test checks (NFC)
Nikita Popov [Tue, 25 Apr 2023 07:57:39 +0000 (09:57 +0200)]
[LICM] Only forget loop/block dispositions
As we are moving the instruction without changing its value, it
is sufficient to only invalidate the loop/block dispositions.
This is the same we do in LoopSink.
Cullen Rhodes [Tue, 25 Apr 2023 07:38:09 +0000 (07:38 +0000)]
[mlir][ArmSME] Add tests for Streaming SVE
This patch adds a couple of tests for targeting Arm Streaming SVE (SSVE)
mode, part of the Arm Scalable Matrix Extension (SME).
SSVE is enabled in the backend at the function boundary by specifying
the `aarch64_pstate_sm_enabled` attribute, as documented here [1]. SSVE
can be targeted from MLIR by specifying this in the passthrough
attributes [2] and compiling with
-mattr=+sme,+sve -force-streaming-compatible-sve
The passthrough will propagate to the backend where `smstart/smstop`
will be emitted around the call to the SSVE function.
The set of legal instructions changes in SSVE,
`-force-streaming-compatible-sve` avoids the use of NEON entirely and
instead lowers to (streaming-compatible) SVE. The behaviour this flag
predicates will be hooked up to the function attribute in the future
such that simply specifying this (should) lead to correct
code-generation.
Two tests are added:
* A basic LLVMIR test verifying the attribute is passed through.
* An integration test calling a SSVE function.
The integration test can be run with QEMU.
[1] https://llvm.org/docs/AArch64SME.html
[2] https://mlir.llvm.org/docs/Dialects/LLVM/#attribute-pass-through
Reviewed By: awarzynski, aartbik
Differential Revision: https://reviews.llvm.org/D148111
Bing1 Yu [Tue, 25 Apr 2023 07:47:33 +0000 (15:47 +0800)]
[ValueMapper] allow mapping ConstantTargetNone to its layout type
zeroinitializer is allowed for spirv TargetExtType.
This PR allows ValueMapper to map TargetExtType ConstantTargetNone to '0' constant of its layout type.
Reviewed By: jcranmer-intel
Differential Revision: https://reviews.llvm.org/D148774
Mehdi Amini [Tue, 25 Apr 2023 07:08:20 +0000 (00:08 -0700)]
[MLIR][doc] Fix the [TOC] tag in two doc
Somehow it was escaped in these documents.
Jean Perier [Tue, 25 Apr 2023 07:05:37 +0000 (09:05 +0200)]
[flang][runtime] Fix padding in CHARACTER(4) assignments.
One piece of pointer arithmetic was adding the number of bytes instead
of the number of characters. This caused failures in CHARACTER(KIND>1)
that required padding.
This was caught using HLFIR that currently uses the runtime for array
assignment where the current lowering does everything inline.
Reviewed By: vzakhari, klausler
Differential Revision: https://reviews.llvm.org/D149062
Jean Perier [Tue, 25 Apr 2023 07:03:55 +0000 (09:03 +0200)]
[flang][hlfir] Support fir.declare in AbstractResult pass
The AbstractResult pass replaces allocation of function result on the callee
side per an extra argument so that the allocation of the result can be
done on the caller stack.
It looks for the result allocation from the fir.return op, so it needs
to handle (in a transparent way) a fir.declare in the chain between the
allocation and the fir.return.
Reviewed By: vzakhari, clementval
Differential Revision: https://reviews.llvm.org/D149057
Jean Perier [Tue, 25 Apr 2023 07:02:18 +0000 (09:02 +0200)]
[flang][hlfir] Lower NULL(MOLD) to a variable
HLFIR lowering promotes intrinsic results lowered in memory to
hlfir.expr to underline their read-only aspect once they are created.
NULL(MOLD) should not be promoted to an hlfir.expr, it is the NULL
variable (we need to see it as an address).
Reviewed By: clementval
Differential Revision: https://reviews.llvm.org/D149053
Timm Bäder [Mon, 24 Apr 2023 12:30:54 +0000 (14:30 +0200)]
[clang][Interp] Fix zero-init of float and pointer arrays
Our Zero opcode only exists for integer types. Use
visitZeroInitializer() here as well so it works for floats and pointers.
Differential Revision: https://reviews.llvm.org/D149059
Kazu Hirata [Tue, 25 Apr 2023 06:31:48 +0000 (23:31 -0700)]
[libc] Fix typos in documentation
Fangrui Song [Tue, 25 Apr 2023 06:18:59 +0000 (23:18 -0700)]
[Driver] Remove no-op -frewrite-map-file=
This option has been a no-op since D99707.
Kazu Hirata [Tue, 25 Apr 2023 06:15:55 +0000 (23:15 -0700)]
[clang] Modernize SkipBodyInfo (NFC)
Piyou Chen [Tue, 25 Apr 2023 06:09:56 +0000 (23:09 -0700)]
[RISCV][NFC] skip non-RISCV target test riscv32-zihintntl.c
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D149126
Timm Bäder [Sat, 22 Apr 2023 04:40:54 +0000 (06:40 +0200)]
[clang][Interp] PointerToBoolean casts
Just emit e != nullptr for these.
Differential Revision: https://reviews.llvm.org/D148981
Vlad Serebrennikov [Tue, 25 Apr 2023 06:03:14 +0000 (09:03 +0300)]
[clang] Add test for CWG1821
[[https://wg21.link/p1787 | P1787]]: My clarification in [[ http://lists.isocpp.org/core/2019/06/6614.php | “Where can namespace-scope functions and variables be redeclared?” ]] is applied, resolving CWG1821.
Wording: (If the declaration is not a friend declaration:) If the id-expression in a declarator-id is a qualified-id Q, let S be its lookup context; the declaration shall inhabit a namespace scope. ([dcl.meaning]/1)
Reviewed By: shafik, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D149003
Fangrui Song [Tue, 25 Apr 2023 05:59:54 +0000 (22:59 -0700)]
[Driver] Simplify handling of -mabi=vec-default -mabi=vec-extabi
And fix a minor issue that -mabi=vec-extabi -mabi=vec-default should not pass
"-bplugin_opt:-vec-extabi" to ld.
Owen Anderson [Tue, 25 Apr 2023 05:52:18 +0000 (22:52 -0700)]
Revert "Remove code only needed to detect a pre-4.0 API break."
This reverts commit
17a3fbf2a3683f862de52e0058110eb8b356be56
due to build failures in llvm/unittests/ADT/IListTest.cpp
Owen Anderson [Tue, 25 Apr 2023 05:23:38 +0000 (22:23 -0700)]
Remove code only needed to detect a pre-4.0 API break.
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D149122
Timm Bäder [Sun, 23 Apr 2023 08:08:44 +0000 (10:08 +0200)]
[clang][AST][NFC] Turn some single-line comments into doc comments
Emilio Cota [Tue, 25 Apr 2023 04:53:03 +0000 (00:53 -0400)]
[bazel][mlir] Fold :Observers and :BreakpointManagers into :Debug
To avoid circular deps.
While at it, add missing dep on CAPIIR.
Ethan Luis McDonough [Tue, 25 Apr 2023 04:35:19 +0000 (23:35 -0500)]
[flang] Feature list plugin
Plugin that counts the number of times each tree node occurs in a given program. Used for test coverage.
Updated to fix build issues.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D143704
Jie Fu [Tue, 25 Apr 2023 03:54:16 +0000 (11:54 +0800)]
[RISCV] Fix -Wdeprecated-declarations in RISCVInstrInfo.cpp (NFC)
/Users/jiefu/llvm-project/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:2636:10: error: 'makeArrayRef<std::pair<llvm::MachineMemOperand::Flags, const char *>, 2UL>' is deprecated: Use deduction guide instead [-Werror,-Wdeprecated-declarations]
return makeArrayRef(TargetFlags);
^~~~~~~~~~~~
ArrayRef
/Users/jiefu/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:572:3: note: 'makeArrayRef<std::pair<llvm::MachineMemOperand::Flags, const char *>, 2UL>' has been explicitly marked deprecated here
LLVM_DEPRECATED("Use deduction guide instead", "ArrayRef")
^
/Users/jiefu/llvm-project/llvm/include/llvm/Support/Compiler.h:143:50: note: expanded from macro 'LLVM_DEPRECATED'
^
1 error generated.
Alex Zinenko [Sat, 22 Apr 2023 08:57:10 +0000 (08:57 +0000)]
[mlir] detensorize: don't accidentally convert function entry blocks
In the Linalg detensorize pass, dialect conversion could accidentally
trigger signature conversion of the function entry block after inlining
the body of a Linalg generic into it. Such a conversion is not desirable
because it would break the internal validity of the function op, that is
futhermore not supposed to be detensorized at the boundary. Mitigate
this by creating a dummy (empty) entry block so Linalg operations are
never inlined into it and the conversion is never triggered.
Closes #62249.
Reviewed By: silvas
Differential Revision: https://reviews.llvm.org/D148983