platform/upstream/llvm.git
17 months ago[AArch64] Make stack tagging compatible with SLH
Kristof Beyls [Mon, 17 Apr 2023 09:19:26 +0000 (11:19 +0200)]
[AArch64] Make stack tagging compatible with SLH

See https://github.com/llvm/llvm-project/issues/61830

Speculative Load Hardening (SLH) requires that conditional branches are
implemented using B.cc branches, not using {TC}B{N}Z branches.

Stack tagging was expanding one of the pseudo instructions it uses to
cbnz. This commit changes that to use b.ne instead.

Note that the added regression test was added to settag.ll rather than
speculation-hardening.ll. The speculation-hardening.ll tests also check
that all tests in the file work with global-isel. It seems that stack
tagging does not work yet with global-isel. Therefore, testing the
combination of stack tagging and SLH hard to be added to a test file
that doesn't test global-isel, i.e. settag.ll

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

17 months ago[AArch64] Fix incorrect `isLegalAddressingMode`
Momchil Velikov [Thu, 20 Apr 2023 13:51:47 +0000 (14:51 +0100)]
[AArch64] Fix incorrect `isLegalAddressingMode`

`AArch64TargetLowering::isLegalAddressingMode` has a number of
defects, including accepting an addressing mode which consists of only
an immediate operand, or not checking the offset range for an
addressing mode in the form `1*ScaledReg + Offs`.

This patch fixes the above issues.

Reviewed By: dmgreen

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

Change-Id: I756fa21941844ded44f082ac7eea4391219f9851

17 months ago[mlir][irdl] Add IRDL registration
Mathieu Fehr [Thu, 20 Apr 2023 14:33:00 +0000 (15:33 +0100)]
[mlir][irdl] Add IRDL registration

This patch add support for loading IRDL dialects at runtime
with `mlir-opt`.

Given the following `dialect.irdl` file:
```mlir
module {
  irdl.dialect @cmath {
    irdl.type @complex {
      %0 = irdl.is f32
      %1 = irdl.is f64
      %2 = irdl.any_of(%0, %1)
      irdl.parameters(%2)
    }

    irdl.operation @norm {
      %0 = irdl.any
      %1 = irdl.parametric @complex<%0>
      irdl.operands(%1)
      irdl.results(%0)
    }
}
```

the IRDL file can be loaded with the `mlir-opt --irdl-file=dialect.irdl`
command, and the following file can then be parsed:

```mlir
func.func @conorm(%p: !cmath.complex<f32>, %q: !cmath.complex<f32>) -> f32 {
  %norm_p = "cmath.norm"(%p) : (!cmath.complex<f32>) -> f32
  %norm_q = "cmath.norm"(%q) : (!cmath.complex<f32>) -> f32
  %pq = arith.mulf %norm_p, %norm_q : f32
  return %pq : f32
}
```

To minimize the size of this patch, the operation, attribute, and type verifier are all always returning `success()`.

Depends on D144692

Reviewed By: rriddle, Mogball, mehdi_amini

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

17 months ago[ConstantFolding] Fix crash when folding vector llvm.is.fpclass
Jay Foad [Thu, 20 Apr 2023 14:03:47 +0000 (15:03 +0100)]
[ConstantFolding] Fix crash when folding vector llvm.is.fpclass

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

17 months ago[gn build] Port 4bc6499f8843
LLVM GN Syncbot [Thu, 20 Apr 2023 14:25:08 +0000 (14:25 +0000)]
[gn build] Port 4bc6499f8843

17 months ago[C11] Allow casting to an _Atomic-qualified type
Aaron Ballman [Thu, 20 Apr 2023 14:20:54 +0000 (10:20 -0400)]
[C11] Allow casting to an _Atomic-qualified type

We were failing to strip off atomic qualification when forming the cast
destination type, but properly stripping off cvr qualification. Now we
accept atomic, qualified, or unqualified destination types.

Note: the semantics of the cast still drop the qualifier, so such a
cast does not result in an atomic rvalue.

Fixes https://github.com/llvm/llvm-project/issues/39596

17 months agoAMDGPU: Fix assertion with multiple uses of f64 fneg of select
Matt Arsenault [Thu, 20 Apr 2023 12:00:02 +0000 (08:00 -0400)]
AMDGPU: Fix assertion with multiple uses of f64 fneg of select

A bitcast needs to be inserted back to the original type. Just
skip the multiple use case for a safer quick fix. Handling
the multiple use case seems to be beneficial in some but not
all cases.

17 months agoReapply D146987 "[Assignment Tracking] Enable by default"
OCHyams [Thu, 20 Apr 2023 13:51:58 +0000 (14:51 +0100)]
Reapply D146987 "[Assignment Tracking] Enable by default"

See https://discourse.llvm.org/t/rfc-enable-assignment-tracking/69399

This sets the -Xclang -fexperimental-assignment-tracking flag to the value
enabled which means it will be enabled so long as none of the following are
true: it's an LTO build, LLDB debugger tuning has been specified, or it's an O0
build (no work is done in any case if -g is not specified or -gmlt is used).

This reverts commit a65ca4546b9ee042d6c40149d3f820893edbd766 which reverts
https://reviews.llvm.org/D146987

17 months ago[libc++][NFC] Remove one apply_cv implementation
Nikolas Klauser [Sun, 16 Apr 2023 15:22:02 +0000 (17:22 +0200)]
[libc++][NFC] Remove one apply_cv implementation

Reviewed By: #libc, ldionne

Spies: arichardson, libcxx-commits

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

17 months ago[Clangd] Make the type hint length limit configurable
zhangyi1357 [Thu, 20 Apr 2023 10:13:44 +0000 (12:13 +0200)]
[Clangd] Make the type hint length limit configurable

This commit is about clangd's type name hint length limit. The past behavior was 32 characters fixed limit. It is now configurable.

Projects can now add the following config fragment to their .clangd:

