Amaury Séchet [Sun, 25 Jun 2023 01:05:21 +0000 (01:05 +0000)]
[NFC] Autogenerate CodeGen/ARM/2013-07-29-vector-or-combine.ll
Amaury Séchet [Sun, 25 Jun 2023 01:02:49 +0000 (01:02 +0000)]
[NFC] Autogenerate CodeGen/ARM/2011-03-15-LdStMultipleBug.ll
Amaury Séchet [Sun, 25 Jun 2023 00:55:03 +0000 (00:55 +0000)]
[NFC] Autogenerate CodeGen/ARM/and-sext-combine.ll
Amaury Séchet [Sun, 25 Jun 2023 00:44:30 +0000 (00:44 +0000)]
[NFC] Autogenerate CodeGen/ARM/machine-cse-cmp.ll
Amaury Séchet [Sun, 25 Jun 2023 00:14:07 +0000 (00:14 +0000)]
[NFC] Autogenerate CodeGen/ARM/pr35103.ll
yronglin [Sun, 25 Jun 2023 00:14:55 +0000 (08:14 +0800)]
[libc++][ranges] Implement P2494R2 (Relaxing range adaptors to allow for move only types)
Implement P2494R2 `Relaxing range adaptors to allow for move only types`
https://open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2494r2.html#wording-ftm
According to the words in P2494R2, I haven't add new test for `drop_while_view`, `take_while_view` and `filter_view`, because these views has the requirement that the predicate is an `indirect_unary_predicate`, which requires that the predicate is `copy_constructible`, so they still can't accept move only types as predicate.
```
[P2483R0] also suggests future work to relax the requirements on the predicate types stored by standard views. This paper does not perform this relaxation, as the copy constructibility requirement is enshrined in the indirect callable concepts ([indirectcallable.indirectinvocable]). Thus, while this paper modifies the views that currently use copyable-box for user provided predicates, it only does so to apply the rename of the exposition-only type to movable-box; it does not change any of the constraints on those views. It does, however, relax the requirements on invocables accepted by the transform family of views, because those are not constrained using the indirect callable concepts.
```
Reviewed By: #libc, var-const
Differential Revision: https://reviews.llvm.org/D151629
Jacques Pienaar [Sun, 25 Jun 2023 00:03:37 +0000 (17:03 -0700)]
[mlir][polyapprox] Use llvm::numbers for constants.
Fixes windows build.
Dave Lee [Sat, 24 Jun 2023 22:00:38 +0000 (15:00 -0700)]
[lldb] Use LLDB_LOGF for printf format strings in AppleObjCDeclVendor.cpp
Fangrui Song [Sat, 24 Jun 2023 18:07:12 +0000 (11:07 -0700)]
[DWARF] Remove remnant .zdebug section recognition
There is a minor behavior difference that is not worth testing for the obsoleted
format. Previously, llvm-dwarfdump considers .zdebug_info as a debug section but
does not decompress it, leading to a warning when the content cannot be parsed.
Now llvm-dwarfdump just ignores the section without a warning.
Ian Anderson [Mon, 5 Jun 2023 22:08:54 +0000 (15:08 -0700)]
[libc++] Remove the type_traits includes from limits and new
type_traits is currently unable to include __type_traits/noexcept_move_assign_container.h, because it would cause several include cycles.
type_traits -> __type_traits/noexcept_move_assign_container.h -> __memory/allocator_traits.h -> __memory/construct_at.h -> new -> exception -> type_traits
type_traits -> __type_traits/noexcept_move_assign_container.h -> __memory/allocator_traits.h -> __memory/construct_at.h -> new -> type_traits
type_traits -> __type_traits/noexcept_move_assign_container.h -> __memory/allocator_traits.h -> limits -> type_traits
This is a problem for clang modules after the std mega module is broken up (D144322), because it becomes a module cycle which is a hard error.
Unconditionally remove the type_traits includes from limits and new in all versions, and also remove the exception include from new. (These are already removed in C++23.)
Reviewed By: ldionne, Mordante, #libc
Differential Revision: https://reviews.llvm.org/D153214
Fangrui Song [Sat, 24 Jun 2023 17:06:17 +0000 (10:06 -0700)]
[DWARF] Adjust warning condition for .dwo sections with relocations
D106624 added a .dwo warning (when there are relocations) that may fire for
non-debug sections, e.g. `.rodata.dwo` when there is a data symbol foo in
-fdata-sections mode. Adjust it to only warn for .debug sections.
While here, change the diagnostic to be more conventional
https://llvm.org/docs/CodingStandards.html#error-and-warning-messages and use
the relocated section name instead of the relocation section name.
This change does not handle `.zdebug` (support was mostly removed from LLVM) or
`__debug` (Mach-O, no DWO support).
Reviewed By: ayermolo, HaohaiWen
Differential Revision: https://reviews.llvm.org/D153602
Shao-Ce SUN [Sat, 24 Jun 2023 16:32:42 +0000 (00:32 +0800)]
[openmp] remove initializeRewriteSymbolsLegacyPassPass
Fix build error caused by D153679
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D153704
Piotr Fusik [Sat, 24 Jun 2023 16:27:06 +0000 (18:27 +0200)]
[libc++] Add noexcept clauses to swap per P0408R7 (Efficient Access to basic_stringbuf's Buffer)
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D153427
Thorsten Schütt [Sat, 24 Jun 2023 05:36:23 +0000 (07:36 +0200)]
[GlobalIsel][X86]] Legalize G_CONSTANT_FOLD_BARRIER
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D153684
Hristo Hristov [Mon, 19 Jun 2023 17:45:03 +0000 (20:45 +0300)]
[libc++][ranges] Addresses: LWG3719 - Directory iterators should be usable with default sentinel
Addresses: LWG3719 - Directory iterators should be usable with default sentinel
https://wg21.link/LWG3719
Reviewed By: #libc, Mordante
Differential Revision: https://reviews.llvm.org/D153299
Nathan James [Sat, 24 Jun 2023 14:18:20 +0000 (14:18 +0000)]
[clang-tidy] Fix false negative in readability-convert-member-functions-to-static
A nested class in a member function can erroneously confuse the check into
thinking that any CXXThisExpr found relate to the outer class, preventing any warnings.
Fix this by not traversing any nested classes.
Fixes https://github.com/llvm/llvm-project/issues/56765
Reviewed By: PiotrZSL
Differential Revision: https://reviews.llvm.org/D130665
Kazu Hirata [Sat, 24 Jun 2023 14:33:54 +0000 (07:33 -0700)]
[CodeGen] Remove unused forward declaration Value
The last use was removed by:
commit
7d894374551f6d5787db0aef2da8dd6aefa616fb
Author: OCHyams <orlando.hyams@sony.com>
Date: Thu Mar 16 08:48:36 2023 +0000
Kazu Hirata [Sat, 24 Jun 2023 14:33:52 +0000 (07:33 -0700)]
[CodeGen] Remove unused forward declarations Instruction and Type
The last uses were removed by:
commit
79b3f0823e562fc652c3272b2ccfb99174445fa6
Author: Tim Northover <tnorthover@apple.com>
Date: Tue Feb 7 11:28:00 2023 +0000
Kazu Hirata [Sat, 24 Jun 2023 14:33:50 +0000 (07:33 -0700)]
[LegacyPM] Remove RewriteSymbolsLegacyPass
Differential Revision: https://reviews.llvm.org/D153679
Kazu Hirata [Sat, 24 Jun 2023 14:33:49 +0000 (07:33 -0700)]
[LegacyPM] Remove PlaceSafepointsLegacyPass
Differential Revision: https://reviews.llvm.org/D153678
Kazu Hirata [Sat, 24 Jun 2023 13:59:52 +0000 (06:59 -0700)]
[CodeGen] Remove unused forward declaration DominatorTree
The last use was removed by:
commit
73523021d0a97c150a76a5cf4a91e99cd03b9efb
Author: Chandler Carruth <chandlerc@gmail.com>
Date: Mon Jan 13 13:07:17 2014 +0000
Kazu Hirata [Sat, 24 Jun 2023 13:59:50 +0000 (06:59 -0700)]
[Analysis] Remove unused forward declaration PhiValues
The last use was removed by:
commit
243acd5dcbc637e477062877185ad76d8ff63d9d
Author: Nikita Popov <npopov@redhat.com>
Date: Fri Dec 9 15:29:35 2022 +0100
Kazu Hirata [Sat, 24 Jun 2023 13:59:49 +0000 (06:59 -0700)]
[Analysis] Remove unused forward declaration GetElementPtrInst
The last use was removed by:
commit
2d79b713663169b3732fcbdf56cac243b5c41e28
Author: Philip Reames <preames@rivosinc.com>
Date: Thu Apr 6 08:23:08 2023 -0700
Kazu Hirata [Sat, 24 Jun 2023 13:59:47 +0000 (06:59 -0700)]
[Analysis] Remove unused forward declaration BasicAAResult
The last use was removed by:
commit
f9b523ebc367f1535bf61797383471e567b24b75
Author: Kazu Hirata <kazu@google.com>
Date: Wed May 31 07:30:14 2023 -0700
LLVM GN Syncbot [Sat, 24 Jun 2023 11:01:56 +0000 (11:01 +0000)]
[gn build] Port
7f6e0052a97f
Piotr Zegar [Sat, 24 Jun 2023 10:59:30 +0000 (10:59 +0000)]
[clang-tidy] Add misc-header-include-cycle check
Check detects cyclic #include dependencies between user-defined headers.
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D144828
David Green [Sat, 24 Jun 2023 10:12:58 +0000 (11:12 +0100)]
[AArch64] Add SVE lowering for vector.reduce.fminimum and fmaximum
Following what is already performed for vector.reduce.fmin/fmax, this adds
lowering for the new vector.reduce.fminimum/fmaximum nodes to the SVE fminv
and fmaxv instructions via the existing FMINV_PRED/FMAXV_PRED nodes.
Differential Revision: https://reviews.llvm.org/D153288
Piotr Zegar [Sat, 24 Jun 2023 08:41:52 +0000 (08:41 +0000)]
Revert "[clang-tidy] Add misc-header-include-cycle check"
This reverts commit
f3aa6cc0f5d56752242203c2a9231c1bc230c15e.
Piotr Zegar [Sat, 24 Jun 2023 07:01:32 +0000 (07:01 +0000)]
[clang-tidy] Add misc-header-include-cycle check
Check detects cyclic #include dependencies between user-defined headers.
Reviewed By: njames93
Differential Revision: https://reviews.llvm.org/D144828
Iain Sandoe [Wed, 14 Jun 2023 18:48:04 +0000 (19:48 +0100)]
[C++20][Modules] Implement P2615R1 revised export diagnostics.
It has been reported to that the current clang errors for, specifically,
static_assert in export contexts are a serious blocker to adoption of
modules in some cases.
There is also implementation divergence with GCC and MSVC allowing the
constructs mentioned below where clang currently rejects them with an
error.
The category of errors [for declarations in an exported context] is:
(unnamed, static_assert, empty and asm decls). These are now permitted
after P2615R1 which was approved by WG21 as a DR (and thus should be
applied to C++20 as well).
This patch removes these diagnostics and amends the testsuite accordingly.
Differential Revision: https://reviews.llvm.org/D152946
Johannes Doerfert [Sat, 24 Jun 2023 07:24:02 +0000 (00:24 -0700)]
[Attributor] Avoid more AAs through IR implication
Johannes Doerfert [Sat, 24 Jun 2023 07:25:22 +0000 (00:25 -0700)]
[Attributor] Avoid uninitialized memory read.
Kazu Hirata [Sat, 24 Jun 2023 07:00:06 +0000 (00:00 -0700)]
[Support] Remove countLeadingZeros, countPopulation, etc
These functions have been deprecated since:
commit
ec116ea684b43aadfdda03cea2c2a86423e3fc27
Author: Kazu Hirata <kazu@google.com>
Date: Sun Feb 12 12:11:51 2023 -0800
Differential Revision: https://reviews.llvm.org/D153686
Pedro Falcato [Sat, 24 Jun 2023 05:45:17 +0000 (22:45 -0700)]
[clang] Add -fcheck-new support
Add -fcheck-new and -fno-check-new, from GCC, which make the compiler
not assume pointers returned from operator new are non-null.
Fixes #16931.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D125272
Vitaly Buka [Sat, 24 Jun 2023 04:10:26 +0000 (21:10 -0700)]
[test][MSAN] Fix test by printing action before execution it
We expect log messages from enother thread triggered by actions.
Thorsten Schütt [Fri, 23 Jun 2023 16:36:59 +0000 (18:36 +0200)]
[GlobalIsel][X86] G_STORE extension
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D153643
Johannes Doerfert [Fri, 23 Jun 2023 22:00:48 +0000 (15:00 -0700)]
[Attributor][FIX] Do not ignore refinement for IPO
This is just a cleanup commit, a follow up will make this way more
structured.
Johannes Doerfert [Fri, 23 Jun 2023 20:08:57 +0000 (13:08 -0700)]
[Attributor] Avoid the type check in getCalledFunction
We now consistently use `CallBase::getCalledOperand` rather than
`getCalledFunction`, as we do not want the type checked performed by the
latter. This exposed various missing checks to handle mismatches
properly, but it is good to have them explicit now.
In a follow up we might want to flag certain calls as UB, but for now,
we allow everything to cut down on unexpected differences.
Kai Sasaki [Sat, 24 Jun 2023 02:43:40 +0000 (02:43 +0000)]
[mlir] Replace HTML escaped character
Youngsuk Kim [Sat, 24 Jun 2023 01:52:43 +0000 (21:52 -0400)]
[llvm] Replace use of Type::getPointerTo() (NFC)
Partial progress towards replacing in-tree uses of
`Type::getPointerTo()`.
If `getPointerTo()` is used solely to support an unnecessary bitcast,
remove the bitcast.
Reviewed By: barannikov88, nikic
Differential Revision: https://reviews.llvm.org/D153307
Mehdi Amini [Sat, 24 Jun 2023 01:15:47 +0000 (03:15 +0200)]
Improve fatal error message when handling promised interfaces
When initializing DialectInterfaceCollection, we wouldn't have the missing
interface name in the error.
Differential Revision: https://reviews.llvm.org/D153676
Mehdi Amini [Sat, 24 Jun 2023 01:46:10 +0000 (03:46 +0200)]
Add missing dependent dialects to AsyncToAsyncRuntimePass and GpuKernelOutliningPass
These aren't detected during testing most of the time because the way we
are setting up mlir-opt and the fact that we always use func.func: it'll
trigger the load of the InlinerInterface extension for the FuncDialect which
itself loads these dialects unconditionally.
Fangrui Song [Sat, 24 Jun 2023 01:44:31 +0000 (18:44 -0700)]
[XRay][AArch64] Add .size directive
Kazu Hirata [Sat, 24 Jun 2023 01:26:17 +0000 (18:26 -0700)]
[LegacyPM] Remove unused declarations createLowerMatrixIntrinsicsPass and createLowerMatrixIntrinsicsMinimalPass
The corresponding function definitions were removed by:
commit
2764322912c1fe767831ebfd195118e8534e21aa
Author: Kazu Hirata <kazu@google.com>
Date: Fri Jun 23 01:32:38 2023 -0700
Kazu Hirata [Sat, 24 Jun 2023 01:26:16 +0000 (18:26 -0700)]
[LegacyPM] Remove unused declaration initializeStripSymbolsPass
The corresponding function definition was removed by:
commit
15977742d3ebba05a33a8eac3201ebba9c9f10e3
Author: Arthur Eubanks <aeubanks@google.com>
Date: Tue Dec 20 13:36:20 2022 -0800
Kazu Hirata [Sat, 24 Jun 2023 01:26:14 +0000 (18:26 -0700)]
[LegacyPM] Remove unused declarations initializeCrossDSOCFIPass and initializeGlobalSplitPass
The corresponding function definitions were removed by:
commit
c8b8d6baddf9a744594a69e9fb266b724e2e99b2
Author: Arthur Eubanks <aeubanks@google.com>
Date: Thu Feb 9 17:22:56 2023 -0800
Kazu Hirata [Sat, 24 Jun 2023 01:26:12 +0000 (18:26 -0700)]
[LegacyPM] Remove unused declarations initializeCorrelatedValuePropagationPass and initializeJumpThreadingPass
The corresponding function definitions were removed by:
commit
7c3c981442b11153ac1a2be678db727ff715253b
Author: Arthur Eubanks <aeubanks@google.com>
Date: Wed Mar 8 15:07:17 2023 -0800
LLVM GN Syncbot [Sat, 24 Jun 2023 01:16:38 +0000 (01:16 +0000)]
[gn build] Port
6085eb308491
Alex Brachet [Sat, 24 Jun 2023 01:15:50 +0000 (01:15 +0000)]
Revert "Reland [llvm] Preliminary fat-lto-objects support"
This reverts commit
44265dc3554ef40920b587eeb787a400663af6c7.
varconst [Sat, 24 Jun 2023 01:10:03 +0000 (18:10 -0700)]
[libc++][NFC] Fix incorrect return type of `operator<=>` in `span` test code.
LLVM GN Syncbot [Sat, 24 Jun 2023 00:59:38 +0000 (00:59 +0000)]
[gn build] Port
c9a8a0e8a9b2
Douglas Yung [Sat, 24 Jun 2023 00:58:22 +0000 (17:58 -0700)]
Revert "[llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed using MD5 as key to Sample Profile map"
This reverts commit
31af18bccea95fe1ae8aa2c51cf7c8e92a1c208e.
This change is causing build failures on many Windows build bots:
https://lab.llvm.org/buildbot/#/builders/216/builds/22833
https://lab.llvm.org/buildbot/#/builders/123/builds/19602
https://lab.llvm.org/buildbot/#/builders/172/builds/28315
https://lab.llvm.org/buildbot/#/builders/119/builds/13870
https://lab.llvm.org/buildbot/#/builders/233/builds/794
https://lab.llvm.org/buildbot/#/builders/235/builds/387
https://lab.llvm.org/buildbot/#/builders/13/builds/36921
https://lab.llvm.org/buildbot/#/builders/127/builds/50510
Douglas Yung [Sat, 24 Jun 2023 00:57:37 +0000 (17:57 -0700)]
Revert "[llvm-profdata] Fix mixed-sign comparison warnings"
This reverts commit
a2e7f26160359ed3913badb5acdd05aa8c663b46.
The original patch (31af18b) will be reverted, so reverting this follow-up patch first.
Robert Suderman [Fri, 23 Jun 2023 23:54:48 +0000 (16:54 -0700)]
[mlir][math] Improved math.atan approximation
Used the cephes numerical approximation for `math.atan`. This is a
significant accuracy improvement over the previous taylor series
approximation.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D153656
Alex Bradbury [Sat, 24 Jun 2023 00:04:56 +0000 (17:04 -0700)]
Recommit "[RISCV] Implement support for bf16 truncate/extend on hard FP targets"
Without the changes from D153598.
Original commit message:
For the same reasons as D151284, this requires custom lowering of the
truncate libcall on hard float ABIs (the normal libcall code path is
used on soft ABIs).
The extend operation is implemented by a shift just as in the standard
legalisation, but needs to be custom lowered because i32 isn't a legal
type on RV64.
This patch aims to make the minimal changes that result in correct
codegen for the bfloat.ll tests.
Differential Revision: https://reviews.llvm.org/D151663
Craig Topper [Sat, 24 Jun 2023 00:01:28 +0000 (17:01 -0700)]
[RISCV] Use binary search on the extension tables in RISCVISAInfo.cpp. NFC
After D153170 the tables are now sorted by extension name so we can use that to
avoid a linear search.
Reviewed By: asb, MaskRay
Differential Revision: https://reviews.llvm.org/D153598
Craig Topper [Sat, 24 Jun 2023 00:00:11 +0000 (17:00 -0700)]
Revert "[RISCV] Implement support for bf16 truncate/extend on hard FP targets"
This was committed with D153598 merged into it. Reverting to recommit as separate patches.
This reverts commit
690b1c847f0b188202a86dc25a0a76fd8c4618f4.
Johannes Doerfert [Sat, 24 Jun 2023 00:06:47 +0000 (17:06 -0700)]
[Attributor][NFC] Avoid string concat for non-tracing runs
Johannes Doerfert [Tue, 20 Jun 2023 05:59:31 +0000 (22:59 -0700)]
[Attributor] Check IR attributes before creating new AAs
Instead of creating an AA for an IR attribute we can first check if it
is implied/known. If so, we can save the time to create the AA, figure
out it is implied, fix it, and later manifest it in the IR
(redundantly). Other IR attributes can be added to the list in
`AA::hasAssumedIRAttr` later on, for now we support 8 different ones.
Johannes Doerfert [Fri, 23 Jun 2023 02:21:02 +0000 (19:21 -0700)]
[Attributor][NFCI] Use pointers to pass around AAs
This will make it easier to create less trivial AAs in the future as we
can simply return `nullptr` rather than an AA with in invalid state.
LLVM GN Syncbot [Sat, 24 Jun 2023 00:07:35 +0000 (00:07 +0000)]
[gn build] Port
44265dc3554e
Teresa Johnson [Fri, 23 Jun 2023 18:01:22 +0000 (11:01 -0700)]
[LTO][GlobalDCE] Use pass parameter instead of module flag for LTO phase
D63932 added a module flag to indicate that we are executing the regular
LTO post merge pipeline, so that GlobalDCE could perform more aggressive
optimization for Dead Virtual Function Elimination. This caused issues
trying to reuse bitcode that had already been through the LTO pipeline
(see context in D139816).
Instead support this by passing down a parameter flag to the
GlobalDCEPass constructor, which is the more usual way for indicating
this information.
Most test changes are to remove incidental uses of this flag. Of the 2
real uses, llvm/test/LTO/ARM/lto-linking-metadata.ll is now obsolete and
removed in this patch, and the virtual-functions-visibility-post-lto.ll
test is updated to use the regular LTO default pipeline where this
parameter is set to true.
Differential Revision: https://reviews.llvm.org/D153655
Craig Topper [Fri, 23 Jun 2023 23:52:45 +0000 (16:52 -0700)]
[RISCV] Split ReadSFB into ReadSFBJmp and ReadSFBALU.
The operands may need to be available at different times.
Matt Arsenault [Thu, 22 Jun 2023 21:50:59 +0000 (17:50 -0400)]
clang: Add missing cases to elementwise builtin SemaCXX test
Matt Arsenault [Sun, 18 Jun 2023 19:40:43 +0000 (15:40 -0400)]
clang: Add __builtin_elementwise_rint and nearbyint
These are basically the same thing and only differ for strictfp,
so add both for future proofing. Note all the elementwise functions are
currently broken for strictfp, and use non-constrained ops. Add a test
that demonstrates this, but doesn't attempt to fix it.
Hongtao Yu [Thu, 22 Jun 2023 21:02:53 +0000 (14:02 -0700)]
[Pseudo Probe] Remove the assert of allowing only one call probe for a callsite.
Compiler-generated static symbols, such as the global initializers, can shared the same name and can coexist in the binary. As a result, their pseudo probes are all kept in the binary too. This could cause multiple call probes decoded against one callsite, as probes are decoded against there owning functions by name. I'm temporarily disabling an assert to keep the debug build green until we have a better fix.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D153588
Matt Arsenault [Thu, 22 Jun 2023 18:28:01 +0000 (14:28 -0400)]
clang: Fix elementwise value naming to match instruction
Johannes Doerfert [Thu, 22 Jun 2023 20:11:33 +0000 (13:11 -0700)]
[Attributor][NFC] Allow to restrict the Attributor to cached passes
If the user wants to avoid running additional passes, they can now
initialize the AnalysisGetter accordingly.
Johannes Doerfert [Mon, 19 Jun 2023 21:46:11 +0000 (14:46 -0700)]
[Attributor] Remove the iteration count verification
It was never really useful to track #iterations, though it helped during
the initial development. What we should track, in a follow up, are
potentially #updates. That is also what we should restrict instead of
the #iterations.
Matt Arsenault [Wed, 19 Apr 2023 21:02:23 +0000 (17:02 -0400)]
ValueTracking: Use new version of cannotBeOrderedLessThanZero
Pass all arguments so now assumes work.
Matt Arsenault [Tue, 18 Apr 2023 23:41:56 +0000 (19:41 -0400)]
ValueTracking: Prepare to phase out CannotBeOrderedLessThanZero
Introduce a full featured wrapper around computeKnownFPClass
to start replacing the uses with.
Paul Kirth [Fri, 24 Mar 2023 00:21:51 +0000 (00:21 +0000)]
Reland [llvm] Preliminary fat-lto-objects support
Fat LTO objects contain both LTO compatible IR, as well as generated
object code. This allows users to defer the choice of whether to use LTO
or not to link-time. This is a feature available in GCC for some time,
and makes the existing -ffat-lto-objects flag functional in the same
way as GCC's.
Within LLVM, we add a new EmbedBitcodePass that serializes the module to
the object file, and expose a new pass pipeline for compiling fat
objects. The new pipeline initially clones the module and runs the
selected (Thin)LTOPrelink pipeline, after which it will serialize the
module into a `.llvm.lto` section of an ELF file. When compiling for
(Thin)LTO, this normally the point at which the compiler would emit a
object file containing the bitcode and metadata.
After that point we compile the original module using the
PerModuleDefaultPipeline used for non-LTO compilation. We generate
standard object files at the end of this pipeline, which contain machine
code and the new `.llvm.lto` section containing bitcode.
Since the two pipelines operate on different copies of the module, we
can be sure that the bitcode in the `.llvm.lto` section and object code
in `.text` are congruent with the existing output produced by the
default and LTO pipelines.
Original RFC: https://discourse.llvm.org/t/rfc-ffat-lto-objects-support/63977
Earlier versions of this patch were missing REQUIRES lines for llc
related tests in Transforms/EmbedBitcode. Those tests are now under
CodeGen/X86, which should avoid running the check on unsupported
platforms.
Reviewed By: tejohnson, MaskRay, nikic
Differential Revision: https://reviews.llvm.org/D146776
Sami Tolvanen [Fri, 23 Jun 2023 16:31:42 +0000 (16:31 +0000)]
[RISCV] Implement KCFI operand bundle lowering
With `-fsanitize=kcfi` (Kernel Control-Flow Integrity), Clang emits
"kcfi" operand bundles to indirect call instructions. Similarly to
the target-specific lowering added in D119296, implement KCFI operand
bundle lowering for RISC-V.
This patch disables the generic KCFI pass for RISC-V in Clang, and
adds the KCFI machine function pass in `RISCVPassConfig::addPreSched`
to emit target-specific `KCFI_CHECK` pseudo instructions before calls
that have KCFI operand bundles. The machine function pass also bundles
the instructions to ensure we emit the checks immediately before the
calls, which is not possible with the generic pass.
`KCFI_CHECK` instructions are lowered in `RISCVAsmPrinter` to a
contiguous code sequence that traps if the expected hash in the
operand bundle doesn't match the hash before the target function
address. This patch emits an `ebreak` instruction for error handling
to match the Linux kernel's `BUG()` implementation. Just like for X86,
we also emit trap locations to a `.kcfi_traps` section to support
error handling, as we cannot embed additional information to the trap
instruction itself.
Relands commit
62fa708ceb027713b386c7e0efda994f8bdc27e2 with fixed
tests.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148385
Mehdi Amini [Fri, 23 Jun 2023 22:44:35 +0000 (00:44 +0200)]
Fix missing return introduced when adding support for properties in MLIR in
5e118f933b659
This is a rarely used API: `matchAndRewrite()` is the usual way of using
patterns.
Matt Arsenault [Mon, 17 Apr 2023 20:33:09 +0000 (16:33 -0400)]
ValueTracking: Handle cannotBeOrderedLessThanZero for fadd
Move cannotBeOrderedLessThanZero logic into computeKnownFPClass.
Kazu Hirata [Fri, 23 Jun 2023 22:21:07 +0000 (15:21 -0700)]
[llvm-profdata] Fix mixed-sign comparison warnings
This patch fixes -Wsign-compare warnings from:
llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp:117:3: note:
in instantiation of function template specialization
'testing::internal::EqHelper::Compare<unsigned long, int, nullptr>'
requested here
llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp:134:3: note:
in instantiation of function template specialization
'testing::internal::EqHelper::Compare<unsigned int, int, nullptr>'
requested here
llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp:144:3: note:
in instantiation of function template specialization
'testing::internal::EqHelper::Compare<unsigned int, int, nullptr>'
requested here
llvm/unittests/tools/llvm-profdata/MD5CollisionTest.cpp:160:3: note:
in instantiation of function template specialization
'testing::internal::EqHelper::Compare<unsigned int, int, nullptr>'
requested here
Vitaly Buka [Fri, 23 Jun 2023 21:57:25 +0000 (14:57 -0700)]
[test][msan] Add test for dc4d9d6
Vitaly Buka [Fri, 23 Jun 2023 00:12:37 +0000 (17:12 -0700)]
[msan] Optimize zeroing allocated memory
Reviewed By: thurston
Differential Revision: https://reviews.llvm.org/D153599
LLVM GN Syncbot [Fri, 23 Jun 2023 21:50:49 +0000 (21:50 +0000)]
[gn build] Port
31af18bccea9
William Huang [Thu, 25 May 2023 03:35:50 +0000 (03:35 +0000)]
[llvm-profdata] Refactoring Sample Profile Reader to increase FDO build speed using MD5 as key to Sample Profile map
This is phase 1 of multiple planned improvements on the sample profile loader. The major change is to use MD5 hash code ((instead of the function itself) as the key to look up the function offset table and the profiles, which significantly reduce the time it takes to construct the map.
The optimization is based on the fact that many practical sample profiles are using MD5 values for function names to reduce profile size, so we shouldn't need to convert the MD5 to a string and then to a SampleContext and use it as the map's key, because it's extremely slow.
Several changes to note:
(1) For non-CS SampleContext, if it is already MD5 string, the hash value will be its integral value, instead of hashing the MD5 again. In phase 2 this is going to be optimized further using a union to represent MD5 function (without converting it to string) and regular function names.
(2) The SampleProfileMap is a wrapper to *map<uint64_t, FunctionSamples>, while providing interface allowing using SampleContext as key, so that existing code still work. It will check for MD5 collision (unlikely but not too unlikely, since we only takes the lower 64 bits) and handle it to at least guarantee compilation correctness (conflicting old profile is dropped, instead of returning an old profile with inconsistent context). Other code should not try to use MD5 as key to access the map directly, because it will not be able to handle MD5 collision at all. (see exception at (5) )
(3) Any SampleProfileMap::emplace() followed by SampleContext assignment if newly inserted, should be replaced with SampleProfileMap::Create(), which does the same thing.
(4) Previously we ensure an invariant that in SampleProfileMap, the key is equal to the Context of the value, for profile map that is eventually being used for output (as in llvm-profdata/llvm-profgen). Since the key became MD5 hash, only the value keeps the context now, in several places where an intermediate SampleProfileMap is created, each new FunctionSample's context is set immediately after insertion, which is necessary to "remember" the context otherwise irretrievable.
(5) When reading a profile, we cache the MD5 values of all functions, because they are used at least twice (one to index into FuncOffsetTable, the other into SampleProfileMap, more if there are additional sections), in this case the SampleProfileMap is directly accessed with MD5 value so that we don't recalculate it each time (expensive)
Performance impact:
When reading a ~1GB extbinary profile (fixed length MD5, not compressed) with 10 million function names and 2.5 million top level functions (non CS functions, each function has varying nesting level from 0 to 20), this patch improves the function offset table loading time by 20%, and improves full profile read by 5%.
Reviewed By: davidxl, snehasish
Differential Revision: https://reviews.llvm.org/D147740
Sami Tolvanen [Fri, 23 Jun 2023 21:42:57 +0000 (21:42 +0000)]
Revert "[RISCV] Implement KCFI operand bundle lowering"
This reverts commit
62fa708ceb027713b386c7e0efda994f8bdc27e2.
Reverting to investigate -verify-machineinstrs errors in MIR tests.
xortoast [Fri, 23 Jun 2023 21:01:35 +0000 (14:01 -0700)]
[WebAssembly] Add lowering for llvm.rint and llvm.roundeven
WebAssembly doesn't expose inexact exceptions, so frint can be mapped to
fnearbyint. Likewise, WebAssembly always rounds ties-to-even, so
froundeven can be mapped to fnearbyint.
Differential Revision: https://reviews.llvm.org/D153451
Amara Emerson [Fri, 23 Jun 2023 20:51:54 +0000 (13:51 -0700)]
Darwin: Use the GOT to reference ___stack_chk_guard.
e018cbf7208b changed the default behaviour for Darwin, and this breaks some
existing software.
rdar://
110350601
Joseph Huber [Wed, 21 Jun 2023 00:36:27 +0000 (19:36 -0500)]
[libc] Add basic utility support for timing functions on the GPU
This patch adds the utilities for the clocks on the GPU. This is done
prior to exporting it via some other interface and is mainly just done
so they are availible if we wish to do internal testing.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D153388
Joseph Huber [Thu, 22 Jun 2023 16:22:31 +0000 (11:22 -0500)]
[ClangPackager] Add an option to extract inputs to an archive
Currently we simply overwrite the output file if we get muliple matches
in the fatbinary. This patch introduces the `--archive` option which
allows us to combine all of the files into a static archive instead.
This is usefuly for creating a device specific static archive library
from a fatbinary.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D153568
Florian Hahn [Fri, 23 Jun 2023 20:01:25 +0000 (21:01 +0100)]
[ConstraintElim] Add tests to check negated OR simplifications.
Additional test coverage for D151799.
Matt Arsenault [Fri, 23 Jun 2023 19:37:27 +0000 (15:37 -0400)]
Revert "OpenMP/cmake: Use list append instead of repeating variable name"
This reverts commit
e429fdd036957f570f624fee4e79a480ff2ec90e.
Joseph Huber [Fri, 23 Jun 2023 19:33:04 +0000 (14:33 -0500)]
[libc][Obvious] Use the current binary dir instead of the base one
Summary:
We include things off of `libc/include` so we need to use the current
binary dir when setting up the directory.
Robert Suderman [Fri, 23 Jun 2023 18:48:33 +0000 (11:48 -0700)]
[mlir][math] Modified the 'math.exp' lowering for higher precision
The existing lowering has lower precision for certain use cases, e.g.
tanh. Improved version should demonstrate an overall higher level of precision.
Reviewed By: cota, jpienaar
Differential Revision: https://reviews.llvm.org/D153592
Matt Arsenault [Fri, 23 Jun 2023 14:42:17 +0000 (10:42 -0400)]
OpenMP/cmake: Use DEPFILE instead of IMPLICIT_DEPENDS
IMPLICIT_DEPENDS doesn't actually work with ninja and this does.
Matt Arsenault [Fri, 23 Jun 2023 13:40:18 +0000 (09:40 -0400)]
OpenMP/cmake: Use list append instead of repeating variable name
Zahira Ammarguellat [Thu, 22 Jun 2023 21:28:22 +0000 (17:28 -0400)]
When float_t and double_t types are used inside a scope with
a '#pragma clang fp eval_method, it can lead to ABI breakage.
See https://godbolt.org/z/56zG4Wo91
This patch prevents this.
Differential Revision: https://reviews.llvm.org/D153590
LLVM GN Syncbot [Fri, 23 Jun 2023 18:59:19 +0000 (18:59 +0000)]
[gn build] Port
a3800ad9d87f
Jonas Devlieghere [Fri, 23 Jun 2023 18:56:07 +0000 (11:56 -0700)]
[lldb] Use format specific for unprintabe char in DumpDataExtractor
Addresses Jason's post-commit feedback in D153644.
Chia-hung Duan [Tue, 20 Jun 2023 22:25:17 +0000 (22:25 +0000)]
[scudo] PopBatch after populateFreeList()
Ensure the thread that refills freelist will get the Batch without
contending the lock in SizeClassAllocator64.
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D152419
Chia-hung Duan [Tue, 20 Jun 2023 22:25:02 +0000 (22:25 +0000)]
[scudo] update Pushedblocks/PoppedBlocks in Impl functions
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D152420
Joseph Huber [Fri, 23 Jun 2023 15:42:54 +0000 (10:42 -0500)]
[libc] Fix installing GPU headers
The patch in D152592 changed the logic for this. We could never check if
we were on the GPU as this was before the variable was defined so I
moved it later. Secondly, we cannot use the `LLVM_BINARY_DIR` here, and
I do not know if that works in general. The problem is that it will
isntall the headers under a normal path outside of the
`LLVM_ENABLE_RUNTIMES` build. I don't know if that's correct for the
other targets, but for the GPU I need to set it back to the
CMAKE_BINARY_DIR so it works.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D153637
Paul Kirth [Fri, 23 Jun 2023 18:43:02 +0000 (18:43 +0000)]
Revert "[llvm] Preliminary fat-lto-objects support"
There seems to be a problem on arm buildbots. Reverting until I can
investigate. https://lab.llvm.org/buildbot#builders/245/builds/10184
This reverts commit
a67208e1c697649ce432e6497f56a93675273dd8
and dependent commit
e54a3112cee5ae0a9117359ecbea878e1388f51e.
Sami Tolvanen [Fri, 23 Jun 2023 16:31:42 +0000 (16:31 +0000)]
[RISCV] Implement KCFI operand bundle lowering
With `-fsanitize=kcfi` (Kernel Control-Flow Integrity), Clang emits
"kcfi" operand bundles to indirect call instructions. Similarly to
the target-specific lowering added in D119296, implement KCFI operand
bundle lowering for RISC-V.
This patch disables the generic KCFI pass for RISC-V in Clang, and
adds the KCFI machine function pass in `RISCVPassConfig::addPreSched`
to emit target-specific `KCFI_CHECK` pseudo instructions before calls
that have KCFI operand bundles. The machine function pass also bundles
the instructions to ensure we emit the checks immediately before the
calls, which is not possible with the generic pass.
`KCFI_CHECK` instructions are lowered in `RISCVAsmPrinter` to a
contiguous code sequence that traps if the expected hash in the
operand bundle doesn't match the hash before the target function
address. This patch emits an `ebreak` instruction for error handling
to match the Linux kernel's `BUG()` implementation. Just like for X86,
we also emit trap locations to a `.kcfi_traps` section to support
error handling, as we cannot embed additional information to the trap
instruction itself.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D148385
LLVM GN Syncbot [Fri, 23 Jun 2023 18:05:33 +0000 (18:05 +0000)]
[gn build] Port
a67208e1c697