platform/upstream/llvm.git
14 months ago[bazel][NFC] Add missing dep after 5ac48ef51393e6d8392182ad439a22002571d554
Jordan Rupprecht [Thu, 11 May 2023 19:40:51 +0000 (12:40 -0700)]
[bazel][NFC] Add missing dep after 5ac48ef51393e6d8392182ad439a22002571d554

14 months ago[AArch64] Update Changed status in AArch64MIPeepholeOpt
David Green [Thu, 11 May 2023 18:55:44 +0000 (19:55 +0100)]
[AArch64] Update Changed status in AArch64MIPeepholeOpt

I have not seen this be a problem, but the Changed status should be updated not
reset on new instruction to get the total Changed status overall.

14 months ago[clang] Document extensions from later standards
Nikolas Klauser [Wed, 10 May 2023 22:40:22 +0000 (15:40 -0700)]
[clang] Document extensions from later standards

Reviewed By: aaron.ballman

Spies: H-G-Hristov, cfe-commits

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

14 months ago[BOLT] Fix flush pending relocs
Rafael Auler [Thu, 11 May 2023 00:56:43 +0000 (17:56 -0700)]
[BOLT] Fix flush pending relocs

https://github.com/facebookincubator/BOLT/pull/255 accidentally
omitted a relocation type when refactoring the code. Add this type back
and change function name so its intent is more clear.

Reviewed By: #bolt, Amir

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

14 months ago[LAA] Simplify identification of speculatable strides [nfc]
Philip Reames [Thu, 11 May 2023 18:44:53 +0000 (11:44 -0700)]
[LAA] Simplify identification of speculatable strides [nfc]

Mostly just avoiding the need to keep both Value and SCEVs flowing through with consistent handling.  We can do everything in terms of SCEV - aside from the profitability heuristics which are now isolated in one spot.

14 months ago[ShrinkWrap] Allow shrinkwrapping past memory accesses to jump tables
Jonathon Penix [Thu, 4 May 2023 18:35:24 +0000 (11:35 -0700)]
[ShrinkWrap] Allow shrinkwrapping past memory accesses to jump tables

This patch adds a check for whether the memory operand is known to be
a jump table and, if so, allows shrinkwrapping to continue. In the
case that we are looking at a jump table, I believe it is safe to
assume that the access will not be to the stack (but please correct me
if I am wrong here).

In the test attached, this is helpful in that we are able to generate
only one instruction for each non-default case in the original switch
statement.

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

14 months ago[Propeller] Use a bit-field struct for the metdata fields of BBEntry.
Rahman Lavaee [Thu, 11 May 2023 18:15:12 +0000 (11:15 -0700)]
[Propeller] Use a bit-field struct for the metdata fields of BBEntry.

This patch encapsulates the encoding and decoding logic of basic block metadata into the Metadata struct, and also reduces the decoded size of `SHT_LLVM_BB_ADDR_MAP` section.

The patch would've looked more readable if we could use designated initializer, but that is a c++20 feature.

Reviewed By: jhenderson

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

14 months ago[LV/LAA] Use PSE to identify stride multiplies which simplify [mostly nfc]
Philip Reames [Thu, 11 May 2023 17:55:15 +0000 (10:55 -0700)]
[LV/LAA] Use PSE to identify stride multiplies which simplify [mostly nfc]

LV/LAA will speculate that (some) strided access patterns have unit stride, and insert runtime checks if required.

LV cost models a multiply by such a stride as free.  We did this by keeping around the StrideSet structure, just to check if one of the operands were one of the strides we speculated.

We can instead just ask PredicatedScalarEvolution if either of the operands are one (after predicates are applied).  We get mostly the same result - PSE can prove it in more cases in theory - and simpler code.

14 months ago[mlgo] Fix reference files / values post - D140975
Mircea Trofin [Thu, 11 May 2023 17:59:28 +0000 (10:59 -0700)]
[mlgo] Fix reference files / values post - D140975

14 months ago[libc] Fix undeclared 'free' function in stream test
Joseph Huber [Thu, 11 May 2023 17:46:37 +0000 (12:46 -0500)]
[libc] Fix undeclared 'free' function in stream test

Summary:
We need this function from the test.cpp but need to declare it manually.

14 months ago[mlir][Linalg] Add support for lowerPack on dynamic outer shapes.
Hanhan Wang [Mon, 1 May 2023 18:23:02 +0000 (11:23 -0700)]
[mlir][Linalg] Add support for lowerPack on dynamic outer shapes.

The revision adds support for tensor.pack op decomposition when all
inner tile sizes are static. The generated tensor.expand_shape op is
still valid because only one of the expanding dimension is dynamic.

Reviewed By: mravishankar

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

14 months ago[mlir][sparse] add util for ToCoordinatesBuffer for COO AoS
Aart Bik [Thu, 11 May 2023 17:05:16 +0000 (10:05 -0700)]
[mlir][sparse] add util for ToCoordinatesBuffer for COO AoS

Reviewed By: Peiming

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

14 months ago[mlir][flang][openacc] Remove obsolete operand legalization passes
Valentin Clement [Thu, 11 May 2023 17:24:22 +0000 (10:24 -0700)]
[mlir][flang][openacc] Remove obsolete operand legalization passes

The information needed for translation is now encoded in the dialect
operations and does not require a dedicated pass to be extracted.
Remove the obsolete passes that were performing operand legalization.

Reviewed By: jeanPerier

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

14 months ago[LAA/LV] Simplify stride speculation logic [NFC] (try 2)
Philip Reames [Thu, 11 May 2023 16:47:37 +0000 (09:47 -0700)]
[LAA/LV] Simplify stride speculation logic [NFC] (try 2)

The original commit wasn't quite NFC, and this was caught by an arguably overly strong assert.  Specifically, I'd failed to strip off the integer cast off the SCEV before saving it in the map.  The result - other than a failed assert - is that we'd speculate on the casted unknown, not the unknown.  The only case I can think of where that might change behavior would be a sext(i1 load).  I doubt that case is interesting in practice, but it's good to be strictly NFC on this change regardless.

Original commit message follows..

The existing code makes it hard to tell that collectStridedAccess is really about identifying some loop invariant SCEV which is *profitable* to speculate is equal to one. The odd dual usage structure of Value and SCEV confuses this point.

