platform/upstream/llvm.git
15 months ago[mlir][Vector] Add canonicalization pattern for vector.transpose(vector.constant_mask)
Diego Caballero [Wed, 29 Mar 2023 19:20:22 +0000 (19:20 +0000)]
[mlir][Vector] Add canonicalization pattern for vector.transpose(vector.constant_mask)

We already had vector.transpose(vector.create_mask) ->
vector.create_mask. This patch adds the constant mask version of it.

Reviewed By: nicolasvasilache

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

15 months ago[mlir][Vector] Add mapIterationSpaceDimToAllOperandDims to Linalg interface
Diego Caballero [Wed, 29 Mar 2023 19:09:41 +0000 (19:09 +0000)]
[mlir][Vector] Add mapIterationSpaceDimToAllOperandDims to Linalg interface

This is a variant of the existing `mapIterationSpaceDimToOperandDim`.
We have a local use downstream.

Reviewed By: nicolasvasilache

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

15 months ago[mlir][Vector] Enable masked vectorization of linalg.fill
Diego Caballero [Wed, 29 Mar 2023 19:19:24 +0000 (19:19 +0000)]
[mlir][Vector] Enable masked vectorization of linalg.fill

linalg.fill was already vectorizable with masks but not supported in the
dynamic pre-checks.

Reviewed By: nicolasvasilache

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

15 months ago[mlir][Vector] Remove lhs and rhs masks from vector.contract
Diego Caballero [Wed, 29 Mar 2023 19:16:12 +0000 (19:16 +0000)]
[mlir][Vector] Remove lhs and rhs masks from vector.contract

This patch removes the historical lhs and rhs masks in vector.contract,
now that vector.mask supports vector.contract and the lhs and rhs masks
are barely supported by all the vector.contract lowerings and
transformations.

Reviewed By: nicolasvasilache

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

15 months ago[WebAssembly] Do nothing when sinking to same place
Heejin Ahn [Fri, 24 Mar 2023 18:49:08 +0000 (11:49 -0700)]
[WebAssembly] Do nothing when sinking to same place

In `DebugValueManager`, if a `Def` is requested to be sunk to the same
place (i.e., `Insert` is right after `Def`, not counting `DBG_VALUE`s)
currently we still do the sink. This can result in unnecessary creation
of `DBG_VALUE $noreg`. See comments for details. This CL detects this
case and do nothing and return, so we don't end up creating unnecessary
undef `DBG_VALUE`s.

Reviewed By: dschuff

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

15 months ago[WebAssembly] Redesign DebugValueManager
Heejin Ahn [Wed, 30 Nov 2022 23:37:08 +0000 (15:37 -0800)]
[WebAssembly] Redesign DebugValueManager

