platform/upstream/llvm.git
21 months ago[LinkerWrapper] Fix optimized debugging builds for NVPTX LTO
Joseph Huber [Mon, 26 Sep 2022 18:39:11 +0000 (13:39 -0500)]
[LinkerWrapper] Fix optimized debugging builds for NVPTX LTO

The ptxas assembler does not allow the `-g` flag along with
optimizations. Normally this is degraded to line info in the driver, but
when using LTO we did not have this step and the linker wrapper was not
correctly degrading the option. Note that this will not work if the user
does not pass `-g` again to the linker invocation. That will require
setting some flags in the binary to indicate that debugging was used
when building.

This fixes #57990

Reviewed By: jdoerfert

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

21 months ago[RISCV] Rename getVectorImmCost to getStoreImmCost [nfc]
Philip Reames [Tue, 27 Sep 2022 15:20:49 +0000 (08:20 -0700)]
[RISCV] Rename getVectorImmCost to getStoreImmCost [nfc]

My original intent had been to reuse this for arithmetic instructions as well, but due to the availability of a immediate splat encoding there, we will need different heuristics.  So specialize the existing code for the store case.

21 months ago[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC) [reland]
Lorenzo Chelini [Tue, 27 Sep 2022 15:16:43 +0000 (11:16 -0400)]
[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC) [reland]

The utility function should live in `StaticValueUtils.h` as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Reviewed By: nicolasvasilache, cota

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

21 months ago[RISCV][SLP] Add test coverage for stores of constants
Philip Reames [Tue, 27 Sep 2022 14:49:54 +0000 (07:49 -0700)]
[RISCV][SLP] Add test coverage for stores of constants

21 months ago[TTI] getExtractWithExtendCost - remove default Index = -1 value
Simon Pilgrim [Tue, 27 Sep 2022 14:44:21 +0000 (15:44 +0100)]
[TTI] getExtractWithExtendCost - remove default Index = -1 value

We currently always specify the index (even if we set it to -1), and a future patch will need to adjust this method to make it more compatible with getScalarizationOverhead

21 months ago[lld-macho] Fix -force_symbols_{,not_}weak_list arg type
Bernhard Urban-Forster [Tue, 27 Sep 2022 14:35:57 +0000 (10:35 -0400)]
[lld-macho] Fix -force_symbols_{,not_}weak_list arg type

This is still undocumented and unsupported, but if someone passed it before you
would end up with a missing file error since this takes an argument that
wouldn't be handled.

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

21 months ago[mlir] Correctly handle HIP_PATH when ROCM_PATH is set
Krzysztof Drewniak [Mon, 26 Sep 2022 20:46:17 +0000 (20:46 +0000)]
[mlir] Correctly handle HIP_PATH when ROCM_PATH is set

With the CMake file as written, if code elsewhere had set ROCM_PATH,
then HIP_PATH would not be set, breaking the rest of the ROCm
execution utility handling.

Reviewed By: mehdi_amini

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

21 months ago[mlir][linalg] Add getIteratorTypesArray to LinalgInterface.
Oleg Shyshkov [Tue, 27 Sep 2022 14:26:56 +0000 (14:26 +0000)]
[mlir][linalg] Add getIteratorTypesArray to LinalgInterface.

Summary:
Most of the code that gets `iterator_types` from LinalgInterface is forced to
extract values from an `Attribute`. As a result, the usage pattern looks like
this:

```
SmallVector<StringRef> iterators = llvm::to_vector<4>(linalgOp.iterator_types().getAsValueRange<StringAttr>());
```

It also forces all operations that implement LinalgOp interface to have
`iterator_types` attribute even when the information can be easily infered from
other parameters.

In perfect future, `getIteratorTypeArray` should be the only method to get
iterator types from the interface. The default implementation can rely on
`iterator_types` attribute though.

The name `getIteratorTypeArray` was picked to be consistent with existing
`getIndexingMapsArray`.

This patch add a few sample usages. More cleanups will follow.

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

21 months ago[LV] Adjust cost model to use uniform store lowering for unpredicated uniform stores
Philip Reames [Tue, 27 Sep 2022 14:22:41 +0000 (07:22 -0700)]
[LV] Adjust cost model to use uniform store lowering for unpredicated uniform stores

Follow up to D133580; adjust the cost model to prefer uniform store lowering for scalable stores which are unpredicated.

The impact here isn't in the uniform store lowering quality itself. InstCombine happily converts the scatter form into the single store form. The main impact is in letting the rest of the cost model make choices based on the knowledge that the vector will be scalarized on use.

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

21 months agoFix 'unused-lambda-capture' gcc warning. NFCI.
Simon Pilgrim [Tue, 27 Sep 2022 14:15:43 +0000 (15:15 +0100)]
Fix 'unused-lambda-capture' gcc warning. NFCI.

21 months ago[SLP] Add ScalarizationOverheadBuilder helper to track vector extractions
Simon Pilgrim [Tue, 27 Sep 2022 13:48:59 +0000 (14:48 +0100)]
[SLP] Add ScalarizationOverheadBuilder helper to track vector extractions

Instead of accumulating all extraction costs separately and then adjusting for repeated subvector extractions, this patch collects all the extractions and then converts to calls to getScalarizationOverhead to improve the accuracy of the costs.

I'm not entirely satisfied with the getExtractWithExtendCost handling yet - this still just adds all the getExtractWithExtendCost costs together - it really needs to be replaced with a "getScalarizationOverheadWithExtend", but that will require further refactoring first.

This replaces my initial attempt in D124769.

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

