platform/upstream/llvm.git
14 months ago[lldb][NFCI] Remove unused swig macros
Alex Langford [Tue, 25 Apr 2023 23:45:19 +0000 (16:45 -0700)]
[lldb][NFCI] Remove unused swig macros

These should have been removed in 662548c82683.

14 months ago[libc] Fix sched_get_priority_max() syscall invocation
Tal Zussman [Tue, 25 Apr 2023 23:14:43 +0000 (16:14 -0700)]
[libc] Fix sched_get_priority_max() syscall invocation

Previously used SYS_sched_get_priority_min. This also updates the tests
for SCHED_RR and SCHED_FIFO to check max_priority > min_priority, rather
than >= in order to catch future breakages.

Reviewed By: michaelrj, goldstein.w.n

Differential Revision: https://reviews.llvm.org/D149102

14 months ago[bazel] Fix //libc:errno deps after d9f033146b47ceef94c1f041afcd339ef007279e.
Jorge Gorbe Moya [Tue, 25 Apr 2023 23:13:54 +0000 (16:13 -0700)]
[bazel] Fix //libc:errno deps after d9f033146b47ceef94c1f041afcd339ef007279e.

14 months ago[lldb/test] Fix test failure from missing decorator
Med Ismail Bennani [Tue, 25 Apr 2023 23:08:55 +0000 (16:08 -0700)]
[lldb/test] Fix test failure from missing decorator

This should fix a test failure in TestInteractiveScriptedProcess.py
caused by a missing decorator added in d0d902d.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
14 months ago[lldb/test] Disable Interactive Scripted Process test unless Darwin
Med Ismail Bennani [Tue, 25 Apr 2023 23:00:13 +0000 (16:00 -0700)]
[lldb/test] Disable Interactive Scripted Process test unless Darwin

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
14 months ago[mlir] reorgnize Linalg TransformOps files. NFC
Alex Zinenko [Wed, 12 Apr 2023 08:10:24 +0000 (08:10 +0000)]
[mlir] reorgnize Linalg TransformOps files. NFC

Mirror the separation between LinalgTransformOps and LinalgMatchOps in
headers. Create a separate pair of files for the extension.

Depends on D148017

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D148075

14 months ago[ThinLTOBitcodeWriter] Properly report when module is changed
Arthur Eubanks [Tue, 25 Apr 2023 22:23:14 +0000 (15:23 -0700)]
[ThinLTOBitcodeWriter] Properly report when module is changed

Happens with split LTO units.

Detected with upcoming changes.

14 months ago[CodeGen] Remove unneeded CoveragePrefixMap. NFC
Fangrui Song [Tue, 25 Apr 2023 22:21:15 +0000 (15:21 -0700)]
[CodeGen] Remove unneeded CoveragePrefixMap. NFC

14 months ago[lldb/test] Enable threads for TestInteractiveScriptedProcess.py (NFC)
Med Ismail Bennani [Tue, 25 Apr 2023 22:19:05 +0000 (15:19 -0700)]
[lldb/test] Enable threads for TestInteractiveScriptedProcess.py (NFC)

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
14 months ago-fdebug-prefix-map=: make the last win when multiple prefixes match
Fangrui Song [Tue, 25 Apr 2023 22:12:17 +0000 (15:12 -0700)]
-fdebug-prefix-map=: make the last win when multiple prefixes match

For
`clang -c -g -fdebug-prefix-map=a/b=y -fdebug-prefix-map=a=x a/b/c.c`,
we apply the longest prefix substitution, but
GCC has always been picking the last applicable option (`a=x`, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109591).

I feel that GCC's behavior is reasonable given the convention that the last
value wins for the same option.

Before D49466, Clang appeared to apply the shortest prefix substitution,
which likely made the least sense.

Reviewed By: #debug-info, scott.linder

Differential Revision: https://reviews.llvm.org/D148975

14 months ago[PGOInstrumentation] Properly report module modifications
Arthur Eubanks [Tue, 25 Apr 2023 22:09:30 +0000 (15:09 -0700)]
[PGOInstrumentation] Properly report module modifications

A global variable is added by the pass.

Detected by an upcoming change.