```
InlayHints:
  TypeNameLimit: 34
```

Ref: [[ https://github.com/clangd/clangd/issues/1357  | Make the type hint length limit configurable ]]

Reviewed By: hokein

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

17 months ago[NFC] Return unique dbg intrinsics from findDbgValues and findDbgUsers
OCHyams [Thu, 20 Apr 2023 12:51:06 +0000 (13:51 +0100)]
[NFC] Return unique dbg intrinsics from findDbgValues and findDbgUsers

The out-param vector from findDbgValues and findDbgUsers should not include
duplicates, which is possible if the debug intrinsic uses the value multiple
times. This filter is already in place for multiple uses in a `DIArgLists`;
extend it to cover dbg.assigns too because a Value may be used in both the
address and value components.

Additionally, refactor the duplicated functionality between findDbgValues and
FindDbgUsers into a new function findDbgIntrinsics.

Reviewed By: jmorse, StephenTozer

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

17 months ago[LangRef] Update list of supported constant expressions (NFC)
Nikita Popov [Thu, 20 Apr 2023 12:33:06 +0000 (14:33 +0200)]
[LangRef] Update list of supported constant expressions (NFC)

For binary ops explicitly list all supported ops, as it's no
longer all of them.

17 months agoRevert "[ORC][LLJIT] Use JITLink by default on ELF/x86-64."
Nikita Popov [Thu, 20 Apr 2023 12:20:43 +0000 (14:20 +0200)]
Revert "[ORC][LLJIT] Use JITLink by default on ELF/x86-64."

This reverts commit 85c649bc02a6605f541b09b33a200a78275ed90f.

Has been causing test failures in OrcV2Examples for the past few
days.

17 months agoReapply [SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating
Nikita Popov [Wed, 22 Mar 2023 10:53:01 +0000 (11:53 +0100)]
Reapply [SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating

This exposed another miscompile in GVN, which was fixed by
20e9b31f88149a1d5ef78c0be50051e345098e41.

-----

After D141386, violation of nonnull, range and align metadata
results in poison rather than immediate undefined behavior,
which means that these are now safe to retain when speculating.
We only need to remove UB-implying metadata like noundef.

This is done by adding a dropUBImplyingAttrsAndMetadata() helper,
which lists the metadata which is known safe to retain on speculation.

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

17 months ago[Flang][MLIR] Alter Fir.GlobalOp to print and lower external attributes
Andrew Gozillon [Thu, 20 Apr 2023 12:05:17 +0000 (07:05 -0500)]
[Flang][MLIR] Alter Fir.GlobalOp to print and lower external attributes

Fir.GlobalOp's currently do not respect attributes that
are applied to them, this change will do two things:

- Allow lowering of arbitrary attributes applied to
Fir.GlobalOp's to LLVMGlobalOp's during CodeGen
- Allow printing and parsing of arbitrarily applied attributes

This allows applying other dialects attributes (or other
fir attributes) to fir.GlobalOps on the fly and have them
exist in the resulting LLVM dialect IR or FIR IR.

Reviewer: jeanPerier

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

17 months ago[C11] Allow initialization of an atomic-qualified pointer from a null pointer constant
Aaron Ballman [Thu, 20 Apr 2023 12:01:23 +0000 (08:01 -0400)]
[C11] Allow initialization of an atomic-qualified pointer from a null pointer constant

The relevant language rule from C11 is 6.5.16.1p1: "the left operand is
an atomic, qualified, or unqualified pointer, and the right is a null
pointer constant; or". We correctly handled qualified or unqualified
pointer types, but failed to handle atomic-qualified pointer types. Now
we look through the atomic qualification before testing the constraint
requirements.

Fixes https://github.com/llvm/llvm-project/issues/49563
Differential Revision: https://reviews.llvm.org/D148730

17 months ago[libc++] Adjust D_LIBCPP_ENABLE_ASSERTIONS defines in exception_guard tests
Louis Dionne [Wed, 19 Apr 2023 19:56:06 +0000 (15:56 -0400)]
[libc++] Adjust D_LIBCPP_ENABLE_ASSERTIONS defines in exception_guard tests

For the assert.FOO.pass.cpp test, we should be passing _LIBCPP_ENABLE_ASSERTIONS=1
for consistency, even though -D_LIBCPP_ENABLE_ASSERTIONS is equivalent.

For the other test, we shouldn't be forcing assertions to be enabled,
since we already have a CI job that enables assertions by default and
will do the right thing.

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

17 months ago[libc] use -O3 to compile memory functions
Guillaume Chatelet [Thu, 20 Apr 2023 11:35:43 +0000 (11:35 +0000)]
[libc] use -O3 to compile memory functions

17 months ago[mlir][llvm] Improve access group import handling.
Tobias Gysi [Thu, 20 Apr 2023 11:27:33 +0000 (11:27 +0000)]
[mlir][llvm] Improve access group import handling.

In particular, do not drop all access groups of a loop annotation
if one of them is unused. This change makes the access group import
robust against stale access group references in loop metadata.

Reviewed By: Dinistro

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

17 months ago[clang-format] Hanlde leading whitespaces for JSON files
Owen Pan [Thu, 20 Apr 2023 03:10:00 +0000 (20:10 -0700)]
[clang-format] Hanlde leading whitespaces for JSON files

Fixes #62228.
Fixes #62229.

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

17 months ago[FuncSpec] Relax restrictions on candidates for specialisation
Momchil Velikov [Thu, 20 Apr 2023 10:51:23 +0000 (11:51 +0100)]
[FuncSpec] Relax restrictions on candidates for specialisation

Allow a function to be specialised even if it has its address taken or
it's global. For such functions, consider all of the arguments as
overdefined. Don't delete the functions even if all the apparent calls
were redirected to specialised instances.

Reviewed By: labrinea, ChuanqiXu

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

17 months agoAMDGPU: Really invert handling of enqueued block detection
Matt Arsenault [Sun, 8 Jan 2023 17:05:27 +0000 (12:05 -0500)]
AMDGPU: Really invert handling of enqueued block detection

Remove the broken call graph analysis in the block enqueue lowering
pass. The previous iteration was reverted due to a runtime bug when
the completion action was unconditionally enabled.

17 months ago[GVN] Fix metadata combining for non-local loads
Nikita Popov [Thu, 20 Apr 2023 10:23:36 +0000 (12:23 +0200)]
[GVN] Fix metadata combining for non-local loads

Make MaterializeAdjustedValue() responsible for adjusting load
metadata in all cases, so it also covers the non-local case.

In conjunction with that, we no longer need to call
patchReplacementInstruction() for the local case, which would
unnecessarily drop metadata if the replacement value just happened
to be a load (without actual load CSE).

17 months ago[clang][Sema][NFC] Make a bunch of things const if possible
Timm Bäder [Wed, 19 Apr 2023 07:59:03 +0000 (09:59 +0200)]
[clang][Sema][NFC] Make a bunch of things const if possible

And some general code style cleanup.

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

17 months ago[IR] Remove dead code for unsupported ConstantExpr binops
Jay Foad [Thu, 20 Apr 2023 10:17:24 +0000 (11:17 +0100)]
[IR] Remove dead code for unsupported ConstantExpr binops

17 months ago[GVN] Add additional metadata combining tests (NFC)
Nikita Popov [Thu, 20 Apr 2023 10:17:31 +0000 (12:17 +0200)]
[GVN] Add additional metadata combining tests (NFC)

17 months ago[clang][Lex][NFC] Use a range for loop in StringLiteralParser
Timm Bäder [Wed, 19 Apr 2023 11:24:48 +0000 (13:24 +0200)]
[clang][Lex][NFC] Use a range for loop in StringLiteralParser

17 months ago[DAG] SimplifyVCastOp - ensure we select the correct value type from an SDValue operand
Simon Pilgrim [Thu, 20 Apr 2023 09:35:51 +0000 (10:35 +0100)]
[DAG] SimplifyVCastOp - ensure we select the correct value type from an SDValue operand

As reported on Issue #62234 - we weren't correctly using the SDValue operand to get its value type, resulting in a failure when it came from a SDNode with multiple results

We haven't been able to create a suitable upstream regression test, but its been confirmed by inspection by both myself and @topperc

Fixes #62234

17 months ago[clang][Sema][NFC] Use existing TargetInfo local variable
Timm Bäder [Wed, 19 Apr 2023 12:38:36 +0000 (14:38 +0200)]
[clang][Sema][NFC] Use existing TargetInfo local variable

17 months ago[AArch64][CostModel] Make sext/zext free if folded into a masked load
David Sherwood [Wed, 5 Apr 2023 12:58:03 +0000 (12:58 +0000)]
[AArch64][CostModel] Make sext/zext free if folded into a masked load

The BasicTTIImpl implementation of getCastInstrCost ensures
that the cost of zext/sext is 0 when following a load if we
know the combined extending load is legal. For SVE we can do
the same for masked loads too, since they use exactly the
same underlying instruction.

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

17 months ago[mlir][linalg][transform] PackGreedilyOp/TileToForallOp: Store payload ops in SmallVector
Matthias Springer [Thu, 20 Apr 2023 08:30:04 +0000 (17:30 +0900)]
[mlir][linalg][transform] PackGreedilyOp/TileToForallOp: Store payload ops in SmallVector

The TrackingListener removes ops from the internal transform dialect state when they are erased. At the same time, the `apply` interface method is iterating over all payload ops. Elements may not be removed from the state while iterating over the state.

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

17 months ago[LLDB] Discard register flags where the size doesn't match the register
David Spickett [Wed, 19 Apr 2023 13:20:06 +0000 (13:20 +0000)]
[LLDB] Discard register flags where the size doesn't match the register

In the particular case I was looking at I autogenerated a 128 bit set
of flags that is only 64 bit. This doesn't crash lldb but it was certainly
not expected.

I suspect that we would have crashed if the top 64 bits weren't
marked as unused (or at least invoked some very undefined behaviour).

When this happens, log the details and ignore the flags. Like this:
```
Size of register flags TTBR0_EL1_flags (16 bytes) for register TTBR0_EL1 does not match the register size (8 bytes). Ignoring this set of flags.
```

Turns out a few of the tests relied on this bug so I have updated
them and added a specific test for this case.

Reviewed By: jasonmolenda

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

17 months agoRecommit "[VPlan] Switch to checking sinking legality for recurrences in VPlan."
Florian Hahn [Thu, 20 Apr 2023 08:31:16 +0000 (09:31 +0100)]
Recommit "[VPlan] Switch to checking sinking legality for recurrences in VPlan."

This reverts the revert commit 3d8ed8b5192a59104bfbd5bf7ac84d035ee0a4a5.

The new version of the patch adds a set to avoid duplicating work in
isFixedOrderRecurrence, which was previously done through the removed
SinkAfter map.

Original commit message:
    Building on D142885 and D142589, retire the SinkAfter map from the
    recurrence handling code. It is replaced by checking whether it is
    possible to sink all users of a recurrence directly in VPlan. This
    results in simpler code overall and allows to handle additional cases
    (see the improvements in @test_crash).

    Depends on D142885.
    Depends on D142589.

    Reviewed By: Ayal

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

17 months ago[MsgPack] Add support for writing binary ELF doc nodes
Martin Dinkov [Tue, 8 Nov 2022 14:15:38 +0000 (09:15 -0500)]
[MsgPack] Add support for writing binary ELF doc nodes

Will be used for a front-end compiler
https://github.com/GPUOpen-Drivers/llpc
to insert a binary blob value into AMDGPU PAL metadata.

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

Change-Id: I90685883d1478335937218e6b1a569b1b26dc05a

17 months ago[RISCV] Remove VConstraintType enum and getConstraint. NFC
Craig Topper [Thu, 20 Apr 2023 07:20:19 +0000 (00:20 -0700)]
[RISCV] Remove VConstraintType enum and getConstraint. NFC

Fold the 3 flag defines into the enum that defines TSFlags. Then
we don't have to extract them we can just test the bits directly
in TSFlags.

Reviewed By: frasercrmck

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

17 months ago[RISCV] Let assembler accept vector memory operands that have an explicit 0 offset.
Craig Topper [Thu, 20 Apr 2023 07:19:24 +0000 (00:19 -0700)]
[RISCV] Let assembler accept vector memory operands that have an explicit 0 offset.

Binutils allows vector instructions with memory operands that
have an explicit 0 offset like 'vle8.v v0, 0(a0)'.

We already have support for this in the parser because the same
thing is allowed for atomics.

This patch changes the AsmOperand and AsmString for the vector
memory instructions to allow this.

Reviewed By: asb

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

17 months ago[clangd] Implement cross reference request for #include lines.
Viktoriia Bakalova [Fri, 31 Mar 2023 14:28:57 +0000 (14:28 +0000)]
[clangd] Implement cross reference request for #include lines.

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

17 months ago[bazel] Fix the bazel build for the "analysis" target for a443b3d18ef4.
Haojian Wu [Thu, 20 Apr 2023 07:02:29 +0000 (09:02 +0200)]
[bazel] Fix the bazel build for the "analysis" target for a443b3d18ef4.

A followup of the fix 46f5aaa82ca6fe2a307504444754ac535fb4760d

17 months ago[Flang][OpenMP] Add support for OpenMP MIN reduction
Kavitha Natarajan [Thu, 20 Apr 2023 05:48:26 +0000 (11:18 +0530)]
[Flang][OpenMP] Add support for OpenMP MIN reduction

This patch adds support for reduction of min-intrinsic for scalar
types. Min is lowered as a compare-select in the default lowering
flow for Flang. This pattern is matched and replaced with the
OpenMP dialect reduction operation.

Note: This is a temporary flow. The plan is to move to a flow
where the OpenMP reduction operation is inserted during lowering.

17 months ago[RISCV] Add scheduling for Zfa instructions
Jun Sha (Joshua) [Thu, 20 Apr 2023 05:46:34 +0000 (13:46 +0800)]
[RISCV] Add scheduling for Zfa instructions

Reviewed By: craig.topper

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

17 months ago[libc][math] Remove placeholder implementations of asin and pow.
Tue Ly [Thu, 20 Apr 2023 05:03:41 +0000 (01:03 -0400)]
[libc][math] Remove placeholder implementations of asin and pow.

Reviewed By: sivachandra

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

17 months ago[NewPM][AMDGPU] Port amdgpu-atomic-optimizer
Pravin Jagtap [Thu, 20 Apr 2023 04:27:47 +0000 (00:27 -0400)]
[NewPM][AMDGPU] Port amdgpu-atomic-optimizer

Reviewed By: arsenm, sameerds, gandhi21299

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

17 months ago[mlir][doc] Fix build after D148389
Mehdi Amini [Thu, 20 Apr 2023 04:12:46 +0000 (22:12 -0600)]
[mlir][doc] Fix build after D148389

The doc aren't part of the usual build, so this got unnoticed.

In c184dcb458 a dependency was added from the OpenACC on the LLVM
and Memref dialects, to generate the dialect doc we need to explicitly
ask for the `acc` dialect now.

17 months agoFix uninitialized class members
Akshay Khadse [Thu, 20 Apr 2023 02:03:36 +0000 (10:03 +0800)]
Fix uninitialized class members

Reviewed By: LuoYuanke

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

17 months ago[X86][Tablgen] Rename IgnoresVEX_W to IgnoresW, VEX_WIG to WIG, NFCI
Shengchen Kan [Thu, 20 Apr 2023 03:07:18 +0000 (11:07 +0800)]
[X86][Tablgen] Rename IgnoresVEX_W to IgnoresW, VEX_WIG to WIG, NFCI

We no longer distinguish REX.W from VEX.W in .td.

17 months ago[FuzzMutate] InsertFunctionStrategy
Peter Rong [Mon, 17 Apr 2023 20:57:29 +0000 (13:57 -0700)]
[FuzzMutate] InsertFunctionStrategy

InsertFunctionStrategy does two things:

1. Add a random function declaration or definition to the module. This would replace previously used `createEmptyFunction`.
2. Add a random function call between instructions.

Reviewed By: arsenm

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

17 months ago[Driver] Support response file on baremetal driver
Petr Hosek [Wed, 19 Apr 2023 23:55:20 +0000 (23:55 +0000)]
[Driver] Support response file on baremetal driver

All officially supported linkers should support response files and
this avoids issues when compiling on platforms such as Windows.

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

17 months ago[Driver] Support response file in Fuchsia driver
Petr Hosek [Thu, 20 Apr 2023 00:03:30 +0000 (00:03 +0000)]
[Driver] Support response file in Fuchsia driver

All officially supported linkers should support response files and
this avoids issues when compiling on platforms such as Windows.

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

17 months ago[X86] combineConcatVectorOps - remove FADD/FSUB/FMUL handling
Xiang1 Zhang [Tue, 11 Apr 2023 06:57:01 +0000 (14:57 +0800)]
[X86] combineConcatVectorOps - remove FADD/FSUB/FMUL handling

Reviewed By: RKSimon

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

17 months ago[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual
Jun Sha (Joshua) [Thu, 20 Apr 2023 02:32:24 +0000 (10:32 +0800)]
[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual

In order to match the latest ISA manual, we need to remove sx prefix.

Reviewed By: asb

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

17 months agoRevert '[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual'
Jun Sha (Joshua) [Thu, 20 Apr 2023 02:27:02 +0000 (10:27 +0800)]
Revert '[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual'

This reverts commit fbc63e5658f67036d4ea57940459074d9ecdd2d8

17 months ago[mlir][Affine][NFC] Wrap dialect in "affine" namespace
Matthias Springer [Thu, 20 Apr 2023 02:02:05 +0000 (11:02 +0900)]
[mlir][Affine][NFC] Wrap dialect in "affine" namespace

This cleanup aligns the affine dialect with all the other dialects.

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

17 months ago[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual
Jun Sha (Joshua) [Thu, 20 Apr 2023 02:19:14 +0000 (10:19 +0800)]
[RISCV] Remove 'sx' when parsing arch string to match the latest ISA manual

17 months ago[mlir][sparse] extend pack operation to support packing a batched COO type
Peiming Liu [Tue, 18 Apr 2023 22:33:25 +0000 (22:33 +0000)]
[mlir][sparse] extend pack operation to support packing a batched COO type

Reviewed By: aartbik

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

17 months ago[mlir][Memref] Fold nvgpu device cp.async on src memref to dst memref
Manish Gupta [Wed, 12 Apr 2023 01:00:58 +0000 (01:00 +0000)]
[mlir][Memref] Fold nvgpu device cp.async on src memref to dst memref

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

17 months ago[scudo] Support printing the status of cached blocks
Chia-hung Duan [Wed, 19 Apr 2023 22:58:36 +0000 (22:58 +0000)]
[scudo] Support printing the status of cached blocks

The output looks like,
  Stats: SharedTSDs: 2 available; total 8
    Shared TSD[0]:
      00 (    64): cached:   10 max:   26
      32 ( 65552): cached:    1 max:    2
    Shared TSD[1]:
      No block is cached.

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

17 months ago[libc] Fix not using the static library on amdgpu
Joseph Huber [Thu, 20 Apr 2023 01:05:30 +0000 (20:05 -0500)]
[libc] Fix not using the static library on amdgpu

Summary:
We have a CMake condition to not include this static library on NVPTX
because their linker doesn't support it. There was a typo that made this
trigger on all builds not just the NVPTX ones.

17 months ago[libc] Test the RPC interface with multiple blocks
Joseph Huber [Mon, 17 Apr 2023 12:09:59 +0000 (07:09 -0500)]
[libc] Test the RPC interface with multiple blocks

The RPC interface can support multiple independent clients. This support
currently only supports many single-thread warps / workgroups
coordinating over a single lock. This patch uses the support added in
the previous patch to test the RPC interface with multiple blocks.

Note that this does not work with multiple threads currently because of
the effect of warps / workgroups executing in lockstep incorrectly. This
will be added later.

Depends on D148485

Reviewed By: lntue, sivachandra

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

17 months ago[libc] Add a test to directly stimulate the RPC interface
Joseph Huber [Fri, 14 Apr 2023 14:24:00 +0000 (09:24 -0500)]
[libc] Add a test to directly stimulate the RPC interface

Currently, the RPC interface with the loader is only tested if the other
tests fail. This test adds a direct test that runs a simple integer
increment over the RPC handshake 10000 times.

Depends on https://reviews.llvm.org/D148288

Reviewed By: lntue

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

17 months ago[libc] Update RPC interface for system utilities on the GPU
Joseph Huber [Fri, 14 Apr 2023 02:27:51 +0000 (21:27 -0500)]
[libc] Update RPC interface for system utilities on the GPU

This patch reworks the RPC interface to allow more generic memory
operations using the shared better. This patch decomposes the entire RPC
interface into opening a port and calling `send` or `recv` on it.

The `send` function sends a single packet of the length of the buffer.
The `recv` function is paired with the `send` call to then use the data.
So, any aribtrary combination of sending packets is possible. The only
restriction is that the client initiates the exchange with a `send`
while the server consumes it with a `recv`.

The operation of this is driven by two independent state machines that
tracks the buffer ownership during loads / stores. We keep track of two
so that we can transition between a send state and a recv state without
an extra wait. State transitions are observed via bit toggling, e.g.

This interface supports an efficient `send -> ack -> send -> ack -> send`
interface and allows for the last send to be ignored without checking
the ack.

A following patch will add some more comprehensive testing to this interface. I
I informally made an RPC call that simply incremented an integer and it took
roughly 10 microsends to complete an RPC call.

Reviewed By: jdoerfert

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

17 months ago[mlir][sparse] support iteration over compressed-hi dimension level in loop emitter
Peiming Liu [Tue, 18 Apr 2023 22:05:31 +0000 (22:05 +0000)]
[mlir][sparse] support iteration over compressed-hi dimension level in loop emitter

Reviewed By: aartbik

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

17 months ago[LIBC] Fix incorrect behavior with pthread_key_t when value was nullptr
Noah Goldstein [Thu, 20 Apr 2023 00:33:32 +0000 (19:33 -0500)]
[LIBC] Fix incorrect behavior with pthread_key_t when value was nullptr

We should not call destructor if value is nullptr.

Reviewed By: sivachandra

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

17 months agoAdd missing header guards so the modules build will succeed.
Jim Ingham [Thu, 20 Apr 2023 00:23:43 +0000 (17:23 -0700)]
Add missing header guards so the modules build will succeed.

17 months ago[gn build] Port 87cec865979c
LLVM GN Syncbot [Thu, 20 Apr 2023 00:13:38 +0000 (00:13 +0000)]
[gn build] Port 87cec865979c

17 months ago[gn] Use clang/utils/bundle_resources.py for clang-pseudo too
Nico Weber [Wed, 19 Apr 2023 18:06:53 +0000 (14:06 -0400)]
[gn] Use clang/utils/bundle_resources.py for clang-pseudo too

See https://reviews.llvm.org/D146591#4281023 -- optimistically
assuming that gets done :)

17 months agoValueTracking: uitofp/sitofp cannot return denormal results
Matt Arsenault [Thu, 13 Apr 2023 14:53:27 +0000 (10:53 -0400)]
ValueTracking: uitofp/sitofp cannot return denormal results

17 months agoValueTracking: Handle sign bit of constrained sitofp/uitofp
Matt Arsenault [Thu, 13 Apr 2023 14:15:15 +0000 (10:15 -0400)]
ValueTracking: Handle sign bit of constrained sitofp/uitofp

This is for parity with CannotBeNegativeZero which is close to
droppable.

17 months agoValueTracking: Implement computeKnownFPClass for fdiv for nan handling
Matt Arsenault [Sun, 9 Apr 2023 11:20:25 +0000 (07:20 -0400)]
ValueTracking: Implement computeKnownFPClass for fdiv for nan handling

17 months agoValueTracking: Add baseline tests for computeKnownFPClass fdiv handling
Matt Arsenault [Wed, 12 Apr 2023 14:48:33 +0000 (10:48 -0400)]
ValueTracking: Add baseline tests for computeKnownFPClass fdiv handling

17 months agoValueTracking: Fix backwards handling of fpclass assumes
Matt Arsenault [Tue, 11 Apr 2023 18:03:42 +0000 (14:03 -0400)]
ValueTracking: Fix backwards handling of fpclass assumes

This was a bit confused because nofpclass expresses the opposite
from what an assume of class expresses. We need to assume
the intersection of assumed classes, which also needs to be inverted
to convert to nofpclass.

17 months agoAttributor: Add baseline tests for nofpclass changes
Matt Arsenault [Tue, 11 Apr 2023 18:20:05 +0000 (14:20 -0400)]
Attributor: Add baseline tests for nofpclass changes

17 months agoValueTracking: Add more tests for trunc handling in computeKnownFPClass
Matt Arsenault [Mon, 17 Apr 2023 14:15:30 +0000 (10:15 -0400)]
ValueTracking: Add more tests for trunc handling in computeKnownFPClass

17 months agoValueTracking: Add baseline test for computeKnownFPClass for sqrt
Matt Arsenault [Sun, 9 Apr 2023 02:38:59 +0000 (22:38 -0400)]
ValueTracking: Add baseline test for computeKnownFPClass for sqrt

17 months ago[TSan] Fix comment describing shadow memory layout
Julian Lettner [Tue, 18 Apr 2023 17:39:00 +0000 (10:39 -0700)]
[TSan] Fix comment describing shadow memory layout

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

17 months ago[lldb] Fix bug to update process public run lock with process state
Med Ismail Bennani [Wed, 19 Apr 2023 23:53:19 +0000 (16:53 -0700)]
[lldb] Fix bug to update process public run lock with process state

This patch should address an issue that caused the process public run
lock to not be updated during a process launch/attach when the process
stops.

That caused the public run lock to report its state as running while the
process state is stopped. This prevents the users to interact with the
process (through the command line or via the SBAPI) since it's
considered still running.

To address that, this patch refactors the name of the internal hijack
listeners to a specific pattern `lldb.internal.<action>.hijack` that
are used to ensure that we've attached to or launched a process successfully.

Then, when updating the process public state, after updating the state
value, if the process is not hijacked externally, meaning if the process
doens't have a hijack listener that matches the internal hijack
listeners pattern, we can update the public run lock accordingly.

rdar://108283017

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
17 months agoRevert "Revert "[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain...
MalavikaSamak [Wed, 19 Apr 2023 23:42:15 +0000 (16:42 -0700)]
Revert "Revert "[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffer usages""

This reverts commit 7bf5f4692ad6f9ba2d5c155f6b630049bb59876f and adding -frtti flag to support PS4/PS5 builds.

17 months ago[CMake] Reduce deps
NAKAMURA Takumi [Wed, 19 Apr 2023 23:33:34 +0000 (08:33 +0900)]
[CMake] Reduce deps

17 months ago[Bazel] Introduce "//clang:bundle_resources" for D146591
NAKAMURA Takumi [Wed, 19 Apr 2023 23:23:56 +0000 (08:23 +0900)]
[Bazel] Introduce "//clang:bundle_resources" for D146591

17 months ago[BOLT][NFC] Remove exec permission from some tests
Nathan Sidwell [Wed, 19 Apr 2023 19:53:52 +0000 (15:53 -0400)]
[BOLT][NFC] Remove exec permission from some tests

These files unnecessarily had execute permission.

17 months ago[BOLT] Add bolt-runtime requirement to tests
Nathan Sidwell [Wed, 19 Apr 2023 19:53:17 +0000 (15:53 -0400)]
[BOLT] Add bolt-runtime requirement to tests

These tests rely on the X86 runtime, add the REQUIRES.

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

17 months ago[libc] Fix strtod hex exponent overflow bug
Michael Jones [Mon, 17 Apr 2023 17:30:28 +0000 (10:30 -0700)]
[libc] Fix strtod hex exponent overflow bug

Same issue as was fixed in commit 3d95323, but for hexadecimal floats.

Reviewed By: sivachandra

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

17 months ago[libc][math] Remove the unused dp_trig target and tests.
Siva Chandra Reddy [Wed, 19 Apr 2023 23:11:10 +0000 (23:11 +0000)]
[libc][math] Remove the unused dp_trig target and tests.

17 months agoRevert "[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffe...
MalavikaSamak [Wed, 19 Apr 2023 23:08:55 +0000 (16:08 -0700)]
Revert "[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffer usages"

This reverts commit 777eb4bcfc3265359edb7c979d3e5ac699ad4641.

17 months ago[CMake] Don't set absolute paths as install runpaths on ELF platforms in llvm_setup_r...
Butta [Wed, 19 Apr 2023 22:55:05 +0000 (15:55 -0700)]
[CMake] Don't set absolute paths as install runpaths on ELF platforms in llvm_setup_rpath()

If any LLVM subprojects are built separately, the LLVM build directory
LLVM_LIBRARY_DIR is added to both the build and install runpaths in
llvm_setup_rpath(), which is incorrect when installed. Separate the
build and install runpaths on ELF platforms and finally remove the
incorrect call to this function for compiler-rt, as previously attempted
in 21c008d5a5b. That prior attempt was reverted in 959dbd1761c, where it
was said to break the build on macOS and Windows, so I made sure to keep
those platforms the same.

Two examples of incorrect runpaths that are currently added, one from
the latest LLVM 16 toolchain for linux x86_64:

  > readelf -d clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.*so | ag "File:|runpath"
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.dyndd.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.hwasan_aliases.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.hwasan.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.memprof.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.scudo_standalone.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.tsan.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.ubsan_minimal.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]
  File: clang+llvm-16.0.0-x86_64-linux-gnu-ubuntu-18.04/lib/clang/16/lib/x86_64-unknown-linux-gnu/libclang_rt.ubsan_standalone.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/tmp/llvm_release/final/Phase3/Release/llvmCore-16.0.0-final.obj/./lib]

Another is in the Swift toolchain, which builds lldb separately:

  > readelf -d swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/{bin/lldb*,lib/liblldb.so}|ag "File:|runpath"
  File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
  File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb-argdumper
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
  File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/bin/lldb-server
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib]
  File: swift-5.9-DEVELOPMENT-SNAPSHOT-2023-03-24-a-ubuntu20.04/usr/lib/liblldb.so
  0x000000000000001d (RUNPATH)            Library runpath: [$ORIGIN/../lib:/home/build-user/build/buildbot_linux/llvm-linux-x86_64/./lib:/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:$ORIGIN/../lib/swift/linux]

This patch should fix this problem of absolute paths from the build host
leaking out into the toolchain's runpaths.

Differential revision: https://reviews.llvm.org/D146918

17 months ago[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffer usages
MalavikaSamak [Wed, 19 Apr 2023 22:52:12 +0000 (15:52 -0700)]
[-Wunsafe-buffer-usage] Handle unevaluated contexts that contain unsafe buffer usages

This patch handles unevaluated contexts to ensure no warnings are produced by the machinery
for buffer access made within an unevaluated contexts. However, such accesses must be
considered by a FixableGadget and produce the necessary fixits.

Reviewed by: NoQ, ziqingluo-90, jkorous

Differential revision: https://reviews.llvm.org/D144905

17 months ago[flang][openacc] Add basic lowering to new data operations for acc.enter_data
Valentin Clement [Wed, 19 Apr 2023 22:52:24 +0000 (15:52 -0700)]
[flang][openacc] Add basic lowering to new data operations for acc.enter_data

This is an initial patch that lowers acc.enter_data copyin/create/attach
clauses to the newly added data operand operations. Follow up patches will
add support for array section and derived type and derived type component
as well as support in other data operation.

Reviewed By: razvanlupusoru

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

17 months ago[libc][Obvious] Remove an unused "using" declaration.
Siva Chandra Reddy [Wed, 19 Apr 2023 22:42:25 +0000 (22:42 +0000)]
[libc][Obvious] Remove an unused "using" declaration.

17 months ago[TableGen] Use heap allocated arrays instead of vectors for TreePatternNode::Types...
Craig Topper [Wed, 19 Apr 2023 22:22:42 +0000 (15:22 -0700)]
[TableGen] Use heap allocated arrays instead of vectors for TreePatternNode::Types and ResultPerm. NFC

These vectors are resized in the constructor and never change size.
We can manually allocate two arrays instead.

This reduces the size of TreePatternNode by removing the
unneeded capacity end pointer fields from the std::vector.

17 months agoRevert "[cmake] Explicitly disable download step"
Vitaly Buka [Wed, 19 Apr 2023 22:13:23 +0000 (15:13 -0700)]
Revert "[cmake] Explicitly disable download step"

This does not help. The build is broken because compiler-rt-clear
deletes cmake generated files in STAMP_DIR/

This reverts commit da89ed99a16920e5986b14853d297322ccf7109e.

17 months ago[mlir][openacc] Refine data operation data clause attribute
Razvan Lupusoru [Wed, 19 Apr 2023 17:59:41 +0000 (10:59 -0700)]
[mlir][openacc] Refine data operation data clause attribute

The data operations added in D148389 hold two data clause fields:
"dataClause" and "decomposedFrom". However, in most cases, dataClause
field holds a default value (except for acc_copyin_readonly,
acc_create_zero, and acc_copyout_zero).

The decomposedFrom field holds the original clause specified by user.
As work began on lowering to these new operations [1], it seems that
having both fields adds a bit of ambiguity. There is only one scenario
where we actually intended to use both:
acc data copyout(zero:)

The original intent was that this clause would be decomposed to
the following operations:
acc.create {dataClause = acc_create_zero, decomposedFrom =
acc_copyout_zero}
...
acc.copyout {dataClause = acc_copyout_zero}

However, we can encode the zero semantics like so without need of both:
acc.create {dataClause = acc_copyout_zero}
...
acc.copyout {dataClause = acc_copyout_zero}

Thus get rid of the decomposedFrom field and update verifier checks
to check for all data clauses that can be decomposed to the particular
operation.

So now the dataClause holds the original user's clause which simplifies
understanding of the operation.

[1] https://reviews.llvm.org/D148721

Reviewed By: clementval

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

17 months ago[lldb] Change setting descriptions to use StringRef instead of ConstString
Alex Langford [Wed, 19 Apr 2023 01:45:03 +0000 (18:45 -0700)]
[lldb] Change setting descriptions to use StringRef instead of ConstString

These probably do not need to be in the ConstString StringPool as they
don't really need any of the advantages that ConstStrings offer.
Lifetime for these things is always static and we never need to perform
comparisons for setting descriptions.

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

17 months ago[compiler-rt] [test] [profile] Avoid issues with an implicit .exe suffix
Martin Storsjö [Wed, 12 Apr 2023 11:17:48 +0000 (11:17 +0000)]
[compiler-rt] [test] [profile] Avoid issues with an implicit .exe suffix

Mingw toolchains implicitly add an .exe suffix if the output linked
file doesn't have a suffix. In many cases the extra suffix doesn't
cause any issues, but in some tests, this discrepancy between expected
output file name and actual output file does affect the tests.

In one test, a rm command fails to remove the executable since it
doesn't have the expected name. By failing to remove the executable, the
later llvm-profdata command tries to read the executable as if it was
a profile data file.

In another test, when the Python executor executes commands, it can
resolve executable names without the extra .exe suffix for absolute
paths (when most binaries are executed as e.g. "%t/foo"), but it fails
to resolve the executables for relative paths such as "./foo". Making
the paths absolute by using %t here shouldn't affect what the test tries
to validate.

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

17 months ago[SLP][NFC] Test showing a cost estimation issue caused by f82eb7e066f322a231627383fc8...
Vasileios Porpodas [Wed, 19 Apr 2023 00:47:18 +0000 (17:47 -0700)]
[SLP][NFC] Test showing a cost estimation issue caused by f82eb7e066f322a231627383fc80522d98ce6181

The buildvector cost for the case shown in the test should be 0 but it is -1, causing the code to get vectorized, whenit shouldn't.

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

17 months ago[libc++] Remove symbols for a std::allocator_arg & friends from the dylib
Louis Dionne [Mon, 6 Mar 2023 21:14:06 +0000 (16:14 -0500)]
[libc++] Remove symbols for a std::allocator_arg & friends from the dylib

This patch removes the symbols defined in the library for std::allocator_arg,
std::defer_lock, std::try_to_lock, std::adopt_lock, and std::piecewise_construct.
Those were defined in the library because we provided them in C++03 as an
extension, and in C++03 it was impossible to define them as `constexpr`
variables, like in the spec.

This is technically an ABI break since we are removing symbols from the
library. However, in practice, only programs compiled in C++03 mode who
take the address of those objects (or pass them as a reference) will have
an undefined ref to those symbols. In practice, this is expected to be
rare. First, those are C++11 features that we happen to provide in C++03,
and only the C++03 definition can potentially lead to code referencing
the dylib definition. So any code that is using these objects but compiling
in C++11 mode (as they should) is not at risk. Second, all uses of these
types in the library is done by passing those types by value to a function
that can get inlined. Since they are empty types, the compiler won't
generate an undefined reference if passed by value, since there's nothing
to pass anyway.

Long story short, the risk for code actually containing an undefined
reference to one of these types is rather small (but non-zero). I also
couldn't find any app on the App Store that referenced these symbols,
which supports my impression that this won't be an issue in practice.

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

17 months ago[lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf
Alex Langford [Tue, 18 Apr 2023 23:46:12 +0000 (16:46 -0700)]
[lldb][NFCI] Stop creating additional temporary string in Log::VAPrintf

Instead of creating a std::string from the `SmallString`,
let's just use a std::string from the start. I initially tried to make
`SmallString` work but getting it right proved complicated because
`LogHandler::Emit` will take its `StringRef` parameter and touch the raw
`const char *` from it directly, which isn't guaranteed to be
null-terminated with a `SmallString`.

I changed `WriteMessage` to take a `StringRef` instead of a
`const std::string &` for flexibility.

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

17 months ago[MemProf] Fix bot failure about missing return value along all paths
Teresa Johnson [Wed, 19 Apr 2023 21:05:26 +0000 (14:05 -0700)]
[MemProf] Fix bot failure about missing return value along all paths

Fixes warning treated as error from
https://lab.llvm.org/buildbot/#/builders/13/builds/34440:
  'llvm::LibCallSimplifier::optimizeNew': not all control paths return a value
after a35206d78280e0ebcf48cd21bc5fff5c3b9c73fa.

Change assert in default case to a return nullptr, so we have a
reasonable fallback if invoked on a different library function, and no
longer get the above warning.

17 months ago[DebugInfo] printCompactDWARFExpr: don't assert on stack size
Scott Linder [Wed, 8 Feb 2023 20:01:42 +0000 (20:01 +0000)]
[DebugInfo] printCompactDWARFExpr: don't assert on stack size

Gracefully handle non-1 stack sizes in printCompactDWARFExpr rather than
assert. Add support for DW_OP_nop and test the zero-sized stack case.

This is intended to be nearly NFC.

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

17 months ago[HeterogeneousDWARF] Update encodings in AMDGPUDwarfExtensionsForHeterogeneousDebuggi...
Scott Linder [Thu, 23 Feb 2023 19:53:47 +0000 (19:53 +0000)]
[HeterogeneousDWARF] Update encodings in AMDGPUDwarfExtensionsForHeterogeneousDebugging.rst

Repurpose the DW_OP_LLVM_aspace_implicit_pointer encoding (0xe9) as the
encoding for a new operation DW_OP_LLVM_user which prefixes all other
new operations.

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

17 months ago[MemProf] Optionally pass hot/cold hints to operator new
Teresa Johnson [Wed, 19 Apr 2023 15:21:52 +0000 (08:21 -0700)]
[MemProf] Optionally pass hot/cold hints to operator new

Optionally (off by default) replace operator new() calls marked with a
hot or cold memprof attribute with an operator new() call that takes a
hot_cold_t parameter.

Currently this is supported by the open source version of tcmalloc, see:
https://github.com/google/tcmalloc/blob/master/tcmalloc/new_extension.h

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

17 months ago[libc] Fix `nvptx_options` variable not being reset in CMake
Joseph Huber [Wed, 19 Apr 2023 20:27:33 +0000 (15:27 -0500)]
[libc] Fix `nvptx_options` variable not being reset in CMake

Summary:
This variable was not being reset, which caused the options to be
compounded when building multiple architectures. This was very
problematic as the architectures are not compatible.