21 months agoFix regression from Deferred Concepts with lambda in var init
Erich Keane [Mon, 26 Sep 2022 18:02:39 +0000 (11:02 -0700)]
Fix regression from Deferred Concepts with lambda in var init

As reported in GH #57945, this would crash because the decl context for
the lambda was being loaded via 'getNonClosureContext', which only gets
CODE contexts, so a global lambda was getting 'nullptr' here instead.
This patch does some work to make sure we get a valid/valuable
declcontext here instead.

21 months ago[lldb][test] Remove failing ValueCheck on deprecated libcxx entity
Michael Buch [Tue, 27 Sep 2022 10:40:13 +0000 (11:40 +0100)]
[lldb][test] Remove failing ValueCheck on deprecated libcxx entity

A recent libcxx change renamed all internal variables starting with
`__`. As such, `std::reverse_iterator::__t` was renamed to
`std::reverse_iterator::__t_`. This breaks the `import-std-module`
tests with newer libcxx versions. Since this variable is deprecated
in libcxx anyway, this patch simply removes the explicit `ValueCheck`
on the variable name. We don't lose any interesting test-case here
since the purpose of the test is to see if we can call functions
from the `std` module.

We can now re-enable the tests on Darwin for all buildbot Clang
compiler variants.

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

21 months ago[lldb][test] Disable TestSBValueUnsignedEnumBitField.py for old DWARF versions
Michael Buch [Tue, 27 Sep 2022 13:00:24 +0000 (14:00 +0100)]
[lldb][test] Disable TestSBValueUnsignedEnumBitField.py for old DWARF versions

With older DWARF versions we don't encode the enum's underlying
type in DWARF. In those cases LLDB sign-extends the bitfield as
a signed integer. Without the actual enum type being present in
DWARF there's not much we can do.

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

21 months ago[DAG] select Cond, -1, C --> or (sext Cond), C if Cond is MVT::i1
Amaury Séchet [Fri, 5 Aug 2022 13:33:07 +0000 (13:33 +0000)]
[DAG] select Cond, -1, C --> or (sext Cond), C if Cond is MVT::i1

This seems to be beneficial overall, except for midpoint-int.ll .

The X86 backend seems to generate zeroing that are not necesary.

Reviewed By: shchenz

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

21 months ago[LoongArch] Add some comments for expand pseudo-inst pass. NFC
wanglei [Tue, 27 Sep 2022 11:03:18 +0000 (19:03 +0800)]
[LoongArch] Add some comments for expand pseudo-inst pass. NFC

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

21 months ago[ADT] Add IntervalTree - light tree data structure to hold intervals.
Carlos Alberto Enciso [Tue, 27 Sep 2022 11:48:44 +0000 (12:48 +0100)]
[ADT] Add IntervalTree - light tree data structure to hold intervals.

Fix build failure in:

  https://lab.llvm.org/buildbot/#/builders/36/builds/25424
  error: comparison of integers of different signs:
  'const unsigned long' and 'const int' [-Werror,-Wsign-compare]

  Reviewed By: Orlando

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

21 months ago[VE] Change to expand FPOW
Kazushi (Jam) Marukawa [Mon, 26 Sep 2022 23:36:02 +0000 (08:36 +0900)]
[VE] Change to expand FPOW

VE doesn't have FPOW instruction, so this patch makes llvm expand it.

Reviewed By: efocht

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

21 months ago[LoongArch] Support lowering frames larger than 2048 bytes
WANG Xuerui [Tue, 27 Sep 2022 09:50:14 +0000 (17:50 +0800)]
[LoongArch] Support lowering frames larger than 2048 bytes

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

21 months ago[mlir] Refactor transform dialect's gpu block func
Guray Ozen [Tue, 27 Sep 2022 10:23:18 +0000 (12:23 +0200)]
[mlir] Refactor transform dialect's gpu block func

This revision refactors gpu block id generator lambda that is used in the transform dialect. It removes the lambda  and instead uses a static function that's name generateGpuBlockIds.

It also simplifies arguments that the function takes.

Reviewed By: nicolasvasilache

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

21 months ago[lldb] Improve display of absolute symbol lookup
Alvin Wong [Tue, 27 Sep 2022 10:09:59 +0000 (13:09 +0300)]
[lldb] Improve display of absolute symbol lookup

When running `target module lookup` command, show the name of absolute
symbols. Also fix indentation issue after printing an absolute symbol.

Reviewed By: clayborg, DavidSpickett

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

21 months ago[lldb] Add newline in output of `target modules lookup`
Alvin Wong [Tue, 27 Sep 2022 10:09:45 +0000 (13:09 +0300)]
[lldb] Add newline in output of `target modules lookup`

This adds a line break between each result address in the output of the
lldb command `target modules lookup`. Before this change, a new address
result will be printed on the same line as the summary of the last
result, making the output difficult to view.

Also adds a test for this command.

Reviewed By: labath

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

21 months ago[X86] Clean up prefixes for avoid-sfb.ll
Simon Pilgrim [Tue, 27 Sep 2022 10:01:17 +0000 (11:01 +0100)]
[X86] Clean up prefixes for avoid-sfb.ll

Simplifies the diff for D134697

21 months ago[LSR] Preserve LCSSA in expander when rewriting loop exit values.
Florian Hahn [Tue, 27 Sep 2022 08:58:48 +0000 (09:58 +0100)]
[LSR] Preserve LCSSA in expander when rewriting loop exit values.

The expanded values when rewriting exit values need to preserve LCSSA.
Ask SCEVExpander to preserve LCSSA to ensure that.

Fixes #58007.

21 months ago[BasicAA] Use ScopeExit to clear Visited set (NFC)
Nikita Popov [Tue, 27 Sep 2022 08:25:58 +0000 (10:25 +0200)]
[BasicAA] Use ScopeExit to clear Visited set (NFC)

