platform/upstream/llvm.git
2 years ago[AArch64] Lower multiplication by a negative constant to shl+sub+shl
zhongyunde [Sat, 1 Oct 2022 07:36:46 +0000 (15:36 +0800)]
[AArch64] Lower multiplication by a negative constant to shl+sub+shl

Change the costmodel to lower a = b * C where C = -(2^n - 2^m) to
            lsl     w8, w0, m
            sub     w0, w8, w0, lsl n
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D134934

2 years ago[gn build] Port 099384dcea49
LLVM GN Syncbot [Sat, 1 Oct 2022 13:18:43 +0000 (13:18 +0000)]
[gn build] Port 099384dcea49

2 years ago[libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction)
Nikolas Klauser [Fri, 30 Sep 2022 09:42:25 +0000 (11:42 +0200)]
[libc++] Implement P0591R4 (Utility functions to implement uses-allocator construction)

Reviewed By: ldionne, #libc, huixie90

Spies: huixie90, libcxx-commits, mgorny

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

2 years ago[lldb] Fix warnings about unused variables when building without asserts. NFC.
Martin Storsjö [Sat, 1 Oct 2022 11:27:48 +0000 (14:27 +0300)]
[lldb] Fix warnings about unused variables when building without asserts. NFC.

2 years ago[ARM] Support all versions of AND, ORR, EOR and BIC in optimizeCompareInstr
Filipp Zhinkin [Fri, 12 Aug 2022 16:09:03 +0000 (19:09 +0300)]
[ARM] Support all versions of AND, ORR, EOR and BIC in optimizeCompareInstr

Combine cmp with zero and all versions of AND, ORR, EOR and BIC instructions into S-suffixed versions.

Related issue: https://github.com/llvm/llvm-project/issues/57122

Reviewed By: efriedma, samtebbs

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

2 years ago[AMDGPU][GFX11] Mitigate VALU mask write hazard
Carl Ritson [Sat, 1 Oct 2022 00:17:42 +0000 (09:17 +0900)]
[AMDGPU][GFX11] Mitigate VALU mask write hazard

VALU use of an SGPR (pair) as mask followed by SALU write to the
same SGPR can cause incorrect execution of subsequent SALU reads
of the SGPR.

Reviewed By: foad, rampitec

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

2 years ago[mlir] Allow DenseElementsAttr to use any shaped type
Jeff Niu [Sat, 1 Oct 2022 00:32:13 +0000 (17:32 -0700)]
[mlir] Allow DenseElementsAttr to use any shaped type

This patch allows the type of DenseElementsAttr to be any shaped type.

Reviewed By: rriddle

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

2 years ago[clang-format] Correctly indent closing brace of compound requires
Emilia Dreamer [Sat, 1 Oct 2022 05:16:45 +0000 (08:16 +0300)]
[clang-format] Correctly indent closing brace of compound requires

When a compound requirement is too long to fit onto a single line, the
braces are split apart onto separate lines, and the contained expression
is indented. However, this indentation would also apply to the closing
brace and the trailing return type requirement thereof.
This was because the indentation level was being restored after all
trailing things were already read

With this change, the initial level of the opening brace is set before
attempting to read any trailing return type requirements

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

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

2 years ago[RISCV] Prevent performCombineVMergeAndVOps from creating cycles in the DAG.
Craig Topper [Sat, 1 Oct 2022 03:01:44 +0000 (20:01 -0700)]
[RISCV] Prevent performCombineVMergeAndVOps from creating cycles in the DAG.

If True has a Chain result, the other operands of the vmerge may
depend on it through that Chain. We need to ensure it isn't a
predecessor of those operands.

Reviewed By: fakepaper56

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

2 years ago[RISCV] Update cost of vector roundeven to match round which uses the same sequence...
Craig Topper [Sat, 1 Oct 2022 03:01:34 +0000 (20:01 -0700)]
[RISCV] Update cost of vector roundeven to match round which uses the same sequence but a different FRM value.

Reviewed By: reames, eopXD

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

2 years ago[MemProf] Update metadata during inlining
Teresa Johnson [Thu, 30 Jun 2022 21:49:44 +0000 (14:49 -0700)]
[MemProf] Update metadata during inlining

Update both memprof and callsite metadata to reflect inlined functions.

For callsite metadata this is simply a concatenation of each cloned
call's call stack with that of the inlined callsite's.

For memprof metadata, each profiled memory info block (MIB) is either
moved to the cloned allocation call or left on the original allocation
call depending on whether its context matches the newly refined call
stack context on the cloned call. We also reapply context trimming
optimizations based on the refined set of contexts on each of the calls
(cloned and original).

Depends on D128142.

Reviewed By: snehasish

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

2 years ago[VP][RISCV] Add vp.copysign and RISC-V support.
Yeting Kuo [Fri, 30 Sep 2022 02:28:40 +0000 (10:28 +0800)]
[VP][RISCV] Add vp.copysign and RISC-V support.

Reviewed By: craig.topper

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

2 years agoUPdate reference-log-noml.txt as well to adapt for D133902
Matthias Braun [Sat, 1 Oct 2022 01:03:28 +0000 (18:03 -0700)]
UPdate reference-log-noml.txt as well to adapt for D133902