14 months ago[SCCP] Properly report modifications when deleting globals
Arthur Eubanks [Tue, 25 Apr 2023 22:07:40 +0000 (15:07 -0700)]
[SCCP] Properly report modifications when deleting globals

Detected by an upcoming change.

14 months ago[lldb/test] Consolidate interactive scripted process debugging test
Med Ismail Bennani [Tue, 25 Apr 2023 22:01:50 +0000 (15:01 -0700)]
[lldb/test] Consolidate interactive scripted process debugging test

This patch improve the interactive scripted process debugging test by
adding test coverage for child process breakpoint setting and execution
state change.

This patch introduces a new test case for a multiplexed launch, which
does the same thing as the simple passthrough launch. After the
multiplexer process stops, this new test launches 2 other scripted processes
that should contain respectively the even and odd threads from the
multiplexer scripted process.

Then, we create a breakpoint on one the child scripted process, make
sure it was set probably on the child process, the multiplexer process
and the real process. This also test the breakpoint name tagging at the
multiplexer level.

Finally, we resume the child process that had a breakpoint and make sure
that all the processes has stopped at the right location.

Differential Revision: https://reviews.llvm.org/D149179

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
14 months ago[lldb/test] Update lldbutil.fetch_next_event to match broadcaster class
Med Ismail Bennani [Tue, 25 Apr 2023 18:24:02 +0000 (11:24 -0700)]
[lldb/test] Update lldbutil.fetch_next_event to match broadcaster class

This patch updates the `lldbutil.fetch_next_event` helper function to
either match a specific broadcaster or match a whole broadcaster class.

This is very handy when testing process events for interactive scripted
process debugging.

This also fixes a bug in the failing case, where `SBEvent.GetDescription`
expects a `SBStream` argument. We never took that code path in the
original implementation so we didn't hit that bug.

Differential Revision: https://reviews.llvm.org/D149175

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
14 months ago[lldb] Improve breakpoint management for interactive scripted process
Med Ismail Bennani [Tue, 25 Apr 2023 22:03:15 +0000 (15:03 -0700)]
[lldb] Improve breakpoint management for interactive scripted process

This patch improves breakpoint management when doing interactive
scripted process debugging.

In other to know which process set a breakpoint, we need to do some book
keeping on the multiplexer scripted process. When initializing the
multiplexer, we will first copy breakpoints that are already set on the
driving target.

Everytime we launch or resume, we should copy breakpoints from the
multiplexer to the driving process.

When creating a breakpoint from a child process, it needs to be set both
on the multiplexer and on the driving process. We also tag the created
breakpoint with the name and pid of the originator process.

This patch also implements all the requirement to achieve proper
breakpoint management. That involves:

- Adding python interator for breakpoints and watchpoints in SBTarget
- Add a new `ScriptedProcess.create_breakpoint` python method

Differential Revision: https://reviews.llvm.org/D148548

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
14 months ago[lldb] Add an example of interactive scripted process debugging
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>
14 months ago[lldb/API] Add convenience constructor for SBError (NFC)
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>
14 months ago[lldb/Plugin] Add breakpoint setting support to ScriptedProcess
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>
14 months ago[lldb] Improve logging for process state change (NFC)
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>
14 months ago[lldb/Utility] Add opt-in shadow mode to event listeners
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>
14 months ago[lldb] Unify default/hijack listener between Process{Attach,Launch}Info (NFC)
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>
14 months ago[lldb] Move ScriptedProcess private state update to implementation
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>
14 months ago[lldb/API] Introduce SBProcess::ForceScriptedState method
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>
14 months ago[LegacyPM] Remove InjectTLIMappings and AssumeSimplify passes
Arthur Eubanks [Tue, 25 Apr 2023 21:34:24 +0000 (14:34 -0700)]
[LegacyPM] Remove InjectTLIMappings and AssumeSimplify passes

14 months ago[LV][NFC] Precommit test for a follow-up patch that introduces uniformity for a speci...
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

14 months ago[NFC][StructuralHash] Use hash_code
Arthur Eubanks [Tue, 25 Apr 2023 21:11:49 +0000 (14:11 -0700)]
[NFC][StructuralHash] Use hash_code

14 months ago[clang] add diagnose when member function contains invalid default argument
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