21 months ago[AArch64] Add all predecessor archs in target info
Daniel Kiss [Tue, 27 Sep 2022 08:22:20 +0000 (10:22 +0200)]
[AArch64] Add all predecessor archs in target info

A given function is compatible with all previous arch versions.
To avoid compering values of the attribute this logic adds all predecessor
architecture values.

Reviewed By: dmgreen, DavidSpickett

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

21 months ago[FunctionAttrs] Infer precise FMRB
Nikita Popov [Fri, 23 Sep 2022 11:03:59 +0000 (13:03 +0200)]
[FunctionAttrs] Infer precise FMRB

This updates checkFunctionMemoryAccess() to infer a precise
FunctionModRefBehavior, rather than an approximation split into
read/write and argmemonly.

Afterwards, we still map this back to imprecise function attributes.
This still allows us to infer some cases that we previously did not
handle, namely inaccessiblememonly and inaccessiblemem_or_argmemonly.
In practice, this means we get better memory attributes in the
presence of intrinsics like @llvm.assume.

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

21 months ago[libcxx] Support LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY + LIBCXX_ENABLE_ABI_LIN...
Nikita Popov [Mon, 26 Sep 2022 13:42:35 +0000 (15:42 +0200)]
[libcxx] Support LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY + LIBCXX_ENABLE_ABI_LINKER_SCRIPT

Currently if both LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY (only
applies to static library) and LIBCXX_ENABLE_ABI_LINKER_SCRIPT (only
applies to shared library) are enabled, the former will be silently
ignored. The shared library will use a linker script, while the
static library fails to link libc++abi.a entirely.

This is caused by what appears to be an implementation bug: The
LIBCXX_STATICALLY_LINK_ABI_IN_*_LIBRARY options are declared as
dependent options of LIBCXX_ENABLE_STATIC_ABI_LIBRARY, rather than
simply using it as the default value.

Of course, the combination of
LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY and
LIBCXX_ENABLE_ABI_LINKER_SCRIPT still results in a cmake error,
because these would be conflicting requests for the shared library.

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

21 months ago[AArch64] Add Neoverse V2 CPU support
David Sherwood [Thu, 15 Sep 2022 12:18:14 +0000 (12:18 +0000)]
[AArch64] Add Neoverse V2 CPU support

Adds support for the Neoverse V2 CPU to the AArch64 backend.

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

21 months ago[LoopUnroll] Forget block and loop dispositions during unrolling.
Florian Hahn [Tue, 27 Sep 2022 07:47:19 +0000 (08:47 +0100)]
[LoopUnroll] Forget block and loop dispositions during unrolling.

After unrolling a loop, the block and loop dispositions need to be
cleared. As we don't know which SCEVs in the loop/blocks may be
impacted, completely clear the cache. This should also fix some cases
where deleted loops remained in the LoopDispositions cache.

This fixes a verification failure surfaced by D134531.

I am planning on reviewing/updating the existing uses of
forgetLoopDispositions to check if they should be replaced by
forgetBlockAndLoopDispositions.

Reviewed By: nikic

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

21 months ago[gn build] Port 6584d1f9309b
LLVM GN Syncbot [Tue, 27 Sep 2022 07:24:34 +0000 (07:24 +0000)]
[gn build] Port 6584d1f9309b

21 months ago[ADT] Add IntervalTree - light tree data structure to hold intervals.
Carlos Alberto Enciso [Tue, 27 Sep 2022 07:22:28 +0000 (08:22 +0100)]
[ADT] Add IntervalTree - light tree data structure to hold intervals.

It allows finding all intervals that overlap with any given point.
At this time, it does not support any deletion or rebalancing
operations.

The IntervalTree is designed to be set up once, and then queried
without any further additions.

Reviewed By: psamolysov, probinson

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

21 months ago[WebAssembly] Use intrinsics for table.get/set instructions
Paulo Matos [Tue, 27 Sep 2022 07:08:43 +0000 (09:08 +0200)]
[WebAssembly] Use intrinsics for table.get/set instructions

Initial table.get/set implementation would match and lower combinations
of GEP+load/store to table.get/set instructions. However, this is error
prone due to potential combinations of GEP+load/store we don't implement,
and load/store optimizations. By changing the code to using intrinsics, we
 avoid both issues and simplify the code.

New builtins implemented:
* @llvm.wasm.table.get.externref
* @llvm.wasm.table.get.funcref
* @llvm.wasm.table.set.externref
* @llvm.wasm.table.set.funcref

Reviewed By: asb, tlively

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

21 months ago[Support][NFC] Fix typo in comment
Fraser Cormack [Tue, 27 Sep 2022 06:31:21 +0000 (07:31 +0100)]
[Support][NFC] Fix typo in comment

21 months ago[test][clangd] Try to deflake with sanitizers
Vitaly Buka [Tue, 27 Sep 2022 05:50:49 +0000 (22:50 -0700)]
[test][clangd] Try to deflake with sanitizers

Test sometimes fail with:
https://lab.llvm.org/buildbot/#/builders/168/builds/9110

21 months ago[VP][RISCV] Add vp.maxnum and vp.minnum intrinsics and RISC-V support.
Yeting Kuo [Mon, 26 Sep 2022 12:41:35 +0000 (20:41 +0800)]
[VP][RISCV] Add vp.maxnum and vp.minnum intrinsics and RISC-V support.

Add vp.maxnum and vp.minnum which are vector predicted intrinsics of llvm.maxnum
and llvm.minnum.

Reviewed By: craig.topper

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