2 years ago[OpenMP] [OMPT] [1/8] Create separate categories for host, device, [no]emi events
Dhruva Chakrabarti [Fri, 30 Sep 2022 04:41:29 +0000 (04:41 +0000)]
[OpenMP] [OMPT] [1/8] Create separate categories for host, device, [no]emi events

In preparation for OMPT target changes, create separate categories of events that will be used by OMPT target support.

Split up existing macro FOREACH_OMPT_EVENT into new ones. There is no change to the original macro. Created new macros FOREACH_OMPT_HOST_EVENT, FOREACH_OMPT_DEVICE_EVENT, FOREACH_OMPT_NOEMI_EVENT, FOREACH_OMPT_EMI_EVENT, and a few other sub-categories that can be used as required. One such use is in D123974 which uses events selectively.

Patch from John Mellor-Crummey <johnmc@rice.edu>

Reviewed By: dreachem

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

2 years agoAdapt dev-mode-logging.ll test to D133902
Matthias Braun [Sat, 1 Oct 2022 00:45:19 +0000 (17:45 -0700)]
Adapt dev-mode-logging.ll test to D133902

2 years ago[mlir][sparse] Improving error messages for MLIR_SPARSETENSOR_FATAL
wren romano [Fri, 30 Sep 2022 23:55:53 +0000 (16:55 -0700)]
[mlir][sparse] Improving error messages for MLIR_SPARSETENSOR_FATAL

Reviewed By: aartbik

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

2 years agoRevert "[mlgo] Fix tests post D133902"
Mircea Trofin [Sat, 1 Oct 2022 00:30:08 +0000 (17:30 -0700)]
Revert "[mlgo] Fix tests post D133902"

This reverts commit 25d65b545530f7155734a06ef0e5143b4edb8ff9.

There's a more thorough fix in f9317bf0bed0e0f248c18114afa24dcd56d727ae

2 years ago[mlgo] Fix tests post D133902
Mircea Trofin [Sat, 1 Oct 2022 00:26:33 +0000 (17:26 -0700)]
[mlgo] Fix tests post D133902

The breaks were expected, except for the dev-mode-extra-features-logging
one. XFAIL-ing to unblock bots, investigating further.

2 years agoFix tied operands in phi-coalescing.mir test; try to adapt MLRegalloc tests
Matthias Braun [Fri, 30 Sep 2022 23:44:07 +0000 (16:44 -0700)]
Fix tied operands in phi-coalescing.mir test; try to adapt MLRegalloc tests

Fix a test using invalid MLIR using different VRegs for the tied operands
of ADD64rr, which happened to trigger an assertion after my latest
changes.

Also attempting to adjust the MLRegalloc tests to the adjusted regalloc
(though I don't have a 100% working setup for them even without my
changes)

2 years agoRevert "[MemProf] Update metadata during inlining" and preceeding commit
Teresa Johnson [Fri, 30 Sep 2022 23:56:57 +0000 (16:56 -0700)]
Revert "[MemProf] Update metadata during inlining" and preceeding commit

This reverts commit 0d7f3464ce0ba3a97df73e08ee0acd4e33adbe9b and
commit f9403ca41e5f3dab60cd6e5de26eea65dcab01a4. The latter was
"Profile matching and IR annotation for memprof profiles." and was left
from a bad rebase from a commit already pushed upstream.

2 years ago[mlir] Flip Async/GPU/MemRef/OpenACC/OpenMP/PDL dialects to prefixed
River Riddle [Fri, 30 Sep 2022 23:06:29 +0000 (16:06 -0700)]
[mlir] Flip Async/GPU/MemRef/OpenACC/OpenMP/PDL dialects to prefixed

This flips all of the remaining dialects to prefixed except for linalg, which
will be done in a followup.

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

2 years ago[MemProf] Update metadata during inlining
Teresa Johnson [Thu, 30 Jun 2022 22:28:10 +0000 (15:28 -0700)]
[MemProf] Update metadata during inlining

Update both memprof and callsite metadata to reflect inlined functions.

For callsite metadata this is simply a concatenation of each cloned
call's call stack with that of the inlined callsite's.

For memprof metadata, each profiled memory info block (MIB) is either
moved to the cloned allocation call or left on the original allocation
call depending on whether its context matches the newly refined call
stack context on the cloned call. We also reapply context trimming
optimizations based on the refined set of contexts on each of the calls
(cloned and original), via utilities in MemoryProfileInfo.

Depends on D128142.

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

2 years agoProfile matching and IR annotation for memprof profiles.
Teresa Johnson [Thu, 30 Jun 2022 21:49:44 +0000 (14:49 -0700)]
Profile matching and IR annotation for memprof profiles.

See also related RFCs:
RFC: Sanitizer-based Heap Profiler [1]
RFC: A binary serialization format for MemProf [2]
RFC: IR metadata format for MemProf [3]*

* Note that the IR metadata format has changed from the RFC during
implementation, as described in the preceeding patch adding the basic
metadata and verification support.

The matching is performed during the normal PGO annotation phase, to
ensure that the inlines applied in the IR at that point are a subset
of the inlines in the profiled binary and thus reflected in the
profile's call stacks. This is important because the call frames are
associated with functions in the profile based on the inlining in the
symbolized call stacks, and this simplifies locating the subset of
profile data relevant for matching onto each function's IR.

