platform/upstream/llvm.git
15 months agoTableGen: Implement TypeSig generator in `Intrinsics.td`
NAKAMURA Takumi [Wed, 8 Mar 2023 23:38:52 +0000 (08:38 +0900)]
TableGen: Implement TypeSig generator in `Intrinsics.td`

This commit doesn't replace `IntrinsicEmitter::ComputeFixedEncoding()`,
but compares outputs to it, to make sure implementation correct.

Depends on D145871, D145872, D145874, and D146914

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

15 months agoTableGen: Prune convertInitListSlice and VarListElementInit
NAKAMURA Takumi [Sat, 11 Mar 2023 18:46:58 +0000 (03:46 +0900)]
TableGen: Prune convertInitListSlice and VarListElementInit

They were dedicated to constant version of list slice.

Depends on D147401

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

15 months agoTableGen: Let expressions available to list subscriptions and list slices
NAKAMURA Takumi [Sat, 4 Mar 2023 10:53:52 +0000 (19:53 +0900)]
TableGen: Let expressions available to list subscriptions and list slices

This enables indexing in `!foreach` and permutation with `list[permlist]`.

Enhancements in syntax:

  - `list<int>` is applicable as a slice element.
  - `list[int,]` is evaluated as not `ElemType` but `list<ElemType>`
    with a single element.

Part of D145872

FIXME: I didn't apply new semantics to BitSlice.

15 months agoReformat
NAKAMURA Takumi [Wed, 26 Apr 2023 13:36:40 +0000 (22:36 +0900)]
Reformat

15 months agoAdd failure testcases as llvm/test/TableGen/ListSlices-fail.td
NAKAMURA Takumi [Sat, 1 Apr 2023 22:43:18 +0000 (07:43 +0900)]
Add failure testcases as llvm/test/TableGen/ListSlices-fail.td

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

15 months agoTableGen/ProgRef.rst: Fix copypasto in the description of `!range`
NAKAMURA Takumi [Wed, 26 Apr 2023 13:53:57 +0000 (22:53 +0900)]
TableGen/ProgRef.rst: Fix copypasto in the description of `!range`

15 months ago[AMDGPU] Delete test for illegal v_cndmask_b16_dpp
Joe Nash [Tue, 25 Apr 2023 19:24:35 +0000 (15:24 -0400)]
[AMDGPU] Delete test for illegal v_cndmask_b16_dpp

There are no VOP2 or VOP2 with dpp forms of v_cndmask_b16. Delete the
test. NFC.

Reviewed By: critson

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

15 months ago[mlir][llvm] Use cached constants when importing landingpad instructions
Victor Perez [Wed, 26 Apr 2023 08:58:13 +0000 (09:58 +0100)]
[mlir][llvm] Use cached constants when importing landingpad instructions

Not using cached constants when importing instructions may lead to
undesired results, as breaking dominance rules in the translated MLIR
module.

Signed-off-by: Victor Perez <victor.perez@codeplay.com>
Differential Revision: https://reviews.llvm.org/D149247

15 months ago[AMDGPU] Fix negative offset values interpretation in getMemOperandsWithOffset for DS
Janek van Oirschot [Wed, 26 Apr 2023 13:05:06 +0000 (14:05 +0100)]
[AMDGPU] Fix negative offset values interpretation in getMemOperandsWithOffset for DS

The offset values may result in an erroneous scheduling of a load before write for a memory location if the offset values are represented as negative values in MIR, despite actually being unsigned values. This representation in MIR happens as SelectionDAG::getConstant could go through APInt to represent the encoding which assumes the MSB of the encoding as a sign-bit, regardless of whether it is supposed to be a signed value. The 8-bit negative (interpreted) value gets cast to an unsigned 32 bit value in getMemOperandsWithOffset used for comparisons in areMemAccessesTriviallyDisjoint eventually leading to an erroneous schedule in the machine scheduler.

Reviewed By: arsenm, foad

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

15 months ago[analyzer] Fix comparison logic in ArrayBoundCheckerV2
Donát Nagy [Fri, 14 Apr 2023 10:31:06 +0000 (12:31 +0200)]
[analyzer] Fix comparison logic in ArrayBoundCheckerV2

The prototype checker alpha.security.ArrayBoundV2 performs two
comparisons to check that in an expression like Array[Index]
    0 <= Index < length(Array)
holds. These comparisons are handled by almost identical logic: the
inequality is first rearranged by getSimplifiedOffsets(), then evaluated
with evalBinOpNN().