We could choose to loosen the profitability analysis if desired. I'm not proposing doing so at this time as it exposes too many cases where the speculation is unprofitable.

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

14 months ago[libc] Implement a generic streaming interface in the RPC
Joseph Huber [Thu, 11 May 2023 16:11:24 +0000 (11:11 -0500)]
[libc] Implement a generic streaming interface in the RPC

Currently we provide the `send_n` and `recv_n` functions. These were
somewhat divergent and not tested on the GPU. This patch changes the
support to be more common. We do this my making the CPU provide an array
equal the to at least the lane size while the GPU can rely on the
private memory address of its stack variables. This allows us to send
data back and forth generically.

Reviewed By: JonChesterfield

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

14 months agoRevert "[LAA/LV] Simplify stride speculation logic [NFC]"
Philip Reames [Thu, 11 May 2023 16:25:45 +0000 (09:25 -0700)]
Revert "[LAA/LV] Simplify stride speculation logic [NFC]"

This reverts commit d5b840131223f2ffef4e48ca769ad1eb7bb1869a.  Running this through broader testing after rebasing is revealing a crash.  Reverting while I investigate.

14 months ago[WPD] Update llvm.public.type.test after importing functions
Teresa Johnson [Wed, 10 May 2023 23:05:41 +0000 (16:05 -0700)]
[WPD] Update llvm.public.type.test after importing functions

I noticed that we are converting llvm.public.type.test to regular
llvm.type.test too early, and thus not updating those in imported
functions. This would result in losing out on WPD opportunities. Move
the update to after function importing, and improve test to cover this
case.

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

14 months ago[LV] Use VPValue to get expanded value for SCEV step expressions.
Florian Hahn [Thu, 11 May 2023 15:49:18 +0000 (16:49 +0100)]
[LV] Use VPValue to get expanded value for SCEV step expressions.

Update skeleton creation logic to use SCEV expansion results from
expanding the pre-header. This avoids another set of SCEV expansions
that may happen after the CFG has been modified.

Fixes #58811.

Depends on D147964.

Reviewed By: Ayal

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

14 months ago[flang][hlfir] Establish <storage, mustFree> tuple for ApplyOp and NoReassocOp.
Slava Zakharin [Thu, 11 May 2023 04:41:14 +0000 (21:41 -0700)]
[flang][hlfir] Establish <storage, mustFree> tuple for ApplyOp and NoReassocOp.

The bufferization pass must create the tuple for these operations, because
the users may require it. For example, in case of ElementalOp inlining
a DestroyOp may be generated for the operand of YieldElementOp, and
the operand may be ApplyOp->NoReassocOp chain.

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

14 months ago[LAA/LV] Simplify stride speculation logic [NFC]
Philip Reames [Thu, 11 May 2023 15:10:49 +0000 (08:10 -0700)]
[LAA/LV] Simplify stride speculation logic [NFC]

The existing code makes it hard to tell that collectStridedAccess is really about identifying some loop invariant SCEV which is *profitable* to speculate is equal to one. The odd dual usage structure of Value and SCEV confuses this point.

We could choose to loosen the profitability analysis if desired. I'm not proposing doing so at this time as it exposes too many cases where the speculation is unprofitable.

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

14 months ago[flang] Use internal linkage for string literals
David Truby [Thu, 11 May 2023 13:47:31 +0000 (14:47 +0100)]
[flang] Use internal linkage for string literals

On Windows, global string literals with "linkonce" linkage is not
supported without using comdat. As a simpler fix than adding comdat
support we can use internal linkage instead.

This fixes a bug where two string literals with the same value in
different fortran files would cause a linker error due to the use
of linkonce linkage.

Reviewed By: jeanPerier

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

14 months agollvm/lib: Use <cerrno> explicitly since D146395 has hidden `errno`
NAKAMURA Takumi [Sat, 29 Apr 2023 07:25:06 +0000 (16:25 +0900)]
llvm/lib: Use <cerrno> explicitly since D146395 has hidden `errno`

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

14 months ago[YamlMF] Serialize EntryValueObjects
Felipe de Azevedo Piovezan [Mon, 1 May 2023 12:37:51 +0000 (08:37 -0400)]
[YamlMF] Serialize EntryValueObjects

This commit implements the serialization and deserialization of the Machine
Function's EntryValueObjects.

Depends on D149879, D149778

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

14 months ago[libc][obvious] Fix undefined variable after name change
Joseph Huber [Thu, 11 May 2023 13:38:27 +0000 (08:38 -0500)]
[libc][obvious] Fix undefined variable after name change

I forgot that we still used these variables in the loaders.

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

14 months agoFixed NATVIS debug visualizers for Clang
Aaron Ballman [Thu, 11 May 2023 13:27:58 +0000 (09:27 -0400)]
Fixed NATVIS debug visualizers for Clang

This fixes the visualizers for:
Type
DeclContext
QualType
TypedefNameDecl
NestedNameSpecifier
FunctionDecl

and adds visualizers for:
VariableArrayType
ElaboratedType
ParenType
BitIntType

14 months agoFixed NATVIS debug visualizers for LLVM
Aaron Ballman [Thu, 11 May 2023 13:27:46 +0000 (09:27 -0400)]
Fixed NATVIS debug visualizers for LLVM

This fixes the visualizers for:
PointerIntPair
PointerUnion
PointerIntPair<PointerUnion<*>, *>
StringMapEntry

and adds a visualizer for:
PunnedPointer

14 months ago[libc][NFC] Clean up some code in the RPC implementation.
Joseph Huber [Thu, 11 May 2023 13:21:12 +0000 (08:21 -0500)]
[libc][NFC] Clean up some code in the RPC implementation.

Small cleanup of the server code and fixes a constant name not following
the naming convention.

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

14 months agoFix CRTP partial specialization instantiation crash.
Erich Keane [Wed, 10 May 2023 18:15:04 +0000 (11:15 -0700)]
Fix CRTP partial specialization instantiation crash.

Fixes #60778.

When instantiating the body of a class template specialization that was
instantiated from a partial specialization, we were incorrectly
collecting template arguments from the primary template, which resulted
in the template arguments list being inaccurate.  In the example from
the issue, we were trying to substitute the boolean 'false' into the
type on Nested, which caused an assertion.

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