The current `DebugValueManager`, which is mostly used in `RegStackify`,
simply sinks `DBG_VALUE`s along when a def instruction sinks.
(`RegStackify` only does sinks; it doesn't do hoists.)

But this simple strategy can result in incorrect combinations of
variables' values which would have not been possible in the original
program. In this case, LLVM's policy is to make the value unavailable,
so they will be shown as 'optimized out', rather than showing inaccurate
debug info. Especially, when an instruction sinks, its original
`DBG_VALUE` should be set to undef. This is well illustrated in the
third example in
https://llvm.org/docs/SourceLevelDebugging.html#instruction-scheduling.

This CL rewrites `DebugValueManager` with this principle in mind. When
sinking an instruction, it sinks its eligible `DBG_VALUE`s with it, but
also leaves undef `DBG_VALUE`s in the original place to make those
variables' values undefined.

Also, unlike the current version, we sink only an eligible subset of
`DBG_VALUE`s with a def instruction. See comments in the code for
details.

In case of cloning, because the original def is still there, we don't
set its `DBG_VALUE`s to undef. But we clone only an eligible subset of
`DBG_VALUE`s here as well.

One consequence of this change is that now we do sinking and cloning of
the def instruction itself within the `DebugValueManager`'s `sink` and
`clone` methods. This is necessary because the `DebugValueManager` needs
to know the original def's location before sinking and cloning in order
to scan other interfering `DBG_VALUE`s between the original def and the
insertion point. If we want to separate these two, we need to call
`DebugValueManager`'s `sink` and `clone` methods //before//
sinking/cloning the def instruction, which I don't think is a good
design alternative either, because the user of this class needs to pay
extra attention when using it.

Because this change is fixing the existing inaccuracy of the current
debug info, this reduces the variable info coverage in debug info, but
not by a large margin. In Emscripten core benchmarks compiled with
`-O1`, the coverage goes from 56.6% down to 55.2%, which I doubt will be
a noticeable drop. The compilation time doesn't have any meaningful
difference either with this change.

Reviewed By: dschuff

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

15 months ago[libc] Re-enable wctob with fixes
Michael Jones [Tue, 21 Mar 2023 18:12:05 +0000 (11:12 -0700)]
[libc] Re-enable wctob with fixes

The stdio test failures were due to headers potentially not being built
in the correct order. This should set up the dependencies correctly.

Reviewed By: sivachandra

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

15 months ago[WebAssembly] Use ArrayRef/SmallVectorImpl in parameters (NFC)
Heejin Ahn [Fri, 24 Mar 2023 19:09:22 +0000 (12:09 -0700)]
[WebAssembly] Use ArrayRef/SmallVectorImpl in parameters (NFC)

It is recommended to use `SmallVectorImpl`/`ArrayRef` over
`SmallVector<TypeName, N>` for function parameters:
https://llvm.org/docs/ProgrammersManual.html#llvm-adt-smallvector-h

Reviewed By: dschuff

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

15 months ago[WebAssembly] Select call_indirect for alloca calls
Heejin Ahn [Tue, 28 Mar 2023 08:01:21 +0000 (01:01 -0700)]
[WebAssembly] Select call_indirect for alloca calls

Currently calling stack locations is selected using `CALL` in ISel,
resulting in an invalid code and crashing in AsmPrinter. FastISel
correctly selects it will `CALL_INDIRECT`.

Fixes the problem reported in D146781.

Reviewed By: tlively, HerrCai0907

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

15 months ago[AMDGPU] Do not fix implicit vcc operand on INLINEASM
Jay Foad [Wed, 29 Mar 2023 14:06:53 +0000 (15:06 +0100)]
[AMDGPU] Do not fix implicit vcc operand on INLINEASM

An INLINEASM can have an implicit def of vcc. It is not appropriate for
fixImplicitOperands to change this to vcc_lo on wave32.

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

15 months ago[AMDGPU] Consistently use v2i16 for packed bf16 inputs. NFC.
Jay Foad [Wed, 29 Mar 2023 12:10:19 +0000 (13:10 +0100)]
[AMDGPU] Consistently use v2i16 for packed bf16 inputs. NFC.

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

15 months ago[libc] Use LTO for AMDGPU compilation and linking
Joseph Huber [Wed, 29 Mar 2023 19:19:08 +0000 (14:19 -0500)]
[libc] Use LTO for AMDGPU compilation and linking

Summary:
The AMDGPU ABI isn't stable or well defined. For that reson we prefer to
rely on LTO to ensure that multiple files get linked correctly.
Currently the internal targets used for testing mix LLVM-IR and
assembly. We should be consistent here.

15 months agoMark test added in D141824 as unsupported for PS4/PS5 as those platforms require...
Douglas Yung [Wed, 29 Mar 2023 19:09:28 +0000 (12:09 -0700)]
Mark test added in D141824 as unsupported for PS4/PS5 as those platforms require an external linker that is not present.

15 months ago[clang-format] NFC ensure clang-format is itself clang-formatted
mydeveloperday [Wed, 29 Mar 2023 19:01:03 +0000 (20:01 +0100)]
[clang-format] NFC ensure clang-format is itself clang-formatted

Some patch in the past introduce this non clang-formatted change

15 months ago[gn build] Port 3be6c4d413f6
LLVM GN Syncbot [Wed, 29 Mar 2023 18:50:19 +0000 (18:50 +0000)]
[gn build] Port 3be6c4d413f6

15 months ago[Flang][OpenMP] Update test case to track an issue
Kavitha Natarajan [Wed, 29 Mar 2023 18:40:16 +0000 (00:10 +0530)]
[Flang][OpenMP] Update test case to track an issue

Adding CHECK-NOT for the MAX intrinsic implementation for which
reduction operation is not generated. Issue #61808 created to
track the same.

15 months ago[MLIR] NFC. Expose/move MDG out of Affine fusion into Affine Analysis
Uday Bondhugula [Wed, 29 Mar 2023 18:27:13 +0000 (23:57 +0530)]
[MLIR] NFC. Expose/move MDG out of Affine fusion into Affine Analysis

Move out MemRefDependenceGraph analysis structure out of LoopFusion into
the Affine Analysis library. This had been a long pending TODO. Moving
MDG out allows its use in other affine passes as well as allows building
custom affine fusion passes downstream while reusing upstream fusion
utilties. The file LoopFusion.cpp had also become lengthy and this
change makes things more modular. This change is a pure NFC and is a
code movement.

NFC.

Reviewed By: springerm

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

15 months agoMake all additions matter in private mapping test.
Doru Bercea [Wed, 29 Mar 2023 16:34:03 +0000 (12:34 -0400)]
Make all additions matter in private mapping test.

15 months agoRevert "Revert "Revert ExtractAPI from https://reviews.llvm.org/D146656""
Mitch Phillips [Wed, 29 Mar 2023 18:36:44 +0000 (11:36 -0700)]
Revert "Revert "Revert ExtractAPI from https://reviews.llvm.org/D146656""

This reverts commit 79116475124112051625b1a0665e35c861bb13fd.

Broke the ASan bots. See more information in
https://reviews.llvm.org/rG79116475124112051625b1a0665e35c861bb13fd

15 months agoRevert "[clang][ExtractAPI] Add queried symbol to parent contexts in libclang"
Mitch Phillips [Wed, 29 Mar 2023 18:35:59 +0000 (11:35 -0700)]
Revert "[clang][ExtractAPI] Add queried symbol to parent contexts in libclang"

This reverts commit 1cfe1e732ad8e8148f6fa8fc0f0c86f4b965d567.

Depends on reverted commit 158a431227a876306fe5838936413dd51588d0c6. See
https://reviews.llvm.org/rG79116475124112051625b1a0665e35c861bb13fd for
more information, this broke the ASan bots.

15 months ago[MSCV][dllexport/dllimport][PS] Allow UniqueExternal linkage classes with dllexport...
Wolfgang Pieb [Mon, 13 Mar 2023 17:45:20 +0000 (17:45 +0000)]
[MSCV][dllexport/dllimport][PS] Allow UniqueExternal linkage classes with dllexport/dllimport

MSVC allows instantiations of exported or imported template classes with template
parameters that have internal linkage. Clang now allows it in Microsoft mode and for
the Playstation platform. This partially addresses issue 56068.

Note that MSVC also allows explicit dllexport/dllimport attributes on classes
with internal linkage (e.g. local classes or classes declared in anonymous name spaces).
Clang continues to reject such declarations.

Reviewed By: hans

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

15 months ago[Flang][OpenMP] Fix crash in MAX intrinsic reduction
Kavitha Natarajan [Wed, 29 Mar 2023 15:35:42 +0000 (21:05 +0530)]
[Flang][OpenMP] Fix crash in MAX intrinsic reduction

This patch fixes a crash that appear in an OpenMP MAX intrinsic
reduction when the reduction is not expressed using MAX intrinsic
function. Updated flang/test/Lower/OpenMP/wsloop-reduction-max.f90
test case with additional way of expressing MAX reduction.

Reviewed By: kiranchandramohan

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

15 months ago[OpenMP][MLIR] Add Flags attribute to OMP OffloadModuleInterface
Andrew Gozillon [Wed, 29 Mar 2023 15:45:59 +0000 (10:45 -0500)]
[OpenMP][MLIR] Add Flags attribute to OMP OffloadModuleInterface

The intent of this attribute is for it to be applied to a module and
then hold information on runtime library (RTL) flags given to
Flang (or other OpenMP frontend) that should be lowered down to
LLVM-IR for devices as LLVM globals. The following related
flags are:

-fopenmp-target-debug
-fopenmp-assume-threads-oversubscription
-fopenmp-assume-teams-oversubscription
-fopenmp-assume-no-nested-parallelism
-fopenmp-assume-no-thread-state

These exist within Clang and are lowered into the IR when
offloading for device. This attribute allows this infromation
to be carried down from the Flang frontend to the
LLVM/OpenMP Dialect to LLVM-IR translation phase
and then be lowered to LLVM-IR.

Reviewers: kiranchandramohan

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

15 months ago[Flang][Driver][OpenMP] Fix omp-frontend-forwarding.f90 failure on windows
Andrew Gozillon [Wed, 29 Mar 2023 15:37:18 +0000 (10:37 -0500)]
[Flang][Driver][OpenMP] Fix omp-frontend-forwarding.f90 failure on windows

Failing due to forgetting the .exe suffix the clang-offload-packager
receives on windows.

15 months ago[RISCV] Made v(f)(w)red* pseudoinstructions SEW-aware
Nitin John Raj [Wed, 29 Mar 2023 00:46:16 +0000 (17:46 -0700)]
[RISCV] Made v(f)(w)red* pseudoinstructions SEW-aware

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

15 months agoReland "[hwasan] Provide aliases for c allocation functions for Fuchsia
Leonard Chan [Wed, 29 Mar 2023 17:34:16 +0000 (17:34 +0000)]
Reland "[hwasan] Provide aliases for c allocation functions for Fuchsia

This reverts commit 3b4cb1e96c645bb833fe710856479c31383859bb.

Reland D145718 but unconditionally define __sanitizer_mallinfo which is
exposed as part of the hwasan interface.

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

15 months ago[compiler-rt] Move __sanitizer_mallinfo to separate header
Leonard Chan [Wed, 29 Mar 2023 17:08:22 +0000 (17:08 +0000)]
[compiler-rt] Move __sanitizer_mallinfo to separate header

mallinfo is platform-specific and not specified by either posix or the C
standard, but the hwasan interface unconditionally exposes
__sanitizer_mallinfo which returns a struct __sanitizer_struct_mallinfo
which is defined in sanitizer_platform_limits_posix.h, so this should
also be available for fuchsia to provide __sanitizer_mallinfo. Fuchsia
doesn't need the rest of what's in sanitizer_platform_limits_posix.h so
we can just move it to its own header.

Exposing this and not forcing it to hide behind
SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO fixes the test failures found
after landing D145718.

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

15 months ago[mlir][arith] Fold `index_cast[ui]` of vectors
Jakub Kuderski [Wed, 29 Mar 2023 16:49:32 +0000 (12:49 -0400)]
[mlir][arith] Fold `index_cast[ui]` of vectors

Handle the splat and dense case.

I saw this pattern show up in a couple recent SPIR-V-specific bug
report.

Reviewed By: antiagainst

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

15 months ago[docs] Fix a typo (malicously-crafter)
Benjamin Kramer [Wed, 29 Mar 2023 16:49:04 +0000 (18:49 +0200)]
[docs] Fix a typo (malicously-crafter)

15 months ago[LV] Add test cases for global struct dereferencability.
Florian Hahn [Wed, 29 Mar 2023 16:47:41 +0000 (17:47 +0100)]
[LV] Add test cases for global struct dereferencability.

Currently LLVM fails to determine that conditional loads in
@accesses_to_struct_dereferenceable are dereferenceable unconditionally.

15 months agoFix ArgsAsWritten being null for ConceptSpecializationExpr in certain
Walter Gray [Wed, 29 Mar 2023 16:27:07 +0000 (09:27 -0700)]
Fix ArgsAsWritten being null for ConceptSpecializationExpr in certain
circumstances when parsing ASTs

Fix ArgsAsWritten being null for ConceptSpecializationExpr in certain
circumstances when parsing ASTs

ASTStmtWriter::VisitConceptSpecializationExpr specifically expects
getTemplateArgsAsWritten() to return true, which it wasn't when parsed
by ASTContext.cpp in certain edge cases.

Fixes: #61486

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

15 months ago[PS4][clang] Limit ThinLTO parallelism when requested
Matthew Voss [Wed, 29 Mar 2023 16:36:46 +0000 (09:36 -0700)]
[PS4][clang] Limit ThinLTO parallelism when requested

Pass the correct option to the linker when "-flto-jobs=" is passed to
the driver.

15 months ago[NFC] Fix uninitalized member variable use in ASTReader::ParseTargetOptions()
Sindhu Chittireddy [Wed, 22 Mar 2023 03:38:45 +0000 (20:38 -0700)]
[NFC] Fix uninitalized member variable use in ASTReader::ParseTargetOptions()

15 months ago[Flang][OpenMP] Issue error for assumed-size array in Map clause
Kiran Chandramohan [Wed, 29 Mar 2023 16:07:23 +0000 (16:07 +0000)]
[Flang][OpenMP] Issue error for assumed-size array in Map clause

Error only applies if it is a whole array. Page 157 in OpenMP 5.2
standard.

Reviewed By: TIFitis

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

15 months ago[mlir][spirv] Fix null pointer dereference in `--test-spirv-target-env`
Jakub Kuderski [Wed, 29 Mar 2023 16:08:21 +0000 (12:08 -0400)]
[mlir][spirv] Fix null pointer dereference in `--test-spirv-target-env`

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

Reviewed By: antiagainst

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

15 months ago[clang-tidy] Fix if-constexpr false-positive in readability-misleading-indentation
Piotr Zegar [Wed, 29 Mar 2023 15:24:54 +0000 (15:24 +0000)]
[clang-tidy] Fix if-constexpr false-positive in readability-misleading-indentation

When  depend on template parameter,
compiler can use NullStmt instead of CompoundStmt.
This causes issues as we losing information about
end location of that Stmt. To avoid this issue
check now ignores ifStmt with NullStmt on true-branch.

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

Reviewed By: carlosgalvezp

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

15 months agoRevert "[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation"
Mitch Phillips [Wed, 29 Mar 2023 16:06:17 +0000 (09:06 -0700)]
Revert "[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation"

This reverts commit e4918d43763e8bdcdf9ad27f4eb536bf9aa4e3cf.

Reason: Broke the sanitizer bots. More information in
https://reviews.llvm.org/D146920 and should be re-landed with
https://reviews.llvm.org/D147164 (or similar)

15 months ago[MLIR][OpenMP] Change map_operands type to OpenMP_PointerLikeType for Target Data
Akash Banerjee [Tue, 28 Mar 2023 13:54:18 +0000 (14:54 +0100)]
[MLIR][OpenMP] Change map_operands type to OpenMP_PointerLikeType for Target Data

This patches chagnes the type of map_operands to OpenMP_PointerLikeType for OMP Target Data directives.

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

15 months agoProperly Propagate RecoveryExpr through RequiresExpr
Erich Keane [Wed, 29 Mar 2023 15:54:40 +0000 (08:54 -0700)]
Properly Propagate RecoveryExpr through RequiresExpr

Commit 3d7946c58 implemented a DR that allowed us to error in a case
where an ill-formedness in a RequiresExpr is diagnosed as a satisfaction
failure.  However, it failed to cover cases where the RequiresExpr had
Requirements that failed for similar reasons.

This patch propagates the RecoveryExpr "containsErrors" correctly
through RequiresExpr.

Fixes: #61776

15 months agoRevert "[mlir-cpu-runner] Add export_executable_symbols in CMake."
Mitch Phillips [Wed, 29 Mar 2023 15:49:04 +0000 (08:49 -0700)]
Revert "[mlir-cpu-runner] Add export_executable_symbols in CMake."

This reverts commit ccdcfad0815296d8952438632d9abe6bc0a5258a.

Reason: Introduced an ODR that broke the ASan bots. See more information
in Phabricator: https://reviews.llvm.org/D146935

15 months ago[IPO] Add documentation for new function argument
Shoaib Meenai [Wed, 29 Mar 2023 10:26:47 +0000 (03:26 -0700)]
[IPO] Add documentation for new function argument

As pointed out by @fhahn in https://reviews.llvm.org/D146876.

Reviewed By: tejohnson

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

15 months ago[clang][ExtractAPI] Add queried symbol to parent contexts in libclang
Daniel Grumberg [Wed, 29 Mar 2023 11:04:30 +0000 (12:04 +0100)]
[clang][ExtractAPI] Add queried symbol to parent contexts in libclang

Ensure that the current symbol is added to the parent contexts in the
output of libclang function for generating symbol graphs for single symbols.

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

15 months ago[symbolizer] Factor out conversion DILineInfo->JSON. NFC
Serge Pavlov [Wed, 29 Mar 2023 05:11:12 +0000 (12:11 +0700)]
[symbolizer] Factor out conversion DILineInfo->JSON. NFC

Move the conversion of DILineInfo to JSON into a separate function, so
it can be used in other places too.

This is a prerequisite patch for implementation of symbol+offset lookup.

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

15 months ago[symbolizer] Treat invalid address as addr2line does
Serge Pavlov [Tue, 28 Mar 2023 17:44:55 +0000 (00:44 +0700)]
[symbolizer] Treat invalid address as addr2line does

llvm-symbolizer echoed input if it was not recognized as a valid address.
This behavior was extended to llvm-addr2line as well. GNU addr2line in
this case optputs "??:0". This difference prevents implementation of
symbol+offset lookup available in the recent versions of GNU binutils.
In that case a string that is not an address may be a symbol.

This change make reaction of llvm-addr2line on unrecognized input closer
to GNU addr2line.

15 months ago[AIX][PGO] Teach profile runtime to read build-id
Wael Yehia [Mon, 20 Mar 2023 19:51:17 +0000 (15:51 -0400)]
[AIX][PGO] Teach profile runtime to read build-id

On AIX, the build-id can be embedded in a binary using the -mxcoff-build-id
compiler option. When present, the build id is stored as an ascii string at the
beginning of the string table in the loader section of the XCOFF file.

Reviewed By: stephenpeckham, daltenty

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

15 months ago[Assignment Tracking] Coalesce dbg loc definitions with contiguous fragments
OCHyams [Wed, 29 Mar 2023 14:27:29 +0000 (15:27 +0100)]
[Assignment Tracking] Coalesce dbg loc definitions with contiguous fragments

MemLocFragmentFill uses an IntervalMap to track which bits of each variable are
stack-homed. Intervals with the same value (same stack location base address)
are automatically coalesced by the map. This patch changes the analysis to take
advantage of that and insert a new dbg loc after each def if any coalescing
took place. This results in some additional redundant defs (we insert a def,
then another that by definition shadows the previous one if any coalescing took
place) but they're all cleaned up thanks to the previous patch in this stack.

This reduces the total number of fragments created by
AssignmentTrackingAnalysis which reduces compile time because LiveDebugValues
computes SSA for every fragment it encounters. There's a geomean reduction in
instructions retired in a CTMark LTO-O3-g build of 0.3% with these two patches.

One small caveat is that this technique can produce partially overlapping
fragments (e.g. slice [0, 32) and slice [16, 64)), which we know
LiveDebugVariables doesn't really handle correctly. Used in combination with
instruction-referencing this isn't a problem, since LiveDebugVariables is
effectively side-stepped in instruction-referencing mode. Given this, the
coalescing is only enabled when instruction-referencing is enabled (but the
behaviour can be overriden using -debug-ata-coalesce-frags=<bool>).

Reviewed By: jmorse

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

15 months ago[Assignment Tracking] Improve removeRedundantDbgLocsUsingBackwardScan
OCHyams [Wed, 29 Mar 2023 13:27:16 +0000 (14:27 +0100)]
[Assignment Tracking] Improve removeRedundantDbgLocsUsingBackwardScan

`removeRedundantDbgLocsUsingBackwardScan` removes redundant dbg loc definitions
by scanning backwards through contiguous sets of them (a "wedge"), removing
earlier (in IR order terms) defs for fragments of variables that are defined
later in the wedge.

In this patch we use a `Bitvector` for each variable to track which bits have
definitions to more accurately determine whether a loc def is redundant. This
patch increases compile time by itself, but reduces it when combined with the
follow-up patch.

Reviewed By: jmorse

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

15 months ago[mlir][arith][NFC] Add missing index_cast fold tests
Jakub Kuderski [Wed, 29 Mar 2023 14:40:11 +0000 (10:40 -0400)]
[mlir][arith][NFC] Add missing index_cast fold tests

It wasn't immediately obvious to me if index-to-integer casts were
folded or not.

Reviewed By: ThomasRaoux

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

15 months ago[RISCV] Cost model for general case of dual vector permute
Philip Reames [Wed, 29 Mar 2023 14:30:46 +0000 (07:30 -0700)]
[RISCV] Cost model for general case of dual vector permute

The cost model was not accounting for the fact that we can generate a dual vrgather + an index expression sequence instead of scalarizing.

A couple cases to call out:

1) I did not model the difference between vrgather and vrgatherei16. The result is the constant pool cost can be slightly understated on RV32. I don't think we care, but if someone disagrees, this would be easy to add.
2) Our current codegen for i8 vectors longer than 256 (which is the limit of what this costs) has some room for improvement.
3) As indicated by the *regression* in reported cost for <2 x iN> vectors, our current vector lowering is missing support for a sub-case where scalarize-and-insert is actually faster than the generic fallback path.

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

