platform/upstream/llvm.git
2 years ago[AArch64][GlobalISel] Implement combines for boolean G_SELECT->bitwise ops.
Amara Emerson [Sun, 20 Feb 2022 08:53:09 +0000 (00:53 -0800)]
[AArch64][GlobalISel] Implement combines for boolean G_SELECT->bitwise ops.

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

2 years ago[HIP] Support linking archive of bundled bitcode
Yaxun (Sam) Liu [Thu, 17 Feb 2022 15:42:15 +0000 (10:42 -0500)]
[HIP] Support linking archive of bundled bitcode

HIP programs compiled with -c -fgpu-rdc generate clang-offload-bundler
bundles which contain bitcode for different GPU's.

Such files can be archived to an archive file which can be linked with
HIP programs with -fgpu-rdc.

This patch adds suppor of linking archive of bundled bitcode.

When an archive of bundled bitcode is passed to clang by -l, for each
GPU specified through --offload-arch, clang extracts bitcode from
the archive and creates a new archive for that GPU and pass it
to lld.

Reviewed by: Artem Belevich

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

Fixes: SWDEV-321741, SWDEV-315773

2 years ago[MLIR][Presburger] Introduce MaybeOptimum type to represent computed optima
Arjun P [Sat, 19 Feb 2022 20:06:14 +0000 (20:06 +0000)]
[MLIR][Presburger] Introduce MaybeOptimum type to represent computed optima

This allows to differentiate between the cases where the optimum does not
exist due to being unbounded and due to the polytope being empty.

Reviewed By: Groverkss

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

2 years ago[VectorCombine] Remove redundant checks (NFC).
Florian Hahn [Sat, 19 Feb 2022 21:05:32 +0000 (21:05 +0000)]
[VectorCombine] Remove redundant checks (NFC).

The removed conditions are already checked by the if above.

Fixes #53761.

2 years ago[mlir][bufferize] Add a way for ops to fail the analysis
Matthias Springer [Sat, 19 Feb 2022 20:49:33 +0000 (05:49 +0900)]
[mlir][bufferize] Add a way for ops to fail the analysis

Add `BufferizableOpInterface::verifyAnalysis`. Ops can implement this method to check for expected invariants and limitations.

The purpose of this change is to introduce a modular way of checking assertions such as `assertScfForAliasingProperties`.

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

2 years ago[SelectionDAGBuilder] Simplify visitShift. NFC
Craig Topper [Sat, 19 Feb 2022 20:03:28 +0000 (12:03 -0800)]
[SelectionDAGBuilder] Simplify visitShift. NFC

This code was detecting whether the value returned by getShiftAmountTy
can represent all shift amounts. If not, it would use MVT::i32 as a
placeholder. getShiftAmountTy was updated last year to return i32
if the type returned by the target couldn't represent all values.

This means the MVT::i32 case here is dead and can the logic can
be simplified.

Reviewed By: RKSimon

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

2 years ago[X86] vector-reduce-add-mask.ll - add missing AVX512BW/BWVL check prefixes
Simon Pilgrim [Sat, 19 Feb 2022 20:19:48 +0000 (20:19 +0000)]
[X86] vector-reduce-add-mask.ll - add missing AVX512BW/BWVL check prefixes

2 years ago[lldb] Fix some accidental IntervalMap copies
Benjamin Kramer [Sat, 19 Feb 2022 19:55:20 +0000 (20:55 +0100)]
[lldb] Fix some accidental IntervalMap copies

I made that type non-copyable in some cases in dc4f9f0368cd

2 years ago[GISel] Fix dead code warning in getRuleRangeForIdentifier emitted method. NFC.
Simon Pilgrim [Sat, 19 Feb 2022 19:43:53 +0000 (19:43 +0000)]
[GISel] Fix dead code warning in getRuleRangeForIdentifier emitted method. NFC.

Break the if-else chain as every block returns, and remove the return at the end of the function as the else block means this was never hit

2 years ago[X86] combineArithReduction - pull out repeated getVectorNumElements() calls
Simon Pilgrim [Fri, 18 Feb 2022 22:04:57 +0000 (22:04 +0000)]
[X86] combineArithReduction - pull out repeated getVectorNumElements() calls

2 years ago[ADT] Just use a union in IntervalMap
Benjamin Kramer [Sat, 19 Feb 2022 19:20:52 +0000 (20:20 +0100)]
[ADT] Just use a union in IntervalMap

IntervalMap has seen type-punned arrays, AlignedCharArrayUnion and
std::aligned_union_t, with varying degrees of buggyness. Plain unions
have become quite powerful, so just try that instead.

2 years ago[X86] Extend bswap+shl tests
Simon Pilgrim [Sat, 19 Feb 2022 19:16:56 +0000 (19:16 +0000)]
[X86] Extend bswap+shl tests

Different shift amounts and multiuse tests

2 years ago[X86] Add bswap(shl()) test
Simon Pilgrim [Sat, 19 Feb 2022 17:37:07 +0000 (17:37 +0000)]
[X86] Add bswap(shl()) test

Test based off issues #51391 and #53867 - we're going to end up needing InstCombine + DAG variants of this fold as DAG can create BSWAP nodes as part of load folding

2 years ago[X86] Add some add reduction tests for values that are zero in the upper bits
Simon Pilgrim [Sat, 19 Feb 2022 15:36:17 +0000 (15:36 +0000)]
[X86] Add some add reduction tests for values that are zero in the upper bits