However the simplification used "naive" elementary mathematical
schematics, but evalBinOpNN() performed the signed -> unsigned
conversions described in the C/C++ standards, and this confusion led to
wildly inaccurate results: false positives from the lower bound check
and false negatives from the upper bound check.

This commit eliminates the code duplication by moving the comparison
logic into a separate function, then adds an explicit check to this
unified code path, which handles the problematic case separately.

In addition to this, the commit also cleans up a testcase that was
demonstrating the presence of this problem. Note that while that
testcase was failing with an overflow error, its actual problem was in
the underflow handler logic:
(0) The testcase introduces a five-element array "char a[5]" and an
    unknown argument "size_t len"; then evaluates "a[len+1]".
(1) The underflow check tries to determine whether "len+1 < 0" holds.
(2) This inequality is rearranged to "len < -1".
(3) evalBinOpNN() evaluates this with the schematics of C/C++ and
    converts -1 to the size_t value SIZE_MAX.
(4) The engine concludes that len == SIZE_MAX, because otherwise we'd
    have an underflow here.
(5) The overflow check tries to determine whether "len+1 >= 5".
(6) This inequality is rearranged to "len >= 4".
(7) The engine substitutes len == SIZE_MAX and reports that we have
    an overflow.

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

15 months ago[NFC] Wrap entire debug logging loop in LLVM_DEBUG
Jordan Rupprecht [Wed, 26 Apr 2023 12:28:15 +0000 (05:28 -0700)]
[NFC] Wrap entire debug logging loop in LLVM_DEBUG

15 months ago[DebugLocEntry][nfc] Remove redundant cast
Felipe de Azevedo Piovezan [Tue, 25 Apr 2023 19:06:10 +0000 (15:06 -0400)]
[DebugLocEntry][nfc] Remove redundant cast

A cast from DIExpression->DIExpression is not needed.

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

15 months ago[Support][Parallel] Add sequential mode to TaskGroup::spawn().
Alexey Lapshin [Tue, 18 Apr 2023 18:22:55 +0000 (20:22 +0200)]
[Support][Parallel] Add sequential mode to TaskGroup::spawn().

This patch allows to specify that some part of tasks should be
done in sequential order. It makes it possible to not use
condition operator for separating sequential tasks:

TaskGroup tg;
for () {
  if(condition)      ==>   tg.spawn([](){fn();}, condition)
    fn();
  else
    tg.spawn([](){fn();});
}

It also prevents execution on main thread. Which allows adding
checks for getThreadIndex() function discussed in D142318.

The patch also replaces std::stack with std::deque in the
ThreadPoolExecutor to have natural execution order in case
(parallel::strategy.ThreadsRequested == 1).

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

15 months ago[LangRef] Improve wording DW_OP_LLVM_entry_value
Felipe de Azevedo Piovezan [Tue, 25 Apr 2023 15:08:13 +0000 (11:08 -0400)]
[LangRef] Improve wording DW_OP_LLVM_entry_value

This commit simplifies the text of DW_OP_LLVM_entry_value by making it
terser, replacing a verbose example with a more concrete one, providing
an explicit conclusion on the meaning of N=1, and by transforming the
description of which passes generate this op into a list (which enables
future expansion of this list).

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

15 months ago[AMDGPU][Disassembler] Fix a spurious error message in an instruction comment.
Ivan Kosarev [Wed, 26 Apr 2023 11:21:50 +0000 (12:21 +0100)]
[AMDGPU][Disassembler] Fix a spurious error message in an instruction comment.

The patch prevents pollution of instruction comments with error messages
generated during unsuccessful decoding attempts.

Reviewed By: foad

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

15 months ago[AMDGPU][Disassembler] Pre-commit a test on an error message generated in an instruct...
Ivan Kosarev [Mon, 24 Apr 2023 09:16:29 +0000 (10:16 +0100)]
[AMDGPU][Disassembler] Pre-commit a test on an error message generated in an instruction comment.

15 months ago[X86] Handle multiple use freeze(undef) in LowerAVXCONCAT_VECTORS as zero vectors
Simon Pilgrim [Wed, 26 Apr 2023 11:32:57 +0000 (12:32 +0100)]
[X86] Handle multiple use freeze(undef) in LowerAVXCONCAT_VECTORS as zero vectors

Replacement for D144903

If we're concatenating freeze(undef) subvector ops with multiple uses then we can't treat them as a wider freeze(undef), but we can replace them with a zero subvector, which is cheap on AVX

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

15 months ago[Test] Add test showing bug in SCEV::getBackedgeTakenInfo (NFC)
Dmitry Makogon [Wed, 26 Apr 2023 11:20:14 +0000 (18:20 +0700)]
[Test] Add test showing bug in SCEV::getBackedgeTakenInfo (NFC)

