platform/upstream/llvm.git
15 months ago[OpenMP] [OMPT] [amdgpu] [4/8] Implemented callback registration in nextgen plugins
Dhruva Chakrabarti [Fri, 5 May 2023 10:00:26 +0000 (12:00 +0200)]
[OpenMP] [OMPT] [amdgpu] [4/8] Implemented callback registration in nextgen plugins

The purpose of this patch is to Implement registration of callback functions in the generic plugin by looking up corresponding callbacks in libomptarget. The overall design document is https://rice.app.box.com/s/pf3gix2hs4d4o1aatwir1set05xmjljc

Defined an object of type OmptDeviceCallbacksTy in the amdgpu plugin for holding the tool-provided callback functions. Implemented a global constructor in the plugin that creates a connector object to connect with libomptarget. The callbacks that are already registered with libomptarget are looked up and registered with the plugin.

Combined with an internal patch from Dhruva Chakrabarti, which fixes the OMPT initialization ordering.
Achieved through removal of the constructor attribute from ompt_init.

Patch from John Mellor-Crummey <johnmc@rice.edu>
With contributions from:
Dhruva Chakrabarti <Dhruva.Chakrabarti@amd.com>
Michael Halkenhaeuser <MichaelGerald.Halkenhauser@amd.com>

Reviewed By: dhruvachak, tianshilei1992

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

15 months agoScalarizer: precommit some tests
Nicolai Hähnle [Fri, 5 May 2023 09:30:59 +0000 (11:30 +0200)]
Scalarizer: precommit some tests

The tests are pulled out from https://reviews.llvm.org/D149842 as a
preparatory change.

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

15 months agoScalarizer: use the canonical form of {extract,insert}element
Nicolai Hähnle [Fri, 5 May 2023 09:11:18 +0000 (11:11 +0200)]
Scalarizer: use the canonical form of {extract,insert}element

This leads to a bunch of trivial test churn, plus some extra test changes
that are purely due to update_test_checks.

Pulled out of https://reviews.llvm.org/D149842 as a preparatory change.

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

15 months agoRevert "[AArch64] Emit FNMADD instead of FNEG(FMADD)"
Matt Devereau [Fri, 5 May 2023 10:49:58 +0000 (10:49 +0000)]
Revert "[AArch64] Emit FNMADD instead of FNEG(FMADD)"

This reverts commit caa95c2408677d7af8c7be4da203ea9271854f46.

15 months ago[X86] Add abds/abdu lowering for scalar i8/i16/i32/i64 types
Simon Pilgrim [Fri, 5 May 2023 10:49:24 +0000 (11:49 +0100)]
[X86] Add abds/abdu lowering for scalar i8/i16/i32/i64 types

The next step will be to begin adding generic legalization/lowering support

15 months agoRevert "Add AArch64 requirement for aarch64_fnmadd.ll"
Matt Devereau [Fri, 5 May 2023 10:49:06 +0000 (10:49 +0000)]
Revert "Add AArch64 requirement for aarch64_fnmadd.ll"

This reverts commit a9919db65a1afa71ac62631d51711383c17d43fc.

15 months agoReland "[lldb][DWARFExpression] Fix DW_OP_div to use signed division"
LU Hongyi [Fri, 5 May 2023 10:42:17 +0000 (06:42 -0400)]
Reland "[lldb][DWARFExpression] Fix DW_OP_div to use signed division"

This patch resolves an issue where a value
is incorrectly displayed if it is represented
by DW_OP_div.

This issue is caused by lldb evaluating
operands of DW_OP_div as unsigned
and performed unintended unsigned
division.

This issue is resolved by creating two
temporary signed scalar and performing
signed division.

