platform/upstream/llvm.git
19 months agoRevert "[RISCV] Enable the LocalStackSlotAllocation pass support."
Craig Topper [Sun, 25 Dec 2022 20:40:53 +0000 (12:40 -0800)]
Revert "[RISCV] Enable the LocalStackSlotAllocation pass support."

This reverts commit 180397cdded67a8fdf56f92a0b70d32f0dac8af6.

This seems to cause llvm-testsuite failures.

19 months ago[libc++] Implement constexpr {isfinite, isinf, isnan, isnormal}
Nikolas Klauser [Sun, 18 Dec 2022 23:02:44 +0000 (00:02 +0100)]
[libc++] Implement constexpr {isfinite, isinf, isnan, isnormal}

This starts implementing P0533

Reviewed By: Mordante, #libc

Spies: libcxx-commits

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

19 months ago[OpenMP] Fix test on 32-bit platforms
Joseph Huber [Sun, 25 Dec 2022 15:47:04 +0000 (09:47 -0600)]
[OpenMP] Fix test on 32-bit platforms

Summary:
This test didn't specify the triple so it defaulted to the user's, if
this was 32-bit then it failed due to a diagnostic message.

19 months ago[NFC][ADT] Rename StringMapEntry *Create() into StringMapEntry *create.
Alexey Lapshin [Sun, 25 Dec 2022 14:25:18 +0000 (15:25 +0100)]
[NFC][ADT] Rename StringMapEntry *Create() into StringMapEntry *create.

19 months ago[NFC][SupportTests] Adjust `UnsignedDivideUsingMagic()` for readability
Roman Lebedev [Sun, 25 Dec 2022 13:43:20 +0000 (16:43 +0300)]
[NFC][SupportTests] Adjust `UnsignedDivideUsingMagic()` for readability

19 months ago[IPSCCP] Enable specialization of functions.
Alexandros Lamprineas [Sun, 25 Dec 2022 08:05:21 +0000 (10:05 +0200)]
[IPSCCP] Enable specialization of functions.

This patch enables Function Specialization by default at all
optimization levels except Os, Oz.

Compilation Time Overhead:
--------------------------
Measured the Instruction Count increase (Geomean) for CTMark from
the llvm-testsuite as in https://llvm-compile-time-tracker.com.
 * {-O3, Non-LTO}: +0.136% Instruction Count
 * {-O3, LTO}: +0.346% Instruction Count

Performance Uplift:
-------------------
Measured +9.121% score increase for 505.mcf_r from SPEC Int 2017
(Tested on Neoverse N1 with -O3 + LTO)

Correctness Testing:
--------------------
 * Passes bootstrap Clang with ASAN + LTO + FuncSpec aggressive options:
   { MaxClonesThreshold=10,
     SmallFunctionThreshold=10,
     AvgLoopIterationCount=30,
     SpecializeOnAddresses=true,
     EnableSpecializationForLiteralConstant=true,
     FuncSpecializationMaxIters=10 }
 * Builds Chromium and passes its unittests with the above options + ThinLTO.

For more info please refer to
https://discourse.llvm.org/t/rfc-should-we-enable-function-specialization/61518

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

19 months ago[Doc] Replace PYTHON_EXECUTABLE with Python3_EXECUTABLE
eopXD [Sat, 24 Dec 2022 13:12:35 +0000 (05:12 -0800)]
[Doc] Replace PYTHON_EXECUTABLE with Python3_EXECUTABLE

As topic, the variable to specify the python executable now should be this.
This is probably something that was left out in D78762.

Reviewed By: JDevlieghere

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

19 months ago[gn build] Port 46c94e5067b5
LLVM GN Syncbot [Sun, 25 Dec 2022 02:55:37 +0000 (02:55 +0000)]
[gn build] Port 46c94e5067b5

19 months ago[gn build] Port 066b492b747a
LLVM GN Syncbot [Sun, 25 Dec 2022 02:55:36 +0000 (02:55 +0000)]
[gn build] Port 066b492b747a

19 months ago[clang-format] Disable FixRanges in IntegerLiteralSeparatorTest
Owen Pan [Sun, 25 Dec 2022 02:47:23 +0000 (18:47 -0800)]
[clang-format] Disable FixRanges in IntegerLiteralSeparatorTest

The FixRanges unit test from 46c94e5067b5 breaks the build bots.
Disable it for now.

19 months agoAdds support for GOT relocations to i386/ELF backend
Kshitij Jain [Mon, 19 Dec 2022 04:07:42 +0000 (04:07 +0000)]
Adds support for GOT relocations to i386/ELF backend

This CR adds support for GOT relocations to the JITLink i386/ELF backend.

Reviewed By: lhames

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

19 months agoUpdates and adds tests for i386/ELF JITLink backend
Kshitij Jain [Sun, 20 Nov 2022 04:09:29 +0000 (04:09 +0000)]
Updates and adds tests for i386/ELF JITLink backend