14 months ago[clang] Don't emit type tests for dllexport/import classes
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

14 months ago[SCEV] Do not plant SCEV checks unnecessarily
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

14 months agoRevert "[MLIR][python bindings] implement `replace_all_uses_with` on `PyValue`"
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

14 months ago[test] A test case for D146958
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

14 months ago[ThinLTO] Reduce pipeline clang test to avoid churn from LLVM changes
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.

14 months ago[flang][openacc] Add initial support to lower assumed size array in data operand
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

14 months ago[gn build] Port b42718dcecdd
LLVM GN Syncbot [Tue, 25 Apr 2023 20:18:23 +0000 (20:18 +0000)]
[gn build] Port b42718dcecdd

14 months agoFactor out split-dwarf test in Generic/empty.ll
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

14 months ago[LLDB][REPL] Destroy the repl instances correctly
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

14 months agoPreserve the address space for llvm.used and llvm.compiler.used global variables...
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

14 months agoRemove code only needed to detect a pre-4.0 API break.
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

14 months ago[SystemZ][z/OS] Create utility functions for converting between EBCDIC and UTF-8.
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

14 months ago[RISCV] Add test case showing failure to fold (fadd (reduce -0.0, X), Y) due to one...
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.

14 months ago[ConstraintElim] Port `mul nuw` for unsigned to `mul nsw` to signed.
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.

14 months ago[ConstraintElim] Split up test case to it easier for Alive2 to verify.
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.

14 months ago[MachO] Disable atexit()-based lowering when LTO'ing kernel/kext code
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

14 months ago[SCEV] Common code for computing trip count in a fixed type [NFC-ish]
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

14 months ago[ConstraintElim] Add tests for mul nsw and signed predicates.
Florian Hahn [Tue, 25 Apr 2023 18:51:23 +0000 (19:51 +0100)]
[ConstraintElim] Add tests for mul nsw and signed predicates.

14 months ago[libc] Fix including 'libc_errno.h' incorrectly
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.

14 months ago[libc][fix] Add missing 'errno' header for the GPU libc
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.

14 months ago[compiler-rt] [test] Add an .exe suffix for unit test executables on MinGW
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

14 months ago[RISCV] Rename hasNonZeroAVL->isNonZeroAVL. NFC
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.

14 months ago[bazel] Fix libc target deps after 7090c102731192d5abafb7e0b2b49adb4912efae
Jorge Gorbe Moya [Tue, 25 Apr 2023 17:46:58 +0000 (10:46 -0700)]
[bazel] Fix libc target deps after 7090c102731192d5abafb7e0b2b49adb4912efae

14 months ago[libc] Ignore 'errno' on the GPU and support 'atoi'
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

14 months ago[flang] Avoid dependency of runtime library on pthread for MinGW
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

14 months ago[flang] Account for .exe suffix in test/Driver/omp-driver-offload.f90.
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.

14 months ago[RISCV][NFC] Pull select->binop identities used in lowerSelect to a helper function
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.

14 months ago[docs] Update HowToReleaseLLVM documentation.
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

14 months ago[AArch64][SME] NFC: Fix comment in enum class
Cullen Rhodes [Tue, 25 Apr 2023 16:45:38 +0000 (16:45 +0000)]
[AArch64][SME] NFC: Fix comment in enum class

14 months ago[flang][runtime] Added Clang CMake modules include path.
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

14 months ago[DebugInfo] Treat empty metadata operands the same as undef operands
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

14 months agoFix codegen for initialization of global atomics
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.

14 months ago[DebugInfo] Replace UndefValue with PoisonValue in DIArgList::handleChangedOperand
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

14 months ago[mlir] ActionTracing: require ASSERTS for debugcounter test
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

14 months ago[AMDGPU] Do not handle _SGPR SMEM instructions in SILoadStoreOptimizer
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

14 months agoDisable private mapping test for AMD GPU due to intermittent fails.
Doru Bercea [Tue, 25 Apr 2023 14:05:07 +0000 (10:05 -0400)]
Disable private mapping test for AMD GPU due to intermittent fails.

14 months ago[mlir][llvm][test] Move exception-related tests to their own file
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