21 months agoRevert "[AMDGPU] Move SIModeRegisterDefaults to SI MFI"
Vitaly Buka [Tue, 27 Sep 2022 05:16:34 +0000 (22:16 -0700)]
Revert "[AMDGPU] Move SIModeRegisterDefaults to SI MFI"

Break msan bots. Details in D134666.

This reverts commit 0ce96e06ee0226938e723bd0c8e16e3d2d51f203.

21 months ago[flang] Write semantics test for atomic_define
Katherine Rasmussen [Mon, 19 Sep 2022 17:37:01 +0000 (10:37 -0700)]
[flang] Write semantics test for atomic_define

Write a semantics test for the atomic intrinsic subroutine,
atomic_define.

Reviewed By: rouson

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

21 months ago[RISCV][NFC] Merge rv32 and rv64 insertelt/extract fp tests.
jacquesguan [Mon, 26 Sep 2022 07:49:32 +0000 (15:49 +0800)]
[RISCV][NFC] Merge rv32 and rv64 insertelt/extract fp tests.

Reviewed By: craig.topper

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

21 months ago[PowerPC] XCOFF exception section support on the direct assembler path
Paul Scoropan [Tue, 27 Sep 2022 02:03:49 +0000 (22:03 -0400)]
[PowerPC] XCOFF exception section support on the direct assembler path

This feature implements support for making entries in the exception section
on XCOFF on the direct assembly path using the ".except" pseudo-op. It also
provides functionality to lower entries (comprised of language and reason
codes) into the exception section through the use of annotation metadata
attached to llvm.ppc.trap/trapd/tw/tdw intrinsics. Integrated assembler
support will be provided in another review. https://reviews.llvm.org/D133030
needs to merge first for LIT tests

Reviewed By: shchenz, RKSimon

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

21 months ago[HIP] Fix unbundling archive
Yaxun (Sam) Liu [Sat, 10 Sep 2022 01:54:49 +0000 (21:54 -0400)]
[HIP] Fix unbundling archive

HIP is able to unbundle archive of bundled bitcode.
However currently there are two bugs:

1. archives passed by -l: are not unbundled.
2. archives passed as input files are not unbundled

The actual file name of an archive passed by -l: should
not be prefixed with lib and appended with '.a',
but the file path is prefixed with paths in '-L' options.

The actual file name of an archive passed as an input file
stays the same, not affected by the '-L' options.

21 months ago[NFC][2/n] Remove PrunePH pass
Sebastian Peryt [Tue, 27 Sep 2022 01:31:32 +0000 (18:31 -0700)]
[NFC][2/n] Remove PrunePH pass

Second patch in the series to remove legacy PM and
associated -enable-new-pm=0 flag targets pass that
has not been ported to new PM - PruneEH.
Discussion about this can be found in D44415.

Reviewed By: aeubanks

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

21 months ago[libc][math] Simplify tanf implementation and improve its performance.
Tue Ly [Fri, 23 Sep 2022 23:12:38 +0000 (19:12 -0400)]
[libc][math] Simplify tanf implementation and improve its performance.

Simplify `tanf` implementation and improve its performance.

Completely reuse the implementation of `sinf`, `cosf`, `sincosf` and use
the definition `tan(x) = sin(x)/cos(x)`.

Performance benchmark using perf tool from the CORE-MATH project on Ryzen 1700:
```
$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh tanf
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH reciprocal throughput   : 18.558
System LIBC reciprocal throughput : 49.919

BEFORE:
LIBC reciprocal throughput        : 36.480
LIBC reciprocal throughput        : 27.217    (with `-msse4.2` flag)
LIBC reciprocal throughput        : 20.205    (with `-mfma` flag)

AFTER:
LIBC reciprocal throughput        : 30.337
LIBC reciprocal throughput        : 21.072    (with `-msse4.2` flag)
LIBC reciprocal throughput        : 15.804    (with `-mfma` flag)

$ CORE_MATH_PERF_MODE="rdtsc" ./perf.sh tanf --latency
GNU libc version: 2.35
GNU libc release: stable
CORE-MATH latency   : 56.702
System LIBC latency : 107.206

BEFORE
LIBC latency        : 97.598
LIBC latency        : 91.119   (with `-msse4.2` flag)
LIBC latency        : 82.655    (with `-mfma` flag)

AFTER
LIBC latency        : 74.560
LIBC latency        : 66.575    (with `-msse4.2` flag)
LIBC latency        : 61.636    (with `-mfma` flag)
```

Reviewed By: zimmermann6

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

21 months ago[NFC][Clang] Remove dead code
Yuanfang Chen [Tue, 27 Sep 2022 00:40:46 +0000 (17:40 -0700)]
[NFC][Clang] Remove dead code

And correct a few typos.

21 months ago[NFC] legalize triple for dxil tests.
Xiang Li [Tue, 27 Sep 2022 01:08:41 +0000 (18:08 -0700)]
[NFC] legalize triple for dxil tests.

21 months ago[test][msan] Fix more tests for D134669
Vitaly Buka [Tue, 27 Sep 2022 01:06:41 +0000 (18:06 -0700)]
[test][msan] Fix more tests for D134669

21 months ago[tests][msan] Use -fno-sanitize-memory-param-retval in tests
Vitaly Buka [Sat, 27 Aug 2022 01:04:17 +0000 (18:04 -0700)]
[tests][msan] Use -fno-sanitize-memory-param-retval in tests

Supports either default of -f[no-]sanitize-memory-param-retval.

Reviewed By: aeubanks, MaskRay

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

