platform/upstream/llvm.git
22 months ago[ConstraintElim] Add nested GEP test with scalable vectors.
Florian Hahn [Thu, 13 Oct 2022 19:58:10 +0000 (20:58 +0100)]
[ConstraintElim] Add nested GEP test with scalable vectors.

22 months ago[llvm-objdump] Add HelpText for --no-addresses after D135040
Fangrui Song [Thu, 13 Oct 2022 19:50:15 +0000 (12:50 -0700)]
[llvm-objdump] Add HelpText for --no-addresses after D135040

22 months ago[PGO] Make emitted symbols hidden
Alex Brachet [Thu, 13 Oct 2022 19:47:15 +0000 (19:47 +0000)]
[PGO] Make emitted symbols hidden

This was reverted because it was breaking when targeting Darwin which
tried to export these symbols which are now hidden. It should be safe
to just stop attempting to export these symbols in the clang driver,
though Apple folks will need to change their TAPI allow list described
in the commit where these symbols were originally exported
https://github.com/llvm/llvm-project/commit/f5380185623be243ba0f1b18d4bd594ac5cc7163

Bug: https://github.com/llvm/llvm-project/issues/58265

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

22 months ago[LLDB][NativePDB] Fix struct layout when it has anonymous unions.
Zequan Wu [Thu, 29 Sep 2022 02:40:35 +0000 (19:40 -0700)]
[LLDB][NativePDB] Fix struct layout when it has anonymous unions.

Previously, lldb mistook fields in anonymous union in a struct as the direct
field of the struct, which causes lldb crashes due to multiple fields sharing
the same offset in a struct. This patch fixes it.