Test for https://github.com/llvm/llvm-project/issues/62380/.

15 months ago[flang]Add more tests for loop versioning
Mats Petersson [Tue, 18 Apr 2023 17:39:33 +0000 (18:39 +0100)]
[flang]Add more tests for loop versioning

These two tests were created from little snippets added late
in the review of the loop versioning work. The code was fixed
to cope with the situation and correctly compile these samples.

This adds tests to avoid regressions in this area.

Reviewed By: tblah

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

15 months ago[clangd] Fix the window buildbot test failures
Haojian Wu [Wed, 26 Apr 2023 10:59:45 +0000 (12:59 +0200)]
[clangd] Fix the window buildbot test failures

15 months ago[analyzer] Show taint origin and propagation correctly
Daniel Krupp [Fri, 3 Mar 2023 11:33:18 +0000 (12:33 +0100)]
[analyzer] Show taint origin and propagation correctly

This patch improves the diagnostics of the alpha.security.taint.TaintPropagation
checker and taint related checkers by showing the "Taint originated here" note
at the correct place, where the attacker may inject it. This greatly improves
the understandability of the taint reports.

In the baseline the taint source was pointing to an invalid location, typically
somewhere between the real taint source and sink.

After the fix, the "Taint originated here" tag is correctly shown at the taint
source. This is the function call where the attacker can inject a malicious data
(e.g. reading from environment variable, reading from file, reading from
standard input etc.).

This patch removes the BugVisitor from the implementation and replaces it with 2
new NoteTags. One, in the taintOriginTrackerTag() prints the "taint originated
here" Note and the other in taintPropagationExplainerTag() explaining how the
taintedness is propagating from argument to argument or to the return value
("Taint propagated to the Xth argument"). This implementation uses the
interestingess BugReport utility to track back the tainted symbols through
propagating function calls to the point where the taintedness was introduced by
a source function call.

The checker which wishes to emit a Taint related diagnostic must use the
categories::TaintedData BugType category and must mark the tainted symbols as
interesting. Then the TaintPropagationChecker will automatically generate the
"Taint originated here" and the "Taint propagated to..." diagnostic notes.

15 months ago[LoopDistribute] Convert tests to opaque pointers (NFC)
Nikita Popov [Wed, 26 Apr 2023 10:29:50 +0000 (12:29 +0200)]
[LoopDistribute] Convert tests to opaque pointers (NFC)

15 months ago[Assignment Tracking] Remove overly defensive AllocaInst assertion
OCHyams [Wed, 26 Apr 2023 10:15:37 +0000 (11:15 +0100)]
[Assignment Tracking] Remove overly defensive AllocaInst assertion

Remove assert from AssignmentTrackingAnalysis that fires if a local variable
has non-alloca storage. The analysis can emit these locations but the
assignment tracking code in SelectionDAG isn't ready to handle non-alloca
storage for locals yet. The AssignmentTrackingPass (pass that adds assignment
tracking metadata) ignores non-alloca dbg.declares, so the only variables
affected are those who's backing storage is changed from an alloca during
optimisation, and the result is the variables are dropped.

Fixes: https://ci.chromium.org/ui/p/pigweed/builders/toolchain/
                 toolchain-ci-pigweed-linux/b8783274592206481489/overview

Reviewed By: StephenTozer

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

15 months agoValueTracking: Handle frem in computeKnownFPClass
Matt Arsenault [Tue, 18 Apr 2023 22:14:21 +0000 (18:14 -0400)]
ValueTracking: Handle frem in computeKnownFPClass

I barely understand what this does, but try to
handle the last case required to delete cannotBeOrderedLessThanZeroImpl.
Also improve by following fdiv handling for nans and identical operand case.

15 months agoValueTracking: Add new tests for computeKnownFPClass copysign handling
Matt Arsenault [Tue, 25 Apr 2023 16:22:36 +0000 (12:22 -0400)]
ValueTracking: Add new tests for computeKnownFPClass copysign handling

It's currently broken

15 months agoValueTracking: fdiv sign handling in computeKnownFPClass
Matt Arsenault [Tue, 18 Apr 2023 11:36:37 +0000 (07:36 -0400)]
ValueTracking: fdiv sign handling in computeKnownFPClass

Copy what cannotBeOrderedLessThanZeroImpl checks for fdiv.