21 months agoRevert "Skip crashing test"
Adrian Prantl [Tue, 27 Sep 2022 00:16:51 +0000 (17:16 -0700)]
Revert "Skip crashing test"

This reverts commit c1ce19021da0cf1c88722024e6ff9cee7aabc7b6.

21 months ago[AArch64] Check target feature support for __builtin_arm_crc*
Fangrui Song [Tue, 27 Sep 2022 00:16:44 +0000 (17:16 -0700)]
[AArch64] Check target feature support for __builtin_arm_crc*

This is the AArch64 counterpart of D134127.
Daniel Kiss will change more `BUILTIN` to `TARGET_BUILTIN`.

Fix #57802

21 months ago[DWARF DUMP] Fix infinite recursion in Type Printer.
Alex Yermolovich [Mon, 26 Sep 2022 23:23:37 +0000 (16:23 -0700)]
[DWARF DUMP] Fix infinite recursion in Type Printer.

There is an implicit circular dependency in a debug information coming from GCC.
This results in a coredump.
It tries to resolve scope for DIE TAGs that are scopeless.

Reviewed By: dblaikie

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

21 months ago[AMDGPU][NFC] Correct name of DW_OP_LLVM_aspace_bregx
Tony Tye [Thu, 22 Sep 2022 18:53:10 +0000 (18:53 +0000)]
[AMDGPU][NFC] Correct name of DW_OP_LLVM_aspace_bregx

Correct naming of DW_OP_LLVM_aspace_bregx in
AMDGPUDwarfExtensionsForHeterogeneousDebugging.rst .

Reviewed By: dblaikie

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

21 months ago[mlir][sparse] minor cleanup of sparse tensor dialect ops
Aart Bik [Mon, 26 Sep 2022 20:40:08 +0000 (13:40 -0700)]
[mlir][sparse] minor cleanup of sparse tensor dialect ops

Removed some whitespace, improved some of the ops doc.

Reviewed By: wrengr

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

21 months ago[nfc][mlgo] Lazily compute the regalloc reward
Mircea Trofin [Mon, 26 Sep 2022 19:20:37 +0000 (12:20 -0700)]
[nfc][mlgo] Lazily compute the regalloc reward

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

21 months ago[mlir][LLVMIR] Add translation of AtomicRMW/CmpXchg from LLVM IR
Min-Yih Hsu [Mon, 25 Jul 2022 20:05:13 +0000 (13:05 -0700)]
[mlir][LLVMIR] Add translation of AtomicRMW/CmpXchg from LLVM IR

Add support for translating AtomicRMWInst and AtomicCmpXchgInst from
LLVM IR.

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

21 months ago[IR][InstCombine] Support scalable vector splats ConstantExprs in Constant::getUnique...
Craig Topper [Mon, 26 Sep 2022 21:53:06 +0000 (14:53 -0700)]
[IR][InstCombine] Support scalable vector splats ConstantExprs in Constant::getUniqueInteger().

I've left the getAggregateElement as a fast path for non-ConstantExprs
to avoid a call to getSplatValue in release builds.

Fixes PR57989.

Reviewed By: spatel

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

21 months agoCheck whether the allocated type is an array type before calling
Akira Hatanaka [Mon, 26 Sep 2022 21:19:53 +0000 (14:19 -0700)]
Check whether the allocated type is an array type before calling
checkArrayElementAlignment in Sema::BuildCXXNew

This commit fixes a bug that was introduced by adaf62ced and reported
here: https://reviews.llvm.org/D133711#3814717

21 months ago[ELF] Rewrite R_RISCV_ALIGN nops when r.addend%4 != 0
Fangrui Song [Mon, 26 Sep 2022 21:20:27 +0000 (14:20 -0700)]
[ELF] Rewrite R_RISCV_ALIGN nops when r.addend%4 != 0

For RVC, GNU assembler and LLVM integrated assembler add c.nop followed by a
sequence of 4-byte nops. Even if remove % 4 == 0, we have to split one 4-byte
nop and therefore need to write the code sequence, otherwise we create an
incorrect c.unimp.

21 months ago[LoopDeletion] Regenerate check lines for test added in f076a7097999d.
Florian Hahn [Mon, 26 Sep 2022 21:11:32 +0000 (22:11 +0100)]
[LoopDeletion] Regenerate check lines for test added in f076a7097999d.

21 months ago[LoopDeletion] Add cache verification failure test case.
Florian Hahn [Mon, 26 Sep 2022 20:59:40 +0000 (21:59 +0100)]
[LoopDeletion] Add cache verification failure test case.

Extra test coverage for D134613.

21 months ago[Matrix] Add tests for addition transpose optimizations
Francis Visoiu Mistrih [Sun, 11 Sep 2022 05:13:41 +0000 (22:13 -0700)]
[Matrix] Add tests for addition transpose optimizations

Tests before transpose optimizations around additions.

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

21 months ago[AMDGPU] Move SIModeRegisterDefaults to SI MFI
Stanislav Mekhanoshin [Mon, 26 Sep 2022 19:40:22 +0000 (12:40 -0700)]
[AMDGPU] Move SIModeRegisterDefaults to SI MFI

It does not belong to a general AMDGPU MFI.

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

21 months agoRevert "[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)"
Lorenzo Chelini [Mon, 26 Sep 2022 20:11:40 +0000 (22:11 +0200)]
Revert "[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)"

It introduces a circular build dependence: DialectUtils <-
ArithmeticUtils <- ArithDialect <- DialectUtils

This reverts commit 27224fe7272a791bcc9f28c997ce322f7d3856cd.

21 months ago[InstCombine] add assert/test for zext to i1
Sanjay Patel [Mon, 26 Sep 2022 19:59:16 +0000 (15:59 -0400)]
[InstCombine] add assert/test for zext to i1

