platform/upstream/llvm.git
18 months agollvm-reduce: Use StringRef/ArrayRef
Matt Arsenault [Sat, 14 Jan 2023 21:37:46 +0000 (16:37 -0500)]
llvm-reduce: Use StringRef/ArrayRef

18 months agollvm-reduce: Add missing consts
Matt Arsenault [Sat, 14 Jan 2023 20:15:44 +0000 (15:15 -0500)]
llvm-reduce: Add missing consts

18 months ago[hwasan] Fix LsanMetadata::LsanMetadata
Vitaly Buka [Wed, 18 Jan 2023 03:21:17 +0000 (19:21 -0800)]
[hwasan] Fix LsanMetadata::LsanMetadata

18 months ago[Flang] Fix parsing error on loop count compiler directive
Nadeem, Usman [Wed, 18 Jan 2023 02:53:51 +0000 (18:53 -0800)]
[Flang] Fix parsing error on loop count compiler directive

Fixes: https://github.com/llvm/llvm-project/issues/58731
Fixes: https://github.com/llvm/llvm-project/issues/56678

Only handles this form which was reported: `!DIR$ LOOP COUNT (n1[, n2]...)`

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

Change-Id: I768c8cb9f289c5fc4adee1ef8262c6d827574f27

18 months ago[AArch64][SVE] Add more intrinsics in 'isZeroingInactiveLanes'.
chendewen [Wed, 18 Jan 2023 03:02:46 +0000 (11:02 +0800)]
[AArch64][SVE] Add more intrinsics in 'isZeroingInactiveLanes'.

The REINTERPRET_CAST operation generates redundant and and ptrue instructions.
For some instructions, this is redundant, because its inactive lanes are zeroed by construction.
For example. Codegen before:
```
facgt p2.d, p0/z, z4.d, z1.d
ptrue p1.d
and p1.b, p2/z, p2.b, p1.b
```
After:
```
facgt p1.d, p0/z, z4.d, z1.d
```
ref: https://reviews.llvm.org/D129851

Reviewed By:sdesmalen,paulwalker-arm

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

18 months agoAdd NVGPUUtil bazel lib
Manish Gupta [Tue, 17 Jan 2023 23:22:30 +0000 (15:22 -0800)]
Add NVGPUUtil bazel lib

18 months ago[C++20] [Modules] Deprecate `-fmodules-ts` flag
Chuanqi Xu [Mon, 16 Jan 2023 07:51:29 +0000 (15:51 +0800)]
[C++20] [Modules] Deprecate `-fmodules-ts` flag

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

Reviewed By: aaron.ballman, erichkeane

Differential Revision: https://reviews.llvm.org/p/erichkeane/

18 months ago[RISCV] Eliminate the need to pass both RISCVSubtarget and MCSubtargetInfo to isCompr...
Craig Topper [Wed, 18 Jan 2023 02:04:55 +0000 (18:04 -0800)]
[RISCV] Eliminate the need to pass both RISCVSubtarget and MCSubtargetInfo to isCompressibleInst.

RISCVSubtarget should be a superclass of MCSubtargetInfo so should
have all the same information. Now we pass RISCVSubtarget by
reference and name it STI.

Confusingly, we seem to have been using an MCSubtargetInfo from
the TargetMachine rather than the one associated with the function
we are operating. I'm going to assume that was a mistake and not
intentional.

Reviewed By: kito-cheng

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

18 months ago[C++] [Coroutines] Deprecates the '-fcoroutines-ts' flag
Chuanqi Xu [Thu, 12 Jan 2023 08:23:46 +0000 (16:23 +0800)]
[C++] [Coroutines] Deprecates the '-fcoroutines-ts' flag

According to https://github.com/llvm/llvm-project/issues/59110, the
`-fcoroutines-ts` flag should be deprecated.

Reviewed By: aaron.ballman, philnik

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

18 months ago[-Wunsafe-buffer-usage][NFC] Refactor checkUnsafeBufferUsage
Jan Korous [Wed, 18 Jan 2023 01:51:37 +0000 (17:51 -0800)]
[-Wunsafe-buffer-usage][NFC] Refactor checkUnsafeBufferUsage

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

18 months ago[HWASAN] Implemented LSAN SetLsanTag and IgnoreObjectLocked
Kirill Stoimenov [Wed, 18 Jan 2023 00:50:48 +0000 (16:50 -0800)]
[HWASAN] Implemented LSAN SetLsanTag and IgnoreObjectLocked

Reviewed By: vitalybuka

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

18 months ago[NFC][bazel] Add export_files for utils/textmate/mlir.json
Jordan Rupprecht [Wed, 18 Jan 2023 01:16:36 +0000 (17:16 -0800)]
[NFC][bazel] Add export_files for utils/textmate/mlir.json

18 months ago[libc++][NFC] Split up ranges.transform.pass.cpp
Nikolas Klauser [Tue, 17 Jan 2023 21:48:00 +0000 (22:48 +0100)]
[libc++][NFC] Split up ranges.transform.pass.cpp

`ranges.transform.pass.cpp` takes ~42s to run on my machine, `ranges.transform.binary.pass.cpp` takes ~26s and `ranges.transform.unary.pass.cpp` takes ~2s.

Reviewed By: ldionne, #libc

Spies: libcxx-commits

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

18 months ago[NFC] [scudo] syntax-check DCHECK arguments if DCHECK is off
Florian Mayer [Fri, 13 Jan 2023 19:15:37 +0000 (11:15 -0800)]
[NFC] [scudo] syntax-check DCHECK arguments if DCHECK is off

This is a widespread technique, used in at least:

* ABSL: https://github.com/abseil/abseil-cpp/blob/master/absl/log/internal/check_op.h#L52
* Chromium: https://source.chromium.org/chromium/chromium/src/+/main:base/check.h;l=185?q=DCHECK%20f:base&ss=chromium
* Android: https://cs.android.com/android/platform/superproject/+/master:system/libbase/include/android-base/logging.h;drc=bda7f0a0cc945c860713a1dc497919f17fad1651;l=321

Reviewed By: Chia-hungDuan, vitalybuka

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