14 months ago[InstSimplify] with logical ops: (X | Y) ? 0 : X --> 0
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

14 months agoReapply [InstSimplify] Support all instructions in simplifyWithOpReplaced()
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.

14 months ago[tests] precommit tests for D148986
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

14 months ago[InstSimplify] Add test for select op replacement in phi (NFC)
Nikita Popov [Tue, 25 Apr 2023 13:40:43 +0000 (15:40 +0200)]
[InstSimplify] Add test for select op replacement in phi (NFC)

14 months agoTableGen: Introduce `!range` operator for half-opened interval
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

14 months agoReformat
NAKAMURA Takumi [Tue, 25 Apr 2023 13:35:33 +0000 (22:35 +0900)]
Reformat

14 months agoRevert "[DebugInfo] Print empty MDTuples wrapped in MetadataAsValue inline"
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

14 months ago[LoopVectorize] Convert test to opaque pointers (NFC)
Nikita Popov [Tue, 25 Apr 2023 13:20:36 +0000 (15:20 +0200)]
[LoopVectorize] Convert test to opaque pointers (NFC)

14 months ago[DebugInfo][CSInfo] Avoid crash when defining super-regs
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

14 months ago[DebugInfo] Print empty MDTuples wrapped in MetadataAsValue inline
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

14 months ago[MC] Eagerly skip zero-sized .fill fragments
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.

14 months ago[AMDGPU] Move GCN-specific stuff out of AMDGPUISelLowering. NFC.
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

14 months ago[flang][hlfir] inline hlfir.transpose as hlfir.elemental
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

14 months ago[flang][hlfir] get constant extents when possible
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

14 months ago[bazel] update build for MLIR test for c8d1388e6c8bd57299d5801f170719218f735c4c
Mikhail Goncharov [Tue, 25 Apr 2023 12:37:23 +0000 (14:37 +0200)]
[bazel] update build for MLIR test for c8d1388e6c8bd57299d5801f170719218f735c4c

14 months ago[SCEV] Regenerate test checks (NFC)
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".

14 months ago[MergeICmps] Adapt to non-eq comparisons, bugfix
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

14 months ago[RISCV][NFC] Fix typo in comment in RISCVISelLowering
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.

14 months ago[compiler-rt][test] Add `--large-address-aware` link flag for MinGW
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

14 months ago[compiler-rt][asan] Add report on intercept fail to more places
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

14 months ago[clangd] Add support TextDocumentEdit.
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

14 months ago[LoopReroll] Convert tests to opaque pointers (NFC)
Nikita Popov [Tue, 25 Apr 2023 10:55:36 +0000 (12:55 +0200)]
[LoopReroll] Convert tests to opaque pointers (NFC)

14 months ago[LoopReroll] Regenerate test checks (NFC)
Nikita Popov [Tue, 25 Apr 2023 10:55:21 +0000 (12:55 +0200)]
[LoopReroll] Regenerate test checks (NFC)

14 months ago[SCEV] Support sub in and negative constants willNotOverflow
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

14 months ago[LICM] Add additional "free instruction" tests (NFC)
Nikita Popov [Tue, 25 Apr 2023 08:51:25 +0000 (10:51 +0200)]
[LICM] Add additional "free instruction" tests (NFC)

14 months ago[SLP] Deduplicate loads subkey generator. NFCI
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

14 months ago[RISCV] Fix interleave crash on unary interleaves
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

14 months ago[LICM] Remove redundant test (NFC)
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.

14 months ago[LICM] Regenerate test checks (NFC)
Nikita Popov [Tue, 25 Apr 2023 08:06:39 +0000 (10:06 +0200)]
[LICM] Regenerate test checks (NFC)

14 months ago[LICM] Only forget loop/block dispositions
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.

14 months ago[mlir][ArmSME] Add tests for Streaming SVE
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

14 months ago[ValueMapper] allow mapping ConstantTargetNone to its layout type
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

14 months ago[MLIR][doc] Fix the [TOC] tag in two doc
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.

14 months ago[flang][runtime] Fix padding in CHARACTER(4) assignments.
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

14 months ago[flang][hlfir] Support fir.declare in AbstractResult pass
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

14 months ago[flang][hlfir] Lower NULL(MOLD) to a variable
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