platform/upstream/llvm.git
21 months agoRevert "[clang][Interp] Handle enums"
Timm Bäder [Thu, 29 Sep 2022 11:40:57 +0000 (13:40 +0200)]
Revert "[clang][Interp] Handle enums"

This reverts commit c090295916a921e809184f589c6830475e293b8b.

One of the test cases fails. Revert this until I know a way to make it
work reliably.

21 months ago[LLVM][DebugInfo] Disable split-complex.ll for aarch64-pc-windows-msvc
Muhammad Omair Javaid [Thu, 29 Sep 2022 11:32:49 +0000 (16:32 +0500)]
[LLVM][DebugInfo] Disable split-complex.ll for aarch64-pc-windows-msvc

This patch disables split-complex.ll for aarch64-pc-windows-msvc.
split-complex.ll fails with a crash when run on AArch64/Windows.
I have reported following issue: llvm-project/issues/58053

21 months ago[Clang][Arm] Fix fp16 return error tests under AArch64/Arm. NFC
David Green [Thu, 29 Sep 2022 11:16:13 +0000 (12:16 +0100)]
[Clang][Arm] Fix fp16 return error tests under AArch64/Arm. NFC

The -fallow-half-arguments-and-returns option was removed in
59528e4bdb27ed4ab3, replaced with an always-on target option under
AArch64/Arm. There are two tests - fp16-sema.c and renderscripts.rs that
test that an error is produced for __fp16 function args/returns, which
are now expected to pass for Arm/AArch64. i.e they no longer give the
same error as before on native Arm/AArch64 machines. Alter the targets
of those tests to compensate.

21 months ago[mlir] Add Python bindings for StridedLayoutAttr
Denys Shabalin [Thu, 29 Sep 2022 09:41:42 +0000 (09:41 +0000)]
[mlir] Add Python bindings for StridedLayoutAttr

Reviewed By: ftynse

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

21 months ago[mlir][Linalg] Slightly adjust DestinationStyleOpInterface.
Adrian Kuegel [Thu, 29 Sep 2022 10:28:45 +0000 (12:28 +0200)]
[mlir][Linalg] Slightly adjust DestinationStyleOpInterface.

Rename some interface methods to be consistent with the new accessor names.
This is a preparation for adding a ReduceOp, which then will implement
getIteratorTypes() and getOutputs() instead of iterator_types() and outputs().

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

21 months ago[clang][Interp][NFC] Remove unused prototypes
Timm Bäder [Wed, 28 Sep 2022 11:20:37 +0000 (13:20 +0200)]
[clang][Interp][NFC] Remove unused prototypes

21 months ago[clang][Interp][NFC] Make EvalEmitter::isActive() const
Timm Bäder [Wed, 28 Sep 2022 10:37:52 +0000 (12:37 +0200)]
[clang][Interp][NFC] Make EvalEmitter::isActive() const

21 months ago[clang][Interp][NFC] Unifty ReadArg() impl in Disasm.cpp
Timm Bäder [Fri, 23 Sep 2022 10:40:44 +0000 (12:40 +0200)]
[clang][Interp][NFC] Unifty ReadArg() impl in Disasm.cpp

We can use another if constexpr here to make this shorter and easier to
understand.

21 months ago[clang][Interp] Print Function address in dump()
Timm Bäder [Fri, 23 Sep 2022 09:48:58 +0000 (11:48 +0200)]
[clang][Interp] Print Function address in dump()

It's used in the bytecode dump of the function itself, so useful to
identify which function is being called.

21 months ago[clang][Interp][NFC] Remove unused opcode argument types
Timm Bäder [Sat, 17 Sep 2022 14:03:39 +0000 (16:03 +0200)]
[clang][Interp][NFC] Remove unused opcode argument types

21 months ago[clang][Interp][NFC] Unify the two ReadArg() implementations
Timm Bäder [Sat, 17 Sep 2022 14:14:37 +0000 (16:14 +0200)]
[clang][Interp][NFC] Unify the two ReadArg() implementations