18 months ago[-Wunsafe-buffer-usage] Emit warnings about unsafe operations on arrays
Rashmi Mudduluru [Wed, 18 Jan 2023 00:28:23 +0000 (16:28 -0800)]
[-Wunsafe-buffer-usage] Emit warnings about unsafe operations on arrays

Differential Revision: https://reviews.llvm.org/D141725/new/

18 months ago[HWASan] link to doc in reports on Android
Florian Mayer [Tue, 17 Jan 2023 21:51:29 +0000 (13:51 -0800)]
[HWASan] link to doc in reports on Android

Reviewed By: eugenis

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

18 months ago[OpenMP] Support kernel record and replay
Giorgis Georgakoudis [Tue, 17 Jan 2023 23:35:44 +0000 (15:35 -0800)]
[OpenMP] Support kernel record and replay

This patch adds functionality for recording and replaying the execution of OpenMP offload kernels, based on an original implementation by Steve Rangel. The patch extends libomptarget to extract a json description of the kernel, the device image binary, and a device memory snapshot before and after the execution of a recorded kernel. Kernel recording/replaying in libomptarget is controlled through env vars (LIBOMPTARGET_RECORD, LIBOMPTARGET_REPLAY). It provides a tool, llvm-omp-kernel-replay, for replaying a kernel using the extracted information with the ability to verify replayed execution using the post-execution device memory snapshot, also supporting changing the number of teams/threads for replaying.

Reviewed By: jdoerfert

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

18 months ago[nfc][mlgo] Remove abstraction layers for training logger
Mircea Trofin [Tue, 17 Jan 2023 21:57:02 +0000 (13:57 -0800)]
[nfc][mlgo] Remove abstraction layers for training logger

This follows from D141720

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

18 months ago[MachineBasicBlock] Explicit FT branching param
Anshil Gandhi [Tue, 17 Jan 2023 21:34:27 +0000 (14:34 -0700)]
[MachineBasicBlock] Explicit FT branching param

Introduce a parameter in getFallThrough() to optionally
allow returning the fall through basic block in spite of
an explicit branch instruction to it. This parameter is
set to false by default.

Introduce getLogicalFallThrough() which calls
getFallThrough(false) to obtain the block while avoiding
insertion of a jump instruction to its immediate successor.

This patch also reverts the changes made by D134557 and
solves the case where a jump is inserted after another jump
(branch-relax-no-terminators.mir).

Reviewed By: arsenm

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

18 months agoRevert ""Reland "[pgo] Avoid introducing relocations by using private alias""
Arthur Eubanks [Tue, 17 Jan 2023 23:40:49 +0000 (15:40 -0800)]
Revert ""Reland "[pgo] Avoid introducing relocations by using private alias""

This reverts commit 6e5cbc097a5ac7fa95a8f425af8b03958151c763.

Causes link errors, see http://go/crb/1408161.

18 months agoFix OSX build break introduced by D141720
Mircea Trofin [Tue, 17 Jan 2023 23:14:30 +0000 (15:14 -0800)]
Fix OSX build break introduced by D141720

18 months ago[Propeller] Use Fixed MBB ID instead of volatile MachineBasicBlock::Number.
Rahman Lavaee [Wed, 7 Dec 2022 06:37:33 +0000 (22:37 -0800)]
[Propeller] Use Fixed MBB ID instead of volatile MachineBasicBlock::Number.

Let Propeller use specialized IDs for basic blocks, instead of MBB number.

This allows optimizations not just prior to asm-printer, but throughout the entire codegen.
This patch only implements the functionality under the new `LLVM_BB_ADDR_MAP` version, but the old version is still being used. A later patch will change the used version.

####Background
Today Propeller uses machine basic block (MBB) numbers, which already exist, to map native assembly to machine IR.  This is done as follows.
    - Basic block addresses are captured and dumped into the `LLVM_BB_ADDR_MAP` section just before the AsmPrinter pass which writes out object files. This ensures that we have a mapping that is close to assembly.
    - Profiling mapping works by taking a virtual address of an instruction and looking up the `LLVM_BB_ADDR_MAP` section to find the MBB number it corresponds to.
    - While this works well today, we need to do better when we scale Propeller to target other Machine IR optimizations like spill code optimization.  Register allocation happens earlier in the Machine IR pipeline and we need an annotation mechanism that is valid at that point.
    - The current scheme will not work in this scenario because the MBB number of a particular basic block is not fixed and changes over the course of codegen (via renumbering, adding, and removing the basic blocks).
    - In other words, the volatile MBB numbers do not provide a one-to-one correspondence throughout the lifetime of Machine IR.  Profile annotation using MBB numbers is restricted to a fixed point; only valid at the exact point where it was dumped.
    - Further, the object file can only be dumped before AsmPrinter and cannot be dumped at an arbitrary point in the Machine IR pass pipeline.  Hence, MBB numbers are not suitable and we need something else.
####Solution
We propose using fixed unique incremental MBB IDs for basic blocks instead of volatile MBB numbers. These IDs are assigned upon the creation of machine basic blocks. We modify `MachineFunction::CreateMachineBasicBlock` to assign the fixed ID to every newly created basic block.  It assigns `MachineFunction::NextMBBID` to the MBB ID and then increments it, which ensures having unique IDs.

 To ensure correct profile attribution, multiple equivalent compilations must generate the same Propeller IDs. This is guaranteed as long as the MachineFunction passes run in the same order. Since the `NextBBID` variable is scoped to `MachineFunction`, interleaving of codegen for different functions won't cause any inconsistencies.

The new encoding is generated under the new version number 2 and we keep backward-compatibility with older versions.

####Impact on Size of the `LLVM_BB_ADDR_MAP` Section
Emitting the Propeller ID results in a 23% increase in the size of the `LLVM_BB_ADDR_MAP` section for the clang binary.

Reviewed By: tmsriram

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

18 months ago[RISCV] Use zeroext instead of signext in mask reduction tests. NFC
Craig Topper [Tue, 17 Jan 2023 23:15:41 +0000 (15:15 -0800)]
[RISCV] Use zeroext instead of signext in mask reduction tests. NFC

This is more consistent with ABI and how bools on RISC-V are
represented.