(Addresses GH#61727)

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

15 months ago[hwasan] Fix data race between ReleaseThread() and VisitAllLiveThreads()
Enna1 [Fri, 5 May 2023 10:38:19 +0000 (18:38 +0800)]
[hwasan] Fix data race between ReleaseThread() and VisitAllLiveThreads()

Data race scenario:
```
Thread 1                                | Thread 2
ReportTagMismatch()                     |
Call VisitAllLiveThreads() to scan all  |
threads' ring buffers to find           |
if it's a heap-use-after-free.          |
Lock live_list_mutex_                   |
                                        | Thread 2 exit
                                        | ReleaseThread() calls Thread::Destroy() for Thread 2,
                                        | which frees heap alloctions ring buffer
                                        | RemoveThreadFromLiveList() tries to take live_list_mutex_ again
Iterate the heap alloctions ring buffer |
of Thread 2, which is already freed     |
```

Reviewed By: vitalybuka

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

15 months ago[InstCombine] Use canonical index type (NFC)
Nikita Popov [Fri, 5 May 2023 10:18:19 +0000 (12:18 +0200)]
[InstCombine] Use canonical index type (NFC)

Directly use the canonical index type, rather than canonicalizing
it afterwards.

15 months ago[mlir][irdl] Add IRDL verification constraint classes
Mathieu Fehr [Thu, 9 Mar 2023 22:39:27 +0000 (23:39 +0100)]
[mlir][irdl] Add IRDL verification constraint classes

This patch adds the necessary constraint classes that are be used
by IRDL to define Operation, Type, and Attribute verifiers.

A constraint is a class inheriting the `irdl::Constraint` class,
which may call other constraints that are indexed by `unsigned`.
A constraint represent an invariant over an Attribute.

The `ConstraintVerifier` class group these constraints together,
and make sure that a constraint can only identify a single
attribute. So, once a constraint is used to check the
satisfiability of an `Attribute`, the `Attribute` will be
memorized for this constraint. This ensure that in IRDL, a
single `!irdl.attribute` value only correspond to a single
`Attribute`.

Depends on D144693

Reviewed By: Mogball

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

15 months ago[ValueTracking][NFC] Factor out computeKnownBitsFromCmp
Max Kazantsev [Fri, 5 May 2023 06:23:00 +0000 (13:23 +0700)]
[ValueTracking][NFC] Factor out computeKnownBitsFromCmp

Separate the part which is specific for assume intrinsic from the part which only requires an icmp,
so that the latter could be reused for other purposes (e.g. in dominating conditions).

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

15 months ago[clang][Interp] Don't call getSource() on functions without a body
Timm Bäder [Wed, 3 May 2023 14:29:20 +0000 (16:29 +0200)]
[clang][Interp] Don't call getSource() on functions without a body

For builtin functions, we create a Function instance without a body or
code. When emitting diagnostics from them, we need a proper SourceInfo
to point to, but the only thing we can use is the call site of the
builtin function.

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

15 months ago[NFC][ValueTracking] Hoist isValidAssumeForContext out of switch
Max Kazantsev [Fri, 5 May 2023 06:03:24 +0000 (13:03 +0700)]
[NFC][ValueTracking] Hoist isValidAssumeForContext out of switch

There is a lot of copy-paste-ish checks while this can be done once.

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

15 months agoUpdate BUILD.bazel for Mem2Reg deps.
Wenzhi Cui [Fri, 5 May 2023 09:45:05 +0000 (11:45 +0200)]
Update BUILD.bazel for Mem2Reg deps.

Reviewed By: csigg

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

15 months ago[X86] Avoid usage constant -1 for fminimum/fmaximum lowering
Serguei Katkov [Thu, 4 May 2023 03:00:42 +0000 (10:00 +0700)]
[X86] Avoid usage constant -1 for fminimum/fmaximum lowering

Instead of equality comparison of value to preferred zero we can check just
the sign of value and if sign is set we should put this value as second operand for minimum
and first operand for maximum.
In this case FMIN/FMAX will choose the right result for 0.f and -0.f comparison.

This allows us:
1. avoid loading of big 64-bit constant for fminimum.
2. for double on non-64-nib platform we need to check only high part of value.
3. test against zero to check sign takes less size of instruction

Additionally, if we know that any of value is guaranteed to be non-zero
we should not care about 0.f and -0.f comparison.

Reviewed By: e-kud
Differential Revision: https://reviews.llvm.org/D149812

15 months ago[NFC] [Coroutines] Add a fastpath when computing the cross suspend point information
Chuanqi Xu [Fri, 5 May 2023 08:29:23 +0000 (16:29 +0800)]
[NFC] [Coroutines] Add a fastpath when computing the cross suspend point information

Mitigate https://github.com/llvm/llvm-project/issues/62348

The root cause for the above issue is that we used a textbook dataflow
analysis for the cross suspend point information. The analysis is
powerful but not scaling.

It is not easy to improve the current algorithm and the patch tries to
prune some branches to mitigate the problems.

Before the patch:

```
n: 20000

real 0m11.081s
user 0m10.597s
sys 0m0.320s

n: 40000

real 0m32.927s
user 0m31.403s
sys 0m1.043s

n: 60000

real 1m2.145s
user 0m58.903s
sys 0m2.268s

n: 80000

real 1m47.143s
user 1m41.630s
sys 0m3.857s

n: 100000

real 2m34.758s
user 2m26.587s
sys 0m5.922s
```

After the patch:

```
n: 20000

real 0m10.418s
user 0m9.945s
sys 0m0.311s

n: 40000

real 0m27.884s
user 0m26.430s
sys 0m1.036s

n: 60000

real 0m52.420s
user 0m49.321s
sys 0m2.267s

n: 80000

real 1m25.389s
user 1m20.247s
sys 0m3.856s

n: 100000

real 2m4.275s
user 1m56.405s
sys 0m5.975s
```

This patch intended to be a NFC patch.

15 months ago[FuncSpec] Fix inconsistent treatment of global variables
Momchil Velikov [Thu, 4 May 2023 16:49:53 +0000 (17:49 +0100)]
[FuncSpec] Fix inconsistent treatment of global variables

There are a few inaccuracies with how FuncSpec handles global
variables.

When specialisation on non-const global variables is disabled (the
default) the pass could nevertheless perform some specializations,
e.g. on a constant GEP expression, or on a SSA variable, for which the
Solver has determined it has the value of a global variable.

When specialisation on non-const global variables is enabled, the pass
would skip non-scalars, e.g. a global array, but this should be
completely inconsequential, a pointer is a pointer.

Reviewed By: SjoerdMeijer

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

Change-Id: Ic73051b2f8602587306760bf2ec552e5860f8d39

15 months agoAMDGPU/SDAG: Improve {extract,insert}_subvector lowering for 16-bit vectors
Nicolai Hähnle [Wed, 3 May 2023 20:29:48 +0000 (22:29 +0200)]
AMDGPU/SDAG: Improve {extract,insert}_subvector lowering for 16-bit vectors

v2:
- simplify the escape to TableGen patterns

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

15 months ago[X86] Avoid usage constant NaN for fminimum/fmaximum lowering
Serguei Katkov [Wed, 3 May 2023 06:23:00 +0000 (13:23 +0700)]
[X86] Avoid usage constant NaN for fminimum/fmaximum lowering

After applying FMIN/FMAX, if any of operands is NaN, the second operand will be the result.
So all we need is to check whether first operand is NaN and return it or result of FMIN/FMAX.

So we avoid usage of constant NaN in the lowering.

Additionally we can avoid handling NaN after FMIN/FMAX if we are sure that first operand is not NaN.

Reviewed By: e-kud
Differential Revision: https://reviews.llvm.org/D149729

15 months agoAdd AArch64 requirement for aarch64_fnmadd.ll
Matt Devereau [Fri, 5 May 2023 08:35:27 +0000 (08:35 +0000)]
Add AArch64 requirement for aarch64_fnmadd.ll

15 months ago[AArch64] Emit FNMADD instead of FNEG(FMADD)
Matt Devereau [Thu, 4 May 2023 17:32:16 +0000 (17:32 +0000)]
[AArch64] Emit FNMADD instead of FNEG(FMADD)

Emit FNMADD instead of FNEG(FMADD) for optimization levels
above Oz when fast-math flags (nsz+contract) permit it.

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

15 months ago[LoopSimplify] Reduce amount of redundant SCEV invalidation (NFCI)
Nikita Popov [Thu, 4 May 2023 13:29:30 +0000 (15:29 +0200)]
[LoopSimplify] Reduce amount of redundant SCEV invalidation (NFCI)

We are simplifying the loop and all its children. Each time, we
invalidate the top-most loop. The top-most loop is going to be
the same every time. The cost of SCEV invalidation is largely
independent from how data about the loop is actually cached, so
we should avoid redundant invalidations.

15 months ago[VPlan] Assert instead of check if VF is vector when widening casts.
Florian Hahn [Fri, 5 May 2023 08:02:32 +0000 (09:02 +0100)]
[VPlan] Assert instead of check if VF is vector when widening casts.

VPWidenRecipes should not be generated for scalar VFs. Replace check
with an assert. Suggested in preparation for D149081.

15 months ago[mlir][LLVM] Support locations in loop annotation
Christian Ulmann [Fri, 5 May 2023 07:51:46 +0000 (07:51 +0000)]
[mlir][LLVM] Support locations in loop annotation

This commit introduces support for locations as part of the loop
annotation attribute. These locations indicate the start and the end of
the loop.

Reviewed By: gysit

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

15 months ago[ORC][MachOPlatform] Don't add InitSectionSymbols for __objc_imageinfo.
Lang Hames [Fri, 5 May 2023 06:57:22 +0000 (23:57 -0700)]
[ORC][MachOPlatform] Don't add InitSectionSymbols for __objc_imageinfo.

The __objc_imageinfo section may be deleted (leaving dangling references to any
symbols that it contains), and shouldn't have any dependencies anyway. This
patch verifies that the section has no dependencies and then skips the section.

rdar://108469243

15 months ago[flang][hlfir] Add ordered assignment pass with TODOs
Jean Perier [Fri, 5 May 2023 07:21:13 +0000 (09:21 +0200)]
[flang][hlfir] Add ordered assignment pass with TODOs

I plan to implement lowering from parse tree to HLFIR first for forall
and where to ease testing of the rewrite pass while writing it.

To avoid cryptic errors in ConvertToFir pass about unhandled operations,
this patch already defines the pass that will further lower these
operations and make it throw clear TODO messages.

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

15 months ago[flang][hlfir] Add hlfir.forall_index operation
Jean Perier [Fri, 5 May 2023 07:13:50 +0000 (09:13 +0200)]
[flang][hlfir] Add hlfir.forall_index operation

This is the last piece required to lower Forall (except pointer
assignments, where an operation may be needed to deal with bounds
remapping).

Lowering requires symbols to be mapped to memory SSA values produced
by a fir_FortranVariableOpInterface operation. This applies to
forall index-values, that are symbols.

fir.alloca/fir.store/hlfir.declare are not allowed inside the body of
an hlfir.forall that only accept operations with the
hlfir_OrderedAssignmentTreeOpInterface so that the forall structure is
well defined and easy to transform.
Allowing such operations in the forall body would open the doors to
generating ill-formed programs where such operation would be used for
non index-values.

Instead, add an hlfir.forall_index with both required interface to
produce a memory address for a forall index.

As a bonus, since forall index-value are by nature read-only, the
loads of hlfir.forall_index can be canonicalized, which will help
simplifying the hlfir.forall nested code (it is unclear we will be
able to tell MLIR enough about hlfir.forall and hlfir.where structure
so that it could safely do a generic mem-to-reg inside it, and getting
rid of read-effect operations will benefit the forall rewrite pass).

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

15 months ago[mlir][tosa] Call TosaInferShapes pass in addTosaToLinalgPasses
Aviad Cohen [Sat, 22 Apr 2023 17:01:22 +0000 (20:01 +0300)]
[mlir][tosa] Call TosaInferShapes pass in addTosaToLinalgPasses

This pass is useful to legalize rankless and dynamic shapes towards static using operands' shapes & types.

Reviewed By: jpienaar

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

15 months ago[libc++][spaceship] Implement `operator<=>` for `optional`
Hristo Hristov [Fri, 28 Apr 2023 20:52:07 +0000 (23:52 +0300)]
[libc++][spaceship] Implement `operator<=>` for `optional`

Implements parts of **P1614R2**: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1614r2.html

- Implemented `operator<=>` for `optional`
- Updated "optional synopsis" to match the current draft https://eel.is/c++draft/optional closer
- Implemented https://cplusplus.github.io/LWG/issue3566
- Implemented https://cplusplus.github.io/LWG/issue3746

Reviewed By: #libc, philnik, ldionne

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

15 months ago[MC] Optimize relaxInstruction: remove SmallVector copy. NFC
Fangrui Song [Fri, 5 May 2023 06:34:35 +0000 (23:34 -0700)]
[MC] Optimize relaxInstruction: remove SmallVector copy. NFC

15 months ago[RISCV] Omit the template parameters in getSerializableMachineMemOperandTargetFlags()
Jie Fu [Fri, 5 May 2023 06:12:16 +0000 (14:12 +0800)]
[RISCV] Omit the template parameters in getSerializableMachineMemOperandTargetFlags()

Reviewed By: craig.topper

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

15 months ago[clang] Replace None with std::nullopt in comments (NFC)
Kazu Hirata [Fri, 5 May 2023 05:42:52 +0000 (22:42 -0700)]
[clang] 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[mlir] Use std::optional instead of llvm::Optional (NFC)
Kazu Hirata [Fri, 5 May 2023 05:39:09 +0000 (22:39 -0700)]
[mlir] Use std::optional instead of llvm::Optional (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] Update DirectX/min_vec_size.ll after shufflevector mask vector poison change
Fangrui Song [Fri, 5 May 2023 05:30:36 +0000 (22:30 -0700)]
[test] Update DirectX/min_vec_size.ll after shufflevector mask vector poison change

15 months ago[lldb] Migrate to GetPropertyAtIndexAs for FileSpecList (NFC)
Jonas Devlieghere [Fri, 5 May 2023 05:22:50 +0000 (22:22 -0700)]
[lldb] Migrate to GetPropertyAtIndexAs for FileSpecList (NFC)

Use the templated GetPropertyAtIndexAs helper for FileSpecList.

15 months ago[RISCV] Directly create MCOperands from addImplySP in Disassembler. NFC
Craig Topper [Fri, 5 May 2023 05:18:33 +0000 (22:18 -0700)]
[RISCV] Directly create MCOperands from addImplySP in Disassembler. NFC

Instead of passing a constant to DecodeGPRRegisterClass, just create
the X2 register directly.

15 months ago[MC] registerSymbol: change an output paramter to return value
Fangrui Song [Fri, 5 May 2023 05:17:56 +0000 (22:17 -0700)]
[MC] registerSymbol: change an output paramter to return value

15 months ago[lldb] Eliminate {Get,Set}PropertyAtIndexAsFileSpec (NFC)
Jonas Devlieghere [Fri, 5 May 2023 05:07:37 +0000 (22:07 -0700)]
[lldb] Eliminate {Get,Set}PropertyAtIndexAsFileSpec (NFC)

This patch is a continuation of 6f8b33f6dfd0 and eliminates the
{Get,Set}PropertyAtIndexAsFileSpec functions.

15 months ago[gn build] Port 917b3a7e6206
LLVM GN Syncbot [Fri, 5 May 2023 05:00:42 +0000 (05:00 +0000)]
[gn build] Port 917b3a7e6206

15 months ago[lldb] Move Core/FileSpecList -> Utility/FileSpecList (NFC)
Jonas Devlieghere [Fri, 5 May 2023 04:52:19 +0000 (21:52 -0700)]
[lldb] Move Core/FileSpecList -> Utility/FileSpecList (NFC)

There's no reason for FileSpecList to live in lldb/Core while FileSpec
lives in lldb/Utility. Move FileSpecList next to FileSpec.

15 months ago[RISCV] Remove unused def simm12_plus1 from RISCVInstrInfo.td. NFC
LiaoChunyu [Fri, 5 May 2023 04:53:43 +0000 (12:53 +0800)]
[RISCV] Remove unused def simm12_plus1 from RISCVInstrInfo.td. NFC

Reviewed By: craig.topper

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

15 months ago[lldb] Remove SetPropertyAtIndexAsLanguage (NFC)
Jonas Devlieghere [Fri, 5 May 2023 04:45:00 +0000 (21:45 -0700)]
[lldb] Remove SetPropertyAtIndexAsLanguage (NFC)

After 6f8b33f6dfd0 this function has no callers anymore.

15 months ago[FuzzMutate] Make ShuffleBlockStrategy deterministic
Zhenkai Weng [Fri, 5 May 2023 03:53:22 +0000 (20:53 -0700)]
[FuzzMutate] Make ShuffleBlockStrategy deterministic

This revision makes ShuffleBlockStrategy deterministic by replacing
SmallPtrSet with other data structures that has a deterministic iteration
order.

Reviewed By: Peter

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

15 months ago[SPIRV] Adapt itaniumDemangle change after itaniumDemangle
Fangrui Song [Fri, 5 May 2023 03:47:34 +0000 (20:47 -0700)]
[SPIRV] Adapt itaniumDemangle change after itaniumDemangle

15 months ago[SPARC][MC] Fix encoding of backwards BPr branches
Brad Smith [Fri, 5 May 2023 00:53:57 +0000 (20:53 -0400)]
[SPARC][MC] Fix encoding of backwards BPr branches

Make sure that the upper bits of the offset is placed in bits 20-21 of the
instruction word.

This fixes the encoding of backwards (negative offset) BPr branches.

(Previously, the upper two bits of the offset would overwrite parts of the rs1
field, causing it to branch on the wrong register, with the wrong offset)

Reviewed By: arsenm

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

15 months ago[RISCV] Promote i1 shuffles to i8 shuffles.
Craig Topper [Fri, 5 May 2023 02:44:43 +0000 (19:44 -0700)]
[RISCV] Promote i1 shuffles to i8 shuffles.

Otherwise I think we extract and use a build_vector. There may be
some more improvements that can be made and there might be some
cases that we should do something different for, but this seemed like a
decent starting point.

Reviewed By: luke

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

15 months ago[libc] Fix hanging test on NVPTX due to lack of warp sync
Joseph Huber [Fri, 5 May 2023 02:36:52 +0000 (21:36 -0500)]
[libc] Fix hanging test on NVPTX due to lack of warp sync

Previously this wasn't implemented because it's effectively a no-op.
However, this should be safe to emit on sm_60 architectures. It's
important because it carries semantic importance for whether or not
something can be moved. So we should always emit this instrinsic.

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

15 months ago[Coverity] Big parameter passed by value.
Luo, Yuanke [Fri, 5 May 2023 01:50:19 +0000 (09:50 +0800)]
[Coverity] Big parameter passed by value.

15 months ago[SeparateConstOffsetFromGEP] Fix bug handling negative offsets
Tom Stellard [Fri, 5 May 2023 01:45:48 +0000 (18:45 -0700)]
[SeparateConstOffsetFromGEP] Fix bug handling negative offsets

Fix bug constants and sub instructions

When finding constants in a chain starting with the RHS operator of
sub instructions, we were negating the constant before zero extending
it, which is incorrect.

Unfortunately, I was unable to find a simple way to implement this
transformation correctly, so for now I just disabled this optimization
for constants that feed into the RHS of a sub.

Resolves #62379

Transformation from alive2.llvm.org:

    define i16 @src(i8 %a, i8 %b, i8 %c) {
    entry:
    %0 = sub nuw nsw i8 %c, %a
    %1 = sub nuw nsw i8 %b, %0
    %2 = zext i8 %1 to i16
    ret i16 %2
    }

    Before/Bad:

    define i16 @tgt(i8 %a, i8 %b, i8 %c) {
    entry:
    %0 = zext i8 %a to i16
    %1 = zext i8 %b to i16
    %c_neg = sub i8 0, %c
    %c_zext = zext i8 %c_neg to i16
    %2 = sub i16 0, %0
    %3 = sub i16 %1, %2
    %4 = add i16 %3, %c_zext
    ret i16 %4
    }

    Correct:

    define i16 @tgt(i8 %a, i8 %b, i8 %c) {
    entry:
    %0 = zext i8 %a to i16
    %1 = zext i8 %b to i16
    %c_zext = zext i8 %c to i16
    %c_neg = sub i16 0, %c_zext
    %2 = sub i16 0, %0
    %3 = sub i16 %1, %2
    %4 = add i16 %3, %c_neg
    ret i16 %4
    }

Reviewed By: nikic

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

15 months ago[Coverity] Big parameter passed by value.
Luo, Yuanke [Fri, 5 May 2023 01:14:04 +0000 (09:14 +0800)]
[Coverity] Big parameter passed by value.

15 months ago[RISCV] Restrict valid indices for cm.jalt to be in [32,255].
Craig Topper [Fri, 5 May 2023 00:48:30 +0000 (17:48 -0700)]
[RISCV] Restrict valid indices for cm.jalt to be in [32,255].

Reviewed By: jrtc27

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

15 months ago[ASan][libcxx] Annotating std::vector with all allocators
Advenam Tacet [Fri, 5 May 2023 00:43:51 +0000 (17:43 -0700)]
[ASan][libcxx] Annotating std::vector with all allocators

This revision is a part of a series of patches extending
AddressSanitizer C++ container overflow detection
capabilities by adding annotations, similar to those existing
in std::vector, to std::string and std::deque collections.
These changes allow ASan to detect cases when the instrumented
program accesses memory which is internally allocated by
the collection but is still not in-use (accesses before or
after the stored elements for std::deque, or between the size and
capacity bounds for std::string).

The motivation for the research and those changes was a bug,
found by Trail of Bits, in a real code where an out-of-bounds read
could happen as two strings were compared via a std::equals function
that took iter1_begin, iter1_end, iter2_begin iterators
(with a custom comparison function).
When object iter1 was longer than iter2, read out-of-bounds on iter2
could happen. Container sanitization would detect it.

In revision D132522, support for non-aligned memory buffers (sharing
first/last granule with other objects) was added, therefore the
check for standard allocator is not necessary anymore.
This patch removes the check in std::vector annotation member
function (__annotate_contiguous_container) to support
different allocators.

Additionally, this revision fixes unpoisoning in std::vector.
It guarantees that __alloc_traits::deallocate may access returned memory.
Originally suggested in D144155 revision.

If you have any questions, please email:
 - advenam.tacet@trailofbits.com
 - disconnect3d@trailofbits.com

Reviewed By: #libc, #sanitizers, philnik, vitalybuka, ldionne

Spies: mikhail.ramalho, manojgupta, ldionne, AntonBikineev, ayzhao, hans, EricWF, philnik, #sanitizers, libcxx-commits

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

15 months ago[libc] Change GPU startup and loader to use multiple kernels
Joseph Huber [Mon, 1 May 2023 13:17:39 +0000 (08:17 -0500)]
[libc] Change GPU startup and loader to use multiple kernels

The GPU has a different execution model to standard `_start`
implementations. On the GPU, all threads are active at the start of a
kernel. In order to correctly intitialize and call the constructors we
want single threaded semantics. Previously, this was done using a
makeshift global barrier with atomics. However, it should be easier to
simply put the portions of the code that must be single threaded in
separate kernels and then call those with only one thread. Generally,
mixing global state between kernel launches makes optimizations more
difficult, similarly to calling a function outside of the TU, but for
testing it is better to be correct.

Depends on D149527 D148943

Reviewed By: JonChesterfield

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

15 months ago[libc] Enable multiple threads to use RPC on the GPU
Joseph Huber [Thu, 4 May 2023 19:53:28 +0000 (14:53 -0500)]
[libc] Enable multiple threads to use RPC on the GPU

The execution model of the GPU expects that groups of threads will
execute in lock-step in SIMD fashion. It's both important for
performance and correctness that we treat this as the smallest possible
granularity for an RPC operation. Thus, we map multiple threads to a
single larger buffer and ship that across the wire.

This patch makes the necessary changes to support executing the RPC on
the GPU with multiple threads. This requires some workarounds to mimic
the model when handling the protocol from the CPU. I'm not completely
happy with some of the workarounds required, but I think it should work.

Uses some of the implementation details from D148191.

Reviewed By: JonChesterfield

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

15 months ago[DAGCombiner][RISCV] Enable reassociation for VP_FMA in visitFADDForFMACombine.
Craig Topper [Fri, 5 May 2023 00:20:58 +0000 (17:20 -0700)]
[DAGCombiner][RISCV] Enable reassociation for VP_FMA in visitFADDForFMACombine.

Reviewed By: fakepaper56

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

15 months agoRevert "[Clang][Sema] Fix comparison of constraint expressions"
Alexander Shaposhnikov [Fri, 5 May 2023 00:02:26 +0000 (00:02 +0000)]
Revert "[Clang][Sema] Fix comparison of constraint expressions"

This reverts commit 3a540229341e3c8dc6d8ee61309eafaf943ea254.
A new regression is discovered and needs to be investigated.

15 months ago[RISCV] Add vp.icmp/fcmp to RISCVTargetLowering::canSplatOperand.
Craig Topper [Thu, 4 May 2023 23:56:14 +0000 (16:56 -0700)]
[RISCV] Add vp.icmp/fcmp to RISCVTargetLowering::canSplatOperand.

15 months agoRevert "[lldb] Expose a const iterator for SymbolContextList"
Alex Langford [Thu, 4 May 2023 23:49:30 +0000 (16:49 -0700)]
Revert "[lldb] Expose a const iterator for SymbolContextList"

This reverts commit 04aa943be8ed5c03092e2a90112ac638360ec253.

This broke the debian buildbot and I'm not sure why. Reverting so I can
investigate.

15 months ago[lldb] Use templates to simplify {Get,Set}PropertyAtIndex (NFC)
Jonas Devlieghere [Thu, 4 May 2023 16:26:58 +0000 (09:26 -0700)]
[lldb] Use templates to simplify {Get,Set}PropertyAtIndex (NFC)

Use templates to simplify {Get,Set}PropertyAtIndex. It has always
bothered me how cumbersome those calls are when adding new properties.
After this patch, SetPropertyAtIndex infers the type from its arguments
and GetPropertyAtIndex required a single template argument for the
return value. As an added benefit, this enables us to remove a bunch of
wrappers from UserSettingsController and OptionValueProperties.

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

15 months ago[lldb] Expose a const iterator for SymbolContextList
Alex Langford [Thu, 4 May 2023 20:26:58 +0000 (13:26 -0700)]
[lldb] Expose a const iterator for SymbolContextList

There are many situations where we'll iterate over a SymbolContextList
with the pattern:
```
SymbolContextList sc_list;
// Fill in sc_list here
for (auto i = 0; i < sc_list.GetSize(); i++) {
  SymbolContext sc;
  sc_list.GetSymbolAtContext(i, sc);

  // Do work with sc
}
```
Adding an iterator to iterate over the instances directly means we don't
have to do bounds checking or create a copy of every element of the
SymbolContextList.

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

15 months ago[libc] Enable linux directory entries syscalls in riscv64
Mikhail R. Gadelha [Thu, 4 May 2023 21:34:01 +0000 (18:34 -0300)]
[libc] Enable linux directory entries syscalls in riscv64

This patch updates the struct dirent to be on par with glibc (by adding
a missing d_type member) and update the readdir call to use SYS_getdents64
instead of SYS_getdents.

Reviewed By: sivachandra

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

15 months ago[mlir][openacc][NFC] Remove braces on single statement bodies
Valentin Clement [Thu, 4 May 2023 22:00:45 +0000 (15:00 -0700)]
[mlir][openacc][NFC] Remove braces on single statement bodies

Update format to stick to https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

15 months ago[libc][rpc] Update locking to work on volta
Jon Chesterfield [Thu, 4 May 2023 21:30:53 +0000 (22:30 +0100)]
[libc][rpc] Update locking to work on volta

Carefully work around not knowing the thread mask that nvptx intrinsic
functions require.

If the warp is converged when calling try_lock, a single rpc call will handle
all lanes within it. Otherwise more than one rpc call with thread masks that
compose to the unknown one will occur.

Reviewed By: jhuber6

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

15 months agoRevert "[libc][rpc] Update locking to work on volta"
Jon Chesterfield [Thu, 4 May 2023 21:44:33 +0000 (22:44 +0100)]
Revert "[libc][rpc] Update locking to work on volta"

This reverts commit b1323738649e96aac943f3773ec7336df110eea5.

15 months ago[libc][rpc] Update locking to work on volta
Jon Chesterfield [Thu, 4 May 2023 21:30:53 +0000 (22:30 +0100)]
[libc][rpc] Update locking to work on volta

Carefully work around not knowing the thread mask that nvptx intrinsic
functions require.

If the warp is converged when calling try_lock, a single rpc call will handle
all lanes within it. Otherwise more than one rpc call with thread masks that
compose to the unknown one will occur.

Reviewed By: jhuber6

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

15 months agoGive NullabilityKind a printing operator<<
Sam McCall [Tue, 2 May 2023 14:22:40 +0000 (16:22 +0200)]
Give NullabilityKind a printing operator<<

This is more useful for debug/test than getNullabilitySpelling:
 - default form has uglifying underscores
 - non-default form crashes on NullableResult
 - both return unhelpfully verbose strings for Unspecified
 - operator<< works with gtest, formatv, etc

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

15 months ago[NFC][HWASAN] Switch to verbose CHECKs
Vitaly Buka [Thu, 4 May 2023 20:56:22 +0000 (13:56 -0700)]
[NFC][HWASAN] Switch to verbose CHECKs

15 months ago[ASan][libcxx] A way to turn off annotations for containers with a specific allocator
Advenam Tacet [Thu, 4 May 2023 21:16:06 +0000 (14:16 -0700)]
[ASan][libcxx] A way to turn off annotations for containers with a specific allocator

This revision is part of our efforts to support container annotations with (almost) every allocator.
That patch is necessary to enable support for most annotations (D136765). Without a way to turn off annotations, it's hard to use ASan with area allocators (no calls to destructors).

This is an answer to a request about it. This patch provides a solution to the aforementioned issue by introducing a new template structure `__asan_annotate_container_with_allocator`, which allows the disabling of container annotations for a specific allocator.

This patch also introduces `_LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS` FTM.

To turn off annotations, it is sufficient to create a template specialization with a false value using a [Unary Type Trait](https://en.cppreference.com/w/cpp/types/integral_constant).

The proposed structure is being used in the code enabling annotations for all allocators in `std::vector`, `std::basic_string`, and `std::deque`. (D136765 D146214 D146815)

Possibility to do it was added to ASan API in rGdd1b7b797a116eed588fd752fbe61d34deeb24e4 commit.

For context on not calling a destructor, look at https://eel.is/c++draft/basic.life#5 and notes there, you may also read a discussion in D136765.

Reviewed By: ldionne, philnik, #libc, hans

Spies: EricWF, mikhail.ramalho, #sanitizers, libcxx-commits, hans, vitalybuka

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

15 months ago[clang][dataflow] Eliminate intermediate `ReferenceValue`s from `Environment::DeclToLoc`.
Martin Braenne [Thu, 4 May 2023 07:42:05 +0000 (07:42 +0000)]
[clang][dataflow] Eliminate intermediate `ReferenceValue`s from `Environment::DeclToLoc`.

For the wider context of this change, see the RFC at
https://discourse.llvm.org/t/70086.

After this change, global and local variables of reference type are associated
directly with the `StorageLocation` of the referenced object instead of the
`StorageLocation` of a `ReferenceValue`.

Some tests that explicitly check for an existence of `ReferenceValue` for a
variable of reference type have been modified accordingly.

As discussed in the RFC, I have added an assertion to `Environment::join()` to
check that if both environments contain an entry for the same declaration in
`DeclToLoc`, they both map to the same `StorageLocation`. As discussed in
https://discourse.llvm.org/t/70086/5, this also necessitates removing
declarations from `DeclToLoc` when they go out of scope.

In the RFC, I proposed a gradual migration for this change, but it appears
that all of the callers of `Environment::setStorageLocation(const ValueDecl &,
SkipPast` are in the dataflow framework itself, and that there are only a few of
them.

As this is the function whose semantics are changing in a way that callers
potentially need to adapt to, I've decided to change the semantics of the
function directly.

The semantics of `getStorageLocation(const ValueDecl &, SkipPast SP` now no
longer depend on the behavior of the `SP` parameter. (There don't appear to be
any callers that use `SkipPast::ReferenceThenPointer`, so I've added an
assertion that forbids this usage.)

This patch adds a default argument for the `SP` parameter and removes the
explicit `SP` argument at the callsites that are touched by this change. A
followup patch will remove the argument from the remaining callsites,
allowing the `SkipPast` parameter to be removed entirely. (I don't want to do
that in this patch so that semantics-changing changes can be reviewed separately
from semantics-neutral changes.)

Reviewed By: ymandel, xazax.hun, gribozavr2

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

15 months ago[SLP][NFC]Do not try to revectorize instructions with constant operands, NFC.
Alexey Bataev [Thu, 4 May 2023 20:32:35 +0000 (13:32 -0700)]
[SLP][NFC]Do not try to revectorize instructions with constant operands, NFC.

The pass should not try to revectorize instructions with constant
operands, which were not folded by the IRBuilder. It prevents the
non-terminating loop in the SLP vectorizer for non foldable constant
operations.

15 months ago[AggressiveInstCombine] Only fold consecutive shifts of loads with constant shift...
Arthur Eubanks [Thu, 4 May 2023 20:07:27 +0000 (13:07 -0700)]
[AggressiveInstCombine] Only fold consecutive shifts of loads with constant shift amounts

This is what the code assumed but never actually checked.

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

Reviewed By: nikic

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

15 months ago[lldb][NFCI] Add unittests for ObjCLanguage::MethodName
Alex Langford [Thu, 4 May 2023 00:41:58 +0000 (17:41 -0700)]
[lldb][NFCI] Add unittests for ObjCLanguage::MethodName

I have a patch to refactor this class and I'd like a unittest in place
to make sure I don't break anything.

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

15 months agoRevert "[libc][rpc] Land helpers from D148943"
Jon Chesterfield [Thu, 4 May 2023 20:45:18 +0000 (21:45 +0100)]
Revert "[libc][rpc] Land helpers from D148943"

This reverts commit 09ceb4729f1ca8781718d41b7876b68820baadba.

15 months ago[VPlan] Reorder cases in switch (NFC).
Florian Hahn [Thu, 4 May 2023 20:40:22 +0000 (21:40 +0100)]
[VPlan] Reorder cases in switch (NFC).

Reorder cases to make sure they are ordered properly in preparation
for D149081.

15 months agoAdd AArch64 MASK watchpoint support in debugserver
Jason Molenda [Thu, 4 May 2023 20:23:51 +0000 (13:23 -0700)]
Add AArch64 MASK watchpoint support in debugserver

Add suport for MASK style watchpoints on AArch64 in debugserver
on Darwin systems, for watching power-of-2 sized memory ranges.
More work needed in lldb before this can be exposed to the user
(because they will often try watching memory ranges that are not
exactly power-of-2 in size/alignment) but this is the first part
of adding that capability.

Differential Revision: https://reviews.llvm.org/D149792
rdar://108233371

15 months agoRecognize `addressing_bits` kv in stop reply packet
Jason Molenda [Thu, 4 May 2023 20:13:30 +0000 (13:13 -0700)]
Recognize `addressing_bits` kv in stop reply packet

If a remote stub provides the addressing_bits kv pair in
the stop reply packet, update the Process address masks with
that value as it possibly changes during the process runtime.
This is an unusual situation, most likely a JTAG remote stub
and some very early startup code that is setting up the page
tables.  Nearly all debug sessions will have a single address
mask that cannot change during the lifetime of a Process.

Differential Revision: https://reviews.llvm.org/D149803
rdar://61900565

15 months ago[libc][rpc] Land helpers from D148943
Jon Chesterfield [Thu, 4 May 2023 19:53:07 +0000 (20:53 +0100)]
[libc][rpc] Land helpers from D148943

15 months ago[LLDB] Add a hook to notify REPLs that an expression was evaluated
walter erquinigo [Wed, 3 May 2023 02:40:12 +0000 (21:40 -0500)]
[LLDB] Add a hook to notify REPLs that an expression was evaluated

REPL implementations don't have an easy way to know that an expression has been evaluated, so I'm adding a simple function for that. In the future we can add another hook for meta commands.

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

15 months ago[lldb] Make some functions useful to REPLs public
walter erquinigo [Wed, 3 May 2023 02:12:43 +0000 (21:12 -0500)]
[lldb] Make some functions useful to REPLs public

`StartEventHandlerThread` and `StopEventHandlerThread` are available to the SwiftREPL even though they are protected because SwiftREPL is a friend class of Debugger. I'm developing my own REPL and having access to these functions, including `FlushProcessOutput`, is desirable.

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

15 months ago[MSP430] Get the DWARF pointer size from MCAsmInfo instead of DataLayout.
Ilya Kuklin [Thu, 4 May 2023 19:36:25 +0000 (12:36 -0700)]
[MSP430] Get the DWARF pointer size from MCAsmInfo instead of DataLayout.

This change will allow to put code pointers in DWARF info fields that are larger than actual pointer size, e.g. 16-bit pointers into 32-bit fields.

The need for this came up while creating support for MSP430 in LLDB. MSP430-GCC already generates DWARF info with 32-bit fields, so this change is necessary for LLDB to maintain compatibility with both GCC and LLVM binaries. Moreover, right now in LLDB there is no support for having DWARF pointer size different from ELF header type, e.g. 16-bit DWARF info within ELF32, and it seems there is no such thing as ELF16.

Since other mainline targets are made to have the same pointer size in both MCAsmInfo and DataLayout, there is no need to change anything there.

Reviewed By: dblaikie

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

15 months ago[llvm-profdata] Change default output format of llvm-profdata to ExtBinary
William Huang [Tue, 2 May 2023 22:35:04 +0000 (22:35 +0000)]
[llvm-profdata] Change default output format of llvm-profdata to ExtBinary

ExtBinary is compatible to, and more superior than Binary format, which is the current default output format. In the long run we are looking to only support ExtBinary format and Text format (for visual inspection), and drop Binary format as well. Since Binary format was the default, we expect many users are still using it, so let's change the default output format first, and hopefully the usage decreases over time

Reviewed By: davidxl, hoy

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

15 months ago[libc] Remove support for atomic test due to failing on sm_60
Joseph Huber [Thu, 4 May 2023 19:12:43 +0000 (14:12 -0500)]
[libc] Remove support for atomic test due to failing on sm_60

This test fails on sm_60 because of the atomics codegen. We test atomics
indirectly with the `rpc` so we still have coverage.

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

15 months agoRevert "[libc] Improve the add_libc_test rule."
Siva Chandra Reddy [Thu, 4 May 2023 19:09:19 +0000 (19:09 +0000)]
Revert "[libc] Improve the add_libc_test rule."

This reverts commit fb6faf4798b1cb327e719898e2ea6eff7f597c49 as the
aarch64 builders are failing.

15 months ago[libc] Improve the add_libc_test rule.
Siva Chandra Reddy [Wed, 3 May 2023 08:00:37 +0000 (08:00 +0000)]
[libc] Improve the add_libc_test rule.

A target for the test named ${fq_target_name} has been added. It depends
on ${fq_target_name}.__unit__ and ${fq_target_name}.__hermetic__ as
relevant.

Reviewed By: jhuber6

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

15 months agodocs: Document policy around GitHub branches
Tom Stellard [Thu, 4 May 2023 18:52:22 +0000 (11:52 -0700)]
docs: Document policy around GitHub branches

See discussion in #56643.

Reviewed By: rengolin, jhenderson, ldionne

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

15 months ago[clang][ExtractAPI] Add semicolon to function declaration fragments
NagaChaitanya Vellanki [Thu, 4 May 2023 18:35:42 +0000 (11:35 -0700)]
[clang][ExtractAPI] Add semicolon to function declaration fragments

Add missing semicolon at the end of function declarations to fragments

Reviewed By: dang

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

15 months ago[libc++][PSTL] Replace _PSTL_ASSERT with _LIBCPP_ASSERT
Nikolas Klauser [Tue, 2 May 2023 22:08:46 +0000 (15:08 -0700)]
[libc++][PSTL] Replace _PSTL_ASSERT with _LIBCPP_ASSERT

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

15 months agoFix build bots due to missing a commit thay change 2b to 23
Shafik Yaghmour [Thu, 4 May 2023 18:23:16 +0000 (11:23 -0700)]
Fix build bots due to missing a commit thay change 2b to 23

Fixing build bot breaks due to b4692f29263006c7ea519c7b11c9082384f0af53

15 months ago[llvm-objdump][COFF] Skip empty export entries when dumping the export table
Alexandre Ganea [Thu, 4 May 2023 17:01:13 +0000 (13:01 -0400)]
[llvm-objdump][COFF] Skip empty export entries when dumping the export table

Before this patch, export entries with empy RVA were displayed in the output. In some cases, when the module had exports with sparse ordinals, `llvm-objdump` used to print a lot of `0 0` lines.
We now skip over these empty entries in the output, just as `dumpbin` or binutils `objdump` does.

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

15 months ago[clang] Fix another case where CPlusPlus2b is still used.
Michael Liao [Thu, 4 May 2023 18:27:33 +0000 (14:27 -0400)]
[clang] Fix another case where CPlusPlus2b is still used.

15 months ago[clang] Fix build after https://reviews.llvm.org/D149553
Michael Liao [Thu, 4 May 2023 18:22:38 +0000 (14:22 -0400)]
[clang] Fix build after https://reviews.llvm.org/D149553

- `CXXPre2bCompat` is referenced somewhere after being removed.
- More warning messages on c++2b need refining

15 months ago[libc] Maintain proper alignment for the hermetic tests malloc
Joseph Huber [Thu, 4 May 2023 16:22:38 +0000 (11:22 -0500)]
[libc] Maintain proper alignment for the hermetic tests malloc

We use a bump pointer to implement malloc for the hermetic tests.
Currently, we bump the pointer up by any amount. This means that calling
`malloc(1)` will misalign the buffer so any following `malloc(8)`
accesses will not be aligned. This causes problems in architectures
which require alignment.

Reviewed By: sivachandra

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

15 months ago[gn build] Fix tblgen CodeGen dependencies
Arthur Eubanks [Thu, 4 May 2023 18:17:55 +0000 (11:17 -0700)]
[gn build] Fix tblgen CodeGen dependencies

Matches the CMake build, otherwise we're rebuilding tblgen (and everything else) when there's a change almost anywhere in LLVM.

15 months ago[MIRParser][nfc] Factor out code parsing debug MD nodes
Felipe de Azevedo Piovezan [Thu, 4 May 2023 16:30:59 +0000 (12:30 -0400)]
[MIRParser][nfc] Factor out code parsing debug MD nodes

This commit splits a function that both parses MD nodes from YAML into
DI{Expr,Loc,Variable} objects AND adds an entry to the MF variable table, so
that each of those jobs is done separately.

It will enable subsequent patches to reuse the MD node parsing code.

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

15 months ago[flang][openacc] Lower data clause on compute construct to data operand ops
Valentin Clement [Thu, 4 May 2023 18:15:04 +0000 (11:15 -0700)]
[flang][openacc] Lower data clause on compute construct to data operand ops

This patch lowers the data clause on the OpenACC compute construct
to their corresponding acc data operand operation.
The decomposition is the same as in D149673.

Note that `private` and `firstprivate` are not lowered to data operand operation as they do not have one and will likely have dedicated design/process.

Depends on D149673

Reviewed By: razvanlupusoru, jeanPerier

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

15 months ago[VPlan] Remove setEntry to avoid leaks when replacing entry.
Florian Hahn [Thu, 4 May 2023 18:12:02 +0000 (19:12 +0100)]
[VPlan] Remove setEntry to avoid leaks when replacing entry.

Update the HCFG builder to directly connect the created CFG to the
existing Plan's entry. This allows removing `setEntry`, which can cause
leaks when the existing entry is replaced.

Should fix
https://lab.llvm.org/buildbot/#/builders/5/builds/33455/steps/13/logs/stdio

15 months agoRestore mlir-opt `--run-reproducer` option to opt-in running a reproducer
Mehdi Amini [Thu, 4 May 2023 16:40:56 +0000 (09:40 -0700)]
Restore mlir-opt `--run-reproducer` option to opt-in running a reproducer

When tooling out there produces a reproducer that is archived, the first thing
a user is likely to expect is to process this as they do with any MLIR file.
However https://reviews.llvm.org/D126447 changed the behavior of mlir-opt to
eliminate the `--run-reproducer` option and instead automatically run it when
present in the input file. This creates a discrepancy in how mlir-opt behaves
when fed with an input file, and is surprising for users.
The explicit passing of `--run-reproducer` to express user-intent seems more
in line with what is expected from `mlir-opt`.

Reviewed By: rriddle, jpienaar

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

15 months ago[Clang] Updating handling of defaulted comparison operators to reflect changes from...
Shafik Yaghmour [Thu, 4 May 2023 18:05:25 +0000 (11:05 -0700)]
[Clang] Updating handling of defaulted comparison operators to reflect changes from P2448R2

Prior to P2448R2 we were more aggressive in diagnosing ill-formed
constexpr functions. Many of these restrictions were relaxed and now it
is not required for defaulted comparison operators to call constexpr
functions.

This behavior is extended to before C++23 and diagnostic for it's use
can be enabled w/ -pedantic or -Wc++2b-default-comp-relaxed-constexpr

This fixes: https://github.com/llvm/llvm-project/issues/61238

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

15 months ago[lldb] Remove unused g_objc_Tagged_ISA constants (NFC)
Dave Lee [Thu, 4 May 2023 17:58:48 +0000 (10:58 -0700)]
[lldb] Remove unused g_objc_Tagged_ISA constants (NFC)

Last use removed in f7420453e80b9294273009efcebaceac2383269e.

15 months ago[libc++][test] Selects proper C++23 field.
Mark de Wever [Sun, 30 Apr 2023 19:23:30 +0000 (21:23 +0200)]
[libc++][test] Selects proper C++23 field.

D149553 changes the name of the LangOptions member. This change allows
libc++ to work with either name.

Reviewed By: philnik, #libc

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