15 months ago[AArch64] Use NEON's tbl1 for 16xi8 and 8xi8 build vector with mask.
Lawrence Benson [Wed, 29 Mar 2023 14:26:28 +0000 (15:26 +0100)]
[AArch64] Use NEON's tbl1 for 16xi8 and 8xi8 build vector with mask.

When using Clang's __builtin_shufflevector with a 16xi8 or 8xi8 source and
runtime mask on an AArch64 target, LLVM currently generates 16 or 8
extract+and+insert operations. This patch replaces these inserts with (a vector
AND +) NEON's tbl1 intruction.

Issue: https://github.com/llvm/llvm-project/issues/60515

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

15 months ago[libc++][NFC] Move __insertion_sort_move to partial_sort.h
Louis Dionne [Tue, 28 Mar 2023 20:45:57 +0000 (16:45 -0400)]
[libc++][NFC] Move __insertion_sort_move to partial_sort.h

The __insertion_sort_move helper function is only used in partial_sort.h,
so it makes sense to define it there.

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

15 months agoFix missing newline in ReleaseNotes which caused sphinx problems
Erich Keane [Wed, 29 Mar 2023 13:37:01 +0000 (06:37 -0700)]
Fix missing newline in ReleaseNotes which caused sphinx problems

15 months agoImprove requirement clause limitation on non templated function
Erich Keane [Tue, 28 Mar 2023 18:12:50 +0000 (11:12 -0700)]
Improve requirement clause limitation on non templated function