The PGOInstrumentationUse pass is enhanced to perform matching for
whatever combination of memprof and regular PGO profile data exists in
the profile.

Using the utilities introduced in D128854:
The memprof profile data for each context is converted to "cold" or
"notcold" based on parameterized thresholds for size, access count, and
lifetime. The memprof allocation contexts are trimmed to the minimal
amount of context required to uniquely identify whether the context is
cold or not cold. For allocations where all profiled contexts have the
same allocation type, no memprof metadata is attached and instead the
allocation call is directly annotated with an attribute specifying the
alloction type. This is the same attributed that will be applied to
allocation calls once cloned for different contexts, and later used
during LibCall simplification to emit allocation hints [4].

Depends on D128141 and D128854.

[1] https://lists.llvm.org/pipermail/llvm-dev/2020-June/142744.html
[2] https://lists.llvm.org/pipermail/llvm-dev/2021-September/153007.html
[3] https://discourse.llvm.org/t/rfc-ir-metadata-format-for-memprof/59165
[4] https://github.com/google/tcmalloc/commit/ab87cf382dc56784f783f3aaa43d6d0465d5f385

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

2 years ago[mlir][ods] Allow references to the self type
Jeff Niu [Fri, 30 Sep 2022 23:08:01 +0000 (16:08 -0700)]
[mlir][ods] Allow references to the self type

The self type always "bound" since it is provided to the attribute
parser hook. Allow custom directives to reference it.

Reviewed By: rriddle

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

2 years agoX86: Stop assigning register costs for longer encodings.
Matthias Braun [Tue, 16 Aug 2022 17:35:33 +0000 (10:35 -0700)]
X86: Stop assigning register costs for longer encodings.

This stops reporting CostPerUse 1 for `R8`-`R15` and `XMM8`-`XMM31`.
This was previously done because instruction encoding require a REX
prefix when using them resulting in longer instruction encodings. I
found that this regresses the quality of the register allocation as the
costs impose an ordering on eviction candidates. I also feel that there
is a bit of an impedance mismatch as the actual costs occure when
encoding instructions using those registers, but the order of VReg
assignments is not primarily ordered by number of Defs+Uses.

I did extensive measurements with the llvm-test-suite wiht SPEC2006 +
SPEC2017 included, internal services showed similar patterns. Generally
there are a log of improvements but also a lot of regression. But on
average the allocation quality seems to improve at a small code size
regression.

Results for measuring static and dynamic instruction counts:

Dynamic Counts (scaled by execution frequency) / Optimization Remarks:
    Spills+FoldedSpills   -5.6%
    Reloads+FoldedReloads -4.2%
    Copies                -0.1%

Static / LLVM Statistics:
    regalloc.NumSpills    mean -1.6%, geomean -2.8%
    regalloc.NumReloads   mean -1.7%, geomean -3.1%
    size..text            mean +0.4%, geomean +0.4%

Static / LLVM Statistics:
    mean -2.2%, geomean -3.1%) regalloc.NumSpills
    mean -2.6%, geomean -3.9%) regalloc.NumReloads
    mean +0.6%, geomean +0.6%) size..text

Static / LLVM Statistics:
    regalloc.NumSpills   mean -3.0%
    regalloc.NumReloads  mean -3.3%
    size..text           mean +0.3%, geomean +0.3%

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

2 years ago[libc] disable syscall test without fullbuild
Michael Jones [Fri, 30 Sep 2022 22:55:28 +0000 (15:55 -0700)]
[libc] disable syscall test without fullbuild

Our syscall implementation depends on a specific macro that's only
defined in our headers. If we're not using our headers, then the test
doesn't work. I've disabled the test in this case because there's no
point in testing the system libc's syscall implementation.

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

2 years ago[libc] add syscall function
Michael Jones [Thu, 22 Sep 2022 21:39:56 +0000 (14:39 -0700)]
[libc] add syscall function

Add the syscall wrapper function and tests. It's implemented using a
macro to guarantee the minimum number of arguments.

Reviewed By: sivachandra, lntue

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

2 years ago[mlir:OpenMP][NFC] Update OpenMP API to use prefixed accessors
River Riddle [Fri, 30 Sep 2022 21:57:08 +0000 (14:57 -0700)]
[mlir:OpenMP][NFC] Update OpenMP API to use prefixed accessors

This doesn't flip the switch for prefix generation yet, that'll be
done in a followup.

2 years ago[mlir:OpenACC][NFC] Update OpenACC API to use prefixed accessors
River Riddle [Fri, 30 Sep 2022 19:50:57 +0000 (12:50 -0700)]
[mlir:OpenACC][NFC] Update OpenACC API to use prefixed accessors

This doesn't flip the switch for prefix generation yet, that'll be
done in a followup.

2 years ago[mlir:PDL][NFC] Update PDL API to use prefixed accessors
River Riddle [Fri, 30 Sep 2022 19:38:37 +0000 (12:38 -0700)]
[mlir:PDL][NFC] Update PDL API to use prefixed accessors

This doesn't flip the switch for prefix generation yet, that'll be
done in a followup.