This CR modifies the existing 32 bit pcrel relocation test to
include the case when the relocation target might be present at
a smaller address than the address of the location that needs to be
patched.

Additionally, it adds a test for 16 bit absolute relocation.

Reviewed By: sunho

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

19 months ago[NFC] Add exhaustive test coverage for `{Un}signedDivisionByConstantInfo`
Roman Lebedev [Sat, 24 Dec 2022 21:48:05 +0000 (00:48 +0300)]
[NFC] Add exhaustive test coverage for `{Un}signedDivisionByConstantInfo`

Use this wrapper if you want to try brute-forcing wider bit widths:
https://godbolt.org/z/3xGzTM881

I've brute-forced i16 for both signed and unsigned, and we're all good.
As mentioned in https://reviews.llvm.org/D140636

19 months ago[clang-format] Add an option to format integer literal separators
Owen Pan [Thu, 22 Dec 2022 09:21:17 +0000 (01:21 -0800)]
[clang-format] Add an option to format integer literal separators

Closes #58949.

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

19 months ago[ConstraintElim] Add missing CHECK lines.
Florian Hahn [Sat, 24 Dec 2022 21:52:28 +0000 (21:52 +0000)]
[ConstraintElim] Add missing CHECK lines.

19 months ago[ConstraintElim] Add extra test with chained GEPs without inbounds.
Florian Hahn [Sat, 24 Dec 2022 21:51:26 +0000 (21:51 +0000)]
[ConstraintElim] Add extra test with chained GEPs without inbounds.

19 months ago[ConstraintElim] Convert tests to use opaque pointers (NFC).
Florian Hahn [Sat, 24 Dec 2022 21:46:46 +0000 (21:46 +0000)]
[ConstraintElim] Convert tests to use opaque pointers (NFC).

19 months ago[LV] Use SCEV to check if the trip count <= VF * UF.
Florian Hahn [Sat, 24 Dec 2022 18:33:36 +0000 (18:33 +0000)]
[LV] Use SCEV to check if the trip count <= VF * UF.

Just comparing constant trip counts causes LV to miss cases where the
vector loop body only executes once.

The motivation for this is to remove the need for unrolling to remove
vector loop back-edges, if the body only executes once in more cases.

Reviewed By: Ayal

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

19 months ago[NFC][Codegen][X86] Autogenerate check lines in shift-i256.ll
Roman Lebedev [Sat, 24 Dec 2022 16:18:50 +0000 (19:18 +0300)]
[NFC][Codegen][X86] Autogenerate check lines in shift-i256.ll

19 months ago[NFC][Codegen][AVR] Make shift.ll autogenerate-able
Roman Lebedev [Sat, 24 Dec 2022 16:12:27 +0000 (19:12 +0300)]
[NFC][Codegen][AVR] Make shift.ll autogenerate-able

19 months ago[NFC][Codegen] Add tests with oversized shifts by non-byte-multiple
Roman Lebedev [Sat, 24 Dec 2022 15:39:57 +0000 (18:39 +0300)]
[NFC][Codegen] Add tests with oversized shifts by non-byte-multiple

19 months ago[NFC][Codegen] Rename tests for oversized shifts by byte multiple
Roman Lebedev [Sat, 24 Dec 2022 15:39:48 +0000 (18:39 +0300)]
[NFC][Codegen] Rename tests for oversized shifts by byte multiple

19 months ago[libc++][chrono] Add calendar type formatters.
Mark de Wever [Sun, 20 Mar 2022 12:40:02 +0000 (13:40 +0100)]
[libc++][chrono] Add calendar type formatters.

Some of the calendar types have landed before, this adds the missing
set. Note this does not complete the implementation of the chrono
formatters.

This removes the `chrono` header for some transitive include in C++17
mode. This is needed to avoid inclusion cycles.

Partially implements:
- P1361 Integration of chrono with text formatting
- P2372 Fixing locale handling in chrono formatters

Reviewed By: #libc, ldionne

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

19 months agoFix lldb option handling since e953ae5bbc313fd0cc980ce021d487e5b5199ea4 (part 2)
serge-sans-paille [Sat, 24 Dec 2022 11:53:50 +0000 (12:53 +0100)]
Fix lldb option handling since e953ae5bbc313fd0cc980ce021d487e5b5199ea4 (part 2)

Option tables are no longer null-terminated.

This is a follow-up to https://reviews.llvm.org/D139881

19 months agoFix lldb option handling since e953ae5bbc313fd0cc980ce021d487e5b5199ea4
serge-sans-paille [Sat, 24 Dec 2022 10:56:21 +0000 (11:56 +0100)]
Fix lldb option handling since e953ae5bbc313fd0cc980ce021d487e5b5199ea4

Option tables are no longer null-terminated.

This is a follow-up to https://reviews.llvm.org/D139881

