456376 Commits

Author SHA1 Message Date
mydeveloperday
07616c5db0 [clang-format] NFC ensure Style operator== remains sorted for ease of editing
{D144170} didn't go via the normal clang-format reviewers and we'd have pointed out that this list of options remains sorted.

Reviewed By: owenpan

Differential Revision: https://reviews.llvm.org/D147176
2023-03-29 21:25:29 +01:00
Haojian Wu
7cd6ce9e91 [include-cleaner] Visit the VarDecl in ASTWalker.
Fixes https://github.com/clangd/clangd/issues/1554

Differential Revision: https://reviews.llvm.org/D147135
2023-03-29 22:20:30 +02:00
Roy Jacobson
0eb06cb3aa [Sema] Stop stripping CV quals from *this captures in lambdas
It appears we've been incorrectly stripping CV qualifiers when capturing `this` by value inside lambdas.
This patch simply removes the CV stripping code as discussed.

Closes https://github.com/llvm/llvm-project/issues/50866

Reviewed By: #clang-language-wg, cor3ntin, aaron.ballman

Differential Revision: https://reviews.llvm.org/D146168
2023-03-29 23:11:51 +03:00
Michael Jones
5ce83caba5 [libc] fix strtointeger behavior on max values
Previously the check to just return MAX or MIN used the caclulated
number being the maximum absolute value. This was right in every case
except for an unsigned conversion being passed its maximum value with a
negative sign on the front. This should return -MAX, but was returning
just MAX.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D147171
2023-03-29 13:02:40 -07:00
Vitaly Cheptsov
f5e63f8fc9 [RISCV] Support emulated TLS
As discussed earlier in the [GitHub
issue](https://github.com/llvm/llvm-project/issues/59500), currently
LLVM generates invalid code when emulated TLS is used. There were
attempts to resolve this previously (D102527), but they were not merged
because the component owners raised concerns about emulated TLS
efficiency.

The current state of the art is that:

- OpenBSD team, which raised the initial issue, simply has [patches
  downstream](https://github.com/openbsd/src/blob/a0747c9/gnu/llvm/llvm/lib/Target/RISCV/RISCVISelLowering.cpp#L2850-L2852).
- Our team, which raised the GH issue, has patches downstream as well.
  We also do not use `malloc` or any [dynamic
allocations](https://github.com/llvm/llvm-project/issues/59500#issuecomment-1349046835)
with emulated TLS, so the concerns raised in the original issue does not
apply to us.
- GCC compatibility is broken, because GCC supports emulated TLS.
- RISC-V is the only architecture in LLVM that does not support emulated
  TLS, and work is being done to at least warn the users about it
(D143619).

With all these in mind I believe it is important to address the
consumers' needs especially given that there is little to no maintenance
downsides.

Differential Revision: https://reviews.llvm.org/D143708
2023-03-29 20:55:51 +01:00
Diego Caballero
1cd434d007 [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
2023-03-29 19:53:29 +00:00
Diego Caballero
e2f1d5ce91 [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
2023-03-29 19:53:29 +00:00
Diego Caballero
f18a861299 [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
2023-03-29 19:53:29 +00:00
Diego Caballero
7b70baa9ef [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
2023-03-29 19:53:29 +00:00
Heejin Ahn
a4e32ae4cd [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
2023-03-29 12:50:39 -07:00
Heejin Ahn
5a55c9507b [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
2023-03-29 12:49:57 -07:00
Michael Jones
e0de24cb0d [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
2023-03-29 12:49:29 -07:00
Heejin Ahn
cfd36aa5b7 [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
2023-03-29 12:48:23 -07:00
Heejin Ahn
d91c9aef9b [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
2023-03-29 12:46:58 -07:00
Jay Foad
3e3594c771 [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
2023-03-29 20:23:36 +01:00
Jay Foad
70e2d631e1 [AMDGPU] Consistently use v2i16 for packed bf16 inputs. NFC.
Differential Revision: https://reviews.llvm.org/D147145
2023-03-29 20:23:36 +01:00
Joseph Huber
2dc60b4ea4 [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.
2023-03-29 14:20:44 -05:00
Douglas Yung
389e93cfcd Mark test added in D141824 as unsupported for PS4/PS5 as those platforms require an external linker that is not present. 2023-03-29 12:09:28 -07:00
mydeveloperday
0ca6dd96d6 [clang-format] NFC ensure clang-format is itself clang-formatted
Some patch in the past introduce this non clang-formatted change
2023-03-29 20:01:03 +01:00
LLVM GN Syncbot
6330447c25 [gn build] Port 3be6c4d413f6 2023-03-29 18:50:19 +00:00
Kavitha Natarajan
8f38cb0e35 [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.
2023-03-30 00:16:11 +05:30
Uday Bondhugula
c910570fd2 [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
2023-03-30 00:11:13 +05:30
Doru Bercea
f2b15b9ed9 Make all additions matter in private mapping test. 2023-03-29 14:40:40 -04:00
Mitch Phillips
3be6c4d413 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
2023-03-29 11:39:44 -07:00
Mitch Phillips
96f028c0a2 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.
2023-03-29 11:39:32 -07:00
Wolfgang Pieb
477f9cea77 [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
2023-03-29 18:15:04 +00:00
Kavitha Natarajan
da9f890d09 [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
2023-03-29 23:41:21 +05:30
Andrew Gozillon
a7e91b18b7 [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
2023-03-29 12:54:38 -05:00
Andrew Gozillon
498041da4e [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.
2023-03-29 12:54:38 -05:00
Nitin John Raj
50876630b9 [RISCV] Made v(f)(w)red* pseudoinstructions SEW-aware
Differential Revision: https://reviews.llvm.org/D147098
2023-03-29 10:37:56 -07:00
Leonard Chan
5bb826d569 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
2023-03-29 17:34:16 +00:00
Leonard Chan
99db65630c [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
2023-03-29 17:09:06 +00:00
Jakub Kuderski
ce6a03ce0b [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
2023-03-29 12:51:51 -04:00
Benjamin Kramer
2657e554d1 [docs] Fix a typo (malicously-crafter) 2023-03-29 18:49:04 +02:00
Florian Hahn
4173ed1382
[LV] Add test cases for global struct dereferencability.
Currently LLVM fails to determine that conditional loads in
@accesses_to_struct_dereferenceable are dereferenceable unconditionally.
2023-03-29 17:47:41 +01:00
Walter Gray
1f48a1fce2 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
2023-03-29 09:44:01 -07:00
Matthew Voss
bbc204b944 [PS4][clang] Limit ThinLTO parallelism when requested
Pass the correct option to the linker when "-flto-jobs=" is passed to
the driver.
2023-03-29 09:36:46 -07:00
Sindhu Chittireddy
6f2a865d2f [NFC] Fix uninitalized member variable use in ASTReader::ParseTargetOptions() 2023-03-29 09:29:14 -07:00
Kiran Chandramohan
38e465686c [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
2023-03-29 16:20:50 +00:00
Jakub Kuderski
16672dba5f [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
2023-03-29 12:10:21 -04:00
Piotr Zegar
498c88563b [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
2023-03-29 16:08:54 +00:00
Mitch Phillips
270067d695 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)
2023-03-29 09:07:02 -07:00
Akash Banerjee
e540d5a20a [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
2023-03-29 17:05:10 +01:00
Erich Keane
98ea471282 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
2023-03-29 09:04:59 -07:00
Mitch Phillips
96c036113e 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
2023-03-29 08:53:07 -07:00
Shoaib Meenai
d33bac18bb [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
2023-03-29 08:36:49 -07:00
Daniel Grumberg
1cfe1e732a [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
2023-03-29 16:32:26 +01:00
Serge Pavlov
90025187f0 [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
2023-03-29 22:28:49 +07:00
Serge Pavlov
27c4777f41 [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.
2023-03-29 22:28:48 +07:00
Wael Yehia
0e2ed90516 [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
2023-03-29 15:15:07 +00:00