This is a test to verify that we do not crash with the
problem noted in issue #57986. The root problem should
be fixed with a prior change to InstSimplify.

21 months ago[InstSimplify] don't commute constant expression operand in min/max calls
Sanjay Patel [Mon, 26 Sep 2022 19:15:20 +0000 (15:15 -0400)]
[InstSimplify] don't commute constant expression operand in min/max calls

The test shows that we would fail to consistently fold the
instruction based on the max value operand. This is also
the root cause for issue #57986, but I'll add an instcombine
test + assert for that exact problem in another commit.

21 months ago[InstSimplify] add tests for max intrinsic with constant expression; NFC
Sanjay Patel [Mon, 26 Sep 2022 19:11:30 +0000 (15:11 -0400)]
[InstSimplify] add tests for max intrinsic with constant expression; NFC

This shows the root problem that leads to the crash in issue #57986.

21 months ago[clang][deps] Fix test on AIX
Jan Svoboda [Mon, 26 Sep 2022 19:40:01 +0000 (12:40 -0700)]
[clang][deps] Fix test on AIX

The "-fno-integrated-as" on AIX expands the driver invocation into multiple jobs. This patch makes new test accommodates for that.

21 months ago[Hexagon] Avoid some unnecessary sign-extend instructions
Krzysztof Parzyszek [Mon, 26 Sep 2022 19:27:56 +0000 (12:27 -0700)]
[Hexagon] Avoid some unnecessary sign-extend instructions

Simplify (sext_inreg (extractu ...)) -> (extract ...) where appropriate.

21 months ago[mlir][TilingInterface] Fix `iter_args` handling in tile (and fuse).
Mahesh Ravishankar [Thu, 22 Sep 2022 06:01:45 +0000 (06:01 +0000)]
[mlir][TilingInterface] Fix `iter_args` handling in tile (and fuse).

The current approach for handling `iter_args` was to replace all uses
of the value that is used as `init` value with the corresponding
region block argument within the `scf.for`. This is not always
correct. Instead a more deliberate approach needs to be taken to
handle these. If the slice being fused represents a slice of the
destination operand of the untiled op, then
- Make the destination of the fused producer the `init` value of the
  loop nest
- For the tiled and fused producer op created, replace the slice of
  the destination operand with a slice of the corresponding region
  iter arg of the innermost loop of the generated loop nest

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

21 months ago[InstSimplify] rearrange matching for select-of-min/max folds; NFC
Sanjay Patel [Mon, 26 Sep 2022 16:47:05 +0000 (12:47 -0400)]
[InstSimplify] rearrange matching for select-of-min/max folds; NFC

This makes the code a little shorter and should be easier to extend
for a pattern like in issue #42100.

21 months ago[InstSimplify] remove redundant predicate check; NFC
Sanjay Patel [Mon, 26 Sep 2022 14:37:23 +0000 (10:37 -0400)]
[InstSimplify] remove redundant predicate check; NFC

It's still possible that there's a simpler way to specify
the conditions needed for this set of folds, but "getStrictPred"
converts >= to > for example, so there's no need to explicitly
check that.

21 months ago[lldb][test] 2 - Add gmodules test category explicitly where previously done implicitly
Michael Buch [Fri, 23 Sep 2022 22:39:01 +0000 (00:39 +0200)]
[lldb][test] 2 - Add gmodules test category explicitly where previously done implicitly

Since we don't compile with `gmodules` implicitly via
debug-info test replication, we should mark all implicit
`gmodules` tests with the appropriate category so the API
tests get actually run as intended.

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

21 months ago[lldb][test] 1 - Don't do test-replication for gmodules debug_info variant
Michael Buch [Fri, 23 Sep 2022 09:39:43 +0000 (11:39 +0200)]
[lldb][test] 1 - Don't do test-replication for gmodules debug_info variant

Currently, by default LLDB runs an API test with 3 variants,
one of which, depending on platform, is `gmodules`. However,
most tests don't actually make use of any specific `gmodules`
feature since they compile a single `main.cpp` file without
imporint types from other modules.

Instead of running all tests an extra time with `-gmodules`
enabled, we plan to test `gmodules` features with dedicated
API tests that explicitly opt-into compiling with `-gmodules`.
One of the main benefits of this will be a reduction in total
API test-suite run-time (by around 1/3).

This patch adds a flag to `debug_info_categories` that indicates
whether a category is eligible to be replicated by `lldbtest`.

Keeping `gmodules` a debug-info category is desirable because
`builder.py` knows how to inject the appropriate Makefile flags
into the build command for debug-info categories already. Whereas
for non-debug-info categories we'd have to teach it how to. The
category is inferred from the test-name debug-info suffix currently.

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

21 months ago[mlir][spirv] Format a define. NFC.
Jakub Kuderski [Mon, 26 Sep 2022 18:53:21 +0000 (14:53 -0400)]
[mlir][spirv] Format a define. NFC.

21 months agoGuardWidening: Pass through AssumptionCache (NFC)
Matt Arsenault [Mon, 19 Sep 2022 20:53:47 +0000 (16:53 -0400)]
GuardWidening: Pass through AssumptionCache (NFC)

21 months agoLoopPeel: Pass through AssumptionCache (NFC)
Matt Arsenault [Mon, 19 Sep 2022 21:50:00 +0000 (17:50 -0400)]
LoopPeel: Pass through AssumptionCache (NFC)

21 months agoLoopUnroll: Pass through AssumptionCache (NFC)
Matt Arsenault [Mon, 19 Sep 2022 21:50:22 +0000 (17:50 -0400)]
LoopUnroll: Pass through AssumptionCache (NFC)