19 months ago[clang] Use a StringRef instead of a raw char pointer to store builtin and call infor...
serge-sans-paille [Mon, 12 Dec 2022 16:02:15 +0000 (17:02 +0100)]
[clang] Use a StringRef instead of a raw char pointer to store builtin and call information

This avoids recomputing string length that is already known at compile
time.

It has a slight impact on preprocessing / compile time, see

https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u

This is a recommit of 719d98dfa841c522d8d452f0685e503538415a53 that into
account a GGC issue (probably
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92181) when dealing with
intiailizer_list and constant expressions.

Workaround this by avoiding initializer list, at the expense of a
temporary plain old array.

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

19 months agoRevert "[DebugInfo] Variables with only empty values emitting when one is variadic"
Vitaly Buka [Sat, 24 Dec 2022 05:29:03 +0000 (21:29 -0800)]
Revert "[DebugInfo] Variables with only empty values emitting when one is variadic"

Breaks HWASAN somehow.

Fails at def915c39cc4e18b304c7a8c4761cc4531c3bc4b
https://lab.llvm.org/buildbot/#/builders/236/builds/1547

Pass at def915c39cc4e18b304c7a8c4761cc4531c3bc4b^
https://lab.llvm.org/buildbot/#/builders/236/builds/1529

This reverts commit def915c39cc4e18b304c7a8c4761cc4531c3bc4b.

19 months ago[RISCV] Support the short-forward-branch predicated ops in RISCVSExtWRemoval.
Craig Topper [Sat, 24 Dec 2022 04:54:54 +0000 (20:54 -0800)]
[RISCV] Support the short-forward-branch predicated ops in RISCVSExtWRemoval.

19 months ago[examples] Fix leaks in OrcV2 c-bindings examples.
Lang Hames [Sat, 24 Dec 2022 05:01:09 +0000 (21:01 -0800)]
[examples] Fix leaks in OrcV2 c-bindings examples.

rdar://103599609

19 months ago[X86][Reduce] Preserve fast math flags when change it. NFCI
Phoebe Wang [Sat, 24 Dec 2022 03:40:59 +0000 (11:40 +0800)]
[X86][Reduce] Preserve fast math flags when change it. NFCI

@arsenm raised a good question that we should use a flag guard.
But I found it is not a problem as long as user uses intrinsics only: https://godbolt.org/z/WoYsqqjh3
Anyway, it is still nice to have.

Reviewed By: arsenm

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

19 months agoRevert "Apply shortened printing/parsing form to linalg.reduce."
Stella Stamenova [Sat, 24 Dec 2022 01:31:08 +0000 (17:31 -0800)]
Revert "Apply shortened printing/parsing form to linalg.reduce."

This reverts commit 281c2d49c929c2130e5f1f0e02d6e96dbf14494a.

This broke the windows mlir buildbot:
https://lab.llvm.org/buildbot/#/builders/13/builds/30167

19 months agoRevert "[mlir][GPU] Add known_block_size and known_grid_size to gpu.func"
Stella Stamenova [Sat, 24 Dec 2022 01:29:42 +0000 (17:29 -0800)]
Revert "[mlir][GPU] Add known_block_size and known_grid_size to gpu.func"

This reverts commit 85e38d7cd670371206f6067772dc822049d2cbd8.

This broke the windows mlir buildbot:
https://lab.llvm.org/buildbot/#/builders/13/builds/30180/steps/6/logs/stdio

19 months ago[lld-macho] Standardize error messages
Jez Ng [Sat, 24 Dec 2022 00:44:56 +0000 (19:44 -0500)]
[lld-macho] Standardize error messages

Errors / warnings that originate from a particular file should be of the
form `$file: $message`.

Reviewed By: #lld-macho, keith

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

19 months ago[NFC][Codegen] Add RISCV test coverage for D140638
Roman Lebedev [Sat, 24 Dec 2022 00:32:37 +0000 (03:32 +0300)]
[NFC][Codegen] Add RISCV test coverage for D140638

19 months agoResolve a long-standing FIXME in memcpyopt.
Owen Anderson [Fri, 23 Dec 2022 04:24:49 +0000 (21:24 -0700)]
Resolve a long-standing FIXME in memcpyopt.

Inspecting the downstream use of the cpyAlign, it is clear that
`performCallSlotOptzn` is expecting it to represent the alignment
of the copy destination, not the minimum of the src and dest
alignments. This patch renames the parameter to make this more
obvious.

I believe this change is NFC, because the downstream code has
alignment checks such that it all works out in the end. I have not
been able to construct a test case that actually triggers a change
in output.

Reviewed By: nikic

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

19 months ago[NFC][Codegen] Tests with wide scalar shifts, for new potential legalization strategy
Roman Lebedev [Fri, 23 Dec 2022 21:27:40 +0000 (00:27 +0300)]
[NFC][Codegen] Tests with wide scalar shifts, for new potential legalization strategy

19 months ago[Support] Use APInt::udivrem in DivisionByConstantInfo. NFC
Craig Topper [Fri, 23 Dec 2022 21:33:20 +0000 (13:33 -0800)]
[Support] Use APInt::udivrem in DivisionByConstantInfo. NFC