2 years ago[mlir:GPU][NFC] Update GPU API to use prefixed accessors
River Riddle [Fri, 30 Sep 2022 19:30:41 +0000 (12:30 -0700)]
[mlir:GPU][NFC] Update GPU API to use prefixed accessors

This doesn't flip the switch for prefix generation yet, that'll be
done in a followup.

2 years ago[mlir:Async][NFC] Update Async API to use prefixed accessors
River Riddle [Fri, 30 Sep 2022 02:00:10 +0000 (19:00 -0700)]
[mlir:Async][NFC] Update Async API to use prefixed accessors

This doesn't flip the switch for prefix generation yet, that'll be
done in a followup.

2 years ago[mlir][sparse] Address style nit in documentation
wren romano [Fri, 30 Sep 2022 19:41:08 +0000 (12:41 -0700)]
[mlir][sparse] Address style nit in documentation

Reviewed By: aartbik, Peiming

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

2 years ago[clang-tidy] Skip variadic ctors in modernize-use-equals-default
Alexander Shaposhnikov [Fri, 30 Sep 2022 22:16:28 +0000 (22:16 +0000)]
[clang-tidy] Skip variadic ctors in modernize-use-equals-default

Skip variadic constructors in modernize-use-equals-default
(such constructors cannot be explicitly defaulted).

Test plan: ninja check-all

Differential revision: https://reviews.llvm.org/D134929

2 years ago[lld-macho] Do not error out on dead stripped duplicate symbols
Vincent Lee [Wed, 28 Sep 2022 06:42:47 +0000 (23:42 -0700)]
[lld-macho] Do not error out on dead stripped duplicate symbols

Builds that error out on duplicate symbols can still succeed if the symbols
will be dead stripped. Currently, this is the current behavior in ld64.
https://github.com/apple-oss-distributions/ld64/blob/main/src/ld/Resolver.cpp#L2018.
In order to provide an easier to path for adoption, introduce a new flag that will
retain compatibility with ld64's behavior (similar to `--deduplicate-literals`). This is
turned off by default since we do not encourage this behavior in the linker.

Reviewed By: #lld-macho, thakis, int3

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

2 years ago[mlir] Fix warnings
Kazu Hirata [Fri, 30 Sep 2022 22:00:56 +0000 (15:00 -0700)]
[mlir] Fix warnings

This patch fixes:

  mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:1348:31: error: comparison
  of integers of different signs: 'size_t' (aka 'unsigned long') and
  'int64_t' (aka 'long') [-Werror,-Wsign-compare]

  mlir/lib/ExecutionEngine/SparseTensor/File.cpp:110:3: error: default
  label in switch which covers all enumeration values
  [-Werror,-Wcovered-switch-default]

2 years ago[mlir][sparse] Add rewriting rules for concatente using foreach operator.
Peiming Liu [Thu, 29 Sep 2022 18:11:56 +0000 (18:11 +0000)]
[mlir][sparse] Add rewriting rules for concatente using foreach operator.

Reviewed By: aartbik

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

2 years ago[mlir][sparse] Add new utility class to help generates loop structures over sparse...
Peiming Liu [Tue, 27 Sep 2022 22:20:10 +0000 (22:20 +0000)]
[mlir][sparse] Add new utility class to help generates loop structures over sparse tensors; Implement foreach operator.

Reviewed By: aartbik

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

2 years ago[gn build] Port 5b26f4f04222
LLVM GN Syncbot [Fri, 30 Sep 2022 21:31:59 +0000 (21:31 +0000)]
[gn build] Port 5b26f4f04222

2 years agoReland "[MLGO] ML Regalloc Priority Advisor"
Eric Wang [Fri, 30 Sep 2022 19:43:09 +0000 (14:43 -0500)]
Reland "[MLGO] ML Regalloc Priority Advisor"

This relands commit 8f4f26ba5bd04f7b335836021e5e63b4236c0305, which was reverted in 91c96a806cae58539e40c9e443a08bde91ccc91e because of Buildbot failures. The previous model test is not compatible with tflite. e.g. https://lab.llvm.org/buildbot/#/builders/6/builds/14041

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

2 years ago[SCCP] remove unnecessary check for constant when folding sext->zext
Sanjay Patel [Fri, 30 Sep 2022 20:52:50 +0000 (16:52 -0400)]
[SCCP] remove unnecessary check for constant when folding sext->zext

I'm not sure how to test this because we seem to constant-fold
all examples already. We changed this code to use the common
isNonNegative() helper, so it should not be necessary to avoid
a constant. This makes the code uniform for all transforms.

2 years ago[SCCP] add a code comment about sitofp -> uitofp; NFC
Sanjay Patel [Fri, 30 Sep 2022 20:40:10 +0000 (16:40 -0400)]
[SCCP] add a code comment about sitofp -> uitofp; NFC

D134975 would have added this fold, but we decided it's
not worth doing without some evidence of benefit.

2 years ago[libc++] Fix ADL for `make_error_{code,condition}`
Jonathan Wakely [Fri, 30 Sep 2022 13:22:01 +0000 (09:22 -0400)]
[libc++] Fix ADL for `make_error_{code,condition}`