Reviewed By: reames

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

18 months ago[libc++] Add ALLOW_RETRIES to a few flaky tests
Nikolas Klauser [Tue, 17 Jan 2023 02:54:32 +0000 (03:54 +0100)]
[libc++] Add ALLOW_RETRIES to a few flaky tests

Fixes #59464

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

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

18 months ago[SystemZ][z/OS] Fix cityhash lit for EBCDIC
Zibi Sarbinowski [Tue, 17 Jan 2023 22:34:43 +0000 (16:34 -0600)]
[SystemZ][z/OS] Fix cityhash lit for EBCDIC

This will fix __murmur2_or_cityhash.pass.cpp in EBCDIC mode. The reason it fails is because of string literals are being used as input to CityHash algorithm so we need to adjust the EBCDIC expected results.

Reviewed By: #libc, philnik

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

18 months ago[CompilerRT] Remove sanitizer support for i386 iossim
usama hameed [Wed, 11 Jan 2023 01:54:46 +0000 (17:54 -0800)]
[CompilerRT] Remove sanitizer support for i386 iossim

Summary:
This patch removes building sanitizers for i386 iossim. This is to reduce the toolchain size.
Reviewers:

Subscribers:

18 months ago[CompilerRT] Remove ubsan static runtime on Apple
usama hameed [Wed, 11 Jan 2023 23:16:30 +0000 (15:16 -0800)]
[CompilerRT] Remove ubsan static runtime on Apple

This patch removes the static ubsan runtime on Apple devices. The motivation
is to reduce the toolchain size.

rdar://102061519

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

18 months ago[ORC-RT] Reapply ab59185fbfb (Add IntervalMap/Set), with missing files included.
Lang Hames [Tue, 17 Jan 2023 21:45:38 +0000 (13:45 -0800)]
[ORC-RT] Reapply ab59185fbfb (Add IntervalMap/Set), with missing files included.

The original commit was reverted in c151e8428a due missing files (thanks Kazu!).

18 months agoRevert "[ORC-RT] Add IntervalMap and IntervalSet collections."
Kazu Hirata [Tue, 17 Jan 2023 21:36:03 +0000 (13:36 -0800)]
Revert "[ORC-RT] Add IntervalMap and IntervalSet collections."

This reverts commit ab59185fbfb15c9ce5a64e3aacd3a8c7f6a97621.

It looks like this commit is missing interval_set_test.cpp.

18 months ago[Analysis] Fix a warning
Kazu Hirata [Tue, 17 Jan 2023 21:36:02 +0000 (13:36 -0800)]
[Analysis] Fix a warning

This patch fixes:

  llvm/include/llvm/Analysis/Utils/TrainingLogger.h:94:14: error:
  private field 'IncludeReward' is not used
  [-Werror,-Wunused-private-field]

18 months ago[RISCV][TableGen] Correct formatting in RISCVGenCompressInstEmitter.inc. NFC
Craig Topper [Tue, 17 Jan 2023 21:35:08 +0000 (13:35 -0800)]
[RISCV][TableGen] Correct formatting in RISCVGenCompressInstEmitter.inc. NFC

18 months ago[clang][sema][Matrix] Move code from try-cast to `TypeLocVisitor`. NFC intended.
Volodymyr Sapsai [Tue, 10 Jan 2023 20:24:07 +0000 (12:24 -0800)]
[clang][sema][Matrix] Move code from try-cast to `TypeLocVisitor`. NFC intended.

`MatrixTypeLoc` is not "sugar" `TypeLoc` and doesn't require to use the
underlying `TypeLoc` instead.

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

18 months ago[ORC-RT] Add IntervalMap and IntervalSet collections.
Lang Hames [Tue, 17 Jan 2023 01:22:28 +0000 (17:22 -0800)]
[ORC-RT] Add IntervalMap and IntervalSet collections.

IntervalMap is an optionally-coalescing map -- it uses half-open ranges as keys,
allows lookups based on elements of the ranges (returning an iterator to the
containing range) and optionally coalesces adjacent ranges that have the same
value.

IntervalSet is an optionally-coalescing set based on IntervalMap.

These collections will be used to store and lookup metadata section ranges,
e.g. unwind-info ranges.

18 months ago[mlir] Fix a deprecation warning
Kazu Hirata [Tue, 17 Jan 2023 21:12:40 +0000 (13:12 -0800)]
[mlir] Fix a deprecation warning

This patch fixes:

  mlir/include/mlir/Dialect/Affine/LoopUtils.h:332:25: error:
  'makeMutableArrayRef<mlir::scf::ForOp>' is deprecated: Use deduction
  guide instead [-Werror,-Wdeprecated-declarations]

18 months ago[mlgo] Remove the protobuf dependency
Mircea Trofin [Fri, 13 Jan 2023 20:22:20 +0000 (12:22 -0800)]
[mlgo] Remove the protobuf dependency

The dependency was due to the log format. This change switches to the
previously-introduced (D139370) "dependency-free" logger instead of the
protobuf-based one.

A subsequent change will clean out the unnecessary abstraction left
behind.

This change drops the logger unittest, we have sufficient test coverage
via lit tests, and a unit test would require adding, unnecesarily, a log
reader (the reader is expected to be python, for the ML side, and there
is a reader for that under Analysis/models, used for tests).

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

18 months ago[VPlan] Replace VPExpandSCEVRecipe::classof with VP_CLASSOF_IMPL. (NFC)
Florian Hahn [Tue, 17 Jan 2023 21:11:32 +0000 (21:11 +0000)]
[VPlan] Replace VPExpandSCEVRecipe::classof with VP_CLASSOF_IMPL. (NFC)

18 months ago[libc++] Mark std::pmr virtual functions as _LIBCPP_HIDE_FROM_ABI_VIRTUAL
Nikolas Klauser [Mon, 16 Jan 2023 18:26:53 +0000 (19:26 +0100)]
[libc++] Mark std::pmr virtual functions as _LIBCPP_HIDE_FROM_ABI_VIRTUAL

Reviewed By: ldionne, Mordante, #libc

Spies: libcxx-commits

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

