platform/upstream/llvm.git
2 years ago[Debugify][OriginalDIMode] Update script to handle large JSON reports
Nikola Tesic [Wed, 28 Sep 2022 10:34:32 +0000 (12:34 +0200)]
[Debugify][OriginalDIMode] Update script to handle large JSON reports

This patch updates llvm/utils/llvm-original-di-preservation.py to create more
compact HTML verify-debuginfo-preserve reports by:
- removing duplicated debug info bugs,
- introducing -compress option to create highly compressed report.
Additionally, this patch makes script able to process very large JSON inputs.
That is done by reading & analyzing JSON report in chunks.

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

2 years ago[Debugify][OriginalDIMode] Make HTML reporting infrastructure more resilient
Nikola Tesic [Wed, 28 Sep 2022 10:32:46 +0000 (12:32 +0200)]
[Debugify][OriginalDIMode] Make HTML reporting infrastructure more resilient

Debugify in OriginalDebugInfo mode (verify-each-debuginfo-preserve), when used
in parallel builds of large projects, can produce incorrect report. More
precisely, simultaneous writes to JSON report file, could form incorrect JSON
objects, which describe found Debug Info bugs.
This patch uses the lock/unlock mechanism to protect JSON report file and also
makes script llvm/utils/llvm-original-di-preservation.py resilient to corrupted
lines in the report file. So, it ensures the creation of HTML report.

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

2 years ago[RISCV] Adjust vector immediate store materialization cost
Philip Reames [Thu, 29 Sep 2022 14:31:03 +0000 (07:31 -0700)]
[RISCV] Adjust vector immediate store materialization cost

This change updates the costs to make constant pool loads match their actual cost, and adds the broadcast special case to avoid too many regressions. We really need more information about the constants being rematerialized, but this is an incremental improvement.

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

2 years ago[libc++] Add missing return 0;'s to main() functions in tests
Louis Dionne [Thu, 29 Sep 2022 14:34:52 +0000 (10:34 -0400)]
[libc++] Add missing return 0;'s to main() functions in tests

2 years ago[mlir][Linalg] Add ReduceOp to Linalg structured ops.
Adrian Kuegel [Wed, 28 Sep 2022 11:49:13 +0000 (13:49 +0200)]
[mlir][Linalg] Add ReduceOp to Linalg structured ops.

This will allow to model (variadic) reductions with this special op instead of
using GenericOp.

RFC: https://discourse.llvm.org/t/rfc-primitive-ops-add-mapop-reductionop-transposeop-broadcastop-to-linalg/64184

2 years ago[mlir] fix formatting in markdown
Alex Zinenko [Thu, 29 Sep 2022 14:09:40 +0000 (14:09 +0000)]
[mlir] fix formatting in markdown

2 years ago[libc][NFC] Move alignment utils to utils.h
Guillaume Chatelet [Thu, 29 Sep 2022 13:51:20 +0000 (13:51 +0000)]
[libc][NFC] Move alignment utils to utils.h

2 years ago[LSR][NFC] Add missing constness
eopXD [Thu, 29 Sep 2022 13:30:32 +0000 (06:30 -0700)]
[LSR][NFC] Add missing constness

2 years ago[InstSimplify] Add test for PR58046 (NFC)
Nikita Popov [Thu, 29 Sep 2022 13:21:57 +0000 (15:21 +0200)]
[InstSimplify] Add test for PR58046 (NFC)

2 years ago[RISCV] Add lowering for llvm.roundeven
eopXD [Wed, 28 Sep 2022 03:14:04 +0000 (20:14 -0700)]
[RISCV] Add lowering for llvm.roundeven

Reviewed By: craig.topper

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

2 years agoUnwind-tables: move back to original logic outline for kind.
Tim Northover [Mon, 26 Sep 2022 12:26:36 +0000 (13:26 +0100)]
Unwind-tables: move back to original logic outline for kind.

There are lots of options interacting in complex ways here, and when moving to
`getDefaultUnwindTableLevel` I had refactored this and changed behaviour in
some cases. So this reverts the basic structure of the logic back to the
original, while leaving the hook in the new style.

2 years ago[mlir][GPU] treat the absence of workgroup attributes correctly
Alex Zinenko [Thu, 29 Sep 2022 09:50:24 +0000 (09:50 +0000)]
[mlir][GPU] treat the absence of workgroup attributes correctly

The helper function in GPUFuncOp incorrectly assumed the workgroup
attribution attribute is always present. Instead, treat its absence as
if its value was zero, i.e., no workgroup attributions are specified.

Closes #58045.

Reviewed By: nicolasvasilache

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

2 years ago[Support] Class for response file expansion (NFC)
Serge Pavlov [Sun, 21 Aug 2022 17:30:28 +0000 (00:30 +0700)]
[Support] Class for response file expansion (NFC)

Functions that implement expansion of response and config files depend
on many options, which are passes as arguments. Extending the expansion
requires new options, it in turn causes changing calls in various places
making them even more bulky.

This change introduces a class ExpansionContext, which represents set of
options that control the expansion. Its methods implements expansion of
responce files including config files. It makes extending the expansion
easier.

No functional changes.

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

2 years ago[libc][test] Better reporting for MemoryMatcher
Guillaume Chatelet [Thu, 29 Sep 2022 12:13:26 +0000 (12:13 +0000)]
[libc][test] Better reporting for MemoryMatcher

2 years agoReapply [FunctionAttrs] Infer precise FMRB
Nikita Popov [Fri, 23 Sep 2022 11:03:59 +0000 (13:03 +0200)]
Reapply [FunctionAttrs] Infer precise FMRB

The previous version of the patch would incorrect convert an
existing argmemonly attribute into an inaccessiblemem_or_argmemonly
attribute.

-----

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

2 years ago[FunctionAttrs] Add test for argmemonly function that already has attr (NFC)
Nikita Popov [Thu, 29 Sep 2022 11:55:36 +0000 (13:55 +0200)]
[FunctionAttrs] Add test for argmemonly function that already has attr (NFC)

Test for the issue reported in https://reviews.llvm.org/D134527#3821010.

2 years 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.

2 years 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

2 years 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.

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years 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

2 years 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.
[#

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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)

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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

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

2 years 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

2 years 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.

2 years 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.

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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.

2 years 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

2 years 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".

2 years 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

2 years 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

2 years 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

2 years 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

2 years 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