15 months agoValueTracking: Add baseline tests for frem computeKnownFPClass
Matt Arsenault [Tue, 18 Apr 2023 22:57:15 +0000 (18:57 -0400)]
ValueTracking: Add baseline tests for frem computeKnownFPClass

15 months ago[Assignment Tracking] Fix faulty assertion inside std::sort predicate
OCHyams [Wed, 26 Apr 2023 09:53:57 +0000 (10:53 +0100)]
[Assignment Tracking] Fix faulty assertion inside std::sort predicate

The vectors being sorted here shouldn't contain duplicate entries. Prior to
this patch this was checked with an assert within the `std::sort`
predicate. However, `std::sort` may compare an element against itself which
causes the assert to fire (false positive). Move the assert outside of the sort
predicate to avoid such issues.

Reviewed By: StephenTozer

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

15 months ago[mlir][test][Integration] Refactor Arm emulator configuration
Cullen Rhodes [Wed, 26 Apr 2023 08:07:44 +0000 (08:07 +0000)]
[mlir][test][Integration] Refactor Arm emulator configuration

The logic enabling the Arm SVE (and now SME) integration tests for
various dialects, that may run under emulation, is now duplicated in
several places.

This patch moves the configuration to the top-level MLIR integration
tests Lit config and renames the '%lli' substitution in contexts where
it will run exclusively (ArmSVE, ArmSME) on AArch64 (and possibly under
emulation) to '%lli_aarch64_cmd', and '%lli_host_or_aarch64_cmd' for
contexts where it may run AArch64 (also possibly under emulation). The
latter is for integration tests that have target-specific and
target-agnostic codepaths such as SparseTensor, which supports scalable
vectors.

The two substitutions have the same effect but the names are different to
convey this information. The '%lli_aarch64_cmd' substitution could be
used in the SparseTensor tests but that would be a misnomer if the host
were x86 and the MLIR_RUN_SVE_TESTS=OFF.

The reason for renaming the '%lli' substitution is to not prevent running other
target-specific integration tests at the same time, since the same substitution
'%lli' is used for lli in other integration tests:

  * mlir/test/Integration/Dialect/Vector/CPU/X86Vector              - (AVX emulation via Intel SDE)
  * mlir/test/Integration/Dialect/Vector/CPU/AMX                    - (AMX emulation via Intel SDE)
  * mlir/test/Integration/Dialect/LLVMIR/CPU/test-vp-intrinsic.mlir - (RISCV emulation via QEMU if supported, native otherwise)

and substituting '%lli' at the top-level with Arm specific logic would override
this.

Reviewed By: awarzynski

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

15 months agoFix docs bot after D140989
OCHyams [Wed, 26 Apr 2023 09:51:28 +0000 (10:51 +0100)]
Fix docs bot after D140989

Commit a93c4239719382e5b17335f3452e9095937ed6b7 broke docs buildbot:
https://lab.llvm.org/buildbot/#/builders/30/builds/34525

15 months ago[llvm][docs] Correct chose to choose in the builder docs
David Spickett [Wed, 26 Apr 2023 09:47:11 +0000 (09:47 +0000)]
[llvm][docs] Correct chose to choose in the builder docs

15 months ago[X86] LowerBUILD_VECTOR - fold build_vector(undef,freeze(undef),zero) -> zero vector
Simon Pilgrim [Wed, 26 Apr 2023 09:44:49 +0000 (10:44 +0100)]
[X86] LowerBUILD_VECTOR - fold build_vector(undef,freeze(undef),zero) -> zero vector

426db6b4eb2e9298598 added the build_vector(undef,freeze(undef)) -> freeze(undef) fold, but failed to account for cases where the scalar freeze(undef) had multiple uses, in those cases we can only only safely fold to a zero vector

https://alive2.llvm.org/ce/z/87jG8K

15 months ago[DebugInfo] Update SourceLevelDebugging.rst to better explain kill locations
OCHyams [Wed, 26 Apr 2023 09:27:40 +0000 (10:27 +0100)]
[DebugInfo] Update SourceLevelDebugging.rst to better explain kill locations

Reviewed By: scott.linder, jryans

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

15 months agoFix buildbots after D140901
OCHyams [Wed, 26 Apr 2023 09:24:06 +0000 (10:24 +0100)]
Fix buildbots after D140901

Commit 3feea34d77f65f0b68520bb7bf372580a72794ad (D140901) should not have
removed the debug label handling code.

Buildbot: https://lab.llvm.org/buildbot/#/builders/139/builds/39813

15 months agoValueTracking: Improve trunc handling in computeKnownFPClass
Matt Arsenault [Mon, 17 Apr 2023 14:18:25 +0000 (10:18 -0400)]
ValueTracking: Improve trunc handling in computeKnownFPClass