This is an extension of some of the tests mentioned in Issue #42019 - we might be able to use PSADBW to add+zext 4 x bytes to i64 that can then be reduced

2 years ago[AArch64] Adds SUBS and ADDS instructions to the MIPeepholeOpt.
Micah Weston [Sat, 19 Feb 2022 15:35:53 +0000 (15:35 +0000)]
[AArch64] Adds SUBS and ADDS instructions to the MIPeepholeOpt.

Implements ADDS/SUBS 24-bit immediate optimization using the
MIPeepholeOpt pass. This follows the pattern:

Optimize ([adds|subs] r, imm) -> ([ADDS|SUBS] ([ADD|SUB] r, #imm0, lsl #12), #imm1),
if imm == (imm0<<12)+imm1. and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

Optimize ([adds|subs] r, imm) -> ([SUBS|ADDS] ([SUB|ADD] r, #imm0, lsl #12), #imm1),
if imm == -(imm0<<12)-imm1, and both imm0 and imm1 are non-zero 12-bit unsigned
integers.

The SplitAndOpcFunc type had to change the return type to an Opcode pair so that
the first add/sub is the regular instruction and the second is the flag setting
instruction. This required updating the code in the AND case.

Testing:

I ran a two stage bootstrap with this code.
Using the second stage compiler, I verified that the negation of an ADDS to SUBS
or vice versa is a valid optimization. Example V == -0x111111.

Reviewed By: dmgreen

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

2 years ago[AArch64] Common patterns between UMULL and int_aarch64_neon_umull
David Green [Sat, 19 Feb 2022 14:38:57 +0000 (14:38 +0000)]
[AArch64] Common patterns between UMULL and int_aarch64_neon_umull

We have some duplicate patterns between the AArch64ISD::UMULL (/SMULL)
and the int_aarch64_neon_umull (/smull) intrinsics. They did not
replicate all the patterns though, leaving some gaps on instructions
like umlal2 from codegen. This commons all the patterns by converting
all int_aarch64_neon_umull intrinsics to UMULL nodes and removing the
duplicate for umull/smull intrinsics, so that all instructions go
through the same tablegen pattern.

This improves some of the longer-than-legal mla patterns, helping them
replace ext with umlal2.

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

2 years agoFix Wdocumentation missing code snippet warnings
Simon Pilgrim [Sat, 19 Feb 2022 13:17:10 +0000 (13:17 +0000)]
Fix Wdocumentation missing code snippet warnings

2 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Sat, 19 Feb 2022 13:06:09 +0000 (13:06 +0000)]
Fix Wdocumentation unknown parameter warning

2 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Sat, 19 Feb 2022 13:00:59 +0000 (13:00 +0000)]
Fix Wdocumentation unknown parameter warning

2 years ago[docs] HowToCrossCompileLLVM.rst: update cmake options
fourdim [Sat, 19 Feb 2022 12:36:31 +0000 (20:36 +0800)]
[docs] HowToCrossCompileLLVM.rst: update cmake options

This patch updates the cmake options suggested when cross compiling. This should fix [#52819](https://github.com/llvm/llvm-project/issues/52819).

Brad King (Member of CMake) says:

The linked [CMAKE_CROSSCOMPILING](https://cmake.org/cmake/help/v3.22/variable/CMAKE_CROSSCOMPILING.html) documentation says:

This variable will be set to true by CMake if the `CMAKE_SYSTEM_NAME` variable has been set manually (i.e. in a toolchain file or as a cache entry from the cmake command line).

It is not meant to be set by project code or toolchain files. It is always set automatically. Don't put `set(CMAKE_CROSSCOMPILING ON)` anywhere in your code.

`CMAKE_CROSSCOMPILING` indicates only whether `CMAKE_SYSTEM_NAME` was set by the user/project/toolchain-file instead of by CMake.

In LLVM project, `CMAKE_CROSSCOMPILING` is used to determine whether to execute some tests on the host machine.

LLVM needs to use another method for that. `CMAKE_CROSSCOMPILING` is not a reliable indicator of whether produced binaries will run on the host, and does not claim so in its documentation. If one sets `CMAKE_SYSTEM_NAME` to Linux in a toolchain file, and builds on a Linux host, that doesn't mean the target architecture or minimum glibc version is the same.

Reviewed By: rengolin

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

2 years ago[CodeGen] Make ShapeT::operator== const. NFC.
Benjamin Kramer [Sat, 19 Feb 2022 12:23:27 +0000 (13:23 +0100)]
[CodeGen] Make ShapeT::operator== const. NFC.

Otherwise it becomes asymmetric in the types it accepts.

2 years ago[RISCV][NFC] Remove unused multiclass def.
Zakk Chen [Sat, 19 Feb 2022 06:26:01 +0000 (22:26 -0800)]
[RISCV][NFC] Remove unused multiclass def.

2 years ago[RISCV] Add IsRV32 to the isel pattern for ZIP_RV32/UNZIP_RV32. NFC
Craig Topper [Sat, 19 Feb 2022 06:38:13 +0000 (22:38 -0800)]
[RISCV] Add IsRV32 to the isel pattern for ZIP_RV32/UNZIP_RV32. NFC

I think the i32 in the pattern prevents this from matching on RV64,
but using IsRV32 is safer.

Add tests for RV64 to make sure we don't print zip or unzip
because we incorrectly picked ZIP_RV32/UNZIP_RV32.

2 years ago[SelectionDAG][X86] Support f16 in getReciprocalOpName.
Craig Topper [Sat, 19 Feb 2022 05:55:48 +0000 (21:55 -0800)]
[SelectionDAG][X86] Support f16 in getReciprocalOpName.

If the "reciprocal-estimates" attribute is present and it doesn't
contain "all", "none", or "default", we previously crashed on f16
operations.

This patch addes an 'h' suffix' to prevent the crash.

I've added simple tests that just enable the estimate for all
vec-sqrt and one test case that explicitly tests the new 'h' suffix
to override the default steps.

There may be some frontend change needed to, but I haven't checked
that yet.

Reviewed By: pengfei

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

2 years ago[mlir][OpenMP] Added assemblyFormat for ParallelOp
Shraiysh Vaishay [Sat, 19 Feb 2022 04:30:03 +0000 (10:00 +0530)]
[mlir][OpenMP] Added assemblyFormat for ParallelOp

This patch adds assemblyFormat for omp.parallel operation.

Some existing functions have been altered to fit the custom directive
in assemblyFormat. This has led to their callsites to get modified too,
but those will be removed in later patches, when other operations get
their assemblyFormat. All operations were not changed in one patch for
ease of review.

Reviewed By: Mogball

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

2 years ago[instcombine] Add/cleanup attributes in a test
Philip Reames [Sat, 19 Feb 2022 03:01:55 +0000 (19:01 -0800)]
[instcombine] Add/cleanup attributes in a test

2 years ago[instcombine] Cleanup foldAllocaCmp slightly [NFC]
Philip Reames [Sat, 19 Feb 2022 02:49:24 +0000 (18:49 -0800)]
[instcombine] Cleanup foldAllocaCmp slightly [NFC]

2 years ago[SelectionDAG] Fix off by one error in range check in DAGTypeLegalizer::ExpandShiftBy...
Craig Topper [Sat, 19 Feb 2022 01:05:38 +0000 (17:05 -0800)]
[SelectionDAG] Fix off by one error in range check in DAGTypeLegalizer::ExpandShiftByConstant.

The code was considering shifts by an about larger than the number of
bits in the original VT to be out of range. Shifts exactly equal to
the original bit width are also out of range.

I don't know how to test this. DAGCombiner should usually fold this
away. I just noticed while looking for something else in this code. The
llvm-cov report shows that we don't have coverage for out of range shifts here.

Reviewed By: arsenm

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

2 years ago[LoongArch] Fix atomic instructions operands sequence
Weining Lu [Sat, 19 Feb 2022 01:21:02 +0000 (09:21 +0800)]
[LoongArch] Fix atomic instructions operands sequence

According to https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#atomic-memory-access-instructions,
the operands sequence of am* instructions should be "rd, rk, rj"
but not "rd, rj, rk". Sorry for this typo in initial patches.

Reviewed By: xen0n, MaskRay

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

2 years ago[gwp_asan] Add missing <algorithm> include
Gulfem Savrun Yeniceri [Sat, 19 Feb 2022 01:05:38 +0000 (01:05 +0000)]
[gwp_asan] Add missing <algorithm> include

After https://reviews.llvm.org/D119667, <algorithm> is no longer
transitively included from various headers. This patch adds the
<algorithm> include into gwp_asan.

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

2 years ago[scudo] Add missing <algorithm> include
Gulfem Savrun Yeniceri [Sat, 19 Feb 2022 00:59:23 +0000 (00:59 +0000)]
[scudo] Add missing <algorithm> include

After https://reviews.llvm.org/D119667, <algorithm> is no longer
transitively included from various headers. This patch adds the
<algorithm> include into scudo.

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

2 years ago[lld][WebAssembly] Convert a bunch more tests to asm. NFC
Sam Clegg [Thu, 17 Feb 2022 15:06:50 +0000 (07:06 -0800)]
[lld][WebAssembly] Convert a bunch more tests to asm. NFC

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

2 years agoRevert "[SelectionDAG][X86] Support f16 in getReciprocalOpName."
Craig Topper [Fri, 18 Feb 2022 23:39:50 +0000 (15:39 -0800)]
Revert "[SelectionDAG][X86] Support f16 in getReciprocalOpName."

This reverts commit 86b5e256628ae49193ad9962626a73bafeda2883.

This wasn't supposed to be commited yet

2 years ago[SelectionDAGBuilder] Remove LegalTypes=false from a call to getShiftAmountConstant.
Craig Topper [Fri, 18 Feb 2022 23:27:38 +0000 (15:27 -0800)]
[SelectionDAGBuilder] Remove LegalTypes=false from a call to getShiftAmountConstant.

getShiftAmountTy will return MVT::i32 if the shift amount
coming from the target's getScalarShiftAmountTy can't reprsent
all possible values. That should eliminate the need to use the
pointer type which is what we do when LegalTypes is false.

Reviewed By: arsenm

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

2 years ago[SelectionDAG][X86] Support f16 in getReciprocalOpName.
Craig Topper [Fri, 18 Feb 2022 21:06:54 +0000 (13:06 -0800)]
[SelectionDAG][X86] Support f16 in getReciprocalOpName.

If the "reciprocal-estimates" attribute is present and it doesn't
contain "all", "none", or "default", we previously crashed on f16
operations.

This patch addes an 'h' suffix' to prevent the crash.

I've added simple tests that just enable the estimate for all
vec-sqrt and one test case that explicitly tests the new 'h' suffix
to override the default steps.

There may be some frontend change needed to, but I haven't checked
that yet.

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

2 years agoRevert "[instsimplify] Simplify HaveNonOverlappingStorage per review suggestion on...
Philip Reames [Fri, 18 Feb 2022 23:34:56 +0000 (15:34 -0800)]
Revert "[instsimplify] Simplify HaveNonOverlappingStorage per review suggestion on D120133 [NFC]"

This reverts commit 3a6be124cc01191ec52192017791bb04a6c7295a.  This appears to have caused a stage2 build failure: https://lab.llvm.org/buildbot/#/builders/168/builds/4813

Will investigate further on Monday and recommit.

2 years ago[mlir][sparse][pytaco] test with 3-dim tensor and scalar
Aart Bik [Fri, 18 Feb 2022 21:43:56 +0000 (13:43 -0800)]
[mlir][sparse][pytaco] test with 3-dim tensor and scalar

Reviewed By: bixia

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

2 years ago[ELF] Remove .strtab deduplication
Fangrui Song [Fri, 18 Feb 2022 22:54:10 +0000 (14:54 -0800)]
[ELF] Remove .strtab deduplication

D118577: the 0.1~1.1% .strtab size reduction does not justify the 3~6%
link time increase. Just remove it even for -O2. release/14.x
has D118577 and the release note mentioned that this may be removed.

Fix https://github.com/ClangBuiltLinux/linux/issues/1578
caused by D118577 (empty string not in stringMap).

2 years ago[lldb/bindings] Expose the progress reporting machinery to the SWIG interface
Med Ismail Bennani [Fri, 18 Feb 2022 22:11:29 +0000 (14:11 -0800)]
[lldb/bindings] Expose the progress reporting machinery to the SWIG interface

This patch defines the SBDebugger::eBroadcastBitProgress enum in the SWIG
interface and exposes the SBDebugger::{GetProgressFromEvent,GetBroadcaster}
methods as well.

This allows to exercise the API from the script interpreter using python.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[memprof] Remove packed qualifier for MemprofRecord::Frame.
Snehasish Kumar [Fri, 18 Feb 2022 18:35:40 +0000 (10:35 -0800)]
[memprof] Remove packed qualifier for MemprofRecord::Frame.

Now that we use dedicated serialize and deserialize methods in order to
ensure consistency across big and small endian systems. The packed
qualifier on the Frame struct can be removed.

Reviewed By: davidxl, tejohnson

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

2 years ago[AArch64][GlobalISel] Constrain the right MOs when lowering calls.
Ahmed Bougacha [Fri, 18 Feb 2022 21:10:42 +0000 (13:10 -0800)]
[AArch64][GlobalISel] Constrain the right MOs when lowering calls.

This was constraining the stale Info.Callee MO instead of the one we
copied into the MI.
In addition, with c8b8c8e989e, when there's an attachedcall, the
Callee is at position 1 rather than 0.

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

2 years ago[mlir][sparse] provide more types for external to/from MLIR routines
Aart Bik [Fri, 18 Feb 2022 20:06:28 +0000 (12:06 -0800)]
[mlir][sparse] provide more types for external to/from MLIR routines

These routines will need to be specialized a lot more based on value types,
index types, pointer types, and permutation/dimension ordering. This is a
careful first step, providing some functionality needed in PyTACO bridge.

Reviewed By: bixia

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

2 years agoAdd a new reflection section for multi-payload enum mask information
Shubham Sandeep Rastogi [Fri, 18 Feb 2022 20:42:56 +0000 (12:42 -0800)]
Add a new reflection section for multi-payload enum mask information

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

2 years ago[MemorySSA] Clear VisitedBlocks per query
Whitney Tsang [Fri, 18 Feb 2022 20:34:24 +0000 (15:34 -0500)]
[MemorySSA] Clear VisitedBlocks per query

The problem can be shown from the newly added test case.
There are two invocations to MemorySSAUpdater::moveToPlace, and the
internal data structure VisitedBlocks is changed in the first
invocation, and reused in the second invocation. In between the two
invocations, there is a change to the CFG, and MemorySSAUpdater is
notified about the change.

Reviewed By: asbirlea

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

2 years ago[ELF][test] Avoid non-portable |& in notest.s
Fangrui Song [Fri, 18 Feb 2022 20:32:27 +0000 (12:32 -0800)]
[ELF][test] Avoid non-portable |& in notest.s

2 years ago[clangd] Use `ObjCProtocolLoc` for generalized ObjC protocol support
David Goldman [Wed, 9 Feb 2022 20:01:17 +0000 (15:01 -0500)]
[clangd] Use `ObjCProtocolLoc` for generalized ObjC protocol support

This removes clangd's existing workaround in favor of proper support
via the newly added `ObjCProtocolLoc`. This improves support by
allowing clangd to properly identify which protocol is selected
now that `ObjCProtocolLoc` gets its own ASTNode.

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

2 years ago[clang] Add `ObjCProtocolLoc` to represent protocol references
David Goldman [Wed, 9 Feb 2022 19:50:26 +0000 (14:50 -0500)]
[clang] Add `ObjCProtocolLoc` to represent protocol references

Add `ObjCProtocolLoc` which behaves like `TypeLoc` but for
`ObjCProtocolDecl` references.

RecursiveASTVisitor now synthesizes `ObjCProtocolLoc` during traversal
and the `ObjCProtocolLoc` can be stored in a `DynTypedNode`.

In a follow up patch, I'll update clangd to make use of this
to properly support protocol references for hover + goto definition.

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

2 years ago[ADT] Have ArrayRef::copy() return a MutableArrayRef
Jez Ng [Fri, 18 Feb 2022 19:56:16 +0000 (14:56 -0500)]
[ADT] Have ArrayRef::copy() return a MutableArrayRef

The allocated memory itself is mutable, so let's expose that to the
caller. LLD has a use case for this.

Reviewed By: MaskRay, #lld-macho

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

2 years ago[mlir][OpenMP] Added assemblyformat for TargetOp
Shraiysh Vaishay [Fri, 18 Feb 2022 19:44:01 +0000 (01:14 +0530)]
[mlir][OpenMP] Added assemblyformat for TargetOp

This patch removes custom parser/printer for `omp.target` and adds
assemblyformat.

Reviewed By: rriddle

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

2 years ago[mlir][OpenMP] Remove clauses that are not being handled
Shraiysh Vaishay [Fri, 18 Feb 2022 17:47:34 +0000 (23:17 +0530)]
[mlir][OpenMP] Remove clauses that are not being handled

This patch removes the following clauses from OpenMP Dialect:

 - private
 - firstprivate
 - lastprivate
 - shared
 - default
 - copyin
 - copyprivate

The privatization clauses are being handled in the flang frontend. The
data copying clauses are not being handled anywhere for now. Once
we have a better picture of how to handle these clauses in OpenMP
Dialect, we can add these. For the time being, removing unneeded
clauses.

For detailed discussion about this refer to [[ https://discourse.llvm.org/t/rfc-privatisation-in-openmp-dialect/3526 | Privatisation in OpenMP dialect ]]

Reviewed By: kiranchandramohan, clementval

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

2 years ago[instsimplify] Simplify HaveNonOverlappingStorage per review suggestion on D120133...
Philip Reames [Fri, 18 Feb 2022 19:32:28 +0000 (11:32 -0800)]
[instsimplify] Simplify HaveNonOverlappingStorage per review suggestion on D120133 [NFC]

2 years ago[ELF] Change (NOLOAD) section type mismatch error to warning
Fangrui Song [Fri, 18 Feb 2022 19:20:36 +0000 (11:20 -0800)]
[ELF] Change (NOLOAD) section type mismatch error to warning

Making a (NOLOAD) section SHT_PROGBITS is fishy (the user may expect all-zero
content, but the linker does not check that), but some projects (e.g. Linux
kernel https://github.com/ClangBuiltLinux/linux/issues/1597) traditionally rely
on the behavior. Issue a warning to not break them.

2 years ago[ifs] Add --exclude flag
Alex Brachet [Fri, 18 Feb 2022 19:13:55 +0000 (19:13 +0000)]
[ifs] Add --exclude flag

Use to remove certain symbols which match the glob pattern. Can be used with --strip-undefined

Reviewed By: haowei, mcgrathr

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

2 years ago[instsimplify] Assume storage for byval args doesn't overlap allocas, globals, or...
Philip Reames [Fri, 18 Feb 2022 19:06:54 +0000 (11:06 -0800)]
[instsimplify] Assume storage for byval args doesn't overlap allocas, globals, or other byval args

This allows us to discharge many pointer comparisons based on byval arguments.

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

2 years ago[mlir][Presburger] Introduce Domain and Range identifiers in PresburgerSpace
Groverkss [Fri, 18 Feb 2022 18:54:18 +0000 (00:24 +0530)]
[mlir][Presburger] Introduce Domain and Range identifiers in PresburgerSpace

This patch introducing seperating dimensions into two types: Domain and Range.
This allows building relations over PresburgerSpace.

This patch is part of a series of patches to introduce relations in Presburger
library.

Reviewed By: arjunp

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

2 years ago[SLP] Address post commit comment from 2e50760
Philip Reames [Fri, 18 Feb 2022 18:57:08 +0000 (10:57 -0800)]
[SLP] Address post commit comment from 2e50760

2 years ago[docs][NewPM] Remove buildDefaultAAPipeline() in example
Arthur Eubanks [Fri, 18 Feb 2022 18:41:41 +0000 (10:41 -0800)]
[docs][NewPM] Remove buildDefaultAAPipeline() in example

With D113210 we're already using the default AA pipeline by default.

2 years ago[InstCombine] visitCallInst - pull out repeated bswap scalar type bitwidth. NFC.
Simon Pilgrim [Fri, 18 Feb 2022 17:33:11 +0000 (17:33 +0000)]
[InstCombine] visitCallInst - pull out repeated bswap scalar type bitwidth. NFC.

2 years ago[clangd] getHover - pass FormatStyle argument by const reference
Simon Pilgrim [Fri, 18 Feb 2022 17:27:32 +0000 (17:27 +0000)]
[clangd] getHover - pass FormatStyle argument by const reference

Reported by coverity

2 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Fri, 18 Feb 2022 17:16:48 +0000 (17:16 +0000)]
Fix Wdocumentation unknown parameter warning

2 years ago[libc++] Replace _LIBCPP_INLINE_VISIBILITY with _LIBCPP_HIDE_FROM_ABI in __filesystem...
Nikolas Klauser [Fri, 18 Feb 2022 17:23:51 +0000 (18:23 +0100)]
[libc++] Replace _LIBCPP_INLINE_VISIBILITY with _LIBCPP_HIDE_FROM_ABI in __filesystem/operations.h

2 years ago[lld-macho] Improve hiding of unnamed_addr symbols
Jez Ng [Fri, 18 Feb 2022 17:03:11 +0000 (12:03 -0500)]
[lld-macho] Improve hiding of unnamed_addr symbols

Symbols for which `canBeOmittedFromSymbolTable()` is true should be
treated as private externs. This diff tries to do that by unsetting the
ExportDynamic bit. It seems to mostly work with the FullLTO backend, but
with the ThinLTO backend, the `local_unnamed_addr` symbols still fail to
be properly hidden. Nonetheless, this is a step in the right direction.

I've documented all the remaining differences between our behavior and
LD64's in the lto-internalized-unnamed-addr.ll test.

See also https://discourse.llvm.org/t/mach-o-lto-handling-of-linkonce-odr-unnamed-addr/60015

Reviewed By: #lld-macho, thevinster

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

2 years ago[dsymutil] Make verification test resilient against output ordering
Jonas Devlieghere [Fri, 18 Feb 2022 17:05:00 +0000 (09:05 -0800)]
[dsymutil] Make verification test resilient against output ordering

I didn't mean the checks for QUIET-OUTPUT-FAIL, QUIET-INPUT-FAIL and
VERBOSE-INPUT-FAIL to have any specific ordering.

2 years ago[lldb] Default initialize CommandOptions fields (NFC)
Jonas Devlieghere [Fri, 18 Feb 2022 04:51:01 +0000 (20:51 -0800)]
[lldb] Default initialize CommandOptions fields (NFC)

Make sure all fields are default initialized to the same values.

2 years ago[clangd] Tweak --query-driver to ignore slash direction on windows
Sam McCall [Fri, 18 Feb 2022 12:28:16 +0000 (13:28 +0100)]
[clangd] Tweak --query-driver to ignore slash direction on windows

See https://github.com/clangd/clangd/issues/1022

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

2 years ago[demangler][NFC] Reformatting
Nathan Sidwell [Fri, 18 Feb 2022 12:05:06 +0000 (04:05 -0800)]
[demangler][NFC] Reformatting

The linter complains about the formatting in subsequent changes.
Fixing that now.

Reviewed By: iains

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

2 years ago[SDAG] fold sub-of-shift to add-of-shift
Sanjay Patel [Fri, 18 Feb 2022 16:43:03 +0000 (11:43 -0500)]
[SDAG] fold sub-of-shift to add-of-shift

This fold is done in IR:
https://alive2.llvm.org/ce/z/jWyFrP

There is an x86 test that shows an improvement
from the added flexibility of using add (commutative).

The other diffs are presumed neutral.

Note that this could also be folded to an 'xor',
but I'm not sure if that would be universally better
(eg, x86 can convert adds more easily into LEA).

This helps prevent regressions from a potential fold for
issue #53829.

2 years ago[instsimplify] Clarify assumptions about disjoint memory regions [NFC]
Philip Reames [Fri, 18 Feb 2022 16:51:18 +0000 (08:51 -0800)]
[instsimplify] Clarify assumptions about disjoint memory regions [NFC]

2 years ago[instsimplify] Add a comment hinting how compares involving two globals are handled...
Philip Reames [Fri, 18 Feb 2022 16:40:58 +0000 (08:40 -0800)]
[instsimplify] Add a comment hinting how compares involving two globals are handled [NFC]

2 years ago[lldb] Add llvm_unreachable in RichManglingContext
Dave Lee [Mon, 14 Feb 2022 18:11:29 +0000 (10:11 -0800)]
[lldb] Add llvm_unreachable in RichManglingContext

Add `llvm_unreachable` to prevent warnings/errors in gcc and msvc.

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

2 years ago[instsimplify] Add a couple more pointer compare folding tests [NFC]
Philip Reames [Fri, 18 Feb 2022 16:18:26 +0000 (08:18 -0800)]
[instsimplify] Add a couple more pointer compare folding tests [NFC]

2 years ago[CodeGen] Remove unneeded regex escaping in FileCheck patterns. NFC.
Jay Foad [Fri, 14 Jan 2022 11:03:21 +0000 (11:03 +0000)]
[CodeGen] Remove unneeded regex escaping in FileCheck patterns. NFC.

Take advantage of D117117 to simplify all {{\[}} to [ and {{\]}} to ].

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

2 years ago[OpenMP][libomptarget] Delay restore of shadow pointers in structs to after H2D memor...
Carlo Bertolli [Fri, 18 Feb 2022 15:55:49 +0000 (09:55 -0600)]
[OpenMP][libomptarget] Delay restore of shadow pointers in structs to after H2D memory copies are completed

When using asynchronous plugin calls, shadow pointer restore could happen before the D2H copy for the entire struct has completed, effectively leaving a device pointer in a host struct.
This patch fixes the problem by delaying restore's to after a synchronization happens (target regions) and by calling early synchronization (target update).

Reviewed By: jdoerfert

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

2 years ago[MLIR][OpenMP][SCF] Mark parallel regions as allocation scopes
William S. Moses [Mon, 14 Feb 2022 18:48:04 +0000 (13:48 -0500)]
[MLIR][OpenMP][SCF] Mark parallel regions as allocation scopes

MLIR has the notion of allocation scopes which specify that stack allocations (e.g. memref.alloca, llvm.alloca) should be freed or equivalently aren't available at the end of the corresponding region.
Currently neither OpenMP parallel nor SCF parallel regions have the notion of such a scope.

This clearly makes sense for an OpenMP parallel as this is implemented in with a new function which outlines the region, and clearly any allocations in that newly outlined function have a lifetime that ends at the return of the function, by definition.

While SCF.parallel doesn't have a guaranteed runtime which it is implemented with, this similarly makes sense for SCF.parallel since otherwise an allocation within an SCF.parallel will needlessly continue to allocate stack memory that isn't cleaned up until the function (or other allocation scope op) which contains the SCF.parallel returns. This means that it is impossible to represent thread or iteration-local memory without causing a stack blow-up. In the case that this stack-blow-up behavior is intended, this can be equivalently represented with an allocation outside of the SCF.parallel with a size equal to the number of iterations.

Reviewed By: ftynse

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

2 years ago[instsimplify] Add pointer compare tests for byval args and globals
Philip Reames [Fri, 18 Feb 2022 15:50:57 +0000 (07:50 -0800)]
[instsimplify] Add pointer compare tests for byval args and globals

2 years ago[instsimplify] Factor out a helper for alloca bounds checking [NFC]
Philip Reames [Fri, 18 Feb 2022 15:39:25 +0000 (07:39 -0800)]
[instsimplify] Factor out a helper for alloca bounds checking [NFC]

At the moment, this just groups comments with a reasonably named predicate, but I plan to add other cases to this in the near future.

2 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Fri, 18 Feb 2022 15:37:49 +0000 (15:37 +0000)]
Fix Wdocumentation unknown parameter warning

2 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Fri, 18 Feb 2022 15:37:23 +0000 (15:37 +0000)]
Fix Wdocumentation unknown parameter warning

2 years agoFix Wdocumentation unknown parameter warning
Simon Pilgrim [Fri, 18 Feb 2022 15:36:55 +0000 (15:36 +0000)]
Fix Wdocumentation unknown parameter warning

2 years ago[Clang][OpenMP][Sema] Remove support for floating point values in atomic compare
Shilei Tian [Fri, 18 Feb 2022 15:24:23 +0000 (10:24 -0500)]
[Clang][OpenMP][Sema] Remove support for floating point values in atomic compare

This is a follow-up patch of D119378.

Reviewed By: ABataev

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

2 years ago[libc][automemcpy] Discard aggrated samples from JSON
Guillaume Chatelet [Thu, 17 Feb 2022 15:29:43 +0000 (15:29 +0000)]
[libc][automemcpy] Discard aggrated samples from JSON

The benchmark framework synthesizes fake "aggregate" Samples representing mean, median and cv.
We're only interested in "iteration" samples.

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

2 years ago[Clang][OpenMP] Add support for compare capture in parser
Shilei Tian [Fri, 18 Feb 2022 15:23:41 +0000 (10:23 -0500)]
[Clang][OpenMP] Add support for compare capture in parser

This patch adds the support for `atomic compare capture` in parser and part of
sema. We don't create an AST node for this because the spec doesn't say `compare`
and `capture` clauses should be used tightly, so we cannot look one more token
ahead in the parser.

Reviewed By: ABataev

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

2 years ago[gn build] Port 57baa14d7442
LLVM GN Syncbot [Fri, 18 Feb 2022 15:11:13 +0000 (15:11 +0000)]
[gn build] Port 57baa14d7442

2 years ago[AMDGPU] Rename AMDGPUCFGStructurizer to R600MachineCFGStructurizer
Jay Foad [Fri, 18 Feb 2022 14:04:19 +0000 (14:04 +0000)]
[AMDGPU] Rename AMDGPUCFGStructurizer to R600MachineCFGStructurizer

Previously the name of the class (AMDGPUCFGStructurizer) did not
match the name of the file (AMDILCFGStructurizer).

Standardize on the name R600MachineCFGStructurizer by analogy with
AMDGPUMachineCFGStructurizer.

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

2 years agoRevert rGc24e197aaad5333717a27f6e4346f97da84821ed "[clangd] getHover - pass FormatSty...
Simon Pilgrim [Fri, 18 Feb 2022 14:59:57 +0000 (14:59 +0000)]
Revert rGc24e197aaad5333717a27f6e4346f97da84821ed "[clangd] getHover - pass FormatStyle argument by const reference"

There are a number of buildbot build failures on non MSVC compilers

2 years ago[flang] Lower basic binary operation for scalars
Valentin Clement [Fri, 18 Feb 2022 14:49:53 +0000 (15:49 +0100)]
[flang] Lower basic binary operation for scalars

Lower simple binary operation (+, -, *, /) for scalars.

This patch is part of the upstreaming effort from fir-dev branch.

Depends on D120058

Reviewed By: PeteSteinfeld

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

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[clangd] getHover - pass FormatStyle argument by const reference
Simon Pilgrim [Fri, 18 Feb 2022 14:21:07 +0000 (14:21 +0000)]
[clangd] getHover - pass FormatStyle argument by const reference

Reported by coverity

2 years ago[ConstraintElimination] Remove ConstraintListTy (NFCI).
Florian Hahn [Fri, 18 Feb 2022 14:33:58 +0000 (14:33 +0000)]
[ConstraintElimination] Remove ConstraintListTy (NFCI).

This patch simplifies constraint handling by removing the
ConstraintListTy wrapper struct and moving the Preconditions directly
into ConstraintTy. This reduces the amount of memory needed for managing
constraints.

The only use case for ConstraintListTy was adding 2 constraints to model
ICMP_EQ conditions. But this can be handled by adding an IsEq flag. When
adding an equality constraint, we need to add the constraint and the
inverted constraint.

2 years ago[mlir][ODS] Infer return types if the operands are variadic but the results are not
Benjamin Kramer [Fri, 18 Feb 2022 13:40:11 +0000 (14:40 +0100)]
[mlir][ODS] Infer return types if the operands are variadic but the results are not

Clean up code that worked around this limitation.

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

2 years agoLambdas are not necessarily locals. This resolves DR48250.
David Stone [Fri, 18 Feb 2022 13:54:33 +0000 (05:54 -0800)]
Lambdas are not necessarily locals. This resolves DR48250.

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

2 years ago[AMDGPU][NFC] Fix typos
Sebastian Neubauer [Fri, 18 Feb 2022 13:57:21 +0000 (14:57 +0100)]
[AMDGPU][NFC] Fix typos

Fix some typos in the amdgpu backend.

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

2 years ago[ConstraintSystem] Pass ArrayRef instead of full small vector (NFC).
Florian Hahn [Wed, 16 Feb 2022 14:35:46 +0000 (14:35 +0000)]
[ConstraintSystem] Pass ArrayRef instead of full small vector (NFC).

This makes the called functions independent of the container type.

2 years ago[AMDGPU] Fix kill flag on overlapping sgpr copy
Sebastian Neubauer [Thu, 17 Feb 2022 12:33:07 +0000 (13:33 +0100)]
[AMDGPU] Fix kill flag on overlapping sgpr copy

Same as on vgpr copies, we cannot kill the source register if it
overlaps with the destination register. Otherwise, the kill of the
source register will also count as a kill for the destination register.

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

2 years ago[OpenMP] Add an option to limit shared memory usage in OpenMPOpt
Joseph Huber [Thu, 17 Feb 2022 20:48:12 +0000 (15:48 -0500)]
[OpenMP] Add an option to limit shared memory usage in OpenMPOpt

One of the optimizations performed in OpenMPOpt pushes globalized
variables to static shared memory. This is preferable to keeping the
runtime call in all cases, however if too many variables are pushed to
hared memory the kernel will crash. Since this is an optimization and
not something the user specified explicitly, there should be an option
to limit this optimization in those cases. This path introduces the
`-openmp-opt-shared-limit=` option to limit the amount of bytes that
will be placed in shared memory from HeapToShared.

Reviewed By: jdoerfert

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

2 years ago[OpenMP] Add flag for disabling thread state in runtime
Joseph Huber [Fri, 18 Feb 2022 00:09:46 +0000 (19:09 -0500)]
[OpenMP] Add flag for disabling thread state in runtime

The runtime uses thread state values to indicate when we use an ICV or
are in nested parallelism. This is done for OpenMP correctness, but it
not needed in the majority of cases. The new flag added is
`-fopenmp-assume-no-thread-state`.

Reviewed By: jdoerfert

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

2 years ago[X86] Add test cases for sub with select.
Luo, Yuanke [Fri, 18 Feb 2022 12:52:06 +0000 (20:52 +0800)]
[X86] Add test cases for sub with select.

2 years ago[SLP]Fix vectorization of the alternate cmp instruction with swapped predicates.
Alexey Bataev [Tue, 15 Feb 2022 15:50:28 +0000 (07:50 -0800)]
[SLP]Fix vectorization of the alternate cmp instruction with swapped predicates.

If the alternate cmp instruction is a swapped predicate of the main cmp
instruction, need to generate alternate instruction, not the one with
the swapped predicate. Also, the lane with the alternate opcode should
be selected only, if the corresponding operands are not compatible.

Correctness confirmed:
https://alive2.llvm.org/ce/z/94BG66

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

2 years ago[VE] Enable v256 fcmp true|false tests
Simon Moll [Fri, 18 Feb 2022 12:26:08 +0000 (13:26 +0100)]
[VE] Enable v256 fcmp true|false tests

The broadcast patterns for all-true|false masks are available now.
Enable the true|fast fcmp predicate tests that use them.

Reviewed By: kaz7

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

2 years ago[VE] Fix vmp0 subregister mapping
Simon Moll [Fri, 18 Feb 2022 12:17:03 +0000 (13:17 +0100)]
[VE] Fix vmp0 subregister mapping

vmp0 is the all-ones v512i1 register and does not break down into
subregisters.

Reviewed By: kaz7

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

2 years ago[mlir][Vector] Add return type inference for multi_reduction
Benjamin Kramer [Fri, 18 Feb 2022 11:51:43 +0000 (12:51 +0100)]
[mlir][Vector] Add return type inference for multi_reduction

This subsumes the builder and verifier.