18 months agonullptr returned from ActOnTag() is not a valid result
Aaron Ballman [Tue, 17 Jan 2023 21:00:46 +0000 (16:00 -0500)]
nullptr returned from ActOnTag() is not a valid result

DeclResult tracks two states: valid/invalid and usable/unusable.
Passing a null pointer to the constructor creates a valid but unusable
result and we wanted an invalid result instead. This changes some
functions to return a DeclResult rather than a Decl * to make it harder
to get this incorrect in callers.

Discovered when working on https://reviews.llvm.org/D141280.

Co-authored-by: Haojian Wu <hokein@google.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Differential Revision: https://reviews.llvm.org/D141580

18 months ago[mlir] Fix a warning
Kazu Hirata [Tue, 17 Jan 2023 21:01:22 +0000 (13:01 -0800)]
[mlir] Fix a warning

This patch fixes:

  mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp:820:13:
  error: unused function 'hasAtMostOneResultFunctionOfDim'
  [-Werror,-Wunused-function]

18 months ago[RISCV] Add missing check prefixes to vreductions-mask.ll. NFC
Craig Topper [Tue, 17 Jan 2023 20:46:11 +0000 (12:46 -0800)]
[RISCV] Add missing check prefixes to vreductions-mask.ll. NFC

There's a conflict between the riscv32 and riscv64 output for some
tests which caused the script to drop the check lines.

Add specific check prefixes for these cases.

18 months ago[mlir][sparse] avoid using mutable descriptor when unnecessary (NFC)
Peiming Liu [Tue, 17 Jan 2023 19:25:40 +0000 (19:25 +0000)]
[mlir][sparse] avoid using mutable descriptor when unnecessary (NFC)

Use SparseTensorDescriptor whenever not calling setters, to avoid needing to create a temporal buffer for simple query purposes.

Reviewed By: bixia, wrengr

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

18 months ago[VPlan] Replace VPScalarIVStepsRecipe::classof with VP_CLASSOF_IMPL(NFC)
Florian Hahn [Tue, 17 Jan 2023 20:53:13 +0000 (20:53 +0000)]
[VPlan] Replace VPScalarIVStepsRecipe::classof with VP_CLASSOF_IMPL(NFC)

18 months ago[Clang] Reject in-class defaulting of previously declared comparison operators
Roy Jacobson [Sun, 15 Jan 2023 22:39:15 +0000 (00:39 +0200)]
[Clang] Reject in-class defaulting of previously declared comparison operators

Comparison operators are not allowed to be defaulted if they were previously declared outside the class.
Pretty low-impact, but it's nice to reject this without a linking error.
Fixes https://github.com/llvm/llvm-project/issues/51227.

Reviewed By: #clang-language-wg, ChuanqiXu

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

18 months ago[Libomptarget][NFC] Rename device environment variable
Joseph Huber [Tue, 17 Jan 2023 20:09:12 +0000 (14:09 -0600)]
[Libomptarget][NFC] Rename device environment variable

This variable is used by the runtime. Before kernel launch we set it to
indicate several configuration options from the host. This patch renames
it to be more in-line with the rest of the named exported from the
runtime. This is better because this is the only symbol visible to the
host from the runtime, so it should have a reserved name.

Reviewed By: tianshilei1992

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

18 months ago[Clang] Configure definitions for amdgpu/nvptx arch query tools
Joseph Huber [Tue, 17 Jan 2023 20:25:29 +0000 (14:25 -0600)]
[Clang] Configure definitions for amdgpu/nvptx arch query tools

Summary:
These tools are built unconditionally now. However, there seemed to be
problems where the headers would be found during cross compilation, but
no libraries present. To combat this we should elect to make the CMake
indicate whether or not we should use the dynamic library method or link
it directly rather than using `__has_include`.

18 months ago[llvm][ADT] Mark `makeMutableArrayRef` as deprecated
Joe Loser [Mon, 16 Jan 2023 21:52:16 +0000 (14:52 -0700)]
[llvm][ADT] Mark `makeMutableArrayRef` as deprecated