15 months agoValueTracking: Handle powi in computeKnownFPClass
Matt Arsenault [Sun, 9 Apr 2023 11:16:04 +0000 (07:16 -0400)]
ValueTracking: Handle powi in computeKnownFPClass

Extract the handling from cannotBeOrderedLessThanZeroImpl and
avoid the mentioned -0 bug.

15 months agoValueTracking: Add baseline tests for powi computeKnownFPClass
Matt Arsenault [Tue, 18 Apr 2023 16:32:50 +0000 (12:32 -0400)]
ValueTracking: Add baseline tests for powi computeKnownFPClass

15 months agoValueTracking: Implement computeKnownFPClass for log
Matt Arsenault [Sun, 9 Apr 2023 11:15:20 +0000 (07:15 -0400)]
ValueTracking: Implement computeKnownFPClass for log

15 months agoValueTracking: Add baseline tests for log computeKnownFPClass
Matt Arsenault [Mon, 17 Apr 2023 17:51:18 +0000 (13:51 -0400)]
ValueTracking: Add baseline tests for log computeKnownFPClass

15 months agoValueTracking: Add computeKnownFPClass baseline tests for rounding intrinsics
Matt Arsenault [Mon, 10 Apr 2023 12:22:29 +0000 (08:22 -0400)]
ValueTracking: Add computeKnownFPClass baseline tests for rounding intrinsics

15 months ago[RISCV][NFC] Remove outdated TODOs about extension versions in RISCVISAInfo
Alex Bradbury [Wed, 26 Apr 2023 08:56:14 +0000 (09:56 +0100)]
[RISCV][NFC] Remove outdated TODOs about extension versions in RISCVISAInfo

As was documented in D147183, we don't currently intend to support
multiple versions of specifications simultaneously. While external
circumstances might mean exceptions to this are needed, the TODOs about
reflecting version numbers in the feature strings no longer make sense.

15 months ago[DebugInfo] Do not delete debug intrinsics with empty metadata operands
OCHyams [Wed, 26 Apr 2023 08:11:41 +0000 (09:11 +0100)]
[DebugInfo] Do not delete debug intrinsics with empty metadata operands

A ValueAsMetadata may be replaced with nullptr for several reasons including
deleting (certain) 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 removes the deletion logic from wouldInstructionBeTriviallyDead.

Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value

Reviewed By: StephenTozer

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