Implement LWG 3629, by making lookup for make_error_code and
make_error_condition only consider names found by ADL. This is achieved
by adding a block scope using-declaration for a function that will be
found by unqualified lookup, preventing unqualified lookup from
continuing to enclosing scopes (the class scope, then enclosing
namespaces). The function named by the using declaration is not
viable, so overload resolution must select a candidate found by ADL.

This fixes https://github.com/llvm/llvm-project/issues/57614

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

2 years ago[mlir][sparse] Renaming x-macros for better hygiene
wren romano [Fri, 30 Sep 2022 20:01:18 +0000 (13:01 -0700)]
[mlir][sparse] Renaming x-macros for better hygiene

Now that mlir_sparsetensor_utils is a public library, this differential renames the x-macros to help avoid namespace pollution issues.

Reviewed By: aartbik, Peiming

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

2 years ago[mlir][vector] Fix double rank reducing folding bug
Lei Zhang [Fri, 30 Sep 2022 20:46:34 +0000 (16:46 -0400)]
[mlir][vector] Fix double rank reducing folding bug

In https://reviews.llvm.org/D133883, we changed the
`FoldExtractSliceIntoTransferRead` pattern from requiring
full identity map to minor identity map. This effectively
allows rank reducing `vector.transfer_read` ops. However,
the logic for checking `tensor.extract_slice` rank reducing
still looks at the vector rank, which now could be smaller
than the `tensor.extract_slice`'s output tensor rank.
It ends up we can have incorrect index cacluation after
folding due to this double rank reducing behavior.

Reviewed By: ThomasRaoux

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

2 years agogn build: Fix formatting in gen_version_script.gni.
Peter Collingbourne [Fri, 30 Sep 2022 20:47:08 +0000 (13:47 -0700)]
gn build: Fix formatting in gen_version_script.gni.

2 years agogn build: Speculative Windows build fix.
Peter Collingbourne [Fri, 30 Sep 2022 20:45:40 +0000 (13:45 -0700)]
gn build: Speculative Windows build fix.

2 years agogn build: Re-add preinit file to static ubsan library.
Peter Collingbourne [Fri, 30 Sep 2022 20:35:52 +0000 (13:35 -0700)]
gn build: Re-add preinit file to static ubsan library.