14 months ago[mlir][llvm] Improve LLVM IR constant import.
Tobias Gysi [Thu, 11 May 2023 12:45:31 +0000 (12:45 +0000)]
[mlir][llvm] Improve LLVM IR constant import.

Improve the constant import to handle zeroinitializer as well as
additional float types such as quad floats. The logic got restructured
to avoid creating intermediate dense element attributes when
constructing multi-dimensional arrays. Additionally, we also leverage
the fact that we do not need to iterate all elements of splat constants.

Reviewed By: Dinistro

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

14 months ago[mlir][llvm] Improve lookups in LLVM IR import (NFC).
Tobias Gysi [Thu, 11 May 2023 12:40:54 +0000 (12:40 +0000)]
[mlir][llvm] Improve lookups in LLVM IR import (NFC).

This revision uses contains in favor of count when
searching sets and maps. Additionally it uses find
instead of count and lookup, which avoids searching
some maps twice.

Reviewed By: Dinistro

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

14 months ago[CodeGen][ShrinkWrap] Split restore point
sgokhale [Thu, 11 May 2023 12:21:48 +0000 (17:51 +0530)]
[CodeGen][ShrinkWrap] Split restore point

Land D42600 with optimisation disabled by default by setting 'enable-shrink-wrap-region-split' option.

This is just to reduce effort involved in making changes to patch each time issue is detected and reland the whole patch.

14 months ago[mlir][bytecode] Fix dialect version parsing.
Jacques Pienaar [Thu, 11 May 2023 12:19:06 +0000 (05:19 -0700)]
[mlir][bytecode] Fix dialect version parsing.

We were querying the wrong EncReader along some paths that resulted in
failures depending on if one encountered an Attribute from an unloaded
dialect before encountering an operation from that dialect.

Also fix error where we were able to emit "custom" form for an attribute
without custom form in TestDialect.

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

14 months ago[Flang] Change complex divide lowering
Kiran Chandramohan [Thu, 11 May 2023 11:52:21 +0000 (11:52 +0000)]
[Flang] Change complex divide lowering

Currently complex division is lowered to a fir.divc operation and the
fir.divc is later converted to a sequence of llvm operations to perform
complex division, however this causes issues for extreme values when
the calculations overflow.

This patch changes the lowering of complex division to use the Intrinsic
Call functionality to lower into library calls (for single, double,
extended and quad precisions) or an MLIR complex dialect division operation
(for half and bfloat precisions).

 A new wrapper function `genLibSplitComplexArgsCall` is written to handle
 the case of the arguments of the Complex Library calls being split to
its real and imaginary real components.

Note 1: If the Complex To Standard conversion of division operation
matures then we can use it for all precisions. Currently it has the
same issues as the conversion of fir.divc.
Note 2: A previous patch (D145808) did the same but during conversion of
the fir.divc operation. But using function calls at that stage leads to
ABI issues since the conversion to LLVM is not aware of the complex target
rewrite.
Note 3: If the patch is accepted, fir.divc can be removed from FIR. We
can use the complex.div operation where any transformation is required.

Reviewed By: vzakhari, PeteSteinfeld, DavidTruby, jeanPerier

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

14 months ago[MachineFunction][DebugInfo][nfc] Introduce EntryValue variable kind
Felipe de Azevedo Piovezan [Sun, 30 Apr 2023 13:48:01 +0000 (09:48 -0400)]
[MachineFunction][DebugInfo][nfc] Introduce EntryValue variable kind

MachineFunction keeps a table of variables whose addresses never change
throughout the function. Today, the only kinds of locations it can
handle are stack slots.

However, we could expand this for variables whose address is derived
from the value a register had upon function entry. One case where this
happens is with variables alive across coroutine funclets: these can
be placed in a coroutine frame object whose pointer is placed in a
register that is an argument to coroutine funclets.

```
define @foo(ptr %frame_ptr) {
  dbg.declare(%frame_ptr, !some_var,
              !DIExpression(EntryValue, <ptr_arithmetic>))
```

This is a patch in a series that aims to improve the debug information
generated by the CoroSplit pass in the context of `swiftasync`
arguments. Variables stored in the coroutine frame _must_ be described
the entry_value of the ABI-defined register containing a pointer to the
coroutine frame. Since these variables have a single location throughout
their lifetime, they are candidates for being stored in the
MachineFunction table.

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