The current implementation 6da3d66f03f9162ef341cc67218be40e22fe9808
got a few things wrong, particularly that a template, or  definition
or member in a templated entity is required to be allowed to have a
trailing requires clause.

This patch corrects this, as reproted by #61748

Fixes: #61748

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

15 months ago[Assignment Tracking] Elide a map copy in some cases
OCHyams [Wed, 29 Mar 2023 12:29:51 +0000 (13:29 +0100)]
[Assignment Tracking] Elide a map copy in some cases

Restructure AssignmentTrackingLowering::join to avoid a map copy in the case
where BB has more than one pred.

We only need to perform a copy of a pred LiveOut if there's exactly one
already-visited pred (Result = PredLiveOut). With more than one pred the result
is built by calling Result = join(std::move(Result), PredLiveOut) for each
subsequent pred, where join parameters are const &. i.e. with more than 1 pred
we can avoid copying by referencing the first two pred LiveOuts in the first
join and then using a move + reference for the rest.

This reduces compile time for CTMark LTO-O3-g builds.

Reviewed By: jmorse

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

15 months ago[ARM] Convert active.lane.masks to vctp with non-zero starts
David Green [Wed, 29 Mar 2023 13:17:10 +0000 (14:17 +0100)]
[ARM] Convert active.lane.masks to vctp with non-zero starts