15 months ago[clang[[Interp][NFC] Make some Descriptor pointers const
Timm Bäder [Wed, 26 Apr 2023 08:52:01 +0000 (10:52 +0200)]
[clang[[Interp][NFC] Make some Descriptor pointers const

15 months ago[Sema] Fix _Alignas/isCXX11Attribute() FIXME
Richard Sandiford [Tue, 25 Apr 2023 12:16:29 +0000 (13:16 +0100)]
[Sema] Fix _Alignas/isCXX11Attribute() FIXME

When doing https://reviews.llvm.org/D148105 , I hadn't noticed that
there was also a FIXME about the misclassification of _Alignas in
ProcessDeclAttribute.

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

15 months ago[clangd] Deduplicate missing-include findings
Kadir Cetinkaya [Tue, 25 Apr 2023 16:50:20 +0000 (18:50 +0200)]
[clangd] Deduplicate missing-include findings

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

15 months ago[JITLink][AArch64] Implement R_AARCH64_CONDBR19
Job Noorman [Wed, 26 Apr 2023 07:44:35 +0000 (09:44 +0200)]
[JITLink][AArch64] Implement R_AARCH64_CONDBR19

This relocation is used for the 19-bit immediate in conditional branch
and compare and branch instructions.

Reviewed By: lhames

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

15 months ago[DebugInfo] Treat empty metadata operands the same as undef operands in SelectionDAG
OCHyams [Tue, 25 Apr 2023 16:19:44 +0000 (17:19 +0100)]
[DebugInfo] Treat empty metadata operands the same as undef operands in SelectionDAG

Without this patch SelectionDAG silently drops dbg.values using `!{}` operands.

Related to https://discourse.llvm.org/t/auto-undef-debug-uses-of-a-deleted-value

Reviewed By: StephenTozer

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

15 months ago[InstSimplify] with logical ops: (X & Y) == -1 ? X : -1 --> -1
Zhongyunde [Wed, 26 Apr 2023 07:52:28 +0000 (15:52 +0800)]
[InstSimplify] with logical ops: (X & Y) == -1 ? X : -1 --> -1

Use simplifySelectWithICmpEq to handle the implied equalities from the icmp-and,
then both of ICMP_NE and ICMP_EQ will be addressed including vector type.
    (X & Y) == -1 ?  X : -1 --> -1 (commuted 2 ways)
    (X & Y) != -1 ? -1 :  X --> -1 (commuted 2 ways)
This is a supplement to the icmp-or scenario on D148986.

Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149229

15 months ago[tests] precommit tests for D149229
Zhongyunde [Wed, 26 Apr 2023 07:48:32 +0000 (15:48 +0800)]
[tests] precommit tests for D149229

Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D149230

15 months ago[LoopVectorize] Preserve SCEV
Nikita Popov [Tue, 25 Apr 2023 10:20:52 +0000 (12:20 +0200)]
[LoopVectorize] Preserve SCEV

As far as I can tell, LoopVectorize preserves SCEV, mainly by dint
of forgetting the loop being vectorized. We should mark it as
preserved in the pass manager.

This is a very small compile-time improvement.

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

15 months ago[clang][Interp] Fix post-inc/dec operator result
Timm Bäder [Fri, 21 Apr 2023 07:52:43 +0000 (09:52 +0200)]
[clang][Interp] Fix post-inc/dec operator result

We pushed the wrong value on the stack, always leaving a 0 behind.

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

15 months ago[LICM] Don't try to constant fold instructions
Nikita Popov [Tue, 25 Apr 2023 08:04:49 +0000 (10:04 +0200)]
[LICM] Don't try to constant fold instructions

This was introduced in 030f02021b6359ec5641622cf1aa63d873ecf55a as
an alleged compile-time optimization. In reality, trying to constant
fold instructions is more expensive than just hoisting them. In a
standard pipeline, LICM tends to run either after a run of
LoopInstSimplify or InstCombine, so LICM doesn't really see constant
foldable instructions in the first place, and the attempted fold
is futile.

This makes for a very minor compile-time improvement.

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

15 months ago[clang-tidy] Modernize ClangTidyValue (NFC)
Kazu Hirata [Wed, 26 Apr 2023 06:58:24 +0000 (23:58 -0700)]
[clang-tidy] Modernize ClangTidyValue (NFC)

15 months ago[llvm] Replace None with std::nullopt in comments (NFC)
Kazu Hirata [Wed, 26 Apr 2023 06:53:32 +0000 (23:53 -0700)]
[llvm] Replace None with std::nullopt in comments (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

15 months ago[test][sanitizer] Use both allocators in test
Vitaly Buka [Wed, 26 Apr 2023 06:20:32 +0000 (23:20 -0700)]
[test][sanitizer] Use both allocators in test

15 months ago[TailDuplicator] Don't constrain register classes due to debug instructions
Mikael Holmen [Fri, 21 Apr 2023 09:30:28 +0000 (11:30 +0200)]
[TailDuplicator] Don't constrain register classes due to debug instructions

If cloning a DBG_VALUE instruction, register uses in that instruction could
lead to constraining of a virtual register that would not happen if the
DBG_VALUE was not present at all. This lead to different code with/without
debug info.

Now we only do that register class constraining if we dealing with a non
debug instruction.

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

15 months agoAdd entry to mailmap
Med Ismail Bennani [Wed, 26 Apr 2023 06:14:29 +0000 (23:14 -0700)]
Add entry to mailmap

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
15 months ago[lldb] Add entry to code owner
Med Ismail Bennani [Wed, 26 Apr 2023 06:14:02 +0000 (23:14 -0700)]
[lldb] Add entry to code owner

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
15 months ago[X86] Remove unused SmallString. Fold a Twine local variable into call. NFC
Craig Topper [Wed, 26 Apr 2023 05:33:58 +0000 (22:33 -0700)]
[X86] Remove unused SmallString. Fold a Twine local variable into call. NFC

15 months ago[clang-repl] Only enable dynamic-library test on x86_64
Anubhab Ghosh [Wed, 26 Apr 2023 04:15:03 +0000 (09:45 +0530)]
[clang-repl] Only enable dynamic-library test on x86_64

This test includes a precompiled library for x86_64 Linux

15 months ago[MemRefToLLVM] Add a method in MemRefDescriptor to get the buffer addr
Quentin Colombet [Fri, 21 Apr 2023 18:09:25 +0000 (20:09 +0200)]
[MemRefToLLVM] Add a method in MemRefDescriptor to get the buffer addr

This patch pushes the computation of the start address of a memref in one
place (a method in MemRefDescriptor.)

This allows all the (indirect) users of this method to produce the start
address in the same way.

Thanks to this change, we expose more CSEs opportunities and thanks to
that, the backend is able to properly find the `llvm.assume` expression
related to the base address as demonstrated in the added test.

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

15 months ago[RISCV] Remove one use restriction on the scalar from combineBinOpToReduce.
Craig Topper [Wed, 26 Apr 2023 04:10:58 +0000 (21:10 -0700)]
[RISCV] Remove one use restriction on the scalar from combineBinOpToReduce.

If multiple reductions use the neutral start value, this prevented
us from optimizing any of them.

This increases the number of scalar->vector operations but reduces
the number of scalar operations.

Note, we were already inconsistent about the one use check when we
peeked through INSERT_SUBVECTORs.

Reviewed By: fakepaper56

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

15 months ago[MemRefToLLVM] Fix the lowering of memref.assume_alignment
Quentin Colombet [Thu, 20 Apr 2023 19:29:29 +0000 (21:29 +0200)]
[MemRefToLLVM] Fix the lowering of memref.assume_alignment

`memref.assume_alignment` annotates the alignment of the source buffer
not the base pointer.
Put diffrently, prior to this patch `memref.assume_alignment` would lower
to `llvm.assume %buffer.base.isAligned(X)` whereas what we want is
`llvm.assume (%buffer.base + %buffer.offset).isAligned(X)`.
In other words, we were missing to include the offset in the expression
checked by the `llvm.assume`.

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

15 months ago[flang][openacc] Add support for allocatable and pointer in data operand
Valentin Clement [Wed, 26 Apr 2023 04:05:53 +0000 (21:05 -0700)]
[flang][openacc] Add support for allocatable and pointer in data operand

Add lowering support for allocatable and pointer array sections
to acc.bounds and acc data operations.

Reviewed By: razvanlupusoru

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

15 months ago[clang-repl] Fix dynamic library test to avoid cstdio and linker
Anubhab Ghosh [Sat, 22 Apr 2023 13:44:29 +0000 (19:14 +0530)]
[clang-repl] Fix dynamic library test to avoid cstdio and linker

Some platforms do not have a working linker present. The goal is to
only test the loading of a shared library in clang-repl. A precompiled
library is used instead.

The cstdio header may also not be present. We only need printf.

Related discussion in D141824

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

15 months agoFix path on Windows for test modified in daad48d.
Douglas Yung [Wed, 26 Apr 2023 03:28:07 +0000 (20:28 -0700)]
Fix path on Windows for test modified in daad48d.

This should fix the failure on the PS5 Windows build bot.

15 months ago[NFC][HWASAN] Check TagMaskByte instead of TargetTriple
Vitaly Buka [Wed, 26 Apr 2023 02:59:25 +0000 (19:59 -0700)]
[NFC][HWASAN] Check TagMaskByte instead of TargetTriple

We need to apply mask for x86_64 because the mask is not full byte. So
instead checking the arch we can check the mask.

15 months ago[NFC][HWASAN] Fix top comment
Vitaly Buka [Wed, 26 Apr 2023 02:57:19 +0000 (19:57 -0700)]
[NFC][HWASAN] Fix top comment

15 months ago[sanitizer-common] Expand testing for 56-bit address spaces
Thurston Dang [Tue, 25 Apr 2023 18:17:32 +0000 (18:17 +0000)]
[sanitizer-common] Expand testing for 56-bit address spaces

This patch adds mmap_56bit_test.c, which attempts to deliberately
mmap above 2^47. This currently exposes a failure on ASan on
systems with 56-bit user address spaces, because it allows an mmap
above 2^47 but the shadow mapping is only set up for a 2^47 user address
space.

Additionally, this patch moves pie_no_aslr from the tsan tests into
sanitizer-common, for greater test coverage.

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

15 months ago[mlir][arith] Add initial integer bitwidth narrowing pass
Jakub Kuderski [Wed, 26 Apr 2023 02:25:11 +0000 (22:25 -0400)]
[mlir][arith] Add initial integer bitwidth narrowing pass

This pass reduces the logical complexity of arith ops by choosing
narrowest supported operand bitwidth. On some targets like mobile GPUs,
narrower bitwidths also bring better runtime performance.

The first batch of rewrites handles a simple case of `arith.sitofp`
and `arith.uitofp` with zero/sign-extended inputs. In future revisions,
I plan to extend it with the following:
-  Propagating sign/zero-extensions through bit-pattern-preserving ops,
   e.g., vector transpose, broadcast, insertions/extractions.
-  Handling `linalg.index` using the `ValueBounds` interface.
-  Handling more arith ops.

Reviewed By: springerm, antiagainst

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

15 months ago[RISCV] Custom lowering of llvm.is.fpclass
LiaoChunyu [Wed, 26 Apr 2023 00:38:45 +0000 (08:38 +0800)]
[RISCV] Custom lowering of llvm.is.fpclass

This patch supports FCLASS.S, FCLASS.H and FCLASS.D.

Reviewed By: craig.topper

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

15 months ago[RISCV] Disable combineBinOpToReduce if the reduction AVL might be 0.
Craig Topper [Wed, 26 Apr 2023 01:46:54 +0000 (18:46 -0700)]
[RISCV] Disable combineBinOpToReduce if the reduction AVL might be 0.

If the reduction AVL is 0, operand 0 of the reduction will be
returned rather than the scalar input.

To make the fold legal, we would need to fold the new scalar value
with whatever operand 0 is which may require a new scalar operation
before the reduction.

Block the combine if we can't prove AVL is non-zero.

Reviewed By: fakepaper56

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

15 months ago[NFC][hwasan] Add const to static array
Vitaly Buka [Sun, 23 Apr 2023 02:43:07 +0000 (19:43 -0700)]
[NFC][hwasan] Add const to static array

15 months ago[nfc] Fix headers comment
Vitaly Buka [Sun, 23 Apr 2023 00:53:26 +0000 (17:53 -0700)]
[nfc] Fix headers comment

15 months ago[FuzzMutate] Correct type cast and add unit test for FCmp
Zhenkai Weng [Fri, 21 Apr 2023 23:35:45 +0000 (16:35 -0700)]
[FuzzMutate] Correct type cast and add unit test for FCmp

This revision fixes an incorrect type cast from Instruction to ICmpInstr, which should have been to FCmpInstr instead. It turns out that StrategiesTest.cpp was missing a test case for InstModificationIRStrategy and FCmp, which is also now implemented in this revision. After this revision, [[ https://reviews.llvm.org/D148854 | llvm-stress in D148854 ]] no longer crashes randomly.

Reviewed By: Peter

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

15 months ago[FuzzMutate] Correct type cast and add unit test for FCmp
Peter Rong [Fri, 21 Apr 2023 23:50:39 +0000 (16:50 -0700)]
[FuzzMutate] Correct type cast and add unit test for FCmp

This revision fixes an incorrect type cast from Instruction to ICmpInstr, which should have been to FCmpInstr instead. It turns out that StrategiesTest.cpp was missing a test case for InstModificationIRStrategy and FCmp, which is also now implemented in this revision. After this revision, [[ https://reviews.llvm.org/D148854 | llvm-stress in D148854 ]] no longer crashes randomly.

Reviewed By: Peter

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

15 months ago[lldb] Fix another GCC build failure in ScriptedPythonInterface.h
Med Ismail Bennani [Wed, 26 Apr 2023 00:26:16 +0000 (17:26 -0700)]
[lldb] Fix another GCC build failure in ScriptedPythonInterface.h

In 6c961ae, I've introduced a new explicit fully specialized templated method
`ScriptedPythonInterface::ReverseTransform(bool&, PythonObject, Status&)`.

However, that explicit specialization is causing GCC to choke when
building the file as shown here:

https://lab.llvm.org/buildbot/#/builders/217/builds/20430

To address that issue, this patch turns the method explicit specialization
into an method overload.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
15 months ago[mlir][vector] Add pattern to break down vector.bitcast
Quinn Dawkins [Thu, 6 Apr 2023 20:45:59 +0000 (16:45 -0400)]
[mlir][vector] Add pattern to break down vector.bitcast

The pattern added here is intended as a last resort for targets like
SPIR-V where there are vector size restrictions and we need to be able
to break down large vector types. Vectorizing loads/stores for small
bitwidths (e.g. i8) relies on bitcasting to a larger element type and
patterns to bubble bitcast ops to where they can cancel.
This fails for cases such as
```
%1 = arith.trunci %0 : vector<2x32xi32> to vector<2x32xi8>
vector.transfer_write %1, %destination[%c0, %c0] {in_bounds = [true, true]} : vector<2x32xi8>, memref<2x32xi8>
```
where the `arith.trunci` op essentially does the job of one of the
bitcasts, leading to a bitcast that need to be further broken down
```
vector.bitcast %0 : vector<16xi8> to vector<4xi32>
```

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

15 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.

15 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

15 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.

15 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>
15 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>
15 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

15 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.

15 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

15 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>
15 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

15 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.

15 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.

15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>
15 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>