19 months agoAdd explicit template instantiation declarations for existing explicit definitions.
David Blaikie [Fri, 23 Dec 2022 20:07:02 +0000 (20:07 +0000)]
Add explicit template instantiation declarations for existing explicit definitions.

Explicit instantiations should be declared. Found with -Wundefined-func-template.

Reviewed By: dblaikie, rriddle

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

19 months ago[lld-macho] Only fold private-label aliases that do not have flags
Jez Ng [Fri, 23 Dec 2022 19:50:58 +0000 (14:50 -0500)]
[lld-macho] Only fold private-label aliases that do not have flags

This will enable us to re-land {D139069}.

The issue with the original diff was that we were folding all
private-label symbols. We were not merging the symbol flags during this
folding; instead we just made all references to the folded symbol point
to its aliasee. This caused some flags to be incorrectly discarded. This
surfaced as code that was incorrectly stripped due to LLD dropping the
`.no_dead_strip` flag.

This diff fixes things by only folding flag-less private-label aliases.
Most (maybe all) of the `ltmp<N>` symbols that are generated by the MC
aarch64 backend are flag-less, so this conservative folding behavior
does the job.

Reviewed By: #lld-macho, thakis

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

19 months ago[reland][lld-macho] Private label aliases to weak symbols should not retain section...
Jez Ng [Wed, 21 Dec 2022 22:44:45 +0000 (17:44 -0500)]
[reland][lld-macho] Private label aliases to weak symbols should not retain section data

This reverts commit a650f2ec7a37cf1f495108bbb313e948c232c29c.

The crashes it was causing will be fixed by the stacked diff {D140606}.

19 months ago[APInt] Move a comment from urem to srem where it belongs.
Craig Topper [Fri, 23 Dec 2022 18:25:19 +0000 (10:25 -0800)]
[APInt] Move a comment from urem to srem where it belongs.

This comment talks about sign of the dividend and the result. I
think it belongs to the srem function.

This is the commit that added it
https://github.com/llvm/llvm-project/commit/709a820a5338ca5c4b949f2f0286f7da39f00661
and the code change with it was for srem.

Reviewed By: nikic

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

19 months ago[APFloat] Remove workaround for old clang.
Craig Topper [Fri, 23 Dec 2022 18:24:35 +0000 (10:24 -0800)]
[APFloat] Remove workaround for old clang.

The comment says this is for clang 3.3. Our build requirements
are clang 5.0 or newer so I think we can remove this.

Reviewed By: nikic, RKSimon

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

19 months ago[NFC][Codegen][X86] Add codegen test coverage for the variably-indexed load of alloca...
Roman Lebedev [Fri, 23 Dec 2022 17:13:23 +0000 (20:13 +0300)]
[NFC][Codegen][X86] Add codegen test coverage for the variably-indexed load of alloca w/zero upper half

19 months ago[NFC][SROA] Variably-indexed load: add test variation w/ upper half of alloca being...
Roman Lebedev [Fri, 23 Dec 2022 17:09:00 +0000 (20:09 +0300)]
[NFC][SROA] Variably-indexed load: add test variation w/ upper half of alloca being zeros

This is the actual pattern i'm looking at.

19 months ago[IPSCCP] Create a Pass parameter to control specialization of functions.
Alexandros Lamprineas [Thu, 22 Dec 2022 17:44:06 +0000 (17:44 +0000)]
[IPSCCP] Create a Pass parameter to control specialization of functions.

Required for D140210 in order to disable FuncSpec at {Os, Oz}
optimization levels.

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

19 months ago[lld-macho][test][nfc] Update stabs.s to use GMT time zone instead of UTC
Pengxuan Zheng [Fri, 16 Dec 2022 18:32:35 +0000 (10:32 -0800)]
[lld-macho][test][nfc] Update stabs.s to use GMT time zone instead of UTC

This is to work around a singularity container issue we ran into recently. The
container fails to honor the time zone setting (TZ=UTC) when executing the touch
command. Replacing UTC with GMT worked correctly in the container. This change
does not change (at least not intentionally) the function of the test in any way
since GMT and UTC should be equivalent AFAIK. Please refer to the discussions in
D139980 for more background information.

Reviewed By: int3, #lld-macho

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

19 months ago[clang][nullability] Remove old overload for getNullability()
Dani Ferreira Franco Moura [Fri, 23 Dec 2022 13:53:13 +0000 (13:53 +0000)]
[clang][nullability] Remove old overload for getNullability()

Reviewed By: gribozavr2

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

19 months ago[lld-macho][test] Hyphenate lit's check-prefixes
Jez Ng [Fri, 23 Dec 2022 05:18:11 +0000 (00:18 -0500)]
[lld-macho][test] Hyphenate lit's check-prefixes

For consistency.