Using these queries with a context instruction and without a cache
seems to be about 2x slower than with it so this theoretically
improves compile time.

21 months agoReland "[mlir][spirv] Change td def/class prefix from SPV to SPIRV"
Jakub Kuderski [Mon, 26 Sep 2022 17:53:58 +0000 (13:53 -0400)]
Reland "[mlir][spirv] Change td def/class prefix from SPV to SPIRV"

This reverts commit ce82530cd03d884a2c9fa48e1f9eb931064b2553.

Undo accidental Vulkan/SPIR-V name changes.
Tested with `ninja check-mlir check-mlir-mlir-spirv-cpu-runner check-mlir-mlir-vulkan-runner`.

21 months ago[mlir][vector] Handle subview correctly in sotre to load opt on memref
Thomas Raoux [Fri, 23 Sep 2022 23:00:18 +0000 (23:00 +0000)]
[mlir][vector] Handle subview correctly in sotre to load opt on memref

Make sure we consider other subviews of the same buffer when doing store
to load forwarding or dead store elimination.

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

21 months ago[lldb] Fix completion of 'settings set' values
Dave Lee [Fri, 23 Sep 2022 04:03:31 +0000 (21:03 -0700)]
[lldb] Fix completion of 'settings set' values

Some time ago, a refactor (1153dc960) broke completion for assigning settings
values (`settings set`). This was most annoying for enum settings, where you'd
have to get the valid enum names separately.

This restores the logic in the post-refactor completion function, as well as
adding a test to catch future regressions.

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

21 months ago[Hexagon] Make sure we can still shift scalar vectors by non-splats
Krzysztof Parzyszek [Mon, 26 Sep 2022 18:13:41 +0000 (11:13 -0700)]
[Hexagon] Make sure we can still shift scalar vectors by non-splats

21 months ago[mlir] Relax transfer op hoisting on tensor
Thomas Raoux [Mon, 26 Sep 2022 05:22:06 +0000 (05:22 +0000)]
[mlir] Relax transfer op hoisting on tensor

Improve hoisting logic to support cases where the read being hoisted
comes from a transfer_write with disjoint indices.

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

21 months ago[JITLink] Remove overly-restrictive visibility check introduced in 75404e9ef88.
Lang Hames [Mon, 26 Sep 2022 14:31:07 +0000 (07:31 -0700)]
[JITLink] Remove overly-restrictive visibility check introduced in 75404e9ef88.

ELF undefined symbols can have non-default visibility.

21 months ago[LegalizeTypes][RISCV] Support f16 in ExpandIntRes_LLROUND_LLRINT.
Craig Topper [Mon, 26 Sep 2022 18:09:31 +0000 (11:09 -0700)]
[LegalizeTypes][RISCV] Support f16 in ExpandIntRes_LLROUND_LLRINT.

Promote f16 to f32 and use the f32 libcall.

I deleted rv64zfh-half-intrinsics-strict.ll because it only existed due to this issue breaking rv32.

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

21 months ago[clang][modules] Over-align the `Module` class
Jan Svoboda [Mon, 26 Sep 2022 16:40:02 +0000 (09:40 -0700)]
[clang][modules] Over-align the `Module` class

This makes `llvm::PointerIntPair<Module *, 3>` from f35230ae work across platforms.

Reviewed By: srj

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

21 months ago[lldb] Skip tests incompatible with older versions of Clang
Felipe de Azevedo Piovezan [Mon, 26 Sep 2022 14:16:53 +0000 (10:16 -0400)]
[lldb] Skip tests incompatible with older versions of Clang

The coroutine tests require a standard library implementation of
coroutines, which was only made available some time _after_ Clang 13.
The first such Clang tested by the LLDB matrix bot is 15.0.1

The TestObjCExceptions test forces the use of the system's libcxx. For
the lldb matrix bot, the first Clang version compatible with the bot's
libraries is 13.0.

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

21 months ago[MLIR] Add doc for Attribute print `elideType` (NFC)
Jeff Niu [Mon, 26 Sep 2022 17:21:09 +0000 (10:21 -0700)]
[MLIR] Add doc for Attribute print `elideType` (NFC)

21 months ago[mlir] Allow accessing TypeID of attrs/types defs
Mathieu Fehr [Mon, 26 Sep 2022 16:42:33 +0000 (09:42 -0700)]
[mlir] Allow accessing TypeID of attrs/types defs

SelfOwningTypeID was inherited privately, so it was not possible to access
the TypeID of an attribute or a type definition.

Reviewed By: Mogball

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

21 months ago[clang] initialize type qualifiers for FunctionNoProtoType
Richard Howell [Fri, 9 Sep 2022 16:58:18 +0000 (09:58 -0700)]
[clang] initialize type qualifiers for FunctionNoProtoType

When initializing FunctionNoProtoType types, zero out the type
qualifiers. This will ensure the ODR hash remains stable as it
hashes the values for these qualifiers for all function types.

Reviewed By: aaron.ballman

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

21 months agoRevert "[mlir][spirv] Change td def/class prefix from SPV to SPIRV"
Jakub Kuderski [Mon, 26 Sep 2022 16:40:35 +0000 (12:40 -0400)]
Revert "[mlir][spirv] Change td def/class prefix from SPV to SPIRV"

This reverts commit a2052b8794cb5abac131cd62f68505eebcfaffcb.

This commit renamed some Vulkan identifiers that shouldn't have been
renamed, e.g., `SPV_KHR_storage_buffer_storage_class`.