Just use a constexpr if here instead of two different implementations.
[#

21 months ago[clang][Interp][NFC] Remove unused function
Timm Bäder [Mon, 19 Sep 2022 07:09:16 +0000 (09:09 +0200)]
[clang][Interp][NFC] Remove unused function

21 months ago[clang][Interp] Specify Boolean conversion operartors as (u)int32
Timm Bäder [Sat, 17 Sep 2022 06:11:36 +0000 (08:11 +0200)]
[clang][Interp] Specify Boolean conversion operartors as (u)int32

Follow up to https://reviews.llvm.org/D133934

21 months ago[clang][Interp] Properly destruct allocated Records
Timm Bäder [Fri, 16 Sep 2022 16:59:00 +0000 (18:59 +0200)]
[clang][Interp] Properly destruct allocated Records

We are otherwise leaking some memory the records might allocate
themselves.

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

21 months ago[clang][Interp][NFC] Make classes final that can be final
Timm Bäder [Sat, 17 Sep 2022 13:14:32 +0000 (15:14 +0200)]
[clang][Interp][NFC] Make classes final that can be final

21 months ago[clang][Interp][NFC] Make some Record methods const
Timm Bäder [Fri, 16 Sep 2022 16:26:24 +0000 (18:26 +0200)]
[clang][Interp][NFC] Make some Record methods const

21 months ago[clang][Interp][NFC] Limit includes to neccessary ones
Timm Bäder [Fri, 16 Sep 2022 16:21:16 +0000 (18:21 +0200)]
[clang][Interp][NFC] Limit includes to neccessary ones

21 months ago[clang][Interp] Rename a local variable to be more specific
Timm Bäder [Fri, 16 Sep 2022 16:15:57 +0000 (18:15 +0200)]
[clang][Interp] Rename a local variable to be more specific

It's called BaseSize in the Record class as well, so call it BaseSize
when creating the Record.

21 months ago[clang][Interp] Handle enums
Timm Bäder [Fri, 16 Sep 2022 07:17:52 +0000 (09:17 +0200)]
[clang][Interp] Handle enums

Handle DeclRefExprs of enum types. They are otherwise handled like
integers.

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

21 months ago[clang][Interp] Record item types in InterpStack
Timm Bäder [Thu, 15 Sep 2022 14:08:28 +0000 (16:08 +0200)]
[clang][Interp] Record item types in InterpStack

The type information is lost when pushing things on the stack. When
later pop()ing items of the wrong type, we can instead simply get
garbage values and those problems are hard to find. Add another stack to
record the type of item we pushed and use that for debugging.

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

21 months ago[clang][Interp][NFC] Make a few InterpStack functions const
Timm Bäder [Thu, 15 Sep 2022 13:36:51 +0000 (15:36 +0200)]
[clang][Interp][NFC] Make a few InterpStack functions const

21 months ago[clang][Interp] Handle sizeof()
Timm Bäder [Wed, 14 Sep 2022 14:53:55 +0000 (16:53 +0200)]
[clang][Interp] Handle sizeof()

Implement visiting UnaryExprOrTypeTraitExprs to handle sizeof()
expressions.

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

21 months ago[clang][Interp][NFC] Unify emit() implementations
Timm Bäder [Tue, 27 Sep 2022 05:29:09 +0000 (07:29 +0200)]
[clang][Interp][NFC] Unify emit() implementations

Instead of two overloads, use a if constexpr to differentiate between
pointer and non-pointer parameters

21 months ago[clang][Interp][NFC] Forward-declare Pointer in InterpFrame.h
Timm Bäder [Wed, 14 Sep 2022 13:13:58 +0000 (15:13 +0200)]
[clang][Interp][NFC] Forward-declare Pointer in InterpFrame.h

We don't need the full include here.

21 months ago[clang][Interp][NFC] Remove an unnecessary <vector> include.
Timm Bäder [Wed, 14 Sep 2022 13:12:42 +0000 (15:12 +0200)]
[clang][Interp][NFC] Remove an unnecessary <vector> include.

21 months ago[clang][Interp] Pass initializer when creating globals
Timm Bäder [Wed, 14 Sep 2022 13:03:04 +0000 (15:03 +0200)]
[clang][Interp] Pass initializer when creating globals

This is dead code right now but will be used for implementing array
fillers, where we need some information from the initializer when
allocaing the Descriptors.

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

21 months ago[BOLT] Report BB reordering %-age vs profiled and total number of functions
Amir Ayupov [Wed, 28 Sep 2022 18:18:51 +0000 (20:18 +0200)]
[BOLT] Report BB reordering %-age vs profiled and total number of functions

Reviewed By: spupyrev

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

21 months ago[AMDGPU] Add use check in v_fma combine.
Thomas Symalla [Thu, 29 Sep 2022 07:29:39 +0000 (09:29 +0200)]
[AMDGPU] Add use check in v_fma combine.

In D132837, an existing v_fma combine was extended to regard nested
fma instructions. Originally, the inner FMA was checked for being used
only once. In its current state, this check is missing, which causes
some regressions.

In this patch, this check was added.

Reviewed By: foad

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

21 months ago[LV] Create createInductionResumeValue helper (NFC).
Florian Hahn [Thu, 29 Sep 2022 10:12:28 +0000 (11:12 +0100)]
[LV] Create createInductionResumeValue helper (NFC).

Factor out the logic to create induction resume values for a specific
induction. This will be used in D92132 to support widened IVs during
epilogue vectorization.

Reviewed By: Ayal

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

21 months ago[Clang][Arm] Convert -fallow-half-arguments-and-returns to a target option. NFC
David Green [Thu, 29 Sep 2022 10:00:32 +0000 (11:00 +0100)]
[Clang][Arm] Convert -fallow-half-arguments-and-returns to a target option. NFC

This cc1 option -fallow-half-arguments-and-returns allows __fp16 to be
passed by argument and returned, without giving an error. It is
currently always enabled for Arm and AArch64, by forcing the option in
the driver. This means any cc1 tests (especially those needing
arm_neon.h) need to specify the option too, to prevent the error from
being emitted.

This changes it to a target option instead, set to true for Arm and
AArch64. This allows the option to be removed. Previously it was implied
by -fnative_half_arguments_and_returns, which is set for certain
languages like open_cl, renderscript and hlsl, so that option now too
controls the errors. There were are few other non-arm uses of
-fallow-half-arguments-and-returns but I believe they were unnecessary.
The strictfp_builtins.c tests were converted from __fp16 to _Float16 to
avoid the issues.

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

21 months ago[mlir] Add C bindings for StridedArrayAttr
Denys Shabalin [Wed, 28 Sep 2022 13:40:31 +0000 (13:40 +0000)]
[mlir] Add C bindings for StridedArrayAttr

Reviewed By: ftynse

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

21 months ago[LLVM][MC] Disable cfi-version test for aarch64-pc-windows*
Muhammad Omair Javaid [Thu, 29 Sep 2022 08:19:37 +0000 (13:19 +0500)]
[LLVM][MC] Disable cfi-version test for aarch64-pc-windows*

This patch disables MC/ELF/cfi-version.ll test as windows does not emit
.debug_frame needed by the test. This was previously disabled for arm64
but windows on arm uses aarch64-pc-windows* triple. Replacing arm64 with
aarch64 to accomodate windows aarch64 triple(s).

Reviewed By: DavidSpickett

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

21 months ago[mlir][memref]Add conversion support for memref.extract_aligned_pointer_as_index...
Nicolas Vasilache [Thu, 29 Sep 2022 09:29:31 +0000 (02:29 -0700)]
[mlir][memref]Add conversion support for memref.extract_aligned_pointer_as_index to LLVM

Reviewed By: pifon2a

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

21 months ago[WinEH] Prepare test win64-funclet-preisel-intrinsics.ll for extension to nested...
Stefan Gränitz [Thu, 29 Sep 2022 09:01:59 +0000 (11:01 +0200)]
[WinEH] Prepare test win64-funclet-preisel-intrinsics.ll for extension to nested try-catch case (NFC)

21 months ago[mlir][memref]Add pattern to forward memref.extract_aligned_pointer_as_index(view_lik...
Nicolas Vasilache [Wed, 28 Sep 2022 22:29:55 +0000 (15:29 -0700)]
[mlir][memref]Add pattern to forward memref.extract_aligned_pointer_as_index(view_like_op) to its source

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

21 months ago[DebugInfo][InferAddressSpaces] Propagate DebugLoc when cloning an instruction in...
Juan Manuel MARTINEZ CAAMAÑO [Mon, 26 Sep 2022 13:49:32 +0000 (13:49 +0000)]
[DebugInfo][InferAddressSpaces] Propagate DebugLoc when cloning an instruction in InferAddressSpaces

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

21 months ago[StructurizeCFG] Remove imposible case and replace by assert
Juan Manuel MARTINEZ CAAMAÑO [Tue, 27 Sep 2022 13:48:10 +0000 (13:48 +0000)]
[StructurizeCFG] Remove imposible case and replace by assert

In addition, replace outdated XFAIL test by a new one.

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

21 months ago[SCEVExpander] Use CreateBitOrPointerCast instead of builder (NFC).
Florian Hahn [Thu, 29 Sep 2022 08:24:38 +0000 (09:24 +0100)]
[SCEVExpander] Use CreateBitOrPointerCast instead of builder (NFC).

Simplify the code by using CastInst::CreateBitOrPointerCast directly. By
not going through the builder, the temporary instruction also won't get
registered in InsertedValues & co, which means less work overall and
simplifies the clean-up.

21 months agoFix frint ACLE intrinsic names
Michael Platings [Wed, 28 Sep 2022 19:30:29 +0000 (20:30 +0100)]
Fix frint ACLE intrinsic names

Although the instruction names begin "frint", the ACLE spec states that
the intrinsic names begin "__rint", without the "f".

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

21 months agoRevert "[cmake] Export GetHostTriple.cmake"
Nikita Popov [Thu, 29 Sep 2022 07:56:51 +0000 (09:56 +0200)]
Revert "[cmake] Export GetHostTriple.cmake"

This turned out to be insufficient by itself, because we would
also need to export config.guess.

This reverts commit 4ac4d6bc9f312e18416739d70c9beb727acd33fb.

21 months agoRevert D134638 "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"
Fangrui Song [Thu, 29 Sep 2022 07:54:55 +0000 (00:54 -0700)]
Revert D134638 "[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC"

This reverts commit b7baddc7557e5c35a0f6a604a134d849265a99d4.

Broke CodeGen/X86/callbr-asm-kill.mir
We shall pay attention when adding new constraints.

21 months ago[NFC][AMDGPU] Pre-commit FMA test.
Thomas Symalla [Thu, 29 Sep 2022 07:53:23 +0000 (09:53 +0200)]
[NFC][AMDGPU] Pre-commit FMA test.

21 months ago[ELF] Make symAux[0] a sentinel
Fangrui Song [Thu, 29 Sep 2022 07:50:19 +0000 (00:50 -0700)]
[ELF] Make symAux[0] a sentinel

And default auxIdx to 0.

21 months ago[Driver] Add --config= as canonical spelling of --config
Fangrui Song [Thu, 29 Sep 2022 07:38:12 +0000 (00:38 -0700)]
[Driver] Add --config= as canonical spelling of --config

Driver options usually use `Joined` instead of `Separate`. It is also weird that
`--config-system-dir=`/etc exist while `--config=` did not exist.

Reviewed By: mgorny

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

21 months ago[clangd] Avoid using constructor/destructor of vector<incomplete type>
Sam McCall [Thu, 29 Sep 2022 07:28:06 +0000 (09:28 +0200)]
[clangd] Avoid using constructor/destructor of vector<incomplete type>

This is formally invalid, and causes build errors when building with
clang in -std=c++20.

http://eel.is/c%2B%2Bdraft/vector.overview#4

21 months ago[AMDGPU] Update `mad-mix*` CodeGen tests
Pierre van Houtryve [Wed, 28 Sep 2022 06:50:17 +0000 (06:50 +0000)]
[AMDGPU] Update `mad-mix*` CodeGen tests

- Use `fneg %a` instead of `fsub -0.0, %a`
  - This is for D134354 as we don't currently support folding `fsub -0.0, %a` into `fneg` on GISel.
    Also, `fneg` is the canonical way to do the negation.
- Switch to `update_llc_test_checks`-generated tests.
  - Better test coverage
  - Easier to update
  - Easier to see changes in future diffs
- Remove unnecessary CL arguments in RUN lines

Motive for the patch: Preparation for D134354 - we would like to
put GISel tests in this file as well. Fixing the lack of `fneg` and
switching to generated testing makes it much easier.

Reviewed By: arsenm

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

21 months ago[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC
Weining Lu [Thu, 29 Sep 2022 06:47:24 +0000 (14:47 +0800)]
[Clang][LoongArch] Add inline asm support for constraints k/m/ZB/ZC

k: A memory operand whose address is formed by a base register and
(optionally scaled) index register.

m: A memory operand whose address is formed by a base register and
offset that is suitable for use in instructions with the same
addressing mode as st.w and ld.w.

ZB: An address that is held in a general-purpose register. The offset
is zero.

ZC: A memory operand whose address is formed by a base register and
offset that is suitable for use in instructions with the same
addressing mode as ll.w and sc.w.

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

21 months agoRevert "[sanitizer] Use LLVM_ENABLE_LIBCXX to build symbolizer"
Vitaly Buka [Thu, 29 Sep 2022 06:53:01 +0000 (23:53 -0700)]
Revert "[sanitizer] Use LLVM_ENABLE_LIBCXX to build symbolizer"

Trigger some "libatomic" error.

This reverts commit ccbb40147286e2e1996b2b7f089fc44f049c9d28.

21 months ago[NFC][CMake] Inline the append_libcxx_libs macro
Petr Hosek [Thu, 29 Sep 2022 06:51:43 +0000 (06:51 +0000)]
[NFC][CMake] Inline the append_libcxx_libs macro

This is only invoked from a single site and doesn't add any value.

21 months ago[llvm-stress] Remove dependency to legacy pass manager
Bjorn Pettersson [Wed, 28 Sep 2022 10:59:33 +0000 (12:59 +0200)]
[llvm-stress] Remove dependency to legacy pass manager

This patch removes the dependency to the legacy pass manager when
building llvm-stress.

Instead of setting up a pass manager at all we just run verifyModule()
to check that the generated IR satisfies the verifier, and then
we use Module::print() to output the IR. No need to setup passes and
populating a pass manager since we aren't doing anything more fancy
than that.

Reviewed By: aeubanks

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

21 months ago[clang] Add debug info in MicrosoftCXXABI::EmitVirtualMemPtrThunk()
Arthur Eubanks [Wed, 28 Sep 2022 19:56:44 +0000 (12:56 -0700)]
[clang] Add debug info in MicrosoftCXXABI::EmitVirtualMemPtrThunk()

(Probably) fixes https://crbug.com/1355639

Reviewed By: dblaikie

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

21 months ago[AMDGPU] Report minimum scratch size in code object v5 and later by default
Abinav Puthan Purayil [Thu, 15 Sep 2022 13:10:36 +0000 (18:40 +0530)]
[AMDGPU] Report minimum scratch size in code object v5 and later by default

This change sets
-amdgpu-assume-{external-call-stack-size | dynamic-stack-object-size}
options to zero by default for code object v5 and later. The runtime is
expected to adjust the scratch size if the amdhsa_uses_dynamic_stack bit
in the kernel descriptor is set.

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

21 months ago[ADT] IntervalTree - Fix random unittests failures in a debug builds.
Carlos Alberto Enciso [Thu, 29 Sep 2022 04:17:36 +0000 (05:17 +0100)]
[ADT] IntervalTree - Fix random unittests failures in a debug builds.

On a debug build with _LIBCPP_DEBUG_RANDOMIZE_UNSPECIFIED_STABILITY
enabled from 100 executions around 80 are failing.

More details in https://reviews.llvm.org/D125776#3820399

The issue is related to the use of std::sort.

Reviewed By: antondaubert, jryans, probinson

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

21 months ago[mlir] Making verification after parsing optional
River Riddle [Thu, 29 Sep 2022 01:39:26 +0000 (18:39 -0700)]
[mlir] Making verification after parsing optional

This is very useful when you want to parse IR even if
its invalid (e.g. bytecode). It's also useful if you don't
want to pay the cost of verification in certain situations.

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

21 months ago[mlir][python] stop initialization on ImportError
Ashay Rane [Wed, 28 Sep 2022 14:53:36 +0000 (14:53 +0000)]
[mlir][python] stop initialization on ImportError

An `_mlirRegisterEverything.*.so` file from an old build that referenced
`MLIRPythonExtension.RegisterEverything`, but which no longer references
that extension in a new build, causes runtime errors in the new build
like:

    ImportError: _mlirRegisterEverything.cpython-38-x86_64-linux-gnu.so: undefined symbol: mlirRegisterAllPasses

The error occurs because the MLIR Python binding tries to dynamically
import the `_mlirRegisterEverything` module but the dynamic importer
fails since the new build no longer references
`MLIRPythonExtension.RegisterEverything`.

One possible solution is for the user to manually remove the
`_mlirRegisterEverything.*.so` file.  This patch instead resolves the
problem in code by printing a waning if the module cannot be
imported.

Reviewed By: stellaraccident

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

21 months ago[ELF] Remove resolve => resolve{Defined,Common,Shared,Lazy,Undefined} indirection...
Fangrui Song [Thu, 29 Sep 2022 03:01:41 +0000 (20:01 -0700)]
[ELF] Remove resolve => resolve{Defined,Common,Shared,Lazy,Undefined} indirection. NFC

21 months ago[GlobalISel][CallLowering] Use hasRetAttr for return flags on CallBases
Jessica Paquette [Thu, 29 Sep 2022 00:25:11 +0000 (17:25 -0700)]
[GlobalISel][CallLowering] Use hasRetAttr for return flags on CallBases

Given something like this:

```
declare signext i16 @signext_callee()
define i32 @caller() {
  %res = call i16 @signext_callee()
  ...
}
```

CallLowering would miss that signext_callee's return value is sign extended,
because it isn't on the call.

Use hasRetAttr on the CallBase to allow us to catch this.

(This now inserts G_ASSERT_SEXT/G_ASSERT_ZEXT like in the original review.)

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

21 months ago[sanitizer] Use LLVM_ENABLE_LIBCXX to build symbolizer
Vitaly Buka [Thu, 29 Sep 2022 02:26:21 +0000 (19:26 -0700)]
[sanitizer] Use LLVM_ENABLE_LIBCXX to build symbolizer

21 months ago[LoongArch] Add fp_to_sint support for soft floating point
gonglingqin [Thu, 29 Sep 2022 02:05:58 +0000 (10:05 +0800)]
[LoongArch] Add fp_to_sint support for soft floating point

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

21 months ago[clang-format] Fix a bug with C++ `export import <Foo/Bar>`
owenca [Tue, 27 Sep 2022 05:34:53 +0000 (22:34 -0700)]
[clang-format] Fix a bug with C++ `export import <Foo/Bar>`

Fixes #57798.

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

21 months ago[test][openmp] Tsan may report more warnings here
Vitaly Buka [Thu, 29 Sep 2022 01:42:57 +0000 (18:42 -0700)]
[test][openmp] Tsan may report more warnings here

21 months ago[test][msan] -fno-sanitize-memory-param-retval in unittests
Vitaly Buka [Thu, 29 Sep 2022 01:39:52 +0000 (18:39 -0700)]
[test][msan] -fno-sanitize-memory-param-retval in unittests

21 months ago[mlir] Add support for parallel dim *after* reduction dim in split reduction
Murali Vijayaraghavan [Thu, 29 Sep 2022 01:07:52 +0000 (01:07 +0000)]
[mlir] Add support for parallel dim *after* reduction dim in split reduction

Previously, splitReduction transformation added the split parallel dimension
*before* the reduction dimension, leading to tiling for reduction. This
commit creates an option to create the parallel dimension *after* the
reduction dimension, allowing us to transform the op into vertical reduction
with SIMD parallelism.

Reviewed By: ThomasRaoux, dcaballe

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

21 months ago[InstrProfiling] Fix emitting runtime hook once
Gulfem Savrun Yeniceri [Wed, 28 Sep 2022 01:52:04 +0000 (01:52 +0000)]
[InstrProfiling] Fix emitting runtime hook once

https://reviews.llvm.org/D134254 introduced an issue on Fuchsia
target, which does not unconditionally emit runtime hook.
It used containsProfilingIntrinsics(M) after intrinsics are lowered.
So, this patch fixes the issue by capturing the result of that
function invocation before intrinsics are lowered.

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

21 months ago[LoongArch] Expand llvm.stacksave and llvm.stackrestore
WANG Xuerui [Thu, 29 Sep 2022 01:06:01 +0000 (09:06 +0800)]
[LoongArch] Expand llvm.stacksave and llvm.stackrestore

As in commit bfb00d4c1c98 ("[RISCV] Allow lowering of dynamic_stackalloc, stacksave, stackrestore").

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

21 months ago[ARM64EC] Add arm64ec for getArchName
chenglin.bi [Thu, 29 Sep 2022 01:04:13 +0000 (09:04 +0800)]
[ARM64EC] Add arm64ec for getArchName

Followup D125412, return the correct arch name for Arm64EC

Reviewed By: efriedma, mstorsjo

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

21 months ago[LoongArch] Produce a R_LARCH_32_PCREL relocation
wanglei [Thu, 29 Sep 2022 00:48:54 +0000 (08:48 +0800)]
[LoongArch] Produce a R_LARCH_32_PCREL relocation

LoongArchELFObjectWriter::getRelocType check IsPCRel for FK_Data_4
(which we produce a R_LARCH_32_PCREL relocation for if IsPCRel).

R_LARCH_32_PCREL is required for FDE relocation.

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

21 months ago[ELF] Avoid redundant assignment to Symbol fields. NFC
Fangrui Song [Thu, 29 Sep 2022 00:56:16 +0000 (17:56 -0700)]
[ELF] Avoid redundant assignment to Symbol fields. NFC

21 months ago[NFC] [HWASan] remove unnecessary cast
Florian Mayer [Thu, 29 Sep 2022 00:40:50 +0000 (17:40 -0700)]
[NFC] [HWASan] remove unnecessary cast

21 months ago[LoongArch] Override TargetSubtargetInfo::getSelectionDAGInfo
wanglei [Wed, 28 Sep 2022 09:56:31 +0000 (17:56 +0800)]
[LoongArch] Override TargetSubtargetInfo::getSelectionDAGInfo

The target selection DAG lowering information is needed for
SelectionDAGBuilder to lower a call like memcmp into an optimized
form.

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

21 months agoInclude <cmath> before using std::pow()
Jason Molenda [Thu, 29 Sep 2022 00:35:35 +0000 (17:35 -0700)]
Include <cmath> before using std::pow()

Not sure why this is failing for me to build tonight, but either
something in a header somewhere changed or my tools changed, and
it is failing to compile.

21 months ago[lldb] Fix deprecation warnings for hasValue and getValue in mac-only code paths
Nico Weber [Thu, 29 Sep 2022 00:11:58 +0000 (20:11 -0400)]
[lldb] Fix deprecation warnings for hasValue and getValue in mac-only code paths

No behavior change.

21 months agoRevert "When there are variable errors, display an error in VS Code's local variables...
Nico Weber [Thu, 29 Sep 2022 00:07:14 +0000 (20:07 -0400)]
Revert "When there are variable errors, display an error in VS Code's local variables view."

This reverts commit 15f83ab77502cb2bd405a091cf419536e1d41381.
Doesn't build, see https://reviews.llvm.org/D134333#3822313

21 months ago[mlir][sparse] provide convenience methods for toOrig/toStoredDim
Aart Bik [Wed, 28 Sep 2022 22:04:17 +0000 (15:04 -0700)]
[mlir][sparse] provide convenience methods for toOrig/toStoredDim

Reviewed By: Peiming

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

21 months ago[StackLifetime] More efficient loop for LivenessType::Must
Vitaly Buka [Wed, 28 Sep 2022 06:41:32 +0000 (23:41 -0700)]
[StackLifetime] More efficient loop for LivenessType::Must

CFG with cycles may requires additional passes of "while (Changed)"
iteration if to propagate data back from latter blocks to earlier blocks,
ordered according to depth_fist.

OR logic, used for ::May, converge to stable state faster then AND logic
use for ::Must.

Though the better solution is to switch to some some form of queue, but
having that this one is good enough, I will consider to do that later.

We can switch ::Must to OR logic if we calculate "may be dead" instead
of direct "must be alive" and then convert values to match existing
interface.

Additionally it fixes correctness in "@cycle" test.

Reviewed By: kstoimenov, fmayer

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

21 months ago[AArch64][GlobalISel] Make G_PTRTOINT only legal for s64 + p0
Jessica Paquette [Wed, 28 Sep 2022 23:20:24 +0000 (16:20 -0700)]
[AArch64][GlobalISel] Make G_PTRTOINT only legal for s64 + p0

A few issues:

  1. There was no legalizer test for G_PTRTOINT
  2. Same clamping issue as in many other opcodes
  3. AArch64 pointers can only be 64b, so in reality we always have to trunc or
     extend with any size other than p0 anyway.

This seems to actually produce more correct selection for narrow types as well.

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

21 months ago[RISCV] Add test coverage for upcoming select lowering optimization
Philip Reames [Wed, 28 Sep 2022 22:47:25 +0000 (15:47 -0700)]
[RISCV] Add test coverage for upcoming select lowering optimization

Test copied from X86 backend since I'm going to be taking the code from there too.

21 months ago[AArch64][GlobalISel] Implement custom legalization for s32/s64 G_FCOPYSIGN
Jessica Paquette [Wed, 28 Sep 2022 23:01:19 +0000 (16:01 -0700)]
[AArch64][GlobalISel] Implement custom legalization for s32/s64 G_FCOPYSIGN

This is intended to be equivalent to the s32 + s64 cases in
AArch64TargetLowering::LowerFCOPYSIGN.

Widen everything and then use G_BIT + a mask to handle the actual copysign
operation. Then, narrow back down to s32/s64.

I wasn't sure about what the best/most canonical INSERT_SUBREG-selectable
pattern is. I chose G_INSERT_VECTOR_ELT + an undef vector because it produces
reasonably okay codegen. (It doesn't produce INSERT_SUBREG right now though.)
If there's a better way to do this then I'm happy to change it.

We also have a couple codegen deficiencies with how we emit vector constants
right now. (We need a GISel equivalent to the tryAdvSIMDModImm64 stuff)

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

21 months ago[PERF2BOLT] Fix unittest failure
Rafael Auler [Wed, 28 Sep 2022 22:59:58 +0000 (15:59 -0700)]
[PERF2BOLT] Fix unittest failure

Fix failure caused by commit e549ac072b "Do not issue parsing error on
weird build ids".

21 months ago[MTE] [HWASan] unify isInterestingAlloca
Florian Mayer [Wed, 28 Sep 2022 00:46:53 +0000 (17:46 -0700)]
[MTE] [HWASan] unify isInterestingAlloca

Reviewed By: eugenis

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

21 months ago[AArch64][GlobalISel] Add a target-specific G_BIT opcode.
Jessica Paquette [Wed, 28 Sep 2022 22:48:35 +0000 (15:48 -0700)]
[AArch64][GlobalISel] Add a target-specific G_BIT opcode.

This is necessary for custom-legalizing G_FCOPYSIGN.

This is equivalent to the BIT instruction (bitwise insert if true).

Add selection testcases for imported patterns.

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

21 months ago[llvm-remarkutil] Add an option to print out function sizes
Jessica Paquette [Tue, 27 Sep 2022 21:26:37 +0000 (14:26 -0700)]
[llvm-remarkutil] Add an option to print out function sizes

This adds an `instruction-count` command to llvm-remarkutil.

```
llvm-remarkutil instruction-count --parser=<bitstream|yaml> <file>
```

This will, for now, only print out asm-printer `InstructionCount` remarks.

Frequently I need to find out things like "what are the top 10 largest
functions" in a given project.

This makes it so we can find that information quickly and easily from any
format of remarks.

I chose a CSV because I usually want to stick these into a spreadsheet, and
the data is two-dimensional.

In the future, we may want to change this to another format if we add more
complicated data.

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

21 months ago[GlobalISel] Add isConstFalseVal helper to Utils
Jessica Paquette [Wed, 28 Sep 2022 22:43:26 +0000 (15:43 -0700)]
[GlobalISel] Add isConstFalseVal helper to Utils

Add a utility function which returns true if the given value is a constant
false value.

This is necessary to port one of the compare simplifications in
TargetLowering::SimplifySetCC.

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

21 months agoTrack which modules have debug info variable errors.
Greg Clayton [Fri, 23 Sep 2022 00:54:06 +0000 (17:54 -0700)]
Track which modules have debug info variable errors.

Now that we display an error when users try to get variables, but something in the debug info is preventing variables from showing up, track this with a new bool in each module's statistic information named "debugInfoHadVariableErrors".

This patch modifies the code to track when we have variable errors in a module and adds accessors to get/set this value. This value is used in the module statistics and we added a test to verify this value gets set correctly.

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

21 months agoWhen there are variable errors, display an error in VS Code's local variables view.
Greg Clayton [Wed, 21 Sep 2022 03:58:08 +0000 (20:58 -0700)]
When there are variable errors, display an error in VS Code's local variables view.

After recent diffs that enable variable errors that stop variables from being correctly displayed when debugging, allow users to see these errors in the LOCALS variables in the VS Code UI. We do this by detecting when no variables are available and when there is an error to be displayed, and we add a single variable named "<error>" whose value is a string error that the user can read. This allows the user to be aware of the reason variables are not available and fix the issue. Previously if someone enabled "-gline-tables-only" or was debugging with DWARF in .o files or with .dwo files and those separate object files were missing or they were out of date, the user would see nothing in the variables view. Communicating these errors to the user is essential to a good debugging experience.

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

21 months ago[bazel] Port 3f050f6ac4626c9bf99bfdf5e4d7162ba7ad5cdc
Benjamin Kramer [Wed, 28 Sep 2022 22:12:46 +0000 (00:12 +0200)]
[bazel] Port 3f050f6ac4626c9bf99bfdf5e4d7162ba7ad5cdc

21 months ago[PERF2BOLT] Do not issue parsing error on weird build ids
Rafael Auler [Fri, 23 Sep 2022 01:32:48 +0000 (18:32 -0700)]
[PERF2BOLT] Do not issue parsing error on weird build ids

In weird entries we were issueing a parse error. For example, in line 5 here:

6862acc063b0aa86595f52ff81628577df4296ff a.so
6862acc063b0aa86595f52ff81628577df4296ff a.so
6862acc063b0aa86595f52ff81628577df4296ff a.so
db758cb3c970044e78d5a4c99b011708a9995636 bin1
60326683eab31acfd03435d9ed4ff9a8         bin2
7d448e51851b4bdb33eac84f90e74628a14a5f00 b.so
742aa26e0211794356cc25f415c25230a26aa045 c.so

Error reading BOLT data input file: line 89, column 33: malformed field

Fix that.

Reviewed By: #bolt, Amir

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

21 months ago[ELF] Remove unused Symbol::getSymbolSize. NFC
Fangrui Song [Wed, 28 Sep 2022 21:32:26 +0000 (14:32 -0700)]
[ELF] Remove unused Symbol::getSymbolSize. NFC

21 months ago[mlir][transform] Add multi-buffering to the transform dialect
Kirsten Lee [Wed, 28 Sep 2022 19:18:24 +0000 (12:18 -0700)]
[mlir][transform] Add multi-buffering to the transform dialect

Add the plumbing necessary to call the memref dialect's multiBuffer
function. This will allow separation between choosing which buffers
to multi-buffer and the actual transform.

Alter the multibuffer function to return the newly created
allocation if multi-buffering succeeds. This is necessary to
communicate with the transform dialect hooks what allocation
multi-buffering created.

Reviewed By: ftynse, nicolasvasilache

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

21 months ago[gn build] Port e61d89efd78b
LLVM GN Syncbot [Wed, 28 Sep 2022 20:36:01 +0000 (20:36 +0000)]
[gn build] Port e61d89efd78b

21 months ago[NFC] [Object] Create library to fetch debug info by build ID.
Daniel Thornburgh [Tue, 23 Aug 2022 20:39:33 +0000 (13:39 -0700)]
[NFC] [Object] Create library to fetch debug info by build ID.

This creates a library for fetching debug info by build ID, whether
locally or remotely via debuginfod. The functionality was refactored
out of existing code in the Symboliize library. Existing utilities
were refactored to use this library.

Reviewed By: phosek

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

21 months ago[mlir][TilingInterface] NFC Refactor of tile and fuse using `TilingInterface`.
Mahesh Ravishankar [Wed, 7 Sep 2022 20:25:17 +0000 (20:25 +0000)]
[mlir][TilingInterface] NFC Refactor of tile and fuse using `TilingInterface`.

This patch refactors the tiling and tile + fuse implementation using
`TilingInterface`. Primarily, it exposes the functionality as simple
utility functions instead of as a Pattern to allow calling it from a
pattern as it is done in the test today or from within the transform
dialect (in the future). This is a step towards deprecating similar
methods in Linalg dialect.

- The utility methods do not erase the root operations.
- The return value provides the values to use for replacements.

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

21 months ago[DirectX backend] Support global ctor for DXILBitcodeWriter.
Xiang Li [Mon, 5 Sep 2022 08:02:01 +0000 (01:02 -0700)]
[DirectX backend] Support global ctor for DXILBitcodeWriter.

1. Save typed pointer type for GlobalVariable/Function instead of the ObjectType.
   This will allow use GlobalVariable/Function as value.
2. Save target type for global ctors for Constant.
3. In DXILBitcodeWriter::getTypeID, check PointerMap first for Constant case.

Reviewed By: beanz

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

21 months ago[test][msan] Pin varg.cpp to -fno-sanitize-memory-param-retval
Arthur Eubanks [Wed, 28 Sep 2022 20:13:40 +0000 (13:13 -0700)]
[test][msan] Pin varg.cpp to -fno-sanitize-memory-param-retval

Should fix https://lab.llvm.org/buildbot#builders/19/builds/12736

21 months ago[AMDGPU] Move SIModeRegisterDefaults to SI MFI
Stanislav Mekhanoshin [Tue, 27 Sep 2022 15:16:20 +0000 (08:16 -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 ago[ELF] Refactor Symbol initialization and overwriting
Fangrui Song [Wed, 28 Sep 2022 20:11:31 +0000 (13:11 -0700)]
[ELF] Refactor Symbol initialization and overwriting

Symbol::replace intends to overwrite a few fields (mostly Elf{32,64}_Sym
fields), but the implementation copies all fields then restores some old fields.
This is error-prone and wasteful. Add Symbol::overwrite to copy just the
needed fields and add other overwrite member functions to copy the extra
fields.

21 months agotry to fix build yet more after 16544cbe64b8
Nico Weber [Wed, 28 Sep 2022 19:40:50 +0000 (15:40 -0400)]
try to fix build yet more after 16544cbe64b8

21 months agotry to fix build more after 16544cbe64b8
Nico Weber [Wed, 28 Sep 2022 19:35:43 +0000 (15:35 -0400)]
try to fix build more after 16544cbe64b8

21 months ago[clang] handle extended integer constant expressions in _Static_assert (PR #57687)
Martin Sebor [Wed, 28 Sep 2022 19:24:54 +0000 (13:24 -0600)]
[clang] handle extended integer constant expressions in _Static_assert (PR #57687)

Reviewed By: aaron.ballman

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

21 months agotry to fix build after 16544cbe64b8
Nico Weber [Wed, 28 Sep 2022 19:18:15 +0000 (15:18 -0400)]
try to fix build after 16544cbe64b8