19 months ago[libc++] LWG3738 Validates a missing precondition.
Mark de Wever [Thu, 22 Dec 2022 19:09:24 +0000 (20:09 +0100)]
[libc++] LWG3738 Validates a missing precondition.

No real changes were needed, but add an assert for the pre-condition.

This implements:
- 3738 Missing preconditions for take_view constructor

Reviewed By: #libc, philnik

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

19 months ago[libc++] LWG3745 noexcept for atomic_wait.
Mark de Wever [Thu, 22 Dec 2022 19:35:36 +0000 (20:35 +0100)]
[libc++] LWG3745 noexcept for atomic_wait.

The noexcept was already implemented, this only updates the synposis and
adds tests to validate that the functions are noexcept.

This implements:
- LWG3745 std::atomic_wait and its friends lack noexcept

Reviewed By: #libc, philnik

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

19 months ago[TTI][NFC]Remove trailing spaces, NFC.
Alexey Bataev [Fri, 23 Dec 2022 16:00:50 +0000 (08:00 -0800)]
[TTI][NFC]Remove trailing spaces, NFC.

19 months ago[mlir] Enable types to us custom assembly formats involving optional attributes.
Nick Kreeger [Fri, 23 Dec 2022 15:55:15 +0000 (09:55 -0600)]
[mlir] Enable types to us custom assembly formats involving optional attributes.

Author: Laszlo Kindrat <laszlokindrat@gmail.com>
Reviewed By: rriddle

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

19 months ago[NFC][OpenMP] Fix compile warning caused by using `std::move` on a local object on...
Shilei Tian [Fri, 23 Dec 2022 15:42:29 +0000 (10:42 -0500)]
[NFC][OpenMP] Fix compile warning caused by using `std::move` on a local object on a `return` statement

19 months ago[LoopUnroll] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 15:33:28 +0000 (16:33 +0100)]
[LoopUnroll] Convert some tests to opaque pointers (NFC)

19 months ago[DAGCombiner] `visitFREEZE()`: fix cycle breaking
Roman Lebedev [Fri, 23 Dec 2022 15:10:39 +0000 (18:10 +0300)]
[DAGCombiner] `visitFREEZE()`: fix cycle breaking

Depending on the particular DAG, we might either create a `freeze`,
or not. And only in the former case, the cycle would be formed.
It would be nicer to have `ReplaceAllUsesOfValueWithIf()`,
like we have in IR, but we don't have that.

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

19 months agoValueTracking: Teach canCreateUndefOrPoison about saturating intrinsics
Matt Arsenault [Fri, 23 Dec 2022 03:38:10 +0000 (22:38 -0500)]
ValueTracking: Teach canCreateUndefOrPoison about saturating intrinsics

19 months agoInstCombine: Add baseline tests for saturating poison handling
Matt Arsenault [Fri, 23 Dec 2022 03:37:12 +0000 (22:37 -0500)]
InstCombine: Add baseline tests for saturating poison handling

19 months ago[libc++] Add custom clang-tidy checks
Nikolas Klauser [Sat, 13 Aug 2022 20:33:12 +0000 (22:33 +0200)]
[libc++] Add custom clang-tidy checks

Reviewed By: #libc, ldionne

Spies: jwakely, beanz, smeenai, cfe-commits, tschuett, avogelsgesang, Mordante, sstefan1, libcxx-commits, ldionne, mgorny, arichardson, miyuki

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

19 months agofix warn-xparser test
Mikhail Goncharov [Fri, 23 Dec 2022 14:32:59 +0000 (15:32 +0100)]
fix warn-xparser test

for https://reviews.llvm.org/D140224

19 months ago[gn] port f29cfab55d1f
Nico Weber [Fri, 23 Dec 2022 14:29:38 +0000 (09:29 -0500)]
[gn] port f29cfab55d1f

19 months ago[InlineAdvisor] Restructure advisor plugin unittest cmake
ibricchi [Fri, 23 Dec 2022 14:12:36 +0000 (09:12 -0500)]
[InlineAdvisor] Restructure advisor plugin unittest cmake

Move the plugin used in the unittest to test Inline Advisor Plugins
into a separate folder to clean up the cmake file for the analysis
tests.

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

19 months ago[DAGCombiner] `visitFREEZE()`: fix handling of no maybe-poison ops
Roman Lebedev [Fri, 23 Dec 2022 14:14:22 +0000 (17:14 +0300)]
[DAGCombiner] `visitFREEZE()`: fix handling of no maybe-poison ops

The original code was confusing. It was stripping poison-generating flags,
but the comments were saying that doing so was a TODO.

If the poison-generating flags are present, then even if all operands
are guaranteed not to be undef or poison, the whole operation may still
produce undef or poison. We can still deal with that case,
and we already do deal with it in fact, by also dropping those flags.

Refs. https://github.com/llvm/llvm-project/issues/59676