This attempts to expand the logic in the MVETailPredication pass to convert
active lane masks that the vectorizer produces to vctp instructions that the
backend can later turn into tail predicated loops. Especially for addrecs with
non-zero starts that can be created from epilog vectorization. There is some
adjustment to the logic to handle this, moving some of the code to check the
addrec earlier so that we can get the start value. This start value is then
incorporated into the logic of checkin the new vctp is valid, and there is a
newly added check that it is known to be a multiple of the VF as we expect.

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

15 months ago[RISCV][test] Update CHECK lines in condops related tests in preparation for Zicond...
Alex Bradbury [Wed, 29 Mar 2023 13:13:37 +0000 (14:13 +0100)]
[RISCV][test] Update CHECK lines in condops related tests in preparation for Zicond codegen

Prefixes like 'CONDOPS' referring to the xventanacondops extension are
going to be confusing once zicond is added to the mix.

15 months ago[bazel] Port ab49747f9d67
Benjamin Kramer [Wed, 29 Mar 2023 13:03:22 +0000 (15:03 +0200)]
[bazel] Port ab49747f9d67

15 months ago[Assignment Tracking] Follow up for D147129 - fix broken clang tests
OCHyams [Wed, 29 Mar 2023 12:50:46 +0000 (13:50 +0100)]
[Assignment Tracking] Follow up for D147129 - fix broken clang tests

D147129 causes the assignment tracking pass to skip optnone functions, which
ends up overriding the "-fexperimental-assignment-tracking=forced" option at
O0. Add -disable-O0-optnone to the tests so that optnone doesn't interfere.

Buildbot example: https://lab.llvm.org/buildbot/#/builders/216/builds/18986

15 months ago[Assignment Tracking][NFC] Reduce work done in fragment overlap calculation
OCHyams [Wed, 29 Mar 2023 12:13:45 +0000 (13:13 +0100)]
[Assignment Tracking][NFC] Reduce work done in fragment overlap calculation

Only calculate fragment overlaps for partially stack homed variables. This
filter is already applied to the rest of the analysis - this change simply
prevents some unnecessary work.

Reviewed By: jmorse

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

15 months ago[Flang] Add debug flag to enable current debug information pass
Sacha Ballantyne [Mon, 27 Mar 2023 13:12:10 +0000 (13:12 +0000)]
[Flang] Add debug flag to enable current debug information pass

While a pass exists to generate basic debug information, currently there is not a corresponding flag to enable it.
This patch adds support for activating this pass at any debug level >= -g1, as well as emiting a warning for higher levels that the functionality is not yet fully implemented.

This patch also adds -g and -gline-tables-only to appear when `flang-new` --help is run

Depends on D142347.

Reviewed By: awarzynski

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