21 months agoAMDGPU: Handle new address pattern in LowerKernelAttributes introduced by opaque...
Changpeng Fang [Mon, 26 Sep 2022 16:31:52 +0000 (09:31 -0700)]
AMDGPU: Handle new address pattern in LowerKernelAttributes introduced by opaque pointers

Summary:
  With opaque pointer support, the "ptr" type is introduced and thus BitCast is not necessary in some cases.
This work takes care of this change, and recognizes the new address patterns to do appropriate optimizations.

Reviewers:
  arsenm

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

21 months ago[flang] Lower F08 bitwise-reduction intrinsics (IALL, IANY, IPARITY)
Tarun Prabhu [Mon, 26 Sep 2022 16:14:17 +0000 (10:14 -0600)]
[flang] Lower F08 bitwise-reduction intrinsics (IALL, IANY, IPARITY)

This calls the corresponding runtime functions when appropriate. The implementation
follows the pattern of the SUM and PRODUCT intrinsics.

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

21 months ago[mlir][MemRef] Simplify extract_strided_metadata(allocLikeOp)
Quentin Colombet [Sat, 24 Sep 2022 00:02:06 +0000 (00:02 +0000)]
[mlir][MemRef] Simplify extract_strided_metadata(allocLikeOp)

Teach the pass that simplifies extract_strided_metadata(other_op(memref))
how to get rid of extract_strided_metadata when they are fed by
allocLikeOp.

For the simplification to happen the allocLikeOp needs to have been
normalized. I.e., no weird offset and strides.

When this is the case, we replace:
```
base, offset, sizes, strides =
    extract_strided_metadata(allocLikeOp(allocSizes))
```

With
```
base = reinterpret_cast allocLikeOp(allocSizes) to a flat memref<eltTy>
offset = 0
sizes = allocSizes
strides#i = prod(allocSizes#j, for j in {i+1..rank-1})
```

The computation involving dynamic sizes are expanded in affine.apply.

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

21 months ago[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)
Lorenzo Chelini [Mon, 26 Sep 2022 08:39:46 +0000 (10:39 +0200)]
[MLIR] Expose `getAsValues` in `StaticValueUtils.h` (NFC)

The utility function should live in `StaticValueUtils.h` as it provides
a convenient way to convert a vector of OpFoldResults into a vector of
Values.

Reviewed By: nicolasvasilache

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

21 months ago[LLD][COFF] Generate map file even if no /out flag is present
Pengxuan Zheng [Fri, 23 Sep 2022 19:39:34 +0000 (12:39 -0700)]
[LLD][COFF] Generate map file even if no /out flag is present

Currently LLD does not generate a map file if no /out flag (e.g., /out:a.exe) is
present. This is because LLD derives the map file's name from the default output
file name is no output file name is specified explicitly on the command
line. However, in this case, the default output file name has not been set by
LLD yet when LLD tries to set the name of the map file. This patch fixes this
corner case by moving the logic handling map file flags to a place after the
default output file name is set.

Reviewed By: thakis

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

21 months ago[xmm] Remove duplicate #define
Nathan Sidwell [Fri, 23 Sep 2022 15:33:17 +0000 (08:33 -0700)]
[xmm] Remove duplicate #define

I noticed a duplicate macro definition in xmmintrin.h.

Reviewed By: RKSimon

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

21 months ago[mlir][Memref] Introduce a memref::ExtractAlignedPointerAsIndexOp
Nicolas Vasilache [Mon, 26 Sep 2022 15:43:20 +0000 (08:43 -0700)]
[mlir][Memref] Introduce a memref::ExtractAlignedPointerAsIndexOp

As experience with memref::ExtractStridedMetadataOp grows we are
still missing a simple way to extract the pointer held by a memref
and lower to different backednds (LLVM, SPIRV, library calls).

This revision introduces a memref.extract_aligned_pointer_as_index that
returns an index containing the aligned pointer of the strided memref.

This operation is intended to be used solely as step during lowering,
it has no side effects. A reverse operation that creates a memref from
an index interpreted as a pointer is explicitly discouraged.

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

21 months ago[ConstraintElimination] Add initial usub.with.overflow tests.
Zain Jaffal [Mon, 26 Sep 2022 15:44:35 +0000 (16:44 +0100)]
[ConstraintElimination] Add initial usub.with.overflow tests.

Optimizations can be used to eliminate unecessary overflow checks. This patch introduces some test cases where the checks can be safely removed

Reviewed By: fhahn, fcloutier

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

21 months ago[mlir][spirv] Change td def/class prefix from SPV to SPIRV
Jakub Kuderski [Mon, 26 Sep 2022 15:42:26 +0000 (11:42 -0400)]
[mlir][spirv] Change td def/class prefix from SPV to SPIRV

Tested with `check-mlir` and `check-mlir-integration`.

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

Reviewed By: antiagainst

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

21 months agoReapply "[Concepts] Recover properly from a RecoveryExpr in a concept"
Erich Keane [Mon, 26 Sep 2022 13:57:25 +0000 (06:57 -0700)]
Reapply "[Concepts] Recover properly from a RecoveryExpr in a concept"

This reverts commit 192d69f7e65a625e344421841e731e39f80595f5.

This fixes the condition to check whether this is a situation where we
are in a recovery-expr'ed concept a little better, so we don't access an
inactive member of a union, which should make the bots happy.

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

21 months ago[mlir][MemRef] Add pattern that forwards constant strided metadata.
Nicolas Vasilache [Thu, 22 Sep 2022 15:52:18 +0000 (08:52 -0700)]
[mlir][MemRef] Add pattern that forwards constant strided metadata.

`memref.extract_strided_metadata` can forward constants independently of the
exsistence of other operations such as subview or reshape.

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