19 months ago[DAGCombiner] `visitFREEZE()`: restore previous behaviour on no maybe-poison operands
Roman Lebedev [Fri, 23 Dec 2022 14:02:14 +0000 (17:02 +0300)]
[DAGCombiner] `visitFREEZE()`: restore previous behaviour on no maybe-poison operands

Lack of such operands implies that the op might be poison-producing due to
it's flags. We seem to drop them already, but the comments are confusing.

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

19 months ago[RISCV] Combine comparison and logic ops
Ilya Andreev [Tue, 13 Sep 2022 13:01:56 +0000 (09:01 -0400)]
[RISCV] Combine comparison and logic ops

Two comparison operations and a logical operation are combined into selection using MIN or MAX and comparison operation.
For optimization to be applied conditions have to be satisfied:
  1. In comparison operations has to be the one common operand.
  2. Supports only signed and unsigned integers.
  3. Comparison has to be the same with respect to common operand.
  4. There are no more users of comparison except logic operation.
  5. Every combination of comparison and AND, OR are supported.

It will convert
  %l0 = %a < %c
  %l1 = %b < %c
  %res = %l0 or %l1
into
  %sel = min(%a, %b)
  %res = %sel < %c

It supports several comparison operations (<, <=, >, >=), signed, unsigned values and different order of operands if they do not violate conditions.

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

19 months ago[RISCV][test] Combine comparison and logic ops
Ilya Andreev [Tue, 13 Sep 2022 13:01:56 +0000 (09:01 -0400)]
[RISCV][test] Combine comparison and logic ops

Two comparison operations and a logical operation are combined into selection using MIN or MAX and comparison operation.
For optimization to be applied conditions have to be satisfied:
  1. In comparison operations has to be the one common operand.
  2. Supports only signed or unsigned integers.
  3. Comparison has to be the same with respect to common operand.
  4. There are no more users of comparison except logic operation.
  5. Every combination of comparison and AND, OR are supported.

It will convert
  %l0 = %a < %c
  %l1 = %b < %c
  %res = %l0 or %l1
into
  %sel = min(%a, %b)
  %res = %sel < %c

It supports several comparison operations (<, <=, >, >=), signed, unsigned values and different order of operands if they do not violate conditions.

19 months ago[gn] port ba0ec6f15f55
Nico Weber [Fri, 23 Dec 2022 14:08:56 +0000 (09:08 -0500)]
[gn] port ba0ec6f15f55

19 months ago[clang] Remove deprecated ControlFlowContext::build()
Dmitri Gribenko [Fri, 23 Dec 2022 14:03:48 +0000 (15:03 +0100)]
[clang] Remove deprecated ControlFlowContext::build()

Reviewed By: merrymeerkat

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

19 months ago[NFC][NVPTX] Remove dead override
Luke Drummond [Tue, 20 Dec 2022 00:05:46 +0000 (00:05 +0000)]
[NFC][NVPTX] Remove dead override

After 68f2218e1e, NVPTXTargetObjectFile::Initialize is an empty wrapper
of the parent method. Get rid of it.

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

19 months agoApply shortened printing/parsing form to linalg.reduce.
Aliia Khasanova [Fri, 23 Dec 2022 13:38:29 +0000 (14:38 +0100)]
Apply shortened printing/parsing form to linalg.reduce.

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

19 months ago[clang] Migrate away from a deprecated Clang CFG factory function
Dmitri Gribenko [Fri, 23 Dec 2022 13:26:34 +0000 (14:26 +0100)]
[clang] Migrate away from a deprecated Clang CFG factory function

Reviewed By: merrymeerkat

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

19 months ago[LV] Move exit cond simplification to separate transform.
Florian Hahn [Fri, 23 Dec 2022 12:51:20 +0000 (12:51 +0000)]
[LV] Move exit cond simplification to separate transform.

This sets the stage for D133017 by moving out the code that performs
VPlan based simplifications to a separate transform that takes the
chosen VF & UF as arguments.

The main advantage is that this transform runs before any changes to
the CFG are being made. This allows using SCEV without worrying about
making queries while the IR is in an incomplete state.

Note that this patch switches the reasoning to use SCEV, but still only
simplifies loops with constant trip counts. Using SCEV here is needed to
access the backedge taken count, because the trip count IR value has not
been created yet.

Reviewed By: Ayal

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

19 months agoRevert "[clang] Use a StringRef instead of a raw char pointer to store builtin and...
serge-sans-paille [Fri, 23 Dec 2022 12:25:58 +0000 (13:25 +0100)]
Revert "[clang] Use a StringRef instead of a raw char pointer to store builtin and call information"

There are still remaining issues with GCC 12, see for instance

https://lab.llvm.org/buildbot/#/builders/93/builds/12669

This reverts commit 5ce4e92264102de21760c94db9166afe8f71fcf6.

19 months ago[NFC][NVPTX] Remove dead comment and commented code
Luke Drummond [Mon, 19 Dec 2022 14:59:12 +0000 (14:59 +0000)]
[NFC][NVPTX] Remove dead comment and commented code