2 years ago[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI
Petr Hosek [Thu, 29 Sep 2022 07:53:06 +0000 (07:53 +0000)]
[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI

When in-tree libcxx is selected as the sanitizer C++ ABI, use
libcxx-abi-* targets rather than libcxxabi and libunwind directly.

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

2 years ago[mlir][sparse] SparseTensorUtils post-refactoring cleanup
wren romano [Fri, 30 Sep 2022 19:37:40 +0000 (12:37 -0700)]
[mlir][sparse] SparseTensorUtils post-refactoring cleanup

This differential corrects a few minor rebasing errors from the recent slew of differentials for factoring out the mlir_sparsetensor_utils library.

Reviewed By: aartbik, Peiming

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

2 years ago[AArch64] Unit test for trunc lowering from i64 to i8
Nilanjana Basu [Fri, 30 Sep 2022 20:02:49 +0000 (13:02 -0700)]
[AArch64] Unit test for trunc lowering from i64 to i8

Reviewed By: fhahn

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

2 years ago[AMDGPU] Fix tests in f6a2e6afed2
Jeffrey Byrnes [Fri, 30 Sep 2022 19:53:08 +0000 (12:53 -0700)]
[AMDGPU] Fix tests in f6a2e6afed2

2 years agoUnittest to skip padding between buildid and filenames.
Sriraman Tallam [Fri, 30 Sep 2022 19:41:45 +0000 (12:41 -0700)]
Unittest to skip padding between buildid and filenames.

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

2 years ago[AMDGPU] Precommit test case for D133584
Jeffrey Byrnes [Fri, 30 Sep 2022 19:18:01 +0000 (12:18 -0700)]
[AMDGPU] Precommit test case for D133584

2 years ago[LiveRangeEdit] Add a statistic variable for rematerialization
Guozhi Wei [Fri, 30 Sep 2022 19:39:51 +0000 (19:39 +0000)]
[LiveRangeEdit] Add a statistic variable for rematerialization

Add a statistic variable for rematerialization.

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

2 years agoAArch64: Don't use RETA[AB] when ShadowCallStack is enabled.
Peter Collingbourne [Fri, 30 Sep 2022 01:22:51 +0000 (18:22 -0700)]
AArch64: Don't use RETA[AB] when ShadowCallStack is enabled.

When returning from a function with both SCS and PAC-RET enabled, we need to
authenticate the return address from the stack and then load from the SCS,
but this was happening in the reverse order when RETA[AB] were being used.
Fix it by disabling the use of RETA[AB] when SCS is enabled.

Fixes pr58072.

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

2 years agogn build: Move bfloat16 source files to x86-specific block.
Peter Collingbourne [Fri, 30 Sep 2022 05:02:16 +0000 (22:02 -0700)]
gn build: Move bfloat16 source files to x86-specific block.

bfloat16 is currently only supported by default on x86.

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

2 years agogn build: Add support for building the standalone ubsan runtime as a shared library...
Peter Collingbourne [Fri, 30 Sep 2022 04:38:54 +0000 (21:38 -0700)]
gn build: Add support for building the standalone ubsan runtime as a shared library on non-Mac.

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

2 years ago[NFC][sanitizer] Simplify symbolizer build script
Vitaly Buka [Fri, 30 Sep 2022 19:22:40 +0000 (12:22 -0700)]
[NFC][sanitizer] Simplify symbolizer build script

This checks are irrelevant with monorepo.

2 years ago[sanitizer] Fix build of 32bit symbolizer
Vitaly Buka [Fri, 30 Sep 2022 19:09:46 +0000 (12:09 -0700)]
[sanitizer] Fix build of 32bit symbolizer

2 years ago[TableGen] Add div bang operator
Michael Maitland [Fri, 16 Sep 2022 00:38:11 +0000 (17:38 -0700)]
[TableGen] Add div bang operator

This patch adds the div bang operator which performs division.

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

2 years ago[libunwind] Fix compile error with CROSS_UNWINDING
Florian Mayer [Fri, 30 Sep 2022 15:46:06 +0000 (08:46 -0700)]
[libunwind] Fix compile error with CROSS_UNWINDING

Reviewed By: #libunwind, MaskRay, mgorny

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

2 years ago[runtimes] Remove all traces of the legacy testing configuration system
Louis Dionne [Thu, 26 May 2022 14:58:28 +0000 (10:58 -0400)]
[runtimes] Remove all traces of the legacy testing configuration system

Now that all jobs have moved over to the new style of Lit configuration,
we can remove all traces of the legacy testing configuration system.
This includes:
- Cache settings that are not honored or useful anymore
- Several CMake options that were only useful in the context of the
  legacy Lit configuration system
- A bunch of Python support code that is not used anymore
- The legacy lit.cfg.in files themselves

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

2 years ago[libc++] Remove unique usage of the en_US locale in a test
Louis Dionne [Thu, 29 Sep 2022 22:15:23 +0000 (18:15 -0400)]
[libc++] Remove unique usage of the en_US locale in a test

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

2 years ago[ConstraintElimination] Simplify check lines in test added in 2812a141.
Florian Hahn [Fri, 30 Sep 2022 18:51:05 +0000 (19:51 +0100)]
[ConstraintElimination] Simplify check lines in test added in 2812a141.

The CHECK lines in the test are too specific and cause mis-matches on
some platforms. Reduce them to make them less fragile.

2 years ago[ConstraintElimination] Add test showing bug in analysis invalidation.
Florian Hahn [Fri, 30 Sep 2022 18:37:58 +0000 (19:37 +0100)]
[ConstraintElimination] Add test showing bug in analysis invalidation.

2 years ago[flang] Remove unused AffineMapAttr from fir.box type
Valentin Clement [Fri, 30 Sep 2022 18:35:25 +0000 (20:35 +0200)]
[flang] Remove unused AffineMapAttr from fir.box type

AffineMapAttr on fir.box type is not used. This patch
remove it. It can be added back later when needed.

Reviewed By: jeanPerier

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

2 years ago[test] Update some legacy PM tests
Arthur Eubanks [Fri, 30 Sep 2022 18:30:46 +0000 (11:30 -0700)]
[test] Update some legacy PM tests

2 years ago[DirectX backend] Support global ctor for DXILBitcodeWriter.
Xiang Li [Thu, 29 Sep 2022 17:23:41 +0000 (10:23 -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

2 years ago[Clang] Fix variant crashes from GH58028, GH57370
Roy Jacobson [Thu, 29 Sep 2022 15:38:46 +0000 (18:38 +0300)]
[Clang] Fix variant crashes from GH58028, GH57370

Fixes a null dereference in some diagnostic issuing code.

Closes https://github.com/llvm/llvm-project/issues/57370
Closes https://github.com/llvm/llvm-project/issues/58028

Reviewed By: shafik

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

2 years ago[mlir][sparse] Factoring out predicates on DimLevelTypes
wren romano [Fri, 30 Sep 2022 00:34:09 +0000 (17:34 -0700)]
[mlir][sparse] Factoring out predicates on DimLevelTypes

This way the predicates can be reused elsewhere, and can more easily be kept in sync with changes to the enum.

Reviewed By: aartbik

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

2 years ago[FixIrreducible][opt] Mark -fix-irreducible as a codegen pass
Arthur Eubanks [Fri, 30 Sep 2022 17:34:04 +0000 (10:34 -0700)]
[FixIrreducible][opt] Mark -fix-irreducible as a codegen pass

So we don't have to specify -enable-new-pm=0.

2 years ago[StructurizeCFG][opt] Mark -structurizecfg as a codegen pass
Arthur Eubanks [Fri, 30 Sep 2022 17:26:18 +0000 (10:26 -0700)]
[StructurizeCFG][opt] Mark -structurizecfg as a codegen pass

So we don't have to specify -enable-new-pm=0.

2 years ago[AMDGPU] Add test for FMAC_e64 dpp combine. NFC.
Joe Nash [Fri, 30 Sep 2022 15:38:42 +0000 (11:38 -0400)]
[AMDGPU] Add test for FMAC_e64 dpp combine. NFC.

2 years ago[ConstraintElimination] Make sure the variable is available before use.
Florian Hahn [Fri, 30 Sep 2022 17:09:01 +0000 (18:09 +0100)]
[ConstraintElimination] Make sure the variable is available before use.

This fixes a crash when trying to access an index for a value where we
don't have a known index.

Fixes #58009.

2 years ago[mlir][MemRef] Simplify extract_strided_metadata(collapse_shape)
Quentin Colombet [Wed, 28 Sep 2022 00:26:52 +0000 (00:26 +0000)]
[mlir][MemRef] Simplify extract_strided_metadata(collapse_shape)

The new pattern gets rid of the collapse_shape operation while
materializing its effects on the sizes, and the strides of the base
object.

In other words, this simplification replaces:

```
baseBuffer, offset, sizes, strides =
    extract_strided_metadata(collapse_shape(memref))
```

With

```
baseBuffer, offset, baseSizes, baseStrides =
    extract_strided_metadata(memref)
for reassDim in {0 .. collapseRank - 1}
  sizes#reassDim = product(baseSizes#i for i in group[reassDim])
  strides#reassDim = baseStrides[group[reassDim].back()]
```

Note: baseBuffer and offset are unaffected by the collapse_shape
operation.

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

2 years ago[DAG] Update foldSelectWithIdentityConstant to use llvm::isNeutralConstant
Simon Pilgrim [Fri, 30 Sep 2022 16:45:05 +0000 (17:45 +0100)]
[DAG] Update foldSelectWithIdentityConstant to use llvm::isNeutralConstant

D133866 added the llvm::isNeutralConstant helper to track neutral/passthrough constants

This patch updates foldSelectWithIdentityConstant to use the helper instead of maintaining its own opcode handling

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

2 years ago[mlir][sparse] minor edit in doc, removed TAB from test
Aart Bik [Fri, 30 Sep 2022 00:20:51 +0000 (17:20 -0700)]
[mlir][sparse] minor edit in doc, removed TAB from test

Reviewed By: Peiming

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

2 years ago[AArch64] Reflow comment in AArch64IselLowering.cpp (NFC).
Florian Hahn [Fri, 30 Sep 2022 15:53:56 +0000 (16:53 +0100)]
[AArch64] Reflow comment in AArch64IselLowering.cpp (NFC).

2 years ago[mlir][linalg] Use getIteratorTypeArray instead of raw iterator_type attribute.
Oleg Shyshkov [Fri, 30 Sep 2022 15:59:53 +0000 (15:59 +0000)]
[mlir][linalg] Use getIteratorTypeArray instead of raw iterator_type attribute.

Summary:
Also modify helper methods to take StringRefs instread of Attributes. It makes
the code cleaner and will help with future migration from StringRef to
utils::IteratorType ([RFC](https://discourse.llvm.org/t/rfc-enumattr-for-iterator-types-in-linalg/64535)).

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

2 years ago[AArch64] Refactor opcode selection for LowerMUL (NFC)
Zain Jaffal [Fri, 30 Sep 2022 15:47:59 +0000 (16:47 +0100)]
[AArch64] Refactor opcode selection for LowerMUL (NFC)

Move the logic for selecting `NewOpc` out of `LowerMUL`

Reviewed By: fhahn

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

2 years ago[RISCV] Address post commit review comments from D134881
Philip Reames [Fri, 30 Sep 2022 15:30:52 +0000 (08:30 -0700)]
[RISCV] Address post commit review comments from D134881

2 years agoRISCV: adjust relocation emission
Saleem Abdulrasool [Fri, 19 Aug 2022 21:30:36 +0000 (21:30 +0000)]
RISCV: adjust relocation emission

Simplify and make the pair-wise relocation more precise.  If either of
the symbol references are textual, the relocation must be delayed.  If
the difference is across sections, delay it as well which partially
matches the behaviour of gas.  We unfortunately do not handle the case
where the difference references a symbol that is not yet defined.  In
such a case, we simply fail to resolve the difference, which should
hopefully not be too onerous (particularly since no other target
supports cross-section references and it is not clear if this was
intentional on the part of RISCV).

Differential Revision: https://reviews.llvm.org/D132262
Reviewed By: @MaskRay

2 years agoRevert "[lldb] Fix member access in GetExpressionPath"
Andy Yankovsky [Fri, 30 Sep 2022 15:24:06 +0000 (15:24 +0000)]
Revert "[lldb] Fix member access in GetExpressionPath"

This reverts commit 14642dc74

Broke the tests on macOS -- https://reviews.llvm.org/D132734#3827245

2 years ago[RISCV] Branchless lowering for select (and (x , 0x1) == 0), y, (z ^ y) ) and select...
Philip Reames [Fri, 30 Sep 2022 15:11:35 +0000 (08:11 -0700)]
[RISCV] Branchless lowering for select (and (x , 0x1) == 0), y, (z ^ y) ) and select (and (x , 0x1) == 0), y, (z | y) )

This code is directly ported from the X86 backend which applies the same rewrite (along with several others). Planning on looking more closely at the other branchless variants from x86 to see if any are worth porting in future changes.

Motivation here is the coremark crc8 routine from https://github.com/eembc/coremark/blob/main/core_util.c#L165. This patch significantly reduces the number of unpredictable branches in the workload.

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

2 years ago[mlir][test] NFC - Fix some worst offenders "capture by SSA name" tests
Nicolas Vasilache [Fri, 30 Sep 2022 15:20:29 +0000 (08:20 -0700)]
[mlir][test] NFC - Fix some worst offenders "capture by SSA name" tests

Many tests still depend on specific names of SSA values (!!).
This commit is a best effort cleanup that will set the stage for adding some pretty SSA result names.

2 years ago[RISCV] Remove some unused var decl. NFC
Ray Wang [Fri, 30 Sep 2022 15:01:27 +0000 (08:01 -0700)]
[RISCV] Remove some unused var decl. NFC

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

2 years ago[BOLT] Fixed some typos
Gabriel Ravier [Fri, 30 Sep 2022 15:00:56 +0000 (17:00 +0200)]
[BOLT] Fixed some typos

I went over the output of the following mess of a command:

`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Reviewed By: Amir, maksfb

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

2 years agoRevert "[Driver][Fuchsia] Add default linker flags"
Alex Brachet [Fri, 30 Sep 2022 14:54:48 +0000 (14:54 +0000)]
Revert "[Driver][Fuchsia] Add default linker flags"

This reverts commit 5dfc8ebee5d688ee94607ccce655672c1a198b82.

2 years ago[NFC] Fix for doc typo in commit 9a4e52ebeb6d
Yitzhak Mandelbaum [Fri, 30 Sep 2022 14:53:07 +0000 (14:53 +0000)]
[NFC] Fix for doc typo in commit 9a4e52ebeb6d

2 years ago[X86] Tweak avx512-gfni-intrinsics.ll tests to avoid xor(select(c,x,0)) 'passthrough...
Simon Pilgrim [Fri, 30 Sep 2022 14:22:08 +0000 (15:22 +0100)]
[X86] Tweak avx512-gfni-intrinsics.ll tests to avoid xor(select(c,x,0)) 'passthrough' patterns

These can be manipulated by foldSelectWithIdentityConstant and lose the predicate/predicate-zero instruction test coverage - use an insertvalue chain into an aggregate instead to retain all the results.

Noticed while trying to convert foldSelectWithIdentityConstant to use llvm::isNeutralConstant

2 years ago[GlobalISel] Do not crash on widening vector result
Serge Pavlov [Fri, 24 Jun 2022 17:17:22 +0000 (00:17 +0700)]
[GlobalISel] Do not crash on widening vector result

Function buildCopyToRegs did not handle properly the case when it should
make wider vector result. It happened, for example, in a function that
returns value of type <2 x f32>, which should be widen to <4 x f32> to
fit XMM register. The function eventually calls
MachineIRBuilder.buildUnmerge, which does not expect that only one
destination register is specified.

Now this case is treated specifically in buildCopyToRegs.

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

2 years ago[clang-tidy] Add an IgnoreMacros option to readability-avoid-const-params-in-decls
Yitzhak Mandelbaum [Fri, 30 Sep 2022 14:14:11 +0000 (14:14 +0000)]
[clang-tidy] Add an IgnoreMacros option to readability-avoid-const-params-in-decls

readability-avoid-const-params-in-decls.IgnoreMacros is enabled by default to be consistent with most other checks.

Reviewed By: ymandel

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

2 years ago[SCCP] regenerate test checks; NFC
Sanjay Patel [Fri, 30 Sep 2022 14:20:03 +0000 (10:20 -0400)]
[SCCP] regenerate test checks; NFC

Avoid names with "tmp" because that can go wrong with the auto-generated script names.

2 years ago[AST] Use BatchAA in aliasesPointer() (NFC)
Nikita Popov [Fri, 9 Sep 2022 14:24:14 +0000 (16:24 +0200)]
[AST] Use BatchAA in aliasesPointer() (NFC)

2 years ago[lldb] Fix deprecation warning for using std::iterator
Nico Weber [Thu, 29 Sep 2022 00:18:27 +0000 (20:18 -0400)]
[lldb] Fix deprecation warning for using std::iterator

std::iterator was deprecated in C++17.

No behavior change.

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

2 years ago[AMDGPU][GISel] Update `isCanonicalized`
Pierre van Houtryve [Thu, 29 Sep 2022 08:30:20 +0000 (08:30 +0000)]
[AMDGPU][GISel] Update `isCanonicalized`

Recognize more opcodes in the function.
Fixes some regressions introduced in D134857 for fdiv.f16 too.

Depends on D134857

Reviewed By: arsenm, foad

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

2 years ago[GISel] Add more cases to isKnownNeverNaN
Pierre van Houtryve [Thu, 29 Sep 2022 07:57:29 +0000 (07:57 +0000)]
[GISel] Add more cases to isKnownNeverNaN

Make it even with the DAG implementation as of D134854

Reviewed By: arsenm, foad

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

2 years ago[LICM] Collect more scalar promotion stats (NFC)
Nikita Popov [Fri, 9 Sep 2022 14:31:36 +0000 (16:31 +0200)]
[LICM] Collect more scalar promotion stats (NFC)

Collect more statistics for scalar promotion. In particular,
keep track of how many promotion candidates there were, and
whether it is a load or a load/store promotion.

2 years ago[Driver][Fuchsia] Add default linker flags
Alex Brachet [Fri, 30 Sep 2022 14:06:51 +0000 (14:06 +0000)]
[Driver][Fuchsia] Add default linker flags

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