14 months ago[libc++] Adjust tests using ext/* headers that undefine __DEPRECATED
John Brawn [Mon, 13 Mar 2023 13:27:41 +0000 (13:27 +0000)]
[libc++] Adjust tests using ext/* headers that undefine __DEPRECATED

Several tests undefined __DEPRECATED to avoid warnings as they're
testing the deprecated ext/hash_map. A better way to do this is to use
-Wno-deprecated so it isn't defined in the first place. This prevents
these tests from failing when we give a warning when undefining the
__DEPRECATED macro, as D144654 will do.

For the generated tests however just remove the testing of these
header files, so we don't disable the warning when testing the other
header files.

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

14 months ago[AArch64] Handle vector with two different values with efficient vector mask
Jingu Kang [Tue, 9 May 2023 09:37:20 +0000 (10:37 +0100)]
[AArch64] Handle vector with two different values with efficient vector mask

When we lower BUILD_VECTOR to VECTOR_SHUFFL, we could generate efficient vector
mask. For example,

 t24: v8i8 = BUILD_VECTOR t25, t25, t25, t25, t26, t26, t26, t26
 ==>
   t27: v8i8 = BUILD_VECTOR t26, t26, t26, t26, t26, t26, t26, t26
   t28: v8i8 = BUILD_VECTOR t25, t25, t25, t25, t25, t25, t25, t25
 t29: v8i8 = vector_shuffle<0,1,2,3,12,13,14,15> t27, t2

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

14 months ago[libc][benchmark] Do not force static linking
Guillaume Chatelet [Thu, 11 May 2023 09:09:28 +0000 (09:09 +0000)]
[libc][benchmark] Do not force static linking

Being able to link statically depends on other CMake options and choice of libc.

14 months ago[libc] Allows cross compilation of membenchmarks
Guillaume Chatelet [Tue, 9 May 2023 13:53:32 +0000 (13:53 +0000)]
[libc] Allows cross compilation of membenchmarks

This patch makes sure:
 - we pass the correct compiler options when building Google benchmarks,
 - we only import the C++ version of the memory functions.

The change in libc/cmake/modules/LLVMLibCTestRules.cmake is here to make sure CMake can generate the right command line in the presence of the CMAKE_CROSSCOMPILING_EMULATOR option.

Relevant documentation:
https://cmake.org/cmake/help/latest/variable/CMAKE_CROSSCOMPILING_EMULATOR.html
https://cmake.org/cmake/help/latest/command/add_custom_command.html#command:add_custom_command
"
If COMMAND specifies an executable target name (created by the `add_executable()` command), it will automatically be replaced by the location of the executable created at build time if either of the following is true:
 - The target is not being cross-compiled (i.e. the CMAKE_CROSSCOMPILING variable is not set to true).
 - New in version 3.6: The target is being cross-compiled and an emulator is provided (i.e. its CROSSCOMPILING_EMULATOR target property is set). In this case, the contents of CROSSCOMPILING_EMULATOR will be prepended to the command before the location of the target executable.
"

Reviewed By: gchatelet

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

14 months ago[mlir][doc] Fix the EBNF description of mlir syntax in language reference doc
Yan Xin [Thu, 11 May 2023 08:36:52 +0000 (09:36 +0100)]
[mlir][doc] Fix the EBNF description of mlir syntax in language reference doc

According to the EBNF syntax described in the 'Common syntax' chapter,
literal characters should be surrounded by backticks (`). However, in
some sections of this document, single quotes (') are used instead.
So, fix them.

Reviewed By: mehdi_amini

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

14 months ago[NFC][AMDGPU] Pre-commit test.
Thomas Symalla [Thu, 11 May 2023 07:11:14 +0000 (09:11 +0200)]
[NFC][AMDGPU] Pre-commit test.

14 months ago[X86] Add lowering of fminimum/fmaximum for vector operands.
Serguei Katkov [Thu, 4 May 2023 10:16:00 +0000 (17:16 +0700)]
[X86] Add lowering of fminimum/fmaximum for vector operands.

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

14 months agoSupport critical edge splitting for jump tables
Matthias Braun [Fri, 9 Dec 2022 01:15:41 +0000 (17:15 -0800)]
Support critical edge splitting for jump tables

Add support for splitting critical edges coming from an indirect jump
using a jump table ("switch jumps").

This introduces the `TargetInstrInfo::getJumpTableIndex` callback to
allows targets to return an index into `MachineJumpTableInfo` for a
given indirect jump. It also updates to
`MachineBasicBlock::SplitCriticalEdge` to allow splitting of critical
edges by rewriting jump table entries.

This is largely based on work done by Zhixuan Huan in D132202.

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

14 months ago[clang][CodeGenPGO] Don't use an invalid index when region counts disagree
Nathan Lanza [Thu, 11 May 2023 02:48:43 +0000 (22:48 -0400)]
[clang][CodeGenPGO] Don't use an invalid index when region counts disagree

If we're using an old instrprof profile and the user passes we can get
Decls with children decl counts not matching the what the profile was
written against. In a particular case I was debugging we have 24 decls
in the AST and 22 decls in the profile. Avoid crashing in this case.

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

14 months ago[AIX] enable enable OrcCAPITest, NFC
Chen Zheng [Thu, 11 May 2023 02:35:16 +0000 (22:35 -0400)]
[AIX] enable enable OrcCAPITest, NFC

After enhancement for XCOFF integrated assembler mode, now OrcCAPITest
can be enabled on AIX.

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

14 months ago[C++] Don't filter using declaration when we perform qualified look up
Chuanqi Xu [Sat, 6 May 2023 08:53:55 +0000 (16:53 +0800)]
[C++] Don't filter using declaration when we perform qualified look up

Close https://github.com/llvm/llvm-project/issues/62174

And this was originally a try to close
https://github.com/llvm/llvm-project/issues/62158.

I don't feel this is the correct fix. I just think it is not bad as an
ad-hoc patch. And let's discuss things in the higher-level in the above
GitHub issue link.

Reviewed By: erichkeane

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

14 months ago[libc][rpc] Allocate a single block of shared memory instead of three
Jon Chesterfield [Thu, 11 May 2023 02:04:55 +0000 (03:04 +0100)]
[libc][rpc] Allocate a single block of shared memory instead of three

Allows moving the pointer swap between server and client into reset.
Single allocation simplifies whatever allocates the client/server, currently
the libc loaders.

Reviewed By: jhuber6

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

14 months agoRemove accidentally committed empty file
Teresa Johnson [Thu, 11 May 2023 01:44:58 +0000 (18:44 -0700)]
Remove accidentally committed empty file

Removes an empty file inadvertently included with
b8d2f7177c39af7be371ba7f46cb00b9c63ef8f5.

14 months ago[mlir][Linalg] Use ReifyRankedShapedTypeOpInterface for pad transforms.
Hanhan Wang [Tue, 9 May 2023 21:25:53 +0000 (14:25 -0700)]
[mlir][Linalg] Use ReifyRankedShapedTypeOpInterface for pad transforms.

The information is not tied to tensor.empty op and tensor.extract_slice
op. We can infer smallest static bounding box for pad transform if
they implement ReifyRankedShapedTypeOpInterface. The revision extends
the usability for downstream projects. No tests are added because the
existing tests cover the change, and most of MLIR
ReifyRankedShapedTypeOpInterface ops are covered in the tests, except
tensor.generate and bufferization.alloc_tensor ops.

Reviewed By: mravishankar

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

14 months ago[OpenMP][Flang][Semantics] Add semantics support for USE_DEVICE_ADDR clause on OMP...
Raghu Maddhipatla [Thu, 4 May 2023 04:47:42 +0000 (23:47 -0500)]
[OpenMP][Flang][Semantics] Add semantics support for USE_DEVICE_ADDR clause on OMP TARGET DATA directive.

Reviewed By: kiranchandramohan

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

14 months ago[ORC-RT] Add REQUIRES: jit-compatible-osx-swift-runtime to testcase.
Lang Hames [Wed, 10 May 2023 23:59:26 +0000 (16:59 -0700)]
[ORC-RT] Add REQUIRES: jit-compatible-osx-swift-runtime to testcase.

Swift and ObjC testcases require a jit-compatible runtime.

rdar://109162598

14 months ago[libc] Fix RPC interface when sending and recieving aribtrary packets
Joseph Huber [Wed, 10 May 2023 23:14:51 +0000 (18:14 -0500)]
[libc] Fix RPC interface when sending and recieving aribtrary packets

The interface exported by the RPC library allows users to simply send
and recieve fixed sized packets without worrying about the data motion
underneath. However, this was broken in the current implementation. We
can think of the send and recieve implementations in terms of waiting
for ownership of the buffer, using the buffer, and posting ownership to
the other side. Our implementation of `recv` was incorrect in the
following scenarios.

recv -> send // we still own the buffer and should give away ownership
recv -> close // The other side is not waiting for data, this will
                 result in multiple openings of the same port

This patch attempts to fix this with an admittedly hacky fix where we
track if the previous implementation was a recv and post conditionally.

Reviewed By: JonChesterfield

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

14 months agoPrioritize using a segment with the name TEXT instead off fileoff 0
Jason Molenda [Wed, 10 May 2023 23:39:20 +0000 (16:39 -0700)]
Prioritize using a segment with the name TEXT instead off fileoff 0

lldb needs to find the virtual address of the mach header of a
binary.  It first scans for a segment which starts at file offset
0, and uses the vmaddr of that segment.  If no segment starts at
fileoff 0, it looks for a segment named __TEXT.

This patch changes the order of those, to first search for the TEXT
segment.  We have a situation where binaries exist that have the
DATA segment first, which does not have the vmaddr of the mach header,
it merely happens to come first in the binary file.  It's an unusual
arrangement, but not breaking any rules of Mach-O.  So lldb needs
to handle this.

Differential Revision: https://reviews.llvm.org/D150239
rdar://109128418

14 months ago[libc][rpc] Allocate locks array within process
Jon Chesterfield [Wed, 10 May 2023 23:39:54 +0000 (00:39 +0100)]
[libc][rpc] Allocate locks array within process

Replaces the globals currently used. Worth changing to a bitmap
before allowing runtime number of ports >> 64. One bit per port is likely
to be cheap enough that sizing for the worst case is always fine, otherwise
in the future we can change to dynamically allocating it.

Reviewed By: jhuber6

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

14 months ago[FS-AFDO] Do not load non-FS profile in MIR loader.
Hongtao Yu [Wed, 10 May 2023 23:10:39 +0000 (16:10 -0700)]
[FS-AFDO] Do not load non-FS profile in MIR loader.

I was seeing a regression when enabling FS discriminators on an non-FS CSSPGO build. This is because a probe can get a zero-valued discriminator at a specific pass and that could lead to accidentally loading the corresponding base counter in the non-FS profile, while a non-zeo discriminator would end up getting zero samples. This could in turn undo the sample distribution effort done by previous BFI maintenance work and the probe distribution factor work for pseudo probes specifically. To mitigate that I'm disabling loading a non-FS profile against FS discriminators. The problem should also exist with non-CS AutoFDO, so I'm doing this for it too.

Reviewed By: wenlei

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

14 months ago[libc] Prevent changing ownership of the port once opened
Joseph Huber [Mon, 8 May 2023 14:04:14 +0000 (09:04 -0500)]
[libc] Prevent changing ownership of the port once opened

The Port type has stipuations that the same exact mask used to open it
needs to close it. This can currently be violated by calling its move
constructor to put it somewhere else. We still need the move constructor
to handle the open and closing functions. So, we simply make these
constructors private and only allow a few classes to have move
priviledges on it.

Reviewed By: JonChesterfield, lntue

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

14 months agoAdopt Properties to store operations inherent Attributes in the Tensor dialect
Mehdi Amini [Fri, 21 Apr 2023 07:11:28 +0000 (01:11 -0600)]
Adopt Properties to store operations inherent Attributes in the Tensor dialect

This is part of an on-going migration to adopt Properties inside MLIR.

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

14 months agoAdopt Properties to store operations inherent Attributes in the SPIRV dialect
Mehdi Amini [Fri, 21 Apr 2023 07:09:46 +0000 (01:09 -0600)]
Adopt Properties to store operations inherent Attributes in the SPIRV dialect

This is part of an on-going migration to adopt Properties inside MLIR.

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

14 months agoAdopt Properties to store operations inherent Attributes in the SparseTensor dialect
Mehdi Amini [Fri, 21 Apr 2023 07:09:12 +0000 (01:09 -0600)]
Adopt Properties to store operations inherent Attributes in the SparseTensor dialect

This is part of an on-going migration to adopt Properties inside MLIR.

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

14 months agoAdopt Properties to store operations inherent Attributes in the Shape dialect
Mehdi Amini [Fri, 21 Apr 2023 07:08:35 +0000 (01:08 -0600)]
Adopt Properties to store operations inherent Attributes in the Shape dialect

This is part of an on-going migration to adopt Properties inside MLIR.

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

14 months agoAdopt Properties to store operations inherent Attributes in the SCF dialect
Mehdi Amini [Fri, 21 Apr 2023 07:06:48 +0000 (01:06 -0600)]
Adopt Properties to store operations inherent Attributes in the SCF dialect

This is part of an on-going migration to adopt Properties inside MLIR.

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

14 months ago[libc++][PSTL] Add missing includes to PSTL headers
Ian Anderson [Mon, 8 May 2023 04:39:40 +0000 (23:39 -0500)]
[libc++][PSTL] Add missing includes to PSTL headers

Several PSTL headers included by <algorithm> are missing includes for things they use.
Switch some quoted includes to angle includes.

(Issues found from running `check-cxx` with https://reviews.llvm.org/D144322)

Reviewed By: ldionne, #libc

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

14 months ago[libc++] Consistently enable __CORRECT_ISO_CPP_WCHAR_H_PROTO in mbstate.
Jordan Rupprecht [Wed, 10 May 2023 22:43:37 +0000 (15:43 -0700)]
[libc++] Consistently enable __CORRECT_ISO_CPP_WCHAR_H_PROTO in mbstate.

In libc++'s `wchar.h`, before we forward to the system `wchar.h`, we set `__CORRECT_ISO_CPP_WCHAR_H_PROTO` to ensure it defines the correct signature (e.g. `extern "C++" const wchar_t *wmemchr` and not `extern wchar_t *wmemchr`). After D148542, there are cases where we include the system `wchar.h` from within `__mbstate_t.h` without setting that, and so we get a function type mismatch if we transitively include `wchar.h` through multiple headers in a modules-enabled build. Consistently setting it here resolves those build errors.

Alternative 1: we could put this in `__config` instead. I chose to put it here for a more limited scope.

Alternative 2: we could patch `wchar.h` itself to work correctly and remove references `__CORRECT_ISO_CPP_WCHAR_H_PROTO` from libc++ entirely. It does already set it, but with an additional condition that it is being built by GCC >= 4.4. Clang does pretend to be GCC via `__GNUC__` etc. which can be controlled via `-fgnuc-version` command line flags, but that might have other consequences.

Reviewed By: ldionne, #libc, MaskRay

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

14 months agoWhen the Debugger runs HandleProcessEvent it should allow
Jim Ingham [Wed, 10 May 2023 22:40:40 +0000 (15:40 -0700)]
When the Debugger runs HandleProcessEvent it should allow
selecting the "Most relevant" frame.

If you don't do that, then the correct frame gets selected, but it
happens AFTER the frame info gets printed in the stop message, so
you don't see the selected frame.

The test for this hid the issue because it ran `frame info` and
checked the result of that.  That happens after the recognizer selects
the frame, and so it was right.  But if the recognizer is working
correctly it will have already done the same printing in the stop
message, and this way we also verify that the stop message was right.

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

14 months ago[FS-AFDO] Fix a pseudo probe test issue.
Hongtao Yu [Wed, 10 May 2023 22:32:28 +0000 (15:32 -0700)]
[FS-AFDO] Fix a pseudo probe test issue.

14 months agoRevert "[RISCV] Fix extract_vector_elt on i1 at idx 0 being inverted"
Philip Reames [Wed, 10 May 2023 22:02:28 +0000 (15:02 -0700)]
Revert "[RISCV] Fix extract_vector_elt on i1 at idx 0 being inverted"

This reverts commit d9683a70fef48cfaee2c83147a3b26f4f90162a2.  A regression was reported in the review, revert until author is back from conference and can investigate.

14 months ago[MemProf] Update hot/cold information after importing
Teresa Johnson [Wed, 10 May 2023 20:14:22 +0000 (13:14 -0700)]
[MemProf] Update hot/cold information after importing

The support added by D149215 to remove memprof metadata and attributes
if we don't link with an allocator supporting hot/cold operator new
interfaces did not update imported code. Move the update handling later
in the ThinLTO backend to just after importing, and update the test to
check this case.

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

14 months ago[Hexagon] Add patterns for bspap/bitreverse for scalar vectors
Krzysztof Parzyszek [Wed, 3 May 2023 23:22:31 +0000 (16:22 -0700)]
[Hexagon] Add patterns for bspap/bitreverse for scalar vectors

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

14 months ago[TableGen] Print message about dropped patterns with -debug
Krzysztof Parzyszek [Wed, 3 May 2023 22:52:12 +0000 (15:52 -0700)]
[TableGen] Print message about dropped patterns with -debug

A selection pattern can be silently dropped if type inference fails to
deduce some types. Print a message when that happens, and -debug was
applied.

14 months ago[scudo] Lock FallbackTSD before draining it
Chia-hung Duan [Wed, 10 May 2023 20:34:36 +0000 (20:34 +0000)]
[scudo] Lock FallbackTSD before draining it

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

14 months ago[libc++][NFC] Remove duplicate declaration of __iter_value_type
Louis Dionne [Wed, 10 May 2023 21:28:02 +0000 (17:28 -0400)]
[libc++][NFC] Remove duplicate declaration of __iter_value_type

The exact same declaration exists a few lines above.

14 months ago[scudo] Drain caches when release with M_PURGE_ALL
Chia-hung Duan [Wed, 10 May 2023 20:11:08 +0000 (20:11 +0000)]
[scudo] Drain caches when release with M_PURGE_ALL

This will drain both quarantine and local caches.

Reviewed By: cferris

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

14 months ago[scudo] Skip releaseToOSMaybe if there's no byte in freelist
Chia-hung Duan [Wed, 10 May 2023 02:40:48 +0000 (02:40 +0000)]
[scudo] Skip releaseToOSMaybe if there's no byte in freelist

In primary32, the unused region will have max/min region index with 0
value and it's an invalid index. Skip releaseToOSMaybe in both primary32
and primary64 even it's M_PURGE_ALL.

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

14 months ago[Headers][doc] Add "shift" intrinsic descriptions to avx2intrin.h
Paul Robinson [Wed, 10 May 2023 17:36:36 +0000 (10:36 -0700)]
[Headers][doc] Add "shift" intrinsic descriptions to avx2intrin.h

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

14 months ago[Flang] Syntax support for OMP Allocators Construct
Ethan Luis McDonough [Wed, 10 May 2023 19:50:41 +0000 (14:50 -0500)]
[Flang] Syntax support for OMP Allocators Construct

OpenMP 5.2 introduces a Fortran specific construct that aims to replace the executable allocate directive.  This patch seeks to add parser support for the directive as well as the allocator clause with the [[ https://www.openmp.org/wp-content/uploads/OpenMP-API-Specification-5-2.pdf#section.6.6 | extended align/complex ]] modifier.

Reviewed By: kiranchandramohan

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

14 months ago[libc++][NFC] Fix slightly incorrect instructions for testing with Ninja
Louis Dionne [Wed, 10 May 2023 19:50:25 +0000 (15:50 -0400)]
[libc++][NFC] Fix slightly incorrect instructions for testing with Ninja

14 months ago[lldb] Mark most SBAPI methods involving private types as protected or private
Alex Langford [Mon, 8 May 2023 23:31:27 +0000 (16:31 -0700)]
[lldb] Mark most SBAPI methods involving private types as protected or private

Many SB classes have public constructors or methods involving types that
are private. Some are more obvious (e.g. containing lldb_private in the
name) than others (lldb::FooSP is usually std::shared_pointer<lldb_private::Foo>).

This commit explicitly does not address FileSP, so I'm leaving that one
alone for now.

Some of these were for other SB classes to use and should have been made
protected/private with a friend class entry added. Some of these were
public for some of the swig python helpers to use. I put all of those
functions into a class and made them static methods. The relevant SB
classes mark that class as a friend so they can access those
private/protected members.

I've also removed an outdated SBStructuredData test (can you guess which
constructor it was using?) and updated the other relevant tests.

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

14 months ago[Libomptarget] Fix AMDGPU Note handling after D150022
Joseph Huber [Wed, 10 May 2023 19:11:50 +0000 (14:11 -0500)]
[Libomptarget] Fix AMDGPU Note handling after D150022

Summary:
The changes in https://reviews.llvm.org/D150022 changed the API for this
function that we query. Simply pass in the alignment from the associated
header to fix.

14 months ago[LangRef] Fix sphinx label syntax
Felipe de Azevedo Piovezan [Wed, 10 May 2023 18:59:03 +0000 (14:59 -0400)]
[LangRef] Fix sphinx label syntax

14 months agoReapply "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"
Philip Reames [Wed, 10 May 2023 18:08:14 +0000 (11:08 -0700)]
Reapply "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"

The original change had a bug where it allowed SEW mutation.  This is wrong in multiple ways, but an easy example is that the slide amount is in units of SEW, and thus that changing SEW changes the slide offset.

I'd reverted this in 33314693 intending to more majorly rework the patch because in addition to the bug, I'd noticed a potential oppurtunity to increase scope.  After implementing that variant, and realizing it triggered nowhere, I decided to go back to the prior patch with the minimal fix.

Note there's no separate test case for the fix.  This is because we already had multiple, and I just didn't realize the impact of the original test diff.  Adding one more test would have been unlikely to catch that human error.

Original commit message..

Noticed this while looking at some SLP output. If we have an extractelement, we're probably using a slidedown into an destination with no contents. Given this, we can allow the slideup to use a larger VL and clobber tail elements of the destination vector. Doing this allows us to avoid vsetvli toggles in many fixed length vector examples.

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

14 months ago[Corosplit] Prepend entry_value in swift async dbg values
Felipe de Azevedo Piovezan [Wed, 3 May 2023 16:29:58 +0000 (12:29 -0400)]
[Corosplit] Prepend entry_value in swift async dbg values

When the coroutine splitter splits swift coroutines, variables in the new
funclets are now described in terms of the frame pointer, which is always placed
at a ABI-specified register whose contents are valid upon function entry. As
such, debug intrinsics must be prepended by the `entry_value` operation.

Depends on D149778

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

14 months ago[Verifier] Allow DW_OP_LLVM_entry_value in IR
Felipe de Azevedo Piovezan [Tue, 25 Apr 2023 14:56:10 +0000 (10:56 -0400)]
[Verifier] Allow DW_OP_LLVM_entry_value in IR

A follow up patch will make the CoroSplit pass introduce such operations in the
IR level when it is safe to do so.

Depends on D149748

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

14 months ago[FS-AFDO] Load pseudo probe profile on MIR
Hongtao Yu [Wed, 10 May 2023 17:28:33 +0000 (10:28 -0700)]
[FS-AFDO] Load pseudo probe profile on MIR

This change enables loading pseudo-probe based profile on MIR. Different from the IR profile loader, callsites are excluded from MIR profile loading since they are not assinged a FS discriminator. Using zero as the discriminator is not accurate and would undo the distribution work done by the IR loader based on pseudo probe distribution factor. We reply on block probes only for FS profile loading.

Some refactoring is done to the IR profile loader so that `getProbeWeight` can be shared by both loaders.

Reviewed By: wenlei

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

14 months ago[FS-AFDO] Generate pseudo-probe-based profiles with FS-discriminators.
Hongtao Yu [Mon, 10 Apr 2023 18:06:27 +0000 (11:06 -0700)]
[FS-AFDO] Generate pseudo-probe-based profiles with FS-discriminators.

This change enables generating pseudo-probe-based FS-AFDO profiles. The change is straightforward based-on previous change {D147651} by just injecting FS-discriminators into various profile generation spot.

Reviewed By: wenlei

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

14 months ago[PseudoProbe] Encode/Decode FS discriminator
Hongtao Yu [Wed, 5 Apr 2023 18:35:17 +0000 (11:35 -0700)]
[PseudoProbe] Encode/Decode FS discriminator

Encoding FS discriminators for block probes. Decoding them correspondingly.

The encoding/decoding of FS discriminators are conditional, only for probes with a non-zero discriminator. This saves encoding size, also ensures downwards-compatiblity.

Reviewed By: wenlei

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

14 months ago[PseudoProbe] Clean up dwarf discriminator and avoid duplicating factor.
Hongtao Yu [Mon, 17 Apr 2023 20:44:39 +0000 (13:44 -0700)]
[PseudoProbe] Clean up dwarf discriminator and avoid duplicating factor.

A pseudo probe is created with dwarf line information shared with its nearest instruction. If the instruction comes with a dwarf discriminator, it will be shared with the probe as well. This can confuse the later FS-AFDO discriminator assignment pass. To fix this, I'm cleaning up the discriminator fields for probes when they are inserted.

I also notice another possibility to change the discriminator field of pseudo probes in the pipeline before the FS discriminator assignment pass. That is the loop unroller, which assigns duplication factor to instruction being vectorized. I'm disabling that for pseudo probe intrinsics specifically, also for callsites with probes.

Reviewed By: wenlei

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

14 months ago[CodeGen] Fix nomerge attribute not working in tail calls.
Zequan Wu [Thu, 23 Mar 2023 18:42:23 +0000 (14:42 -0400)]
[CodeGen] Fix nomerge attribute not working in tail calls.

In D79537, `nomerge` was made to only apply to non-tail calls. This fixes it by also applying it to tail calls.

For ARM, I only made the new MI to inherit the flag under `TCRETURNdi` and `TCRETURNri`, because that's the place tail calls got replaced. Not sure if there's any other place needed.

Fixes #61545.

Reviewed By: rnk

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

14 months ago[lldb][NFCI] Replace dw_form_t with llvm::dwarf::Form
Alex Langford [Tue, 9 May 2023 21:34:20 +0000 (14:34 -0700)]
[lldb][NFCI] Replace dw_form_t with llvm::dwarf::Form

LLDB currently defines `dw_form_t` as a `uint16_t` which makes sense.
However, LLVM also defines a similar type `llvm::dwarf::Form` which is
an enum backed by a `uint16_t`. Switching to the llvm implementation
means that we can more easily interoperate with the LLVM DWARF code.

Additionally, we get some type checking out of this: I found that
DWARFAttribute had a method called `FormAtIndex` that returned a
`dw_attr_t`. Although `dw_attr_t` is also a `uint16_t` under the hood,
the type checking benefits here are undeniable: If this had returned a
something of different signedness/width, we could have had some bad
bugs.

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

14 months agoRevert "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"
Philip Reames [Wed, 10 May 2023 17:49:30 +0000 (10:49 -0700)]
Revert "[RISCV][InsertVSETVLI] Avoid VL toggles for extractelement patterns"

This reverts commit 657d20dc75252f0c8415ada5214affccc3c98efe.  A correctness problem was reported against the review and the fix warrants re-review.

14 months agoReland [clang] Make predefined expressions string literals under -fms-extensions
Arthur Eubanks [Sun, 7 May 2023 18:24:48 +0000 (11:24 -0700)]
Reland [clang] Make predefined expressions string literals under -fms-extensions

MSVC makes these string literals [1][2].

[1] https://godbolt.org/z/6vnTzbExx
[2] https://learn.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=msvc-170

Fixes #114

Initial commit didn't check if there was a function name when stepping through expressions ignoring parens.

Reviewed By: aaron.ballman

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

14 months agofix typos to cycle bots
Nico Weber [Wed, 10 May 2023 17:53:47 +0000 (19:53 +0200)]
fix typos to cycle bots

14 months ago[clang][modules] Avoid unnecessary writes of .timestamp files
Jan Svoboda [Wed, 10 May 2023 17:41:16 +0000 (10:41 -0700)]
[clang][modules] Avoid unnecessary writes of .timestamp files

Clang currently updates the mtime of .timestamp files on each load of the corresponding .pcm file. This is not necessary. In a given build session, Clang only needs to write the .timestamp file once, when we first validate the input files. This patch makes it so that we only touch the .timestamp file when it's older than the build session, alleviating some filesystem contention in clang-scan-deps.

Reviewed By: benlangmuir

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

14 months ago[RISCV] Add support for V extenstion in SiFive7
Michael Maitland [Thu, 27 Apr 2023 20:08:27 +0000 (13:08 -0700)]
[RISCV] Add support for V extenstion in SiFive7

Add scheduling information for vector extension in SiFive7,
while using new LMUL & SEW scheduling constructs.

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

14 months agolibclang: add missing `struct` in the declaration
Saleem Abdulrasool [Wed, 10 May 2023 17:31:53 +0000 (10:31 -0700)]
libclang: add missing `struct` in the declaration

When building with compilers that do not support the Blocks extension,
we would fail to compile due to the missing type specifier on the
`typedef`.  This should repair those builds.

Fixes: #62640

14 months ago[libcxx] Fix pstl __init_ identifier after 9c4717a
Aaron Siddhartha Mondal [Wed, 10 May 2023 17:19:37 +0000 (19:19 +0200)]
[libcxx] Fix pstl __init_ identifier after 9c4717a

Reviewed By: ldionne, #libc

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

14 months ago[RISCV] Remove redundant F and D extension implication from V. NFC
Craig Topper [Wed, 10 May 2023 17:00:41 +0000 (10:00 -0700)]
[RISCV] Remove redundant F and D extension implication from V. NFC

We recently added implications for F and D to Zve32f and Zve64d
which V implies. So these have become redundant.

14 months agolibclang: declare blocks interfaces always
Saleem Abdulrasool [Wed, 10 May 2023 15:49:35 +0000 (08:49 -0700)]
libclang: declare blocks interfaces always

The implementation of these methods is not reliant on the availability
of the Blocks extension in the compiler.  However, when building on
Windows, the interface declaration is important for the attribution of
the DLL storage.  Without the attribution, the method implementation is
built but not made available as part of the ABI.  Use a check for the
blocks extension to determine how method signature is viewed rather than
controlling whether it is part of the interface.

14 months agoRevert "[SCEV] Replace IsAvailableOnEntry with block disposition"
Manoj Gupta [Wed, 10 May 2023 16:38:06 +0000 (09:38 -0700)]
Revert "[SCEV] Replace IsAvailableOnEntry with block disposition"

This reverts commit 103fc0f629aa6218783f65dff0197f257137cade.
Causes a clang crash in ChromeOS builds.
Testcase provided at D149344.

14 months ago[SLP][NFC] Rename a couple of variables and replace an if-else with an std::min
Vasileios Porpodas [Wed, 10 May 2023 02:07:21 +0000 (19:07 -0700)]
[SLP][NFC] Rename a couple of variables and replace an if-else with an std::min

- Rename `LimitForRegisterSize` to `MaxVFOnly` to make the meaning of the limit less ambiguous
- Rename `OpsWidth` to `ActualVF`, which makes it clear that this is the VF we are using for vectorization.
- Replace the if-else code for the initialization of OpsWidth with an std::min.

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

14 months ago[Object] Fix handling of Elf_Nhdr with sh_addralign=8
Fangrui Song [Wed, 10 May 2023 16:36:58 +0000 (09:36 -0700)]
[Object] Fix handling of Elf_Nhdr with sh_addralign=8

The generic ABI says:

> Padding is present, if necessary, to ensure 8 or 4-byte alignment for the next note entry (depending on whether the file is a 64-bit or 32-bit object). Such padding is not included in descsz.

Our parsing code currently aligns n_namesz. Fix the bug by aligning the start
offset of the descriptor instead. This issue has been benign because the primary
uses of sh_addralign=8 notes are `.note.gnu.property`, where
`sizeof(Elf_Nhdr) + sizeof("GNU") = 16` (already aligned by 8).

In practice, many 64-bit systems incorrectly use sh_addralign=4 notes.
We can use sh_addralign (= p_align) to decide the descriptor padding.
Treat an alignment of 0 and 1 as 4. This approach matches modern GNU readelf
(since 2018).

We have a few tests incorrectly using sh_addralign=0. We may make our behavior
stricter after fixing these tests.

Linux kernel dumped core files use `p_align=0` notes, so we need to support the
case for compatibility.

Reviewed By: jhenderson

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

14 months ago[gn build] Port f041b3472a87
LLVM GN Syncbot [Wed, 10 May 2023 16:23:50 +0000 (16:23 +0000)]
[gn build] Port f041b3472a87