A confusing comment after the last return statement in
`NVPTXAsmPrinter::doFinalization` referred to a preprocessor macro
(NVISA) that has never existed since the NVPTX backend has been a part
of upstream llvm - as far as the pickaxe will tell me anyway. Thus I've
removed it.

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

19 months ago[mlir] Add option to limit number of pattern rewrites in CanonicalizerPass
Matthias Springer [Fri, 23 Dec 2022 12:01:00 +0000 (13:01 +0100)]
[mlir] Add option to limit number of pattern rewrites in CanonicalizerPass

The greedy pattern rewriter consists of two nested loops. `config.maxIterations` (which configurable on the CanonicalizerPass) controls the maximum number of iterations of the outer loop.

```
/// This specifies the maximum number of times the rewriter will iterate
/// between applying patterns and simplifying regions. Use `kNoLimit` to
/// disable this iteration limit.
int64_t maxIterations = 10;
```

This change adds `config.maxNumRewrites` which controls the maximum number of pattern rewrites within an iteration. (It effectively control the maximum number of iterations of the inner loop.)

This flag is meant for debugging and useful in cases where one or multiple faulty patterns can be applied indefinitely, resulting in an infinite loop.

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

19 months ago[VE] Convert test to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 11:46:41 +0000 (12:46 +0100)]
[VE] Convert test to opaque pointers (NFC)

There is a minor codegen regression here (an extra and instruction).
The reason is that CGP only eliminates fallthrough branches if it
has made some other kind of change, and with opaque pointers that
other change does not occur.

Ideally, we should probably always try to eliminate fallthroughs,
but this runs into the problem that performing a dummy fallthrough
is a common pattern in tests for forcing SDAG to select them
separately, so it's not quite that simple.

19 months ago[clang] Use a StringRef instead of a raw char pointer to store builtin and call infor...
serge-sans-paille [Mon, 12 Dec 2022 16:02:15 +0000 (17:02 +0100)]
[clang] Use a StringRef instead of a raw char pointer to store builtin and call information

This avoids recomputing string length that is already known at compile
time.

It has a slight impact on preprocessing / compile time, see

https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u

This is a recommit of 719d98dfa841c522d8d452f0685e503538415a53 with a
change to llvm/utils/TableGen/OptParserEmitter.cpp to cope with GCC bug
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108158

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

19 months ago[LV] Assert that the executed plan contains selected VF & UF (NFC).
Florian Hahn [Fri, 23 Dec 2022 11:44:42 +0000 (11:44 +0000)]
[LV] Assert that the executed plan contains selected VF & UF (NFC).

Add assertion to ensure the executed plan is valid for the selected VF
and UF.

19 months ago[clang] Fix a clang crash on invalid code in C++20 mode.
Haojian Wu [Thu, 22 Dec 2022 22:23:54 +0000 (23:23 +0100)]
[clang] Fix a clang crash on invalid code in C++20 mode.

This crash is a combination of recovery-expr + new SemaInit.cpp code
introduced by by https://reviews.llvm.org/D129531.

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

19 months agoRemove empty header file.
Dani Ferreira Franco Moura [Fri, 23 Dec 2022 10:04:56 +0000 (10:04 +0000)]
Remove empty header file.

Reviewed By: gribozavr2, merrymeerkat

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

19 months ago[VE] Name instructions in test (NFC)
Nikita Popov [Fri, 23 Dec 2022 10:41:57 +0000 (11:41 +0100)]
[VE] Name instructions in test (NFC)

19 months agoRevert "[clang] Use a StringRef instead of a raw char pointer to store builtin and...
serge-sans-paille [Fri, 23 Dec 2022 10:36:56 +0000 (11:36 +0100)]
Revert "[clang] Use a StringRef instead of a raw char pointer to store builtin and call information"

Failing builds: https://lab.llvm.org/buildbot#builders/9/builds/19030
This is GCC specific and has been reported upstream: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108158

This reverts commit 719d98dfa841c522d8d452f0685e503538415a53.

19 months ago[clang] Use a StringRef instead of a raw char pointer to store builtin and call infor...
serge-sans-paille [Mon, 12 Dec 2022 16:02:15 +0000 (17:02 +0100)]
[clang] Use a StringRef instead of a raw char pointer to store builtin and call information

This avoids recomputing string length that is already known at compile
time.

It has a slight impact on preprocessing / compile time, see

https://llvm-compile-time-tracker.com/compare.php?from=3f36d2d579d8b0e8824d9dd99bfa79f456858f88&to=e49640c507ddc6615b5e503144301c8e41f8f434&stat=instructions:u

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

19 months ago[examples] Direct HowToUseJIT readers to HowToUseLLJIT instead.
Lang Hames [Fri, 23 Dec 2022 09:08:50 +0000 (01:08 -0800)]
[examples] Direct HowToUseJIT readers to HowToUseLLJIT instead.