15 months ago[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions
Paul Osmialowski [Wed, 29 Mar 2023 12:05:49 +0000 (13:05 +0100)]
[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions

This commit extends D134719 "[AArch64] Enable libm vectorized
functions via SLEEF" with the mappings for the scalable functions.

It also introduces all the necessary changes needed to support masked
interfaces.

Reviewed By: danielkiss, sdesmalen

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

15 months ago[NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang
Kiran Chandramohan [Fri, 24 Mar 2023 17:12:40 +0000 (17:12 +0000)]
[NFC][Clang] Move DebugOptions to llvm/Frontend for reuse in Flang

This patch moves the Debug Options to llvm/Frontend so that it can be shared by Flang as well.

Reviewed By: kiranchandramohan, awarzynski

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

15 months ago[Assignment Tracking] Don't run declare-to-assign on functions marked optnone
OCHyams [Wed, 29 Mar 2023 11:54:39 +0000 (12:54 +0100)]
[Assignment Tracking] Don't run declare-to-assign on functions marked optnone

Assignment tracking doesn't add value when optimisations are disabled - don't
apply it to functions marked optnone.

Reviewed By: jryans

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

15 months agoRevert "[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions"
Paul Osmialowski [Wed, 29 Mar 2023 11:54:22 +0000 (12:54 +0100)]
Revert "[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions"

Reverting it so I could land it with Arcanist.

This reverts commit 59dcf927ee43e995374907b6846b657f68d7ea49.

15 months ago[Assignment Tracking][NFC] Cache debug-info-assignment-tracking module flag
OCHyams [Wed, 29 Mar 2023 11:51:59 +0000 (12:51 +0100)]
[Assignment Tracking][NFC] Cache debug-info-assignment-tracking module flag

This reduces CTMark LTO-O3-g compile time by a geomean of 0.1%.

Reviewed By: jmorse

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

15 months ago[Assignment Tracking] Give -fexperimental-assignment-tracking flag 3 options
OCHyams [Wed, 29 Mar 2023 10:33:11 +0000 (11:33 +0100)]
[Assignment Tracking]  Give -fexperimental-assignment-tracking flag 3 options

Without this patch assignment tracking is enabled with
`-fexperimental-assignment-tracking` and disabled with
`-fno-experimental-assignment-tracking` (default). This patch removes the
`-fno-` version and changes `-fexperimental-assignment-tracking` to take 3
values: `enabled`, `disabled` (default), and `forced`.

`clang -Xclang -fexperimental-assignment-tracking=enabled` enables the feature
if some other conditions are met and `=forced` enables it without any further
checks.

If `enabled` is specified the feature will remain disabled if any of the
following are true: it's an LTO or ThinLTO build, optimisations are not
enabled, or lldb debugger tuning has been specified. See this short RFC
for more info:
https://discourse.llvm.org/t/rfc-enable-assignment-tracking/69399

Reviewed By: jmorse

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

15 months agoRevert "[GuardWidening] Freeze the introduced use."
Serguei Katkov [Wed, 29 Mar 2023 11:35:53 +0000 (18:35 +0700)]
Revert "[GuardWidening] Freeze the introduced use."

This reverts commit f4b2360cecd4c92e85bccb1443f2ef425fc6a77b.

The patch has no specific order in adding freeze instruction in the
entry basic block. It causes failure of CHECK like unit tests.

15 months ago[Doc][Clang] Update information about default standard version
Roy Jacobson [Wed, 29 Mar 2023 11:25:27 +0000 (14:25 +0300)]
[Doc][Clang] Update information about default standard version

15 months ago[X86] combineMOVMSK - fold movmsk(logic(X,C)) -> logic(movmsk(X),C)
Simon Pilgrim [Wed, 29 Mar 2023 11:19:36 +0000 (12:19 +0100)]
[X86] combineMOVMSK - fold movmsk(logic(X,C)) -> logic(movmsk(X),C)

Avoid a vector mask load for something that is likely to be able to fold into a scalar logic op + EFLAGS comparison result

15 months ago[Doc][Clang] Update Clang 16 from 'unreleased' to 'full'
Roy Jacobson [Wed, 29 Mar 2023 11:20:08 +0000 (14:20 +0300)]
[Doc][Clang] Update Clang 16 from 'unreleased' to 'full'

15 months ago[RISCV][MC] Add support for the experimental zicond extension
Alex Bradbury [Wed, 29 Mar 2023 11:13:53 +0000 (12:13 +0100)]
[RISCV][MC] Add support for the experimental zicond extension

This patch adds the basic MC layer support for Zicond, based on
[1.0-rc1](https://github.com/riscv/riscv-zicond/releases/tag/v1.0-rc1).
As with other extensions, if there are additional changes between
release candidates without incrementing the version number we won't be
able to reflect that in the version number. I believe we've previously
decided this is not a problem for extensions still considered
experimental (i.e. not yet ratified).

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

15 months ago[clang][MinGW] Add asan DLL lib before other libs and objects
Alvin Wong [Sun, 26 Mar 2023 11:07:06 +0000 (19:07 +0800)]
[clang][MinGW] Add asan DLL lib before other libs and objects

As stated in https://github.com/llvm/llvm-project/issues/61685, by
passing LLD the import lib of the asan DLL first, the asan DLL will be
listed as the first entry in the Import Directory Table, making it be
loaded first before other user DLLs. This allows asan to be initialized
as early as possible to increase its instrumentation coverage to include
other DLLs not built with asan.

This also avoids some false asan reports on `realloc` for memory
allocated during initialization of user DLLs being loaded earlier than
asan, because after this change they will be loaded later than asan.

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

15 months ago[MLIR][LLVM] Take the alignment attribute into account during inlining.
Johannes de Fine Licht [Wed, 29 Mar 2023 08:38:52 +0000 (08:38 +0000)]
[MLIR][LLVM] Take the alignment attribute into account during inlining.

This is a subset of the full LLVM functionality to detect whether
realignment is necessary, conservatively copying byval arguments
whenever we cannot prove that the alignment requirement is met.

Reviewed By: gysit

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

15 months ago[mlir][llvm] Make DINamespace name optional
Christian Ulmann [Wed, 29 Mar 2023 09:02:36 +0000 (09:02 +0000)]
[mlir][llvm] Make DINamespace name optional

This commit makes the name of a DINamespace optional to enable modeling
of anonymous namespaces.

Reviewed By: gysit

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

15 months ago[LoopVectorize] Add non-zero check for MaxPowerOf2RuntimeVF in computeMaxVF
David Sherwood [Wed, 29 Mar 2023 08:54:56 +0000 (08:54 +0000)]
[LoopVectorize] Add non-zero check for MaxPowerOf2RuntimeVF in computeMaxVF

This one-line patch just tightens up the code added in
1c4fedfa35aeb8b456e2d8f4f826c0e026b9d863
where we try to avoid tail-folding if we know the runtime
VF will always be a multiple of the trip count.

15 months ago[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions
Paul Osmialowski [Fri, 24 Mar 2023 15:07:05 +0000 (15:07 +0000)]
[TLI][AArch64] Extend SLEEF vectorized functions mapping with VLA functions

This commit extends D134719 "[AArch64] Enable libm vectorized
functions via SLEEF" with the mappings for the scalable functions.

It also introduces all the necessary changes needed to support masked
interfaces.

Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
15 months agoNFC: remove stray extra space from llvm.spec.in
Paul Osmialowski [Wed, 29 Mar 2023 09:27:46 +0000 (10:27 +0100)]
NFC: remove stray extra space from llvm.spec.in

Signed-off-by: Paul Osmialowski <pawel.osmialowski@arm.com>
15 months ago[gn build] Port 791164751241
LLVM GN Syncbot [Wed, 29 Mar 2023 09:55:58 +0000 (09:55 +0000)]
[gn build] Port 791164751241

15 months agoRevert "Revert ExtractAPI from https://reviews.llvm.org/D146656"
Daniel Grumberg [Tue, 28 Mar 2023 17:00:13 +0000 (18:00 +0100)]
Revert "Revert ExtractAPI from https://reviews.llvm.org/D146656"

This reverts commit 158a431227a876306fe5838936413dd51588d0c6.

15 months ago[clang][HIP][OpenMP] Add warning if mixed HIP / OpenMP offloading
Michael Halkenhaeuser [Wed, 22 Mar 2023 09:45:08 +0000 (10:45 +0100)]
[clang][HIP][OpenMP] Add warning if mixed HIP / OpenMP offloading

Adds a warning, issued by the clang semantic analysis, if HIP and OpenMP target offloading is requested concurrently.
That is, if HIP language mode is active but OpenMP target directives are encountered.
Previously, a user might not have been aware that target directives are ignored in such a case.

Generation of this warning is (lit-)tested via "make check-clang-semaopenmp".
The warning can be ignored via "-Wno-hip-omp-target-directives".

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

15 months ago[GuardWidening] Freeze the introduced use.
Serguei Katkov [Thu, 23 Mar 2023 04:05:10 +0000 (11:05 +0700)]
[GuardWidening] Freeze the introduced use.

Guard widening optimization is able to move the condition from one
guard to the previous one. As a result if the condition is poison
and orginal second guard is never executed but the first one does,
we introduce undefined behavior which was not observed in original
program.

To resolve the issue we must freeze the condition we are moving.
However optimization itself does not know how to work with freeze.
Additionally optimization is written in incremental way.
For example we have three guards
G1(base + 8 < L)
G2(base + 16 < L)
G3(base + 24 < L)

On the first step GW will combine G1 and G2 as
G1(base + 8 < L && freeze(base + 16 < L))
G2(true)
G3(base + 24 < L)

while combining G1 and G3 base appears to be different.

To keep optimization enabled after freezing the moving condition, the
freeze instruction is pushed as much as possible and later all uses
of freezed values are replaced with frozen version.

This is similar what instruction combining does but more aggressevely.

Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D146699

15 months ago[LV][AArch64] Precommit interleaved access tests
Graham Hunter [Tue, 28 Mar 2023 13:13:26 +0000 (14:13 +0100)]
[LV][AArch64] Precommit interleaved access tests

Precommit for D145163

15 months ago[clangd] Handle the C++2b elifdef and elindef PP structure in CollectMainFileMacros.
Haojian Wu [Wed, 29 Mar 2023 09:20:01 +0000 (11:20 +0200)]
[clangd] Handle the C++2b elifdef and elindef PP structure in CollectMainFileMacros.

Reviewed By: kadircet

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

15 months ago[lld][ARM][2/3]Big Endian support - Word invariant support
Simi Pallipurath [Mon, 20 Feb 2023 13:31:45 +0000 (13:31 +0000)]
[lld][ARM][2/3]Big Endian support - Word invariant support

Changes:
 - Adding BE32 big endian Support for Arm.
 - Replace the writele and readle with their endian-aware versions.
 - Adding test cases for the big-endian be32 arm configuration.

     Patch by: Milosz Plichta. This patch merges all the changes from
     this patch https://reviews.llvm.org/D140203 as well.

Reviewed By: peter.smith, MaskRay

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

15 months ago[mlir] Fix build files
Matthias Springer [Wed, 29 Mar 2023 09:13:40 +0000 (11:13 +0200)]
[mlir] Fix build files

This should have been part of D147039.

15 months ago[mlir][transform] Add TrackingListener
Matthias Springer [Wed, 29 Mar 2023 09:02:26 +0000 (11:02 +0200)]
[mlir][transform] Add TrackingListener

This change makes it possible to use a greedy pattern rewrite as part of a transform op, even if the transform op does not invalidate the target handle (in particular transform ops without `FunctionalStyleTransformOpTrait`) and the targeted op is not isolated from above.

The listener API allows us to track replacements of ops with values, but not ops with ops. Therefore, the TrackingListener is conservative: If an op is replaced with values that all have the same defining op and the defining op is of the same type as the original op, it is safe to assume that the op was replaced with an equivalent op. Otherwise, the op mapping is dropped. When this is not good enough, transforms can track values instead or provide a custom `findReplacementOp` function.

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

15 months ago[mlir][transform] TransformStateExtension: Replace op/value handles separately
Matthias Springer [Wed, 29 Mar 2023 08:48:00 +0000 (10:48 +0200)]
[mlir][transform] TransformStateExtension: Replace op/value handles separately

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

15 months ago[X86] Preserve !pcsections on atomic intrinsics
Marco Elver [Wed, 29 Mar 2023 08:25:10 +0000 (10:25 +0200)]
[X86] Preserve !pcsections on atomic intrinsics

Preserve !pcsections metadata on X86-only atomic intrinsics when
expanding higher-level atomics.

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

15 months ago[LoopPredication] Fix the LoopPredication by feezing the result of predication.
Serguei Katkov [Wed, 22 Mar 2023 10:10:38 +0000 (17:10 +0700)]
[LoopPredication] Fix the LoopPredication by feezing the result of predication.

LoopPredication introduces the use of possibly posion value in branch (guard)
instruction, so to avoid introducing undefined behavior it should be frozen.

Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D146685

15 months ago[RISCV][NFC] Fix ident in RISCVISelLowering.h.
Yeting Kuo [Wed, 29 Mar 2023 07:47:29 +0000 (15:47 +0800)]
[RISCV][NFC] Fix ident in RISCVISelLowering.h.

Reviewed By: craig.topper

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

15 months ago[mlir] [bazel] Make OpenMPInterfaces.h a textual header.
Johannes Reifferscheid [Wed, 29 Mar 2023 07:40:39 +0000 (09:40 +0200)]
[mlir] [bazel] Make OpenMPInterfaces.h a textual header.

This header can't be built standalone. Making it textual will prevent
blaze from attempting to do so.

15 months ago[Clang][Flang][AMDGPU] Add support for AMDGPU to Flang driver
Dominik Adamski [Mon, 27 Mar 2023 12:19:40 +0000 (07:19 -0500)]
[Clang][Flang][AMDGPU] Add support for AMDGPU to Flang driver

Scope of changes:
  1) Extract common code between Clang and Flang for parsing AMDGPU features
  2) Add function which adds implicit target features for AMDGPU as Clang does
  3) Add AMDGPU target as one of valid targets for Flang

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

Reviewed By: yaxunl, awarzynski

15 months ago[mlir][Tensor] Use helper function for `getDroppedDims`
Matthias Springer [Tue, 28 Mar 2023 14:37:03 +0000 (16:37 +0200)]
[mlir][Tensor] Use helper function for `getDroppedDims`

This helper function is used for both ExtractSliceOp and InsertSliceOp. Also fixes a bug in the implementation of `InsertSliceOp::getDroppedDims`.

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

15 months ago[AsmPrinter] Fix Crash when Emitting Global Constant of small bit width when targetin...
Henry Yu [Wed, 29 Mar 2023 07:06:06 +0000 (00:06 -0700)]
[AsmPrinter] Fix Crash when Emitting Global Constant of small bit width when targeting Big Endian arch

For Big Endian, the function `emitGlobalConstantLargeInt` tries to right shift `Realigned` by an amount `ExtraBitSize` in place. However, if the constant to emit has a bit width less than 64 and the bit width is not a multiple of 8, the shift amount will be greater than the bit width of `Realigned`, which causes assertion error described in issue [[ https://github.com/llvm/llvm-project/issues/59055 | issue #59055 ]].

This patch fixes the issue by avoiding right shift when bit width is under 64 to avoid the assertion error.

Reviewed By: Peter

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

15 months ago[llvm][CycleInfo] Quick look-up for block in cycle.
Sameer Sahasrabuddhe [Wed, 29 Mar 2023 06:37:44 +0000 (12:07 +0530)]
[llvm][CycleInfo] Quick look-up for block in cycle.

Use a SetVector to store blocks in a cycle to ensure a quick loop-up when
querying whether the cycle contains a given block. This is along the same lines
as the SmallPtrSet in LoopBase, introduced by commit
be640b28c0cb81b77015baaef20ca2941fc61dea.

To make this work, we also enhance SetVector to support vector operations with
pointers and set operations with const pointers in the same container.

Reviewed By: foad

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

15 months ago[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation
Sergei Barannikov [Sun, 26 Mar 2023 16:25:16 +0000 (19:25 +0300)]
[compiler-rt] Quote multiple warning flags in check_cxx_compiler_flag invocation

Without this all checks fail because CMake passes the flags
like this:
`... -nodefaultlibs   -D-Warray-bounds -Werror -std=c++17 ...`
Note the `-D` before the `-W`.

Reviewed By: ahatanak

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

15 months agore-land [C++20][Modules] Introduce an implementation module.
Iain Sandoe [Fri, 3 Jun 2022 09:43:38 +0000 (10:43 +0100)]
re-land [C++20][Modules] Introduce an implementation module.

We need to be able to distinguish individual TUs from the same module in cases
where TU-local entities either need to be hidden (or, for some cases of ADL in
template instantiation, need to be detected as exposures).

This creates a module type for the implementation which implicitly imports its
primary module interface per C++20:
[module.unit/8] 'A module-declaration that contains neither an export-keyword
nor a module-partition implicitly imports the primary module interface unit of
the module as if by a module-import-declaration.

Implementation modules are never serialized (-emit-module-interface for an
implementation unit is diagnosed and rejected).

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

15 months agoRevert "[C++20] [Modules] Don't load declaration eagerly for named modules"
Chuanqi Xu [Wed, 29 Mar 2023 03:05:37 +0000 (11:05 +0800)]
Revert "[C++20] [Modules] Don't load declaration eagerly for named modules"

This reverts commit af86957cbbffd3dfff3c6750ebddf118aebd0069.

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

Previously I banned the eagerly loading for declarations from named
modules to speedup the process of reading modules. But I didn't think
about special decls like PragmaCommentDecl and PragmaDetectMismatchDecl.
So here is the issue https://github.com/llvm/llvm-project/issues/61733.

Note that the current behavior is still incorrect. Given:

```
// mod.cppm
module;

export module mod;
```

and

```
// user.cpp
import mod;
```

Now the IR of `user.cpp` will contain the metadata '!0 =
!{!"msvcprt.lib"}' incorrectly. The root cause of the problem is that
`EagerlyDeserializedDecls` is designed for headers and it didn't take
care for named modules. We need to redesign a new mechanism for named
modules.

15 months ago[clang-repl] Use std::move when converting Error to Expected
Anubhab Ghosh [Wed, 29 Mar 2023 02:48:36 +0000 (08:18 +0530)]
[clang-repl] Use std::move when converting Error to Expected

15 months ago[clang-repl] Add a command to load dynamic libraries
Anubhab Ghosh [Sun, 15 Jan 2023 15:10:44 +0000 (20:40 +0530)]
[clang-repl] Add a command to load dynamic libraries

This commit adds the %lib <file> command to load a dynamic library to be
used by the currently running interpreted code.
For example `%lib libSDL2.so`.

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