Now that all of the uses of `makeMutableArrayRef` are replaced in-tree with use
of deduction guides (see
https://github.com/llvm/llvm-project/commit/a288d7f937708cf67d960962bfa22ffae37ddbf4),
mark `makeMutableArrayRef` as deprecated.

Also remove the old tests for `makeMutableArrayRef` in favor of the ones
introduced with the deduction guides in
https://github.com/llvm/llvm-project/commit/38791259c1165cedfa313e06dc20e443f1e20634.

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

18 months ago[InstCombine] factor difference-of-squares to reduce multiplication
Sanjay Patel [Tue, 17 Jan 2023 19:37:18 +0000 (14:37 -0500)]
[InstCombine] factor difference-of-squares to reduce multiplication

(X * X) - (Y * Y) --> (X + Y) * (X - Y)
https://alive2.llvm.org/ce/z/BAuRCf

The no-wrap propagation could be relaxed in some cases,
but there does not seem to be an obvious rule for that.

18 months ago[InstCombine] add tests for difference-of-squares; NFC
Sanjay Patel [Tue, 17 Jan 2023 18:32:50 +0000 (13:32 -0500)]
[InstCombine] add tests for difference-of-squares; NFC

18 months ago[RISCV] Remove MCRegisterInfo dependency from compressInst/uncompresInst/isCompressib...
Craig Topper [Tue, 17 Jan 2023 19:50:54 +0000 (11:50 -0800)]
[RISCV] Remove MCRegisterInfo dependency from compressInst/uncompresInst/isCompressibleInst.

This was being used to lookup the register class for a register number,
but those live in a tablegened array. We can index that array directly
just like RISCVAsmParser does.

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

18 months ago[MC] Use MCRegister instead of unsigned in MCInstPrinter (NFC)
Sergei Barannikov [Sun, 15 Jan 2023 10:02:26 +0000 (13:02 +0300)]
[MC] Use MCRegister instead of unsigned in MCInstPrinter (NFC)

Reviewed By: craig.topper

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

18 months ago[RISCV] Use Zvl*b as a lower bound for VScaleRange.
Craig Topper [Tue, 17 Jan 2023 19:32:08 +0000 (11:32 -0800)]
[RISCV] Use Zvl*b as a lower bound for VScaleRange.

The backend has a fatal error in RISCVSubtarget::getMinRVVVectorSizeInBits
if RVVVectorBitsMin is less than the Zvl length from -march. Now
RVVVectorBitsMin is connected to VScaleRange in the backend, we
can trip this fatal error.

This patch adds the Zvl*b length as a lower bound to protect this.
The test is updated to test vscale-min with Zvl64b instead of V.

I'd like to do a proper diagnostic for this, but I don't think we
can do that from this function. Since -mvscale-min is an internal cc1
option, I'm not sure it's a big deal.

I'm planning to add a driver option -msve-vector-bits. I will
probably implement a diagnostic for that.

Reviewed By: kito-cheng

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

18 months agoDiagnose extensions in 'offsetof'
Aaron Ballman [Tue, 17 Jan 2023 19:26:29 +0000 (14:26 -0500)]
Diagnose extensions in 'offsetof'

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm made very
clear that it is an UB having type definitions with in offsetof.
Clang supports defining a type as the first argument as a conforming
extension due to how many projects use the construct in C99 and earlier
to calculate the alignment of a type. GCC also supports defining a type
as the first argument.

This adds extension warnings and documentation for the functionality
Clang explicitly supports.

Fixes #57065

Co-authored-by: Yingchi Long <i@lyc.dev>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
18 months ago[PS5] Handle visibility options same as PS4
Paul Robinson [Tue, 17 Jan 2023 19:26:51 +0000 (11:26 -0800)]
[PS5] Handle visibility options same as PS4

This update was missed in the initial rounds of upstreaming PS5.

18 months ago[PS4] NFC: rewrite a test to use lit's DEFINE feature
Paul Robinson [Tue, 17 Jan 2023 18:47:07 +0000 (10:47 -0800)]
[PS4] NFC: rewrite a test to use lit's DEFINE feature

Preparatory to running the same test for PS5.

18 months ago[MLIR] Add return type inference to scf.if builder
Frederik Gossen [Tue, 17 Jan 2023 19:07:33 +0000 (14:07 -0500)]
[MLIR] Add return type inference to scf.if builder

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

18 months agoAdd additional tests for ctlz{_zero_undef} to test folding with xor; NFC
Noah Goldstein [Tue, 17 Jan 2023 18:41:31 +0000 (10:41 -0800)]
Add additional tests for ctlz{_zero_undef} to test folding with xor; NFC

Reviewed By: pengfei

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

18 months ago[mlir] fix dereferencing of optional sym_name attribute
Ashay Rane [Tue, 17 Jan 2023 18:55:02 +0000 (10:55 -0800)]
[mlir] fix dereferencing of optional sym_name attribute

`sym_name` is an optional attribute of `ModuleOp`, so it is unsafe to
fetch the underlying value without checking whether it is non-empty.
Such unsafe dereferencing causes the lower-host-to-llvm-calls_fail.mlir
test to segfault.  Although this bug existed for four months, it wasn't
triggered, since previous tests executed a code path that used a default
value instead of one fetched from the module attribute.

This patch makes the code use a default value if the optional attribute
does not have a value.

Reviewed By: stella.stamenova

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

18 months ago[OpenMP] Make `-Xarch_host` and `-Xarch_device` work for OpenMP offloading
Joseph Huber [Tue, 17 Jan 2023 15:34:49 +0000 (09:34 -0600)]
[OpenMP] Make `-Xarch_host` and `-Xarch_device` work for OpenMP offloading

Clang currently supports the `-Xarch_host` and `-Xarch_device` variants
to handle passing arguments to only one part of the offloading
toolchain. This was previously only supported fully for HIP / CUDA This
patch simple updates the logic to make it work for any offloading kind.

Fixes #59799

Reviewed By: tianshilei1992

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

18 months ago[Libomptarget] Replace Nvidia arch lookup with 'nvptx-arch'
Joseph Huber [Tue, 17 Jan 2023 14:55:55 +0000 (08:55 -0600)]
[Libomptarget] Replace Nvidia arch lookup with 'nvptx-arch'

This method to look up the CUDA architecture is deprecated in newer
versions of CMake. We also have our own way to query this information
that we control now via the `nvptx-arch` program, which should always be
present in LLVM builds with clang going forward. This is currently only
used for testing so I think we should be okay with the dependency.

Reviewed By: tianshilei1992

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

18 months ago[lldb] Only allow SymbolFiles to construct Types
Augusto Noronha [Fri, 13 Jan 2023 21:30:41 +0000 (13:30 -0800)]
[lldb] Only allow SymbolFiles to construct Types

SymbolFiles should own Types by keeping them in their TypeList. This
patch privates the Type constructor to guarantee that every created Type
is kept in the SymbolFile's type list.

18 months agoReland: [GWP-ASan] Add recoverable mode.
Mitch Phillips [Fri, 13 Jan 2023 00:01:06 +0000 (16:01 -0800)]
Reland: [GWP-ASan] Add recoverable mode.

The GWP-ASan recoverable mode allows a process to continue to function
after a GWP-ASan error is detected. The error will continue to be
dumped, but GWP-ASan now has APIs that a signal handler (like the
example optional crash handler) can call in order to allow the
continuation of a process.

When an error occurs with an allocation, the slot used for that
allocation will be permanently disabled. This means that free() of that
pointer is a no-op, and use-after-frees will succeed (writing and
reading the data present in the page).

For heap-buffer-overflow/underflow, the guard page is marked as accessible
and buffer-overflows will succeed (writing and reading the data present
in the now-accessible guard page). This does impact adjacent
allocations, buffer-underflow and buffer-overflows from adjacent
allocations will no longer touch an inaccessible guard page. This could
be improved in future by having two guard pages between each adjacent
allocation, but that's out of scope of this patch.

Each allocation only ever has a single error report generated. It's
whatever came first between invalid-free, double-free, use-after-free or
heap-buffer-overflow, but only one.

Reviewed By: eugenis, fmayer

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

18 months ago[flang] Generate TBAA information.
Slava Zakharin [Tue, 17 Jan 2023 17:08:43 +0000 (09:08 -0800)]
[flang] Generate TBAA information.

This is initial version of TBAA information generation for Flang
generated IR. The desired behavior is that TBAA type descriptors
are generated for FIR types during FIR to LLVM types conversion,
and then TBAA access tags are attached to memory accessing operations
when they are converted to LLVM IR dialect.

In the initial version the type conversion is not producing
TBAA type descriptors, and all memory accesses are just partitioned
into two sets of box and non-box accesses, which can never alias.

The TBAA generation is enabled by default at >O0 optimization levels.
TBAA generation may also be enabled via `apply-tbaa` option of
`fir-to-llvm-ir` conversion pass. `-mllvm -disable-tbaa` engineering
option allows disabling TBAA generation to override Flang's default
(e.g. when -O1 is used).

SPEC CPU2006/437.leslie3d speeds up by more than 2x on Icelake.

Reviewed By: jeanPerier, clementval

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

18 months ago[InstCombine] Handle PHI nodes in PtrReplacer
Anshil Gandhi [Tue, 17 Jan 2023 17:36:05 +0000 (10:36 -0700)]
[InstCombine] Handle PHI nodes in PtrReplacer

This patch adds on to the functionality implemented
in rG42ab5dc5a5dd6c79476104bdc921afa2a18559cf,
where PHI nodes are supported in the use-def traversal
algorithm to determine if an alloca ever overwritten
in addition to a memmove/memcpy. This patch implements
the support needed by the PointerReplacer to collect
all (indirect) users of the alloca in cases where a PHI
is involved. Finally, a new PHI is defined in the replace
method which takes in replaced incoming values and
updates the WorkMap accordingly.

Reviewed By: nikic

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

18 months ago[MLIR][SCF] Fix comment in `TestTilingInterface.cpp` (NFC)
Lorenzo Chelini [Tue, 17 Jan 2023 17:47:36 +0000 (18:47 +0100)]
[MLIR][SCF] Fix comment in `TestTilingInterface.cpp` (NFC)

The method is called `tileConsumerAndFuseProducerGreedilyUsingSCFForOp`
and not `tileAndFuseGreedilyUsingSCFForOp`.

18 months agotsan: fix broken aarch64_39/42 mappings and expand them
Thurston Dang [Thu, 12 Jan 2023 23:18:17 +0000 (23:18 +0000)]
tsan: fix broken aarch64_39/42 mappings and expand them

The aarch64 39- and 42-bit mappings were broken: mappings to meta and shadow were not fully invertible. This CL introduces a working set of mappings, and also increases the size of some app regions:
* aarch64, 39-bit (2^39 == 512GB):
 - Low: (Old) 4GB -> (New) 20GB
 - Mid: 4GB -> 20GB
 - Heap: 4GB -> 12GB
 - High: 8GB -> 12GB
* aarch64, 42-bit (2^42 == 4TB):
 - Low: 64GB -> 128GB
 - Mid: 4GB -> 88GB
 - Heap: 64GB -> 192GB
 - High: 64GB

Additionally, this CL improves the code comments for all the linux aarch64 mappings.

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

18 months ago[mlir][vector] Fix extract op canonicalization for 0d vector
Thomas Raoux [Tue, 17 Jan 2023 17:25:51 +0000 (17:25 +0000)]
[mlir][vector] Fix extract op canonicalization for 0d vector

Fix ExtractOpFromBroadcast when the broadcast source is a 0d vector.

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

18 months ago[mlir][gpu] Improve foreach_thread distribution
Thomas Raoux [Fri, 13 Jan 2023 19:53:56 +0000 (19:53 +0000)]
[mlir][gpu] Improve foreach_thread distribution

Replace Ids with 0 when block dim is 1 when distributing foreach_thread.

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

18 months ago[mlir][vector] Add extra lowering for more transfer_write maps
Thomas Raoux [Tue, 17 Jan 2023 17:05:11 +0000 (17:05 +0000)]
[mlir][vector] Add extra lowering for more transfer_write maps

Add pattern to lower transfer_write with permutation map that are not
permutation of minor identity map.

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

18 months ago[mlir][EmitC] Remove Pure trait from `emitc.include`
Christopher Bate [Thu, 8 Dec 2022 00:28:27 +0000 (17:28 -0700)]
[mlir][EmitC] Remove Pure trait from `emitc.include`

The op `emitc.include` does not have results and thus will be elided
during canonicalization, which is not correct behavior. This change
removes the 'Pure' trait and adds a canonicalization test.

Reviewed By: jpienaar, marbre

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

18 months ago[mlir][vector] Fix lowering of permutation maps for transfer_write op
Thomas Raoux [Sun, 15 Jan 2023 07:25:00 +0000 (07:25 +0000)]
[mlir][vector] Fix lowering of permutation maps for transfer_write op

The lowering of transfer write permutation maps didn't match the op definition:
https://github.com/llvm/llvm-project/blob/93ccccb00d9717b58ba93f0942a243ba6dac4ef6/mlir/include/mlir/Dialect/Vector/IR/VectorOps.td#L1476

Fix the lowering and add a case to the integration test in
order to enforce the correct semantic.

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

18 months ago[scudo] Fix -Wsign-compare warning
Alex Brachet [Tue, 17 Jan 2023 17:02:50 +0000 (17:02 +0000)]
[scudo] Fix -Wsign-compare warning

18 months agoFix crash in LLVM Dialect inliner interface: add support for llvm.return
Mehdi Amini [Tue, 17 Jan 2023 08:28:08 +0000 (08:28 +0000)]
Fix crash in LLVM Dialect inliner interface: add support for llvm.return

The LLVM inliner was missing the `handleTerminator` method in the
Dialect interface implementation.

Fixes #60093

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

18 months agoFix crash in scf.parallel verifier
Mehdi Amini [Tue, 17 Jan 2023 16:20:20 +0000 (16:20 +0000)]
Fix crash in scf.parallel verifier

Fixes #59989

Reviewed By: ftynse

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

18 months ago[clangd] Disable modernize-macro-to-enum tidy check
Kadir Cetinkaya [Tue, 17 Jan 2023 16:11:02 +0000 (17:11 +0100)]
[clangd] Disable modernize-macro-to-enum tidy check

Check relies on seeing PP-directives from preamble, hence it's unusable.
See https://github.com/clangd/clangd/issues/1464.

18 months ago[CVP] Avoid duplicate range calculation (NFC)
Nikita Popov [Tue, 17 Jan 2023 15:53:59 +0000 (16:53 +0100)]
[CVP] Avoid duplicate range calculation (NFC)

Calculate the range once for all the sdiv/srem transforms.

18 months ago[AArch64][SVE] Implement isVScaleKnownToBeAPowerOfTwo
David Green [Tue, 17 Jan 2023 15:49:29 +0000 (15:49 +0000)]
[AArch64][SVE] Implement isVScaleKnownToBeAPowerOfTwo

According to https://developer.arm.com/documentation/102105/ia-00/?lang=en

> Arm is making a retrospective change to the SVE architecture to remove
> the capability of selecting a non-power-of-two vector length in
> non-Streaming SVE as well as in Streaming SVE mode. Specific updates as
> a result of this change will be communicated in due course.

This patch implements the isVScaleKnownToBeAPowerOfTwo method to teach
DAG Combines that VScale will be known to be a power of 2, which helps
reduce or simplify some expressions (notably the udiv in vector trip
count expressions).

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

18 months ago[CVP] Avoid duplicate range calculation (NFC)
Nikita Popov [Tue, 17 Jan 2023 15:39:27 +0000 (16:39 +0100)]
[CVP] Avoid duplicate range calculation (NFC)

Calculate the range once and use it in processURem() and
narrowUDivOrURem().

18 months ago[CVP] Handle use-site conditions in domain-based folds
Nikita Popov [Tue, 17 Jan 2023 15:22:57 +0000 (16:22 +0100)]
[CVP] Handle use-site conditions in domain-based folds

As a side-effect, this switchem them to use getConstantRange() rather
than getPredicateAt(). getPredicateAt() is not supposed to be more
powerful than getConstantRange() for non-equality comparisons (as
long as block values are used).

18 months agoRevert "[clang] Instantiate concepts with sugared template arguments"
Erich Keane [Tue, 17 Jan 2023 14:12:40 +0000 (06:12 -0800)]
Revert "[clang] Instantiate concepts with sugared template arguments"

This reverts commit b8064374b217db061213c561ec8f3376681ff9c8.

Based on the report here:
https://github.com/llvm/llvm-project/issues/59271

this produces a significant increase in memory use of the compiler and a
large compile-time regression.  This patch reverts this so that we don't
branch for release with that issue.

18 months ago[CVP] Handle use-site conditions in more folds
Nikita Popov [Tue, 17 Jan 2023 15:10:41 +0000 (16:10 +0100)]
[CVP] Handle use-site conditions in more folds

18 months ago[flang] Support allocate with source for polymorphic entities
Valentin Clement [Tue, 17 Jan 2023 15:11:45 +0000 (16:11 +0100)]
[flang] Support allocate with source for polymorphic entities

Apply the source type spec to the descriptor for
polyrmophic entities.

Reviewed By: PeteSteinfeld

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

18 months ago[VPlan] Remove duplicated VPValue IDs (NFCI).
Florian Hahn [Tue, 17 Jan 2023 15:11:37 +0000 (15:11 +0000)]
[VPlan] Remove duplicated VPValue IDs (NFCI).

At the moment, both VPValue and VPDef have an ID used when casting via
classof. This duplication is cumbersome, because it requires adding IDs
for new recipes twice and also requires setting them twice. In a few
cases, there's only a VPDef ID and no VPValue ID, which can cause same
confusion.

To simplify things, remove the VPValue IDs for different recipes.
Instead, only retain the generic VPValue ID (= used VPValues without a
corresponding defining recipe) and VPVRecipe for VPValues that are
defined by recipes that inherit from VPValue.

Reviewed By: Ayal

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

18 months ago[mlir][Transform] Add a transform.get_consumers_of_result navigation op
Nicolas Vasilache [Tue, 17 Jan 2023 14:25:21 +0000 (06:25 -0800)]
[mlir][Transform] Add a transform.get_consumers_of_result navigation op

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

18 months ago[MIScheduler] Print top/down cycle in the SUnit dump.
Francesco Petrogalli [Tue, 17 Jan 2023 11:02:08 +0000 (12:02 +0100)]
[MIScheduler] Print top/down cycle in the SUnit dump.

Add an extra command line option to `llc` that allows checking at what cycle an instruction has been scheduled by the machine scheduler.

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

18 months ago[flang] Lower allocation with MOLD
Valentin Clement [Tue, 17 Jan 2023 14:51:04 +0000 (15:51 +0100)]
[flang] Lower allocation with MOLD

Lower allocate statement with MOLD= to calls to the Fortran
runtime. PointerApplyMold and AllocatableApplyMold are called
depending on the object to be allocated.

Reviewed By: jeanPerier, PeteSteinfeld

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

18 months ago[Flang] [OpenMP] Refine parser restrictions for OMP TARGET UPDATE clauses.
Raghu Maddhipatla [Thu, 12 Jan 2023 06:32:06 +0000 (00:32 -0600)]
[Flang] [OpenMP] Refine parser restrictions for OMP TARGET UPDATE clauses.

In Parser, move some clauses of OMP TARGET UPDATE to allowedOnceClauses so that restrictions will be imposed.

Reviewed By: kiranchandramohan

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

18 months ago[MLIR][Transform] Introduce loop.coalesce transform op.
Amy Wang [Tue, 17 Jan 2023 14:33:36 +0000 (09:33 -0500)]
[MLIR][Transform] Introduce loop.coalesce transform op.

This patch made a minor refactor of LoopCoalescing.cpp's walkLoops
templated method and placed it in Affine's LoopUtils.cpp/h.
This method is also renamed as coalescePerfectlyNestedLoops method. This
minor change enables this method to be invoked
by both the original LoopCoalescing pass as well as the newly introduced
loop.coalesce transform op.

The loop.coalesce transform op has the ability to coalesce affine, and
scf loop nests, leveraging existing LoopCoalescing
mechanism. I have created it inside the SCFTransformOps.td instead of
AffineTransformOps.td as it feels to be similar
in spirit as the loop.unroll op that can handle both scf and affine
loops. Please let me know if you feel that this op
should be moved into AffineTransformOps.td instead.

The testcase added illustrates loop.coalesce transform op working for
scf, affine loops (inner, outer) as well as
coalesced loop can be further unrolled (achieving composibility).

Reviewed By: ftynse

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

18 months ago[clang-repl] XFAIL riscv targets in simple-exception test case
Alex Bradbury [Tue, 17 Jan 2023 14:28:15 +0000 (14:28 +0000)]
[clang-repl] XFAIL riscv targets in simple-exception test case

This test fails for RISC-V and Arm targets are already XFAILed, so add
RISC-V to the XFAIL list.

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

18 months ago[InstCombine] Don't combine smul of i1 type constant one
luxufan [Tue, 17 Jan 2023 13:21:11 +0000 (21:21 +0800)]
[InstCombine] Don't combine smul of i1 type constant one

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

Reviewed By: nikic

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

18 months ago[flang] fix FIRLangRef.md path
Leonardo Sandoval [Tue, 17 Jan 2023 12:54:19 +0000 (12:54 +0000)]
[flang] fix FIRLangRef.md path

Reviewed By: kiranchandramohan

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

18 months ago[mlir][Linalg] Fix post-commit typo for 5443743ca1874acfe2d5654fedd4a0c0bed6777e
Nicolas Vasilache [Tue, 17 Jan 2023 13:40:23 +0000 (05:40 -0800)]
[mlir][Linalg] Fix post-commit typo for 5443743ca1874acfe2d5654fedd4a0c0bed6777e

18 months ago[mlir][Linalg] Add a transform.structured.pack operation
Nicolas Vasilache [Mon, 16 Jan 2023 17:06:14 +0000 (09:06 -0800)]
[mlir][Linalg] Add a transform.structured.pack operation

This revision introduces a `transform.structured.pack` operation to
transform any Linalg operation to a higher-dimensional Linalg operation on
packed operands.

`tensor.pack` (resp. `tensor.unpack`) operations are inserted for the operands
(resp. results) that need to be packed (resp. unpacked) according to the
`packed_sizes` specification.

At the moment, the packing operation always pads with `getZeroAttr` which will
need to be adjusted depending on the consumers.

Packing is limited to those dimensions that are indexed only by AffineDimExpr.
Packing more advanced indexings requires modular arithmetic that is outside the
scoped of a `linalg.generic` at the moment.

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

18 months ago[AArch64][SVE] Fix typo after post review change to D141471.
Paul Walker [Tue, 17 Jan 2023 13:06:14 +0000 (13:06 +0000)]
[AArch64][SVE] Fix typo after post review change to D141471.

18 months ago[docs] Add llvm & clang release notes for LoongArch
Weining Lu [Tue, 17 Jan 2023 12:53:58 +0000 (20:53 +0800)]
[docs] Add llvm & clang release notes for LoongArch

Reviewed By: rengolin

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

18 months ago[AArch64][SVE] Fix crash for DestructiveBinaryComm zero merging
zhongyunde [Tue, 17 Jan 2023 12:43:05 +0000 (20:43 +0800)]
[AArch64][SVE] Fix crash for DestructiveBinaryComm zero merging

This fix is similar to D124325, and I find the DestructiveBinaryComm
operation type also may be allocated same register, so insert the LSL.

      movprfx       z0.s, p0/z, z0.s
      lsl z0.b, p0/m, z0.b, #0
      fmul z0.s, p0/m, z0.s, z0.s

Reviewed By: paulwalker-arm

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

18 months ago[flang][hlfir] Lower some character elemental references
Jean Perier [Tue, 17 Jan 2023 12:40:44 +0000 (13:40 +0100)]
[flang][hlfir] Lower some character elemental references

Lower character elemental user procedures with constant length, and
bot dynamic and constant length ADJUSTL, ADJUSTR, and MERGE references
(which leaves out MIN/MAX).

Character elemental user procedures with dynamic length are a bit more
involving and since it is an edge-case that is not currently supported,
I will take this on later.

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

18 months ago[flang][OpenMP] Parser support for the unroll construct (5.1)
Abid Malik [Tue, 17 Jan 2023 11:54:23 +0000 (11:54 +0000)]
[flang][OpenMP] Parser support for the unroll construct (5.1)

added parser support for the unroll construct

Reviewed By: kiranchandramohan

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

18 months ago[mlir][Tensor][NFC] Migrate Tensor dialect to the new fold API
Markus Böck [Tue, 10 Jan 2023 19:40:25 +0000 (20:40 +0100)]
[mlir][Tensor][NFC] Migrate Tensor dialect to the new fold API

See https://discourse.llvm.org/t/psa-new-improved-fold-method-signature-has-landed-please-update-your-downstream-projects/67618 for context

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

18 months ago[BitcodeReader] Allow reading pointer types from old IR
Sebastian Neubauer [Tue, 17 Jan 2023 12:18:26 +0000 (13:18 +0100)]
[BitcodeReader] Allow reading pointer types from old IR

When opaque pointers are enabled and old IR with typed pointers is read,
the BitcodeReader automatically upgrades all typed pointers to opaque
pointers. This is a lossy conversion, i.e. when a function argument is a
pointer and unused, it’s impossible to reconstruct the original type
behind the pointer.

There are cases where the type information of pointers is needed. One is
reading DXIL, which is bitcode of old LLVM IR and makes a lot of use of
pointers in function signatures.
We’d like to keep using up-to-date llvm to read in and process DXIL, so
in the face of opaque pointers, we need some way to access the type
information of pointers from the read bitcode.

This patch allows extracting type information by supplying functions to
parseBitcodeFile that get called for each function signature or metadata
value. The function can access the type information via the reader’s
type IDs and the getTypeByID and getContainedTypeID functions.
The tests exemplarily shows how type info from pointers can be stored in
metadata for use after the BitcodeReader finished.

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

18 months agoFix bazel build overlay.
Johannes Reifferscheid [Tue, 17 Jan 2023 12:17:56 +0000 (13:17 +0100)]
Fix bazel build overlay.