HowToUseJIT describes the older APIs. We want to discourage their use in new
projects.

19 months ago[Docs] Clarify typed pointers support timeline
Nikita Popov [Fri, 23 Dec 2022 09:07:59 +0000 (10:07 +0100)]
[Docs] Clarify typed pointers support timeline

As there have been a couple of questions about this recently, this
gives a hard timeline on typed pointers support.

Given that we are about a month away from LLVM 16 branching, I think
we should retain best-effort typed pointer support in LLVM 16 even
if we get all tests migrated before that point.

Conversely, regardless of what the actual test migration state will
be at that point, I believe we should un-support typed pointers as
a matter of policy immediately after branching. Once release/16.x
has been branched, typed pointers on main will no longer be
supported (and can be actively broken). We only need to keep
not-yet-migrated tests working, if there are any left at that point.

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

19 months ago[LoopDeletion] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 09:06:50 +0000 (10:06 +0100)]
[LoopDeletion] Convert tests to opaque pointers (NFC)

19 months ago[VectorCombine] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 09:03:38 +0000 (10:03 +0100)]
[VectorCombine] Convert tests to opaque pointers (NFC)

19 months ago[SLP] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 09:01:56 +0000 (10:01 +0100)]
[SLP] Convert some tests to opaque pointers (NFC)

19 months ago[GVN] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 08:58:33 +0000 (09:58 +0100)]
[GVN] Convert some tests to opaque pointers (NFC)

19 months ago[BDCE] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 08:57:22 +0000 (09:57 +0100)]
[BDCE] Convert tests to opaque pointers (NFC)

19 months ago[Attributor] Convert some tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 08:55:29 +0000 (09:55 +0100)]
[Attributor] Convert some tests to opaque pointers (NFC)

These were converted without adjustments.

19 months ago[clang-tidy][NFC] Remove custom isInAnonymousNamespace matchers
Carlos Galvez [Fri, 23 Dec 2022 08:47:28 +0000 (08:47 +0000)]
[clang-tidy][NFC] Remove custom isInAnonymousNamespace matchers

Since now the same matcher exists in ASTMatchers.

19 months ago[ArgPromotion] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 08:48:36 +0000 (09:48 +0100)]
[ArgPromotion] Convert tests to opaque pointers (NFC)

update_test_checks was rerun for some of those, because we use
a different GEP representation with opaque pointers.

19 months ago[AggressiveInstCombine] Convert tests to opaque pointers (NFC)
Nikita Popov [Fri, 23 Dec 2022 08:47:48 +0000 (09:47 +0100)]
[AggressiveInstCombine] Convert tests to opaque pointers (NFC)

19 months ago[MLIR][Arith] Remove unused assertions
liqinweng [Fri, 23 Dec 2022 08:01:29 +0000 (16:01 +0800)]
[MLIR][Arith] Remove unused assertions
We shouldn't be checking things that are guaranteed by the op's verifier.

Reviewed By: benshi001

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

19 months ago[Support] Use inplace APInt operators in DivisionByConstantInfo. NFC
Craig Topper [Fri, 23 Dec 2022 06:48:12 +0000 (22:48 -0800)]
[Support] Use inplace APInt operators in DivisionByConstantInfo. NFC

Reduces the number of temporary APInts that get created and
copy/moved from.

19 months ago[ASTMatchers] Add isInAnonymousNamespace narrowing matcher
Carlos Galvez [Mon, 19 Dec 2022 18:34:35 +0000 (18:34 +0000)]
[ASTMatchers] Add isInAnonymousNamespace narrowing matcher

Used in a couple clang-tidy checks so it could be extracted
out as its own matcher.

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

19 months ago[X86] Add reduce_*_ep[i|u]8/16 series intrinsics.
Freddy Ye [Fri, 23 Dec 2022 06:53:33 +0000 (14:53 +0800)]
[X86] Add reduce_*_ep[i|u]8/16 series intrinsics.

Reviewed By: pengfei, skan

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

19 months ago[libc][obvious] Remove a spurious statement leftover from a previous change.
Siva Chandra Reddy [Fri, 23 Dec 2022 06:49:45 +0000 (06:49 +0000)]
[libc][obvious] Remove a spurious statement leftover from a previous change.

19 months ago[OpenMP] [OMPD] Enable OMPD Tests
Vignesh Balasubramanian [Wed, 14 Dec 2022 04:36:30 +0000 (10:06 +0530)]
[OpenMP] [OMPD] Enable OMPD Tests

It was disabled due to different failures it different llvm bots.

Reviewed By: ye-luo
Differential Revision: https://reviews.llvm.org/D138411

19 months ago[Support] Move some APInt declarations in DivisionByConstantInfo to their first assig...
Craig Topper [Fri, 23 Dec 2022 05:50:01 +0000 (21:50 -0800)]
[Support] Move some APInt declarations in DivisionByConstantInfo to their first assignment.

This uses copy initialization instead of default constructing the
APInts and assigning over them.