MSVC generated pdb doesn't have the debug info entity representing a anonymous
union in a struct. It looks like the following:
```
struct S {
union {
  char c;
  int i;
};
};

0x1004 | LF_FIELDLIST [size = 40]
         - LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
         - LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
0x1005 | LF_STRUCTURE [size = 32] `S`
         unique name: `.?AUS@@`
         vtable: <no type>, base list: <no type>, field list: 0x1004
```
Clang generated pdb is similar, though due to the [[ https://github.com/llvm/llvm-project/issues/57999 | bug ]],
it's not more useful than the debug info above. But that's not very relavent,
lldb should still be able to understand MSVC geneerated pdb.
```
0x1003 | LF_UNION [size = 60] `S::<unnamed-tag>`
         unique name: `.?AT<unnamed-type-$S1>@S@@`
         field list: <no type>
         options: forward ref (= 0x1003) | has unique name | is nested, sizeof 0
0x1004 | LF_FIELDLIST [size = 40]
         - LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
         - LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
         - LF_NESTTYPE [name = ``, parent = 0x1003]
0x1005 | LF_STRUCTURE [size = 32] `S`
         unique name: `.?AUS@@`
         vtable: <no type>, base list: <no type>, field list: 0x1004
         options: contains nested class | has unique name, sizeof 4
0x1006 | LF_FIELDLIST [size = 28]
         - LF_MEMBER [name = `c`, Type = 0x0070 (char), offset = 0, attrs = public]
         - LF_MEMBER [name = `i`, Type = 0x0074 (int), offset = 0, attrs = public]
0x1007 | LF_UNION [size = 60] `S::<unnamed-tag>`
         unique name: `.?AT<unnamed-type-$S1>@S@@`
         field list: 0x1006
         options: has unique name | is nested | sealed, sizeof
```
This patch delays the FieldDecl creation when travesing LF_FIELDLIST so we know
if there are multiple fields are in the same offsets and are able to group them
into different anonymous unions based on offsets. Nested anonymous union will
be flatten into one anonymous union, because we simply don't have that info, but
they are equivalent in terms of union layout.

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

22 months ago[DirectX backend] [NFC] Change Resources::write to const.
Xiang Li [Tue, 11 Oct 2022 18:43:42 +0000 (11:43 -0700)]
[DirectX backend] [NFC] Change Resources::write to const.

Change Resources::write to const.
Also fix parameter name.

Reviewed By: beanz

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

22 months agoOnly enable driver test if in driver build
Alex Brachet [Thu, 13 Oct 2022 19:26:06 +0000 (19:26 +0000)]
Only enable driver test if in driver build

22 months ago[llvm-driver] Add lld
Alex Brachet [Thu, 13 Oct 2022 19:23:25 +0000 (19:23 +0000)]
[llvm-driver] Add lld

The llvm-driver, enabled with LLVM_TOOL_LLVM_DRIVER_BUILD combines many llvm executables
into one to save overall toolchain size. This patch adds the capability for lld to be part of the
llvm-driver.

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

22 months agoFix clang version check in SARIF diagnostics test
Yabin Cui [Thu, 13 Oct 2022 19:16:58 +0000 (15:16 -0400)]
Fix clang version check in SARIF diagnostics test

This is to allow future clang versions and use of LLVM_VERSION_PATCH.

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

22 months ago[clang] Update ASM goto documentation to reflect how Clang differs from GCC
Bill Wendling [Wed, 12 Oct 2022 21:43:38 +0000 (14:43 -0700)]
[clang] Update ASM goto documentation to reflect how Clang differs from GCC

That said, we are planning to add this support in the near future.

Link: https://github.com/llvm/llvm-project/issues/53562
Differential Revision: https://reviews.llvm.org/D135818

22 months ago[libc] Add a simple implementation of the posix_spawn function.
Siva Chandra Reddy [Tue, 11 Oct 2022 00:38:29 +0000 (00:38 +0000)]
[libc] Add a simple implementation of the posix_spawn function.

The implementation currently ignores all spawn attributes. Support for
them will be added in future changes.

A simple allocator for integration tests has been added so that the
integration test for posix_spawn can use the
posix_spawn_file_actions_add* functions.

Reviewed By: michaelrj

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

22 months agoUnbreak Windows build
Sanjoy Das [Thu, 13 Oct 2022 18:09:09 +0000 (11:09 -0700)]
Unbreak Windows build

Without the llvm_unreachable, Windows complains about not returning a
value from mlir::isSpeculatable on all paths.

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

22 months ago[flang] Lower assumed length character allocatable and pointer arguments
Jonathon Penix [Fri, 7 Oct 2022 02:37:10 +0000 (19:37 -0700)]
[flang] Lower assumed length character allocatable and pointer arguments

It seems the needed functionality was already implemented for host associations,
so turn that code into a function and move it into a (hopefully appropriate)
common location and reuse it.

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

22 months ago[ConstraintElim] Move check-and-replace logic to helper function (NFC).
Florian Hahn [Thu, 13 Oct 2022 17:58:37 +0000 (18:58 +0100)]
[ConstraintElim] Move check-and-replace logic to helper function (NFC).

Move logic to check and replace conditions to a helper function. This
isolates the code, allows using early returns, reduces the
indentation and simplifies eliminateConstraints.

22 months ago[NVPTX] Support neg{.ftz} for f16 and f16x2
Jakub Chlanda [Thu, 13 Oct 2022 17:40:00 +0000 (10:40 -0700)]
[NVPTX] Support neg{.ftz} for f16 and f16x2

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

22 months agoFix LSan build
Wiktor Garbacz [Thu, 13 Oct 2022 17:40:27 +0000 (10:40 -0700)]
Fix LSan build

This change fixes a build bug introduced in
39db491957dcf095936d81bed89c2b4edae2a1e7

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

22 months agoThread safety analysis: Support copy-elided production of scoped capabilities through...
Aaron Puchert [Wed, 13 Jul 2022 23:47:52 +0000 (01:47 +0200)]
Thread safety analysis: Support copy-elided production of scoped capabilities through arbitrary calls

When support for copy elision was initially added in e97654b2f2807, it
was taking attributes from a constructor call, although that constructor
call is actually not involved. It seems more natural to use attributes
on the function returning the scoped capability, which is where it's
actually coming from. This would also support a number of interesting
use cases, like producing different scope kinds without the need for tag
types, or producing scopes from a private mutex.

Changing the behavior was surprisingly difficult: we were not handling
CXXConstructorExpr calls like regular calls but instead handled them
through the DeclStmt they're contained in. This was based on the
assumption that constructors are basically only called in variable
declarations (not true because of temporaries), and that variable
declarations necessitate constructors (not true with C++17 anymore).

Untangling this required separating construction from assigning a
variable name. When a call produces an object, we use a placeholder
til::LiteralPtr for `this`, and we collect the call expression and
placeholder in a map. Later when going through a DeclStmt, we look up
the call expression and set the placeholder to the new VarDecl.

The change has a couple of nice side effects:
* We don't miss constructor calls not contained in DeclStmts anymore,
  allowing patterns like
    MutexLock{&mu}, requiresMutex();
  The scoped lock temporary will be destructed at the end of the full
  statement, so it protects the following call without the need for a
  scope, but with the ability to unlock in case of an exception.
* We support lifetime extension of temporaries. While unusual, one can
  now write
    const MutexLock &scope = MutexLock(&mu);
  and have it behave as expected.
* Destructors used to be handled in a weird way: since there is no
  expression in the AST for implicit destructor calls, we instead
  provided a made-up DeclRefExpr to the variable being destructed, and
  passed that instead of a CallExpr. Then later in translateAttrExpr
  there was special code that knew that destructor expressions worked a
  bit different.
* We were producing dummy DeclRefExprs in a number of places, this has
  been eliminated. We now use til::SExprs instead.

Technically this could break existing code, but the current handling
seems unexpected enough to justify this change.

Reviewed By: aaron.ballman

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

22 months ago[clangd] Add missing readonly modifier for const generic parameters
Tom Praschan [Fri, 7 Oct 2022 10:46:11 +0000 (12:46 +0200)]
[clangd] Add missing readonly modifier for const generic parameters

Fixes https://github.com/clangd/clangd/issues/1222. As discussed there, we saw no reason to keep this check.

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

22 months ago[llvm-ocaml] Fix arity mismatch in pointer bindings
Alan Hu [Thu, 13 Oct 2022 17:07:06 +0000 (10:07 -0700)]
[llvm-ocaml] Fix arity mismatch in pointer bindings

Reviewed By: nikic

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

22 months ago[clang] Support `constexpr` for some `ASTNodeKind` member functions
Eric Li [Wed, 12 Oct 2022 20:28:59 +0000 (16:28 -0400)]
[clang] Support `constexpr` for some `ASTNodeKind` member functions

Add `constexpr` support for:

  * The `getFromNodeKind` factory function
  * `isSame`
  * `isNone`
  * `hasPointerIdentity`

This enables these functions to be used in SFINAE context for AST node
types.

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

22 months ago[lld/mac] Add test for bug fixed in reland 82ca390062d115
Nico Weber [Thu, 13 Oct 2022 15:44:09 +0000 (11:44 -0400)]
[lld/mac] Add test for bug fixed in reland 82ca390062d115

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

22 months ago[lld][WebAssembly] Add `--extra-features` flag to add addional features
Sam Clegg [Wed, 12 Oct 2022 23:39:47 +0000 (16:39 -0700)]
[lld][WebAssembly] Add `--extra-features` flag to add addional features

This flag acts just like the existing `--features` flag but instead
of replacing the set of inferred features it adds to it.

This is useful for example if you want to `--export` a mutable global
but none of the input of object were built with mutable global support.
In that case you can do `--extra-features=mutable-globals` to avoid the
linker error that would otherwise be generated in this case:

wasm-ld: error: mutable global exported but 'mutable-globals' feature not present in inputs: `__stack_pointer`. Use --no-check-features to suppress.

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

22 months ago[PassTimingInfo] Stop double (or worse) counting passes/analyses
Arthur Eubanks [Tue, 4 Oct 2022 22:13:16 +0000 (15:13 -0700)]
[PassTimingInfo] Stop double (or worse) counting passes/analyses

If we nest timers, we end up double counting anything nested.

The most egregious is ModuleInlinerWrapperPass/DevirtSCCRepeatedPass showing up as >20% of the total time when they're just wrappers.

Analyses also end up getting counted multiple times because they're nested inside wrappers and passes.

Ignore ModuleInlinerWrapperPass/DevirtSCCRepeatedPass and put analyses into their own TimerGroup.

Reviewed By: asbirlea

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

22 months ago[RISCV] Match (select C, -1, X)->(or -C, X) during lowerSelect
Craig Topper [Thu, 13 Oct 2022 15:52:58 +0000 (08:52 -0700)]
[RISCV] Match (select C, -1, X)->(or -C, X) during lowerSelect

Same with (select C, X, -1), (select C, 0, X), and (select C, X, 0).

There's a DAGCombine after we turn the select into select_cc, but
that may introduce a setcc that didn't previously exist. We could
add more DAGCombines to remove the extra setcc, but this seemed lower
effort.

Reviewed By: reames

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

22 months ago[lld/mac] Convert undef-spell-corrector.s test to split-file
Nico Weber [Thu, 13 Oct 2022 15:18:59 +0000 (11:18 -0400)]
[lld/mac] Convert undef-spell-corrector.s test to split-file

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

22 months ago[lld/mac] Make two local variables const
Nico Weber [Thu, 13 Oct 2022 14:36:08 +0000 (10:36 -0400)]
[lld/mac] Make two local variables const

While reading this code, I was wondering if we change these variables in the
loop. We don't, so make them const to make this easier to see next time.

No behavior change.

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

22 months agoFix handling of rank-1 tensors in tosa.reduce_sum
Ramiro Leal-Cavazos [Thu, 13 Oct 2022 16:02:01 +0000 (09:02 -0700)]
Fix handling of rank-1 tensors in tosa.reduce_sum

The conversion of `tosa.reduce_sum` to linalg creates a
`linalg.generic` op that produces a tensor of rank `input_rank -
1`. This tensor is then expanded back into a tensor of rank
`input_rank`. In the case where the tensor being expanded is rank-0,
the reassociation map used must be empty. However, the current
implementation indexes and modifies the reassociation map independent
of the rank of the tensor being expanded, resulting in out-of-bounds
indexing when the tensor being expanded is rank-0. This commit adds a
guard to the reassociation map indexing.

Reviewed By: jpienaar

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

22 months agoApply clang-tidy fixes for performance-unnecessary-value-param in TosaCanonicalizatio...
Mehdi Amini [Thu, 6 Oct 2022 19:31:50 +0000 (19:31 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in TosaCanonicalizations.cpp (NFC)

22 months agoApply clang-tidy fixes for modernize-use-equals-default in TosaCanonicalizations...
Mehdi Amini [Thu, 6 Oct 2022 19:31:17 +0000 (19:31 +0000)]
Apply clang-tidy fixes for modernize-use-equals-default in TosaCanonicalizations.cpp (NFC)

22 months ago[CodeGenPrep] Handle constants in ConvertPhiType
David Green [Thu, 13 Oct 2022 15:41:44 +0000 (16:41 +0100)]
[CodeGenPrep] Handle constants in ConvertPhiType

This is a simple addition to the convertPhiTypes in CodeGenPrepare to
consider and convert constants as it converts the phi type. Someone
fixed the bug in the motivating example, so the undef is now a constant
0. This does mean converting between integer and floating point
constants, which may have different materialization.

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

22 months ago[mlir][Transform] Fix dropReverseMapping early exit condition
Nicolas Vasilache [Thu, 13 Oct 2022 15:13:25 +0000 (08:13 -0700)]
[mlir][Transform] Fix dropReverseMapping early exit condition

Previously, the erasure would not trigger and result in surprising behavior.

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

22 months ago[MemCpyOpt] Add additional tests with lifetime intrinsics (NFC)
Nikita Popov [Thu, 13 Oct 2022 15:29:37 +0000 (17:29 +0200)]
[MemCpyOpt] Add additional tests with lifetime intrinsics (NFC)

22 months ago[AArch64] Add ConvertPhiType constant tests. NFC
David Green [Thu, 13 Oct 2022 15:23:34 +0000 (16:23 +0100)]
[AArch64] Add ConvertPhiType constant tests. NFC

22 months ago[MemCpyOpt] Add additional debug output (NFC)
Nikita Popov [Thu, 13 Oct 2022 15:02:16 +0000 (17:02 +0200)]
[MemCpyOpt] Add additional debug output (NFC)

22 months ago[MemCpyOpt] Don't run full pipeline in test (NFC)
Nikita Popov [Thu, 13 Oct 2022 14:47:04 +0000 (16:47 +0200)]
[MemCpyOpt] Don't run full pipeline in test (NFC)

Just memcpyopt is enough for this test.

22 months agoUpdate developer policy on potentially breaking changes
Aaron Ballman [Thu, 13 Oct 2022 14:58:52 +0000 (10:58 -0400)]
Update developer policy on potentially breaking changes

We've recently had issues appropriately notifying users and
stakeholders of changes to projects that may be potentially disruptive
when upgrading. This led to discussion on Discourse about how to
improve the situation, which can be found at:
https://discourse.llvm.org/t/rfc-add-new-discourse-channel-for-potentially-breaking-disruptive-changes-for-clang/65251

Ultimately, it sounds like we want to encourage three things:

* Alert vendors during the code review so they can provide early
  feedback on potentially breaking changes that would be unacceptable
  for them.
* Alert vendors and users after committing the changes so they can
  perform pre-release testing on a completed change to determine if it
  causes unreasonable problems for them.
* Alert users more clearly through the release notes so that it's
  easier to determine how disruptive an upgrade might be.

This updates the developer policy accordingly.

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

22 months ago[LV] Add epilogue test with variable induction start value.
Florian Hahn [Thu, 13 Oct 2022 14:56:26 +0000 (15:56 +0100)]
[LV] Add epilogue test with variable induction start value.

Add additional test mentioned by @venkataramanan.kumar.llvm in
D92132.

22 months agoRevert "[libc] New version of the mem* framework"
Guillaume Chatelet [Thu, 13 Oct 2022 14:49:58 +0000 (14:49 +0000)]
Revert "[libc] New version of the mem* framework"

This reverts commit d55f2d8ab076298cfd745c05c1b4dfd5583f8b9e.

22 months ago[libc] New version of the mem* framework
Guillaume Chatelet [Thu, 13 Oct 2022 14:43:44 +0000 (14:43 +0000)]
[libc] New version of the mem* framework

This version is more composable and also simpler at the expense of being more explicit and more verbose. It also provides minimal implementations for ARM platforms.

Codegen can be checked here https://godbolt.org/z/x19zvE59v

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

22 months agoReland "[lld/mac] Port typo correction for undefined symbols from ELF port"
Nico Weber [Wed, 12 Oct 2022 00:40:26 +0000 (20:40 -0400)]
Reland "[lld/mac] Port typo correction for undefined symbols from ELF port"

The only difference in the reland is that the loop at the top of
getAlternativeSpelling() now calls dyn_cast_or_null() instead
of dyn_cast() -- a file's symbols list can contain null entries.

The test for this might be slightly involved, so I'll land it in
a follow-up, to make the reland similar to the original commit.

Originally reviewed at:
Differential Revision: https://reviews.llvm.org/D135038

This reverts commit 317b5582b813c51d1fb6723fd44b227b7f274bc7.

22 months ago[SLP]Improve costs of vectorized loads/stores by analyzing GEPs.
Alexey Bataev [Tue, 4 Oct 2022 18:14:38 +0000 (11:14 -0700)]
[SLP]Improve costs of vectorized loads/stores by analyzing GEPs.

When generating masked gathers nodes, SLP vectorizer accounts the cost
of the GEPs for loads as part of the scalar-vector transformation cost
estimation. But it does not do it for vectorized loads/stores, while it
may completely remove some of the GEPs completely. Because of this in
some cases masked gather operation can be much more profitable rather
than regular vectorization (masked-gather cost + vector GEP - scalar
loads + GEPs comparing to vectorized loads - scalar loads).
Added the analysis of the removed scalarGEPs for vectorized load/store nodes for better cost estimation.

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

22 months agoRevert "Remove PlaceSafepoints pass"
Philip Reames [Thu, 13 Oct 2022 14:08:35 +0000 (07:08 -0700)]
Revert "Remove PlaceSafepoints pass"

This reverts commit cb66e123c6bc82a793300b6fb3ecbed79c58f557.  It was reported via https://reviews.llvm.org/rGcb66e123c6bc82a793300b6fb3ecbed79c58f557#1132969 that the Microsoft.NET compiler is still using this pass.

22 months ago[VectorCombine] Add insertelement-shufflevector VectorCombine tests
Matt Devereau [Thu, 13 Oct 2022 14:06:24 +0000 (14:06 +0000)]
[VectorCombine] Add insertelement-shufflevector VectorCombine tests

This is a precommit which adds some tests to show the functionality of an
upcoming VectorCombine optimization

22 months ago[PowerPC] Stash GPR to VSR if emergency spill slot is not reachable
Nemanja Ivanovic [Thu, 13 Oct 2022 14:06:26 +0000 (09:06 -0500)]
[PowerPC] Stash GPR to VSR if emergency spill slot is not reachable

When removing frame indices on PowerPC, we need to scavenge
a GPR to materialize a large constant if the stack offset
for the spill/reload cannot be reached by a D-Form
instruction. However, in a perfect storm of conditions,
we may not have GPR's available to scavenge, thereby
requiring an emergency spill. If such an emergency
spill also needs to be spilled to a location with a
large offset, it would itself require register scavenging
thereby creating an infinite loop.

This patch detects when the scavenger cannot scavenge
a register and the spill/reload is to a location with
a large offset. It then stashes a GPR into a VSR so
that it can use the GPR to materialize the constant
(rather than scavenging a GPR).

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

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

22 months ago[NFC] Use forward decl of MachineCombinerPattern enum to reduce dependencies
Anton Sidorenko [Thu, 13 Oct 2022 13:56:14 +0000 (14:56 +0100)]
[NFC] Use forward decl of MachineCombinerPattern enum to reduce dependencies

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

22 months ago[Libomp] Do not error on undefined version script symbols
Joseph Huber [Thu, 13 Oct 2022 13:44:07 +0000 (08:44 -0500)]
[Libomp] Do not error on undefined version script symbols

Summary:
A recent patch made all of the places we used version scripts in OpenMP
start throwing errors when linking with LLD. This is hopefully the last
one required to get the build bots to pass. This patch simply adds the
`--undefined-version` flag to the places where the version scripts are
used.

22 months ago[X86] Attempt to combine binary shuffles where both operands come from the same large...
Simon Pilgrim [Thu, 13 Oct 2022 13:34:01 +0000 (14:34 +0100)]
[X86] Attempt to combine binary shuffles where both operands come from the same larger vector

Allows us to use combineX86ShuffleChainWithExtract to combine targetshuffle(low_subvector(x),high_subvector(x)) -> low_subvector(targetshuffle(x)) style patterns

This is currently very limited (it must have a v2i64/v2f64 result), but while triaging I noticed we might be able to extend this to allow more types for targets with suitable variable cross lane shuffle support.

Fixes #58339

22 months ago[lldb] Place PlatformQemu Properties into anonymous namespace
Pavel Labath [Thu, 13 Oct 2022 13:22:22 +0000 (15:22 +0200)]
[lldb] Place PlatformQemu Properties into anonymous namespace

It's fine right now, but will break as soon as someone else declares a
PluginProperties class in the same way.

Also tighten up the scope of the anonymous namespaces surrounding the
other PluginProperties classes.

22 months ago[Libomptarget] Make the plugins ingore undefined exported symbols
Joseph Huber [Thu, 13 Oct 2022 13:08:46 +0000 (08:08 -0500)]
[Libomptarget] Make the plugins ingore undefined exported symbols

Summary:
Recent changes made the default behaviour to error when given an
undefined symbol in a version script. A previous patch fixed this for
`libomptarget` by removing the single undefined symbol. However, the
plguins are expected to only define a subset of the availible functions
so we shouldn't treat it as an error. This patch updates the build flags
to work appropriately.

22 months ago[ConstraintElim] Use MulOverflow to avoid UB on signed overflow.
Florian Hahn [Thu, 13 Oct 2022 12:57:43 +0000 (13:57 +0100)]
[ConstraintElim] Use MulOverflow to avoid UB on signed overflow.

This fixes an UBSan failure after 359bc5c541ae. For inbounds GEP with
index sizes <= 64, having the coefficients overflowing is fine.

22 months ago[flang] Lower tbp dispatch calls for polymorphic array element
Valentin Clement [Thu, 13 Oct 2022 12:48:20 +0000 (14:48 +0200)]
[flang] Lower tbp dispatch calls for polymorphic array element

When calling a type-bound procedure from a polymoprhic array element,
the dynamic type needs to be extracted from the array descriptor
and passed to the embox operation for the pass-object.

Depends on D135809

Reviewed By: jeanPerier

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

22 months ago[Libomptarget] Remove undefined 'omp_get_interop_rc_desc' symbol from exports list
Joseph Huber [Thu, 13 Oct 2022 12:39:04 +0000 (07:39 -0500)]
[Libomptarget] Remove undefined 'omp_get_interop_rc_desc' symbol from exports list

Summary:
A recent patch made undefined symbols in version scripts cause errors by
default. The `omp_get_interop_rc_desc` function is declared but not
defined, so it is undefined in the final link unit. This patch removes
it from the exports list, it should be added back in when actually
defined and used.

22 months ago[mlir][llvm] Use TableGen to import compare ops from LLVM IR.
Tobias Gysi [Thu, 13 Oct 2022 11:45:13 +0000 (14:45 +0300)]
[mlir][llvm] Use TableGen to import compare ops from LLVM IR.

The revision imports compare operations using TableGen generated
builders, instead of using the special handlers defined by the Importer.
It therefore adds a new llvmArgIndexes field that allows to specify
a mapping between MLIR argument and LLVM IR operand indexes if they do
not match. Additionally, the FCmp op is extended with an additional
builder and all compare operations are extended with verification
traits to ensure the operands types match. These extensions simplify
the logic of the newly introduced builders and are in line with the
compare operations define by the arithmetic dialect.

Reviewed By: ftynse

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

22 months ago[flang][RFC] Adding higher level FIR ops to ease expression lowering
Jean Perier [Thu, 13 Oct 2022 12:24:56 +0000 (14:24 +0200)]
[flang][RFC] Adding higher level FIR ops to ease expression lowering

This document describes a new HLFIR dialect with a new value type
(hlfir.expr) and some new higher level FIR operations to make lowering
to FIR more straightforward and make pattern matching of high level
Fortran concepts (array and character assignments, character operations,
and transformational intrinsics) easier in FIR.

This should allow implementing the remaining gaps in Fortran 95 features
without increasing the lowering code complexity too much, and get a
clean start for the remaining F2003 and F2018 features.

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

22 months ago[Clang][LoongArch] Pass "f" and "d" features to cc1 to enable hard float
Weining Lu [Thu, 13 Oct 2022 06:37:53 +0000 (14:37 +0800)]
[Clang][LoongArch] Pass "f" and "d" features to cc1 to enable hard float

On LoongArch, currently neither of "f" and "d" feature is passed from
clang driver to cc1 by default. This means the backend generates code
for soft float.

In order to run programs in current LoongArch machines (hard float
environment) this patch temporarily enables "f" and "d" features.

In future, we should conditionally turn on these features depend on
various clang options, e.g. -mdouble-float, -msingle-float,
-msoft-float and -mfpu.

22 months ago[test][LoongArch] Mark old JIT ExecutionEngine tests as unsupported
WANG Xuerui [Thu, 13 Oct 2022 11:29:17 +0000 (19:29 +0800)]
[test][LoongArch] Mark old JIT ExecutionEngine tests as unsupported

The old MCJIT won't be accepting new architectures so it can only be
appropriate to add ourselves to the exclude list.

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

22 months ago[LoongArch] Add support for llvm.trap and llvm.debugtrap
WANG Xuerui [Thu, 13 Oct 2022 11:19:49 +0000 (19:19 +0800)]
[LoongArch] Add support for llvm.trap and llvm.debugtrap

Similar to D69390 for RISCV, use a guaranteed non-existing insn for
llvm.trap and the break insn for llvm.debugtrap.

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

22 months ago[libc++] <sstream>: update references to standard paragraphs
Rupert Nash [Thu, 13 Oct 2022 11:22:50 +0000 (07:22 -0400)]
[libc++] <sstream>: update references to standard paragraphs

The paragraph numbers used previously did not match the C++20 nor
C++17 standards. I have updated them to the textual dotted names to
avoid this problem in future.

Reviewed By: #libc, ldionne

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

22 months ago[LoongArch] Updates for the LoongArch ELF psABI v2.01 revision
WANG Xuerui [Thu, 13 Oct 2022 06:56:52 +0000 (14:56 +0800)]
[LoongArch] Updates for the LoongArch ELF psABI v2.01 revision

The e_flags of existing object files are all 0x3 which happens to be
compatible. From this commit on, all LoongArch objects produced with
upstream LLVM will be of object file ABI v1, which is already supported
by binutils' master branch (to be released as 2.40), and is allowed by
the same binutils version to interlink with v0 objects so the existing
distributions have time to migrate.

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

22 months ago[AArch64] Improve codegen for "trunc <4 x i64> to <4 x i8>" for all cases
Sheng [Thu, 13 Oct 2022 10:57:00 +0000 (18:57 +0800)]
[AArch64] Improve codegen for "trunc <4 x i64> to <4 x i8>" for all cases

To achieve this, we need this observation:

`uzp1` is just a `xtn` that operates on two registers

For example, given the following register with type v2i64:

LSB_______MSB

x0 x1 x2 x3

Applying xtn on it we get:

x0 x2

This is equivalent to bitcast it to v4i32, and then applying uzp1 on it:

x0 x1 x2 x3
   |
  uzp1
   v
x0 x2 <value from other register>

We can transform xtn to uzp1 by this observation, and vice versa.

This observation only works on little endian target. Big endian target has
a problem: the uzp1 cannot be replaced by xtn since there is a discrepancy
in the behavior of uzp1 between the little endian and big endian.

To illustrate, take the following for example:

LSB____________________MSB

x0 x1 x2 x3

On little endian, uzp1 grabs x0 and x2, which is right; on big endian, it
grabs x3 and x1, which doesn't match what I saw on the document. But, since
I'm new to AArch64, take my word with a pinch of salt. This bevavior is
observed on gdb, maybe there's issue in the order of the value printed by it ?

Whatever the reason is, the execution result given by qemu just doesn't match.
So I disable this on big endian target temporarily until we find the crux.

Fixes #57502

Reviewed By: dmgreen, mingmingl

Co-authored-by: Mingming Liu <mingmingl@google.com>
Differential Revision: https://reviews.llvm.org/D133850

22 months ago[pseudo] Document disambiguation design progress
Sam McCall [Tue, 11 Oct 2022 17:10:53 +0000 (19:10 +0200)]
[pseudo] Document disambiguation design progress

Need to take a break from this, so write down where we got to.

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

22 months ago[clang][ExtractAPI] Ignore fully anonymous RecordDecls
Daniel Grumberg [Wed, 12 Oct 2022 17:18:15 +0000 (18:18 +0100)]
[clang][ExtractAPI] Ignore fully anonymous RecordDecls

ExtractAPI was emitting a separate symbol for anonymous record declaration
that define the type of a member of another record declaration. Now
ExtractAPI ignores these declarations and just records the existence of
the actual member.

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

22 months ago[X86][AVX2] Add shuffle test case where we fail to merge vpunpcklqdq(vextracti128...
Simon Pilgrim [Thu, 13 Oct 2022 10:36:14 +0000 (11:36 +0100)]
[X86][AVX2] Add shuffle test case where we fail to merge vpunpcklqdq(vextracti128(x,0),vextracti128(x,1)) -> vpermq

These are likely to appear during truncation

22 months ago[AArch64] Add SME 2 target feature for Armv8-A and Armv9-A 2022 Architecture Extension
Caroline Concatto [Thu, 6 Oct 2022 11:38:42 +0000 (12:38 +0100)]
[AArch64] Add SME 2 target feature for Armv8-A and Armv9-A 2022 Architecture Extension

First patch in a series adding MC layer support for Scalable Matrix
Extension 2 (SME2).

This patch adds the following feature:
  sme2

The 2022 Architecture Extension release adds other feature flags(eg.:sme2.1),
that will be in follow-up patches.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2022-09

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

22 months agoRevert "[FunctionAttrs] Make location classification more precise"
Nikita Popov [Thu, 13 Oct 2022 10:08:08 +0000 (12:08 +0200)]
Revert "[FunctionAttrs] Make location classification more precise"

This reverts commit b05f5b90a12098660a4fc16da0b4d421ddfe14e2.

There are thread sanitizer buildbot failures in simple_stack.c.
I think that's because this ended up affecting the handling of
volatile accesses to allocas. Reverting for now.

22 months ago[ModRef] Move ModRefInfo and FunctionModRefBehavior into IR (NFC)
Nikita Popov [Mon, 10 Oct 2022 12:12:18 +0000 (14:12 +0200)]
[ModRef] Move ModRefInfo and FunctionModRefBehavior into IR (NFC)

This is in preparation for
https://discourse.llvm.org/t/rfc-unify-memory-effect-attributes/65579.
FunctionModRefBehavior will be used by attributes, and as such has
to be available in IR, not just Analysis.

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

22 months ago[clangd] Block clang-tidy misc-const-correctness check
Sam McCall [Wed, 12 Oct 2022 23:43:49 +0000 (01:43 +0200)]
[clangd] Block clang-tidy misc-const-correctness check

This check performs an extremely large amount of work (for each variable, it
runs very many full matcher-driven traversals of the whole scope the variable
is defined in).

When (inadvertently) enabled for Fuchsia, it regressed BuildAST times by >10x
(400ms -> 7s on my machine).

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

22 months ago[flang] Add optional tdesc operand to fir.embox for polymorphic entities
Valentin Clement [Thu, 13 Oct 2022 09:40:40 +0000 (11:40 +0200)]
[flang] Add optional tdesc operand to fir.embox for polymorphic entities

In some cases, it is useful to be able to embox a polymorphic entity
together with its dynamic type. This patch adds an optional tdesc operand
to fir.embox so the dynamic type can be provided while emboxing the entity.
This will be used in follow-up patch that lowers tbp calls for element of
polymorphic entities array.

Reviewed By: jeanPerier

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

22 months ago[ARM] Support fp16/bf16 using w constraint
Archibald Elliott [Tue, 11 Oct 2022 13:02:33 +0000 (14:02 +0100)]
[ARM] Support fp16/bf16 using w constraint

fp16 and bf16 values can be used in GCC's inline assembly using the "w"
constraint, which means "VFP floating-point registers d0-d31" - fp16 and
bf16 values are stored in S registers (which alias the D registers).

This change ensures that LLVM is compatible with GCC for programs that
use fp16 and the 'w' constraint.

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

22 months ago[FunctionAttrs] Make location classification more precise
Nikita Popov [Thu, 13 Oct 2022 08:48:18 +0000 (10:48 +0200)]
[FunctionAttrs] Make location classification more precise

Don't add argmem if the pointer is clearly not an argument (e.g.
a global). I don't think this makes a difference right now, but
gives more obvious results with D135780.

22 months ago[FunctionAttrs] Regenerate test checks (NFC)
Nikita Popov [Thu, 13 Oct 2022 09:16:24 +0000 (11:16 +0200)]
[FunctionAttrs] Regenerate test checks (NFC)

22 months ago[ConstraintElim] Bail out for GEPs when index size > 64 bits.
Florian Hahn [Thu, 13 Oct 2022 09:19:29 +0000 (10:19 +0100)]
[ConstraintElim] Bail out for GEPs when index size > 64 bits.

Limit pointer decomposition to pointers with index sizes of at most 64
bits. int64_t is used for coefficients, so as long as the index size <=
64 bits we should be able to represent all pointer offsets.

Pointer decomposition is limited to inbounds GEPs, so if a index
computation would overflow the result is poison, so it doesn't matter
that the coefficient overflows.

This allows replacing MulOverflow with regular multiplications.

22 months ago[FunctionAttrs] Handle potential access of captured argument
Nikita Popov [Thu, 13 Oct 2022 09:13:30 +0000 (11:13 +0200)]
[FunctionAttrs] Handle potential access of captured argument

We have to account for accesses to argument memory via captures.
I don't think there's any way to make this produce incorrect
results right now (because as soon as "other" is set, we lose the
ability to infer argmemonly), but this avoids incorrect results
once we have more precise representation.

22 months ago[clangd] Fix a crash in ExtractFunction tweak.
Haojian Wu [Thu, 13 Oct 2022 08:01:47 +0000 (10:01 +0200)]
[clangd] Fix a crash in ExtractFunction tweak.

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

22 months ago[test][SLPVectorizer] Use -passes syntax in RUN lines. NFC
Bjorn Pettersson [Wed, 12 Oct 2022 17:59:50 +0000 (19:59 +0200)]
[test][SLPVectorizer] Use -passes syntax in RUN lines. NFC

22 months ago[test][IndVarSimplify] Use -passes syntax in RUN lines. NFC
Bjorn Pettersson [Wed, 12 Oct 2022 17:17:02 +0000 (19:17 +0200)]
[test][IndVarSimplify] Use -passes syntax in RUN lines. NFC

22 months ago[test][AggressiveInstCombine] Use -passes syntax in RUN lines. NFC
Bjorn Pettersson [Wed, 12 Oct 2022 17:10:09 +0000 (19:10 +0200)]
[test][AggressiveInstCombine] Use -passes syntax in RUN lines. NFC

22 months ago[test][DSE] Use -passes=dse instead of -dse in lit tests. NFC
Bjorn Pettersson [Wed, 12 Oct 2022 14:26:27 +0000 (16:26 +0200)]
[test][DSE] Use -passes=dse instead of -dse in lit tests. NFC

22 months agoPropagate tied operands when copying a MachineInstr.
Simon Tatham [Thu, 13 Oct 2022 08:18:31 +0000 (09:18 +0100)]
Propagate tied operands when copying a MachineInstr.

MachineInstr's copy constructor works by calling the addOperand method
to add each operand of the old MachineInstr to the new one, one by
one. But addOperand deliberately avoids trying to replicate ties
between operands, on the grounds that the tie refers to operands by
index, and the indices aren't necessarily finalized yet.

This led to a code generation fault when the machine pipeliner cloned
an Arm conditional instruction, and lost the tie between the output
register and the input value to be used when the condition failed to
execute.

Reviewed By: dmgreen

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

22 months ago[flang] Embox derived-type directly to fir.class without fir.convert
Valentin Clement [Thu, 13 Oct 2022 08:39:29 +0000 (10:39 +0200)]
[flang] Embox derived-type directly to fir.class without fir.convert

non-polymorphic derived-type can call type-bound procedure with passed-object.
In that case, the derived-type is emboxed in order to be passed to the call.
Until now the emboxing was done to a fir.box followed by a fir.convert.
This patch update the createBox function so that we can directly embox to
a fir.class and avoid the extra fir.convert.

Reviewed By: PeteSteinfeld

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

22 months ago[FunctionAttrs] Convert tests to use opaque pointers (NFC)
Nikita Popov [Thu, 13 Oct 2022 08:36:09 +0000 (10:36 +0200)]
[FunctionAttrs] Convert tests to use opaque pointers (NFC)

Conversion performed using the script at:
https://gist.github.com/nikic/98357b71fd67756b0f064c9517b62a34

22 months ago[FunctionAttrs] Regenerate test checks (NFC)
Nikita Popov [Thu, 13 Oct 2022 08:31:07 +0000 (10:31 +0200)]
[FunctionAttrs] Regenerate test checks (NFC)

22 months ago[FunctionAttrs] Account for memory effects of inalloca/preallocated
Nikita Popov [Wed, 12 Oct 2022 15:22:11 +0000 (17:22 +0200)]
[FunctionAttrs] Account for memory effects of inalloca/preallocated

The code for inferring memory attributes on arguments claims that
inalloca/preallocated arguments are always clobbered:
https://github.com/llvm/llvm-project/blob/d71ad4108056d685f48407447095d8d92fd7685d/llvm/lib/Transforms/IPO/FunctionAttrs.cpp#L640-L642

However, we would still infer memory attributes for the whole
function without taking this into account, so we could still end
up inferring readnone for the function. This adds an argument
clobber if there are any inalloca/preallocated arguments.

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

22 months ago[mlir] MemRefToLLVM: Save / restore stack when lowering memref.copy
Andi Drebes [Thu, 13 Oct 2022 08:11:43 +0000 (10:11 +0200)]
[mlir] MemRefToLLVM: Save / restore stack when lowering memref.copy

The MemRef to LLVM conversion pass emits `llvm.alloca` operations to promote MemRef descriptors to the stack when lowering `memref.copy` operations for operands which do not have a contiguous layout in memory. The original stack position is never restored after the allocations, which creates an issue when the copy operation is embedded into a loop with a high trip count, ultimately resulting in a segmentation fault due to the stack growing too large.

Below is as a minimal example illustrating the issue:

```
module {
  func.func @main() {
    %arg0 = memref.alloc() : memref<32x64xi64>
    %arg1 = memref.alloc() : memref<16x32xi64>
    %lb = arith.constant 0 : index
    %ub = arith.constant 100000 : index
    %step = arith.constant 1 : index
    %slice = memref.subview %arg0[16,32][16,32][1,1] :
       memref<32x64xi64> to memref<16x32xi64, #map>

    scf.for %i = %lb to %ub step %step {
       memref.copy %slice, %arg1 :
         memref<16x32xi64, #map> to memref<16x32xi64>
    }

    return
  }
}
```

When running the code above, e.g., with mlir-cpu-runner, the execution crashes with a segmentation fault:

```
$ mlir-opt \
    --convert-scf-to-cf \
    --convert-memref-to-llvm \
    --convert-func-to-llvm
    --convert-cf-to-llvm \
    --reconcile-unrealized-casts <file> | \
  mlir-cpu-runner \
    -e main -entry-point-result=void \
    --shared-libs=$PWD/build/lib/libmlir_c_runner_utils.so
[...]
Segmentation fault
```

This patch causes the code lowering a `memref.copy` operation in the MemRefToLLVM pass to emit a pair of matching `llvm.intr.stacksave` and `llvm.intr.stackrestore` operations around the promotion of memory descriptors and the subsequent call to `memrefCopy` in order to restore the stack to its original position after the call.

Reviewed By: ftynse

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

22 months ago[mlir] Remove iterator_types() method from LinalgStructuredInterface.
Oleg Shyshkov [Thu, 13 Oct 2022 07:28:46 +0000 (07:28 +0000)]
[mlir] Remove iterator_types() method from LinalgStructuredInterface.

`getIteratorTypesArray` should be used instead. It's a better substitute for all the current usages of the interface.

The current `ArrayAttr iterator_types()` has a few problems:
* It creates an assumption operation has iterators types as an attribute, but it's not always the case. Sometime iterator types can be inferred from other attribute, or they're just static.
* ArrayAttr is an obscure contained and required extracting values in the client code.
* Makes it hard to migrate iterator types from strings to enums ([RFC](https://discourse.llvm.org/t/rfc-enumattr-for-iterator-types-in-linalg/64535/9)).

Concrete ops, like `linalg.generic` will still have iterator types as an attribute if needed.

As a side effect, this change helps a bit with migration to prefixed accessors.

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

22 months ago[HLSL] Simplify code and fix unused variable warnings. NFC.
Benjamin Kramer [Thu, 13 Oct 2022 07:46:32 +0000 (09:46 +0200)]
[HLSL] Simplify code and fix unused variable warnings. NFC.

22 months agoPrecommit for SWDEV-353076: Add check directives to existing tests.
Leon Clark [Thu, 13 Oct 2022 07:02:24 +0000 (08:02 +0100)]
Precommit for SWDEV-353076: Add check directives to existing tests.

Add FileCheck directives to existing tests in preparation for new tests.

Reviewed By: arsenm

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

22 months ago[MC] [Win64EH] Check that ARM64 prologs and epilogs have the right matching number...
Martin Storsjö [Mon, 8 Aug 2022 09:55:57 +0000 (12:55 +0300)]
[MC] [Win64EH] Check that ARM64 prologs and epilogs have the right matching number of instructions

This matches what was done for the ARM implementation (where getting
the instruction sizes right is even more tricky, and hence needed
tighter testing).

This will allow catching any future cases where prologs and epilogs
don't match the instructions within them.

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

22 months ago[AArch64] Use encodeLogicalImmediate for forming the immediate to an AND. NFC.
Martin Storsjö [Wed, 12 Oct 2022 21:30:33 +0000 (00:30 +0300)]
[AArch64] Use encodeLogicalImmediate for forming the immediate to an AND. NFC.

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

22 months ago[AArch64] Remove dead code for inserting SEH opcodes for realignment. NFC.
Martin Storsjö [Wed, 12 Oct 2022 12:03:16 +0000 (15:03 +0300)]
[AArch64] Remove dead code for inserting SEH opcodes for realignment. NFC.

If the stack is realigned, we've emitted a frame pointer and
already terminated the SEH prologue, making this dead code since
a07787c9a50c046e45921dd665f5a53a752bbc31.

The immediate to this SEH opcode was entirely bogus - we don't
know how many bytes the AND operation adjusts the SP, and by
doing "NumBytes & andMaskEncoded" (where andMaskEncoded was the
immediate bitpattern for the AND instruction), the immediate to the
opcode was total gibberish.

This hasn't had any practical effect, since the original stack
pointer always was restored from the frame pointer afterwards anyway.

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

22 months ago[AArch64] Fix aligning the stack after calling __chkstk
Martin Storsjö [Tue, 11 Oct 2022 12:20:59 +0000 (15:20 +0300)]
[AArch64] Fix aligning the stack after calling __chkstk

Whenever a call to __chkstk was made, the frame lowering previously
omitted the aligning (as NumBytes was reset to zero before doing
alignment).

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

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

22 months ago[analyzer] Workaround crash on encountering Class non-type template parameters
Balazs Benics [Thu, 13 Oct 2022 06:41:31 +0000 (08:41 +0200)]
[analyzer] Workaround crash on encountering Class non-type template parameters

The Clang Static Analyzer will crash on this code:
```lang=C++
struct Box {
  int value;
};
template <Box V> int get() {
  return V.value;
}
template int get<Box{-1}>();
```
https://godbolt.org/z/5Yb1sMMMb

The problem is that we don't account for encountering `TemplateParamObjectDecl`s
within the `DeclRefExpr` handler in the `ExprEngine`.

IMO we should create a new memregion for representing such template
param objects, to model their language semantics.
Such as:
 - it should have global static storage
 - for two identical values, their addresses should be identical as well
http://eel.is/c%2B%2Bdraft/temp.param#8

I was thinking of introducing a `TemplateParamObjectRegion` under `DeclRegion`
for this purpose. It could have `TemplateParamObjectDecl` as a field.

The `TemplateParamObjectDecl::getValue()` returns `APValue`, which might
represent multiple levels of structures, unions and other goodies -
making the transformation from `APValue` to `SVal` a bit complicated.

That being said, for now, I think having `Unknowns` for such cases is
definitely an improvement to crashing, hence I'm proposing this patch.

Reviewed By: xazax.hun

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

22 months ago[HLSL] CodeGen hlsl cbuffer/tbuffer.
Xiang Li [Thu, 13 Oct 2022 00:02:56 +0000 (17:02 -0700)]
[HLSL] CodeGen hlsl cbuffer/tbuffer.

cbuffer A {
  float a;
  float b;
}

will be translated to a global variable.

Something like

struct CB_Ty {
  float a;
  float b;
};

CB_Ty A;

And all use of a and b will be replaced with A.a and A.b.

Only support none-legacy cbuffer layout now.
CodeGen for Resource binding will be in separate patch.
In the separate patch, resource binding will map the resource information to the global variable.

Reviewed By: efriedma

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

22 months ago[clang][Module][AIX] Mark test unsupported since objc doesn't have xcoff support
Kai Luo [Thu, 13 Oct 2022 03:51:50 +0000 (11:51 +0800)]
[clang][Module][AIX] Mark test unsupported since objc doesn't have xcoff support

Fixed error
```
Command Output (stderr):
--
fatal error: error in backend: Objective-C support is unimplemented for object file format
```
Source code in `clang/lib/CodeGen/CGObjCMac.cpp:5080`

```
  case llvm::Triple::Wasm:
  case llvm::Triple::GOFF:
  case llvm::Triple::SPIRV:
  case llvm::Triple::XCOFF:
  case llvm::Triple::DXContainer:
    llvm::report_fatal_error(
        "Objective-C support is unimplemented for object file format");
  }

```

Reviewed By: hubert.reinterpretcast

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

22 months ago[test] Fix a test that wasn't running
Jordan Rupprecht [Thu, 13 Oct 2022 03:43:45 +0000 (20:43 -0700)]
[test] Fix a test that wasn't running

The functionality is fine (we don't run the breakpoint command twice), but this test forgot to call `FileCheck` and isn't checking the same value isn't there twice..

22 months ago[HIP] Detect HIP for Debian/Fedora
Yaxun (Sam) Liu [Tue, 11 Oct 2022 22:53:59 +0000 (18:53 -0400)]
[HIP] Detect HIP for Debian/Fedora

HIP is installed at /usr or /usr/local on Debin/Fedora,
and the version file is at {root}/share/hip/version.

Reviewed by: Artem Belevich

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

22 months agoApply clang-tidy fixes for llvm-qualified-auto in SparseTensorCodegen.cpp (NFC)
Mehdi Amini [Thu, 6 Oct 2022 19:24:31 +0000 (19:24 +0000)]
Apply clang-tidy fixes for llvm-qualified-auto in SparseTensorCodegen.cpp (NFC)

22 months agoApply clang-tidy fixes for readability-identifier-naming in SparseBufferRewriting...
Mehdi Amini [Thu, 6 Oct 2022 19:23:43 +0000 (19:23 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in SparseBufferRewriting.cpp (NFC)

22 months ago[clang] Use std::underlying_type_t (NFC)
Kazu Hirata [Thu, 13 Oct 2022 02:20:38 +0000 (19:20 -0700)]
[clang] Use std::underlying_type_t (NFC)

22 months ago[clang][deps] Respect VFS overlays in canonical preprocessing mode
Jan Svoboda [Tue, 11 Oct 2022 23:06:08 +0000 (16:06 -0700)]
[clang][deps] Respect VFS overlays in canonical preprocessing mode

The `-ivfsoverlay` flag was only being respected when the scanner was instructed to minimize the inputs. This patch respects that flag even in canonical preprocessing mode.

Depends on D135414.

Reviewed By: Bigcheese

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

22 months ago[clang][deps] Don't share in-memory VFS across scans
Jan Svoboda [Tue, 11 Oct 2022 23:02:10 +0000 (16:02 -0700)]
[clang][deps] Don't share in-memory VFS across scans

The dependency scanning worker may create an in-memory VFS and inject that into its `FileManager`. (Implemented in D109485.) This VFS currently persists between scans, which is not correct: in-memory files created in one scan could affect subsequent scans. This patch changes things so that the in-memory VFS is local to `DependencyScanningWorker::computeDependencies()`.

To test this, one would first scan for dependencies of a named module and then run second scan (on the same worker) for something unrelated, which would pick up the in-memory file created in the first scan. This set up is impossible to achieve with `clang-scan-deps`. We could set this up in `ToolingTests`, but the scanner needs to access the physical filesystem to store `.pcm` files. AFAIK we don't have a good way to propagate something like `%t` into unit tests to make that feasible. (This could be achieved with something like the virtualized `OutputManager`.)

Reviewed By: Bigcheese

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