Kazu Hirata [Wed, 15 Mar 2023 05:20:33 +0000 (22:20 -0700)]
[flang] Use Use *{Set,Map}::contains (NFC)
Matt Arsenault [Tue, 28 Feb 2023 11:47:23 +0000 (07:47 -0400)]
clang: Handle MatrixType in hasFloatingRepresentation
Allows applying nofpclass to matrix arguments.
Matt Arsenault [Mon, 27 Feb 2023 23:56:00 +0000 (19:56 -0400)]
clang: Emit nofpclass(nan inf) for -ffinite-math-only
Set this on any source level floating-point type argument,
return value, call return or outgoing parameter which is lowered
to a valid IR type for the attribute. Currently this isn't
applied to emitted intrinsics since those don't go through
ABI code.
Matt Arsenault [Thu, 2 Mar 2023 12:22:07 +0000 (08:22 -0400)]
Attributor: Add baseline tests for nofpclass
Matt Arsenault [Tue, 28 Feb 2023 12:05:23 +0000 (08:05 -0400)]
clang: Add baseline test for nofpclass emission
Matt Arsenault [Wed, 1 Feb 2023 12:56:58 +0000 (08:56 -0400)]
CodeGen: Add some additional is_fpclass lowering tests
Cover more cases in preparation for making greater use
of fcmp based lowerings. Also add more tests for the inverted
cases. Test iszero | isnan test masks. We should probably just
generate every combination of test masks.
Kazu Hirata [Wed, 15 Mar 2023 04:48:49 +0000 (21:48 -0700)]
[mlir] Use Use *{Set,Map}::contains (NFC)
Kazu Hirata [Wed, 15 Mar 2023 04:41:40 +0000 (21:41 -0700)]
[lldb] Use *{Set,Map}::contains (NFC)
Kazu Hirata [Wed, 15 Mar 2023 04:30:29 +0000 (21:30 -0700)]
[clang-tools-extra] Use *{Set,Map}::contains (NFC)
Jie Fu [Wed, 15 Mar 2023 04:07:25 +0000 (12:07 +0800)]
[mlir] Fix two build warnings (NFC)
/data/llvm-project/mlir/lib/Dialect/Tensor/Utils/Utils.cpp:62:11: error: comparison of integers of different signs: 'int64_t' (aka 'long') and 'size_t' (aka 'unsigned long') [-Werror,-Wsign-compare]
if (dim >= shape.size())
~~~ ^ ~~~~~~~~~~~~
1 error generated.
/data/llvm-project/mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp:484:8: error: unused variable 'appendIndex' [-Werror,-Wunused-variable]
auto appendIndex = [&](Value val, SmallVector<Value> &dynIndices,
^
1 error generated.
Mahesh Ravishankar [Wed, 15 Mar 2023 03:18:49 +0000 (03:18 +0000)]
[mlir][Tensor] Use folded evaluators in tiling implementation of `tensor.pad`.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D145135
Jeff Bailey [Tue, 14 Mar 2023 14:53:03 +0000 (14:53 +0000)]
[libc] Add instructions for linux headers
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D146049
jinge90 [Wed, 15 Mar 2023 03:09:25 +0000 (11:09 +0800)]
Add __builtin_set_flt_rounds
This builtin will be converted to llvm.set.rounding intrinsic
in IR level and should be work with "#pragma STDC FENV_ACCESS ON"
since it changes default FP environment. Users can change rounding
mode via this builtin without introducing libc dependency.
Reviewed by: andrew.w.kaylor, rjmccall, sepavloff, aaron.ballman
Differential Revision: https://reviews.llvm.org/D145765
Signed-off-by: jinge90 <ge.jin@intel.com>
Jacob Lambert [Wed, 15 Mar 2023 02:40:33 +0000 (19:40 -0700)]
[clang-offload-bundler] Fix error with regex in bundler test
Fix recently introduced error and further generalize
pattern matching for accepted HOST string
Arthur Eubanks [Mon, 13 Mar 2023 17:03:09 +0000 (10:03 -0700)]
[Pipeline] Remove early InstCombine in ThinLTO post link sample profile pipeline
With opaque pointers, all function pointer types are the same, meaning there should be no bitcasts.
Internal benchmarks with SampleFDO look neutral.
This was added in D36333.
Reviewed By: tejohnson, davidxl
Differential Revision: https://reviews.llvm.org/D146099
Kazu Hirata [Wed, 15 Mar 2023 02:17:18 +0000 (19:17 -0700)]
[clang] Use *{Set,Map}::contains (NFC)
Jacob Lambert [Wed, 15 Mar 2023 02:05:59 +0000 (19:05 -0700)]
[clang-offload-bundler] Fix test failures and document typo
The recent bundler patch (e48ae0d) introduced a few errors
in two clang/Driver tests, and in the bundler documentation
Kazu Hirata [Wed, 15 Mar 2023 01:56:06 +0000 (18:56 -0700)]
[llvm] Use *{Set,Map}::contains (NFC)
Douglas Yung [Wed, 15 Mar 2023 01:33:55 +0000 (18:33 -0700)]
Mark test modified in e48ae0d as XFAIL for PS4/PS5 until the author can investigate.
The test is failing on the PS4/PS5 bots:
https://lab.llvm.org/buildbot/#/builders/139/builds/37475
https://lab.llvm.org/buildbot/#/builders/216/builds/18354
Uday Bondhugula [Sat, 18 Feb 2023 09:16:55 +0000 (14:46 +0530)]
[MLIR] Update/fix memref region computation for affine.parallel ops
When the affine.parallel op was introduced, affine utilities weren't
extended to handle it. Extending these is straightforward and natural
given that addAffineParallelOpDomain has also been added.
Update/complete memref region compute to account for affine.parallel
ops. Handle failure cleanly.
Add and expose utilities missing for affine.parallel to be consistent
with affine.for.
All of these allow various affine passes to work with a combination of
affine.parallel and affine.for ops.
Differential Revision: https://reviews.llvm.org/D145669
Kazu Hirata [Wed, 15 Mar 2023 01:06:55 +0000 (18:06 -0700)]
[Target] Use *{Set,Map}::contains (NFC)
David Blaikie [Wed, 15 Mar 2023 00:50:11 +0000 (00:50 +0000)]
Fix split-dwarf-dwp-invalid test to be Windows-path-separator compatible
Amir Ayupov [Wed, 15 Mar 2023 00:29:23 +0000 (17:29 -0700)]
[BOLT][NFC] Move addRelocation{X86,AArch64} into MCPlusBuilder
The two methods don't belong in BinaryFunction methods.
Move the dispatch tables into target-specific MCPlusBuilder methods.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D131813
Ben Shi [Tue, 14 Mar 2023 03:59:55 +0000 (11:59 +0800)]
[RISCV][NFC] Combine identical switch cases in TTI
Reviewed By: craig.topper, asb
Differential Revision: https://reviews.llvm.org/D146008
Amir Ayupov [Wed, 15 Mar 2023 00:26:21 +0000 (17:26 -0700)]
[BOLT][NFC] Simplify MCPlusBuilder::getRegSize
Pre-calculate the register size table in MCPlusBuilder constructor,
similar to `AliasMap`/`SmallerAliasMap` in `initAliases`.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D145828
Frank Dischner [Wed, 15 Mar 2023 00:20:54 +0000 (17:20 -0700)]
[compiler-rt][builtins] Support builtins for armv8m.base
This allows building the compiler builtins library for the Armv8-M
Baseline architecture. It can be built in the same way as other
baremetal targets using the appropriate '--target' flag
(e.g. --target=armv8m.base-eabi).
NOTE: As with the other Cortex-M targets, only the builtins library is
supported. There is no support for sanitizers, etc.
The armv8m.base architecture is a superset of armv6m, so adding it to
the cmake files using thumb1_SOURCES is almost enough for it to compile.
Minor changes are needed to divsi3 and udivsi3, because armv8m.base does
have support for div instructions but not mov with an immediate operand.
Reviewed By: MaskRay, peter.smith
Differential Revision: https://reviews.llvm.org/D143297
Amir Ayupov [Tue, 14 Mar 2023 22:40:57 +0000 (15:40 -0700)]
[BOLT][NFC] Provide default impl for MIB methods that are only overridden on X86
Simplifies D145687
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D145972
Frank Tetzel [Tue, 14 Mar 2023 23:25:37 +0000 (16:25 -0700)]
[lli] Register profiling support for ORC in lli
Adds perf event listeners when RTDyldObjectLinkingLayer is used in -jit-kind=orc
mode.
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D126214
Michael Maitland [Wed, 15 Feb 2023 18:40:41 +0000 (10:40 -0800)]
[VPlan] VPWidenIntOrFpInductionRecipe inherits from VPHeaderPHIRecipe
Differential Revision: https://reviews.llvm.org/D144125
Lei Zhang [Tue, 14 Mar 2023 23:45:42 +0000 (23:45 +0000)]
[mlir][spirv] Fix UnifyAliasedResourcePass for 64-bit index
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D145079
Tom Stellard [Tue, 14 Mar 2023 23:51:21 +0000 (16:51 -0700)]
JITLink: Add missing EHFrame NULL terminator on aarch64/ELF
This fixes test failures on AArch64 with libgcc-13:
Clang :: Interpreter/global-dtor.cpp
Clang-Unit :: Interpreter/./ClangReplInterpreterTests/2/4
Reviewed By: lhames, v.g.vassilev
Differential Revision: https://reviews.llvm.org/D146067
Yeting Kuo [Mon, 6 Mar 2023 10:13:48 +0000 (18:13 +0800)]
[RISCV] Support ISD::STRICT_FADD/FSUB/FMUL/FDIV for vector types.
The patch handles fixed type strict-fp by new RISCVISD::STRICT_ prefixed
isd nodes.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D145900
Shafik Yaghmour [Tue, 14 Mar 2023 23:27:55 +0000 (16:27 -0700)]
[Clang] Fix ClassifyImplicitMemberAccess to handle cases where the access in an unevaluated context is not within a CXXRecordDecl or CXXMethodDecl
ClassifyImplicitMemberAccess assumes that if we are not in a static context then
the DeclContext must be a CXXRecordDecl or a CXXMethodDecl. In the case of the
unevaluated context this may not be true.
This will lead to a crash because contextClass will remain a nullptr.
Fixes: https://github.com/llvm/llvm-project/issues/37792
Fixes: https://github.com/llvm/llvm-project/issues/48405
Differential Revision: https://reviews.llvm.org/D142490
NAKAMURA Takumi [Sat, 11 Feb 2023 18:42:09 +0000 (03:42 +0900)]
Let IntrinsicEmitter free from CodeGenTarget.h
For now, I have introduced `llvm::tmp::getValueType(Rec)` as a copy from
`CodeGenTarget.cpp`. This will be removed in the near future, when
IntrinsicEmitter will not depend on MVT.
Differential Revision: https://reviews.llvm.org/D143844
NAKAMURA Takumi [Sun, 12 Feb 2023 03:04:06 +0000 (12:04 +0900)]
llvm-tblgen: Split out CodeGenIntrinsics.cpp from CodeGenTarget.cpp
Differential Revision: https://reviews.llvm.org/D143844
NAKAMURA Takumi [Tue, 14 Mar 2023 23:06:57 +0000 (08:06 +0900)]
clang/test/Driver/clang-offload-bundler-standardize.c REQUIRES asserts. (fixup D145770)
Jorge Gorbe Moya [Tue, 14 Mar 2023 22:49:25 +0000 (15:49 -0700)]
[bazel][libc] Re-add dependency on errno to strtol_test_helper.
https://reviews.llvm.org/D146014 removed the dependency on errno from
several targets and added it to the `libc_test` macro. However,
strtol_test_helper is not a `libc_test` but a `cc_library` so it's
missing a dependency.
Fangrui Song [Tue, 14 Mar 2023 22:50:03 +0000 (15:50 -0700)]
[test] Improve MC/AArch64/elf-reloc-plt32.s to check defined symbol
Jakub Kuderski [Tue, 14 Mar 2023 22:47:33 +0000 (18:47 -0400)]
[mlir][spirv] Fix scf.yield pattern conversion
Only rewrite `scf.yield` when the parent op is supported by
scf-to-spirv.
Fixes: #61380, #61107, #61148
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D146080
Jakub Kuderski [Tue, 14 Mar 2023 22:35:24 +0000 (18:35 -0400)]
[mlir][spirv][NFC] Clean up scf-to-spirv pass
This is a clean up before fixing issues identified in this pass by
https://github.com/llvm/llvm-project/issues/61380 and similar issues.
- Move patterns definitions closer to declarations.
- Simplify pattern definitions.
- Drop hand-written pass constructor in favor of an auto-generated on.
- Fix typos in pass description.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D146077
David Blaikie [Tue, 14 Mar 2023 22:43:53 +0000 (22:43 +0000)]
Amir Ayupov [Tue, 14 Mar 2023 22:36:40 +0000 (15:36 -0700)]
[BOLT][NFC] Use llvm::is_contained
Apply the replacement throughout BOLT.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D145464
Amir Ayupov [Tue, 14 Mar 2023 22:34:08 +0000 (15:34 -0700)]
[BOLT][NFC] Remove BB::getBranchInfo accepting MCSymbol ptr
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D144924
Fangrui Song [Tue, 14 Mar 2023 22:17:38 +0000 (15:17 -0700)]
[RISCV][MC] Adjust conditions to emit R_RISCV_ADD*/R_RISCV_SUB* pairs
D132262 tried to simplify `IsMetadataOrEHFrameSection` originally introduced in
D127549 but caused a regression as `.quad` directives in
```
.section .note,"a",@note; note:
.quad extern-note # extern is undefined
.section .rodata,"a",@progbits; rodata:
.quad extern-rodata # extern is undefined
.section .nonalloc,"",@progbits; nw:
.quad extern-nw
```
are incorrectly rejected: these differences may be link-time constants and
are allowed in GNU assembler and LLVM MC's non-RISC-V ports.
Relax the conditions to allow these cases. For A-B, A may be defined later, but
this requiresFixups call has to eagerly make a decision. For now, emit ADD/SUB
unless A is `.L*`. This euristic handles many temporary label differences for
.debug_* and .apple_types sections. Ideally we should delay the decision of
PC-relative vs ADD/SUB until A is defined.
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D145474
Fangrui Song [Tue, 14 Mar 2023 22:16:58 +0000 (15:16 -0700)]
[RISCV] A@plt-B+C: emit R_RISCV_PLT32 even if A is defined
Follow-up to D143226
Currently we incorrectly emit R_RISCV_ADD32/R_RISCV_SUB32.
Emit R_RISCV_PLT32 instead. The new behavior matches x86-64 and AArch64.
Arthur Eubanks [Tue, 14 Mar 2023 16:40:48 +0000 (09:40 -0700)]
[SimplifyLibCalls] Return Value from optimizeSinCosPi when making change
Or else InstCombine can incorrectly report that no change has been made.
This optimization doesn't really fit into InstCombine since it optimizes multiple instructions at once; there's likely a more comprehensive fix.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D146064
bixia1 [Thu, 9 Mar 2023 17:38:09 +0000 (09:38 -0800)]
[mlir][sparse] Improve sort operation by generating inlined code to compare values.
Previously, we generate function calls to compare values for sorting. It turns
out that the compiler doesn't inline those function calls. We now directly
generate inlined code. Also, modify the code for comparing values to use less
number of branches.
This improves all sort implementation in general. For arabic-2005.mtx CSR, the
improvement is around 25%.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D145442
Kiran Chandramohan [Tue, 14 Mar 2023 21:51:02 +0000 (21:51 +0000)]
[MLIR] : Add integer mul in scf to openmp conversion
Add conversion for integer multiplication in scf reductions in the
SCF to OpenMP dialect conversion.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D145948
Kiran Chandramohan [Tue, 14 Mar 2023 19:08:34 +0000 (19:08 +0000)]
[Flang][OpenMP] Add support for OpenMP max reduction
This patch adds support for reduction of max-intrinsic for scalar
types. Max is lowered as a compare-select in the default lowering
flow for Flang. This pattern is matched and replaced with the
OpenMP dialect reduction operation.
Note: This is a temporary flow. The plan is to move to a flow where
the OpenMP reduction operation is inserted during lowering.
Reviewed By: do
Differential Revision: https://reviews.llvm.org/D145083
David Green [Tue, 14 Mar 2023 21:25:18 +0000 (21:25 +0000)]
[AArch64] Add FP16 broadcast and transpose costs
The FP16 broadcast and transpose can always use the same instructions as are
used for i16 vectors, with or without +fullfp16. This fills in some extra costs
to make sure we get them right.
Differential Revision: https://reviews.llvm.org/D146035
Julian Lettner [Thu, 9 Mar 2023 19:32:17 +0000 (11:32 -0800)]
Remove -lower-global-dtors-via-cxa-atexit flag
Remove the `-lower-global-dtors-via-cxa-atexit` escape hatch introduced
in D121736 [1], which switched the default lowering of global
destructors on MachO to use `__cxa_atexit()` to avoid emitting
deprecated `__mod_term_func` sections.
I added this flag as an escape hatch in case the switch causes any
problems. We didn't discover any problems so now we can remove it.
[1] https://reviews.llvm.org/D121736
rdar://
90277838
Differential Revision: https://reviews.llvm.org/D145715
Jacob Lambert [Fri, 10 Mar 2023 08:47:50 +0000 (00:47 -0800)]
[clang-offload-bundler] Standardize TargetID field for bundler
The bundler accepts both of the following for the --target option:
hip-amdgcn-amd-amdhsa-gfx900 (no env field)
hip-amdgcn-amd-amdhsa--gfx900 (blank env field)
The environment field is defined as optional for Triples
in Triple.h. However, in this patch we update the bundler to
internally standardize to include the env field. While users
aren't required to specify an env field when listing targets on
the commandline, bundles generated by the offload-bundler will
include the ABI field.
This standardization simplifies things for APIs that deal with
bundles generated by the clang-offload-bundler tool.
Differential Revision: https://reviews.llvm.org/D145770
Philip Reames [Tue, 14 Mar 2023 21:05:00 +0000 (14:05 -0700)]
[BasicBlockUtils] Expose an internal utility in API [nfc]
Shrinking a patch about to be posted for review.
Valery N Dmitriev [Thu, 23 Feb 2023 00:35:38 +0000 (16:35 -0800)]
[SLP] Outline GEP chain cost modeling into new TTI interface - NFCI.
Cost modeling for GEPs should actually be target dependent but is currently
done inside SLP target-independent way.
Sinking it into TTI enables target dependent implementation.
This patch adds new TTI interface and implementation of the basic functionality
trying to retain existing cost modeling.
Differential Revision: https://reviews.llvm.org/D144770
Slava Zakharin [Tue, 14 Mar 2023 20:58:58 +0000 (13:58 -0700)]
[flang] Fixed linaro-flang-aarch64-sharedlibs after D145992.
Daniel Thornburgh [Tue, 14 Mar 2023 20:44:07 +0000 (13:44 -0700)]
Revert "[LLVM][OHOS] Clang toolchain and targets"
This change had tests that break whenever LLVM_ENABLE_LINKER_BUILD_ID is
set, as is the case in the Fuchsia target.
This reverts commits:
f81317a54586dbcef0c14cf512a0770e8ecaab3d
72474afa27570a0a1307f3260f0187b703aa6d84
Valentin Clement [Tue, 14 Mar 2023 20:44:41 +0000 (21:44 +0100)]
[flang] Load fir.ref<fir.class<T>> instead of creating a wrong box
When a subroutine has an entry statement, the non-used argument
will be a fir.alloca and result in a fir.ref<fir.class<T>> for
polymorphic entities. In createBox, just load the box instead of
creating a wrong box.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D146079
Arthur Eubanks [Mon, 13 Mar 2023 16:53:50 +0000 (09:53 -0700)]
[Passes] Remove some legacy passes
NewGVN
GVNHoist
GVNSink
MemCpyOpt
Float2Int
These were only used for the optimization pipeline, of which the legacy version was removed.
Philip Reames [Tue, 14 Mar 2023 20:18:05 +0000 (13:18 -0700)]
[MSAN] Minor refactor to reduce future diff [nfc]
Joseph Huber [Tue, 14 Mar 2023 20:11:30 +0000 (15:11 -0500)]
[libc] Remove leftover debug prints
Kazu Hirata [Tue, 14 Mar 2023 20:13:56 +0000 (13:13 -0700)]
[InlineOrder] Plugin Inline Order
This allows developing and distributing inlining heuristics
outside of tree. And together with the inline advisor plugins
allows for fine grained control of the inliner.
The PluginInlineOrderAnalysis class serves as the entry point
for dynamic advisors. Plugins must register instances of this
class to provide their own InlineOrder.
I'm checking in this patch on behalf of ibricchi
<ibricchi@student.ethz.ch>.
Differential Revision: https://reviews.llvm.org/D140637
Craig Topper [Tue, 14 Mar 2023 20:04:44 +0000 (13:04 -0700)]
[RISCV] Merge getLoadFP*Imm into a single function.
We currently have 3 functions and 3 lookup tables. This was the
most expediant and obvious way to fix several bugs.
This patch uses a single function and single lookup
table. It uses APFloat::convert to convert from the half or double
to single precision. If the conversion doesn't have any errors or
lose any information we use the f32 table to finish the lookup.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D145897
Craig Topper [Tue, 14 Mar 2023 20:01:28 +0000 (13:01 -0700)]
[RISCV] Pre-commit tests for D145897. NFC
Slava Zakharin [Mon, 13 Mar 2023 21:50:13 +0000 (14:50 -0700)]
[flang] Handle Flang examples consistently with LLVM.
Without this change the problem is that flangOmpReport and
flangPrintFunctionNames libraries are not built under 'all',
but they are imported targets via LLVMExports.cmake so that
any out-of-tree build that configures upon LLVM+Flang package
will get this CMake error:
```
The imported target "flangPrintFunctionNames" references the file
".../lib/flangPrintFunctionNames.so"
but this file does not exist.
```
flang-aarch64-out-of-tree buildbot (https://lab.llvm.org/buildbot/#/builders/175)
does not catch this issue, because it does not enable Flang on the first stage.
This change gets rid of FLANG_BUILD_EXAMPLES in favor of LLVM_BUILD_EXAMPLES
and uses available LLVM CMake macros to add example executables/libraries.
Differential Revision: https://reviews.llvm.org/D145992
Vladislav Khmelevsky [Mon, 6 Feb 2023 13:13:46 +0000 (17:13 +0400)]
[BOLT] Add writable segment for allocatable sections
The golang support creates 2 new data segments, one of them contains
relocations in PIC binaries, so the section must have writable rights.
Currently BOLT creates only one new segment that contains new sections
with RX rights, now also create RW segment if there are any new writable
sections were allocated during BOLT binary processing.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Differential Revision: https://reviews.llvm.org/D143390
Joseph Huber [Tue, 14 Mar 2023 20:03:22 +0000 (15:03 -0500)]
[libc] Fix CMake deduplication `-Xclang` arguments
Summary:
We use `-Xclang` to pass the GPU binary to be embedded. In the case of
multi-source objects this will be passed more than once, but CMake
implicitly deduplicates arguments. Use the special generator to prevent
this from happening.
Joseph Huber [Tue, 14 Mar 2023 19:59:27 +0000 (14:59 -0500)]
[libc] Fix GPU fatbinary dependencies for multi-source object libraries
Summary:
Multi-source object libraries require some additional handling, this
logic wasn't correctly settending the dependency on each filename
individually and was instead using the last one. This meant that only
the last file was built for multi-object libraries.
Craig Topper [Tue, 14 Mar 2023 20:00:38 +0000 (13:00 -0700)]
[TableGen][RISCV][Hexagon][LoongArch] Add a list of Predicates to HwMode.
Use the predicate condition instead of checkFeatures in *GenDAGISel.inc.
This makes the code similar to isel pattern predicates.
checkFeatures is still used by code created by SubtargetEmitter so
we can't remove the string. Backends need to be careful to keep
the string and predicates in sync, but I don't think that's a big issue.
I haven't measured it, but this should be a compile time improvement
for isel since we don't have to do any of the string processing that's
inside checkFeatures.
Reviewed By: kparzysz
Differential Revision: https://reviews.llvm.org/D146012
Alex Bradbury [Tue, 14 Mar 2023 19:52:32 +0000 (19:52 +0000)]
[clang][docs] Clarify the semantics of -fexceptions
As noted in <https://github.com/llvm/llvm-project/issues/61216>, the
documentation for -fexceptions appears to imply that unwind information
is always generated, which isn't the case.
Differential Revision: https://reviews.llvm.org/D145564
Arthur Eubanks [Thu, 2 Feb 2023 23:29:20 +0000 (15:29 -0800)]
[AutoUpgrade] Add flag to disable autoupgrading debug info
Auto-upgrade can be expensive, especially UpgradeDebugInfo() since it runs the verifier.
With this patch, we can specify that the imported bitcode is built with the same revision of LLVM, meaning there's no need to run any auto-upgrading. For now, limit this to just debug info since projects like Rust want to support multiple versions of LLVM at the same time (at compiler build time, not at Rust source code build time) and run a subset of the autoupgrade functionality for simplicity.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D143229
Alex Bradbury [Tue, 14 Mar 2023 19:12:07 +0000 (19:12 +0000)]
[RISCV] Consistently error for arch strings with trailing _
RISCVISAInfo::parseArchString would sometimes error for arch strings
with a trailing _ and sometimes accept them. This patch makes it
consistently error.
Differential Revision: https://reviews.llvm.org/D145949
Luke Hutton [Tue, 14 Mar 2023 18:55:39 +0000 (18:55 +0000)]
[mlir][tosa] Add FFT2d operation
Adds the FFT2d TOSA operation and supporting
shape inference function.
Signed-off-by: Luke Hutton <luke.hutton@arm.com>
Reviewed By: rsuderman, eric-k256
Differential Revision: https://reviews.llvm.org/D144784
Alexandros Lamprineas [Mon, 6 Mar 2023 16:43:22 +0000 (16:43 +0000)]
[FuncSpec] Do not run pre-link when doing LTO.
Saves time. Post link will cover most cases anyway.
Differential Revision: https://reviews.llvm.org/D145394
Ramiro Leal-Cavazos [Tue, 14 Mar 2023 18:34:06 +0000 (18:34 +0000)]
[mlir][tosa] Swap reshape at end of reduce op with expand_shape
This commit swaps back the `tosa.reshape` op used at the end of the
lowering for reduce ops with the op `tensor.expand_shape`. This is
needed to properly support dynamically-sized tensors. In such cases,
lowering directly to `tensor.expand_shape` allows us to control which
dimension gets expanded at the end using the knowledge of the
reduction. This would not be possible when using `tosa.reshape`, since
the op does not have a way of knowing that we are only unsqueezing a
single dimension.
Note: this change had previously been performed in
https://reviews.llvm.org/D133877.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D145986
wren romano [Fri, 10 Mar 2023 01:00:27 +0000 (17:00 -0800)]
[mlir][sparse] Cleaning up names in {Merger,LoopEmitter,CodegenEnv}.{h,cpp}
This change does a bunch of renaming to clear up confusions in these files. In particular, this change:
* Renames variables and methods to clarify the "dim"/"lvl" distinction, and changes them to use the `Dimension`/`Level` types as appropriate.
* Introduces new typedefs
* `ExprId`, `LatPointId`, `LatSetId`: to clarify the interning design of the Merger.
* `LoopId`, `LoopOrd`: to clarify the distinction between arbitrary names for loop-variables, vs numeric identifiers based on the actual order of loop generation.
* `TensorId`
* (Future CLs will change these from typedefs to structs/classes, so that the typechecker can help avoid mixups.)
* Updates documentation to match the new terminology
* Adds additional assertions
* Adds `const` to local variables along the way
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D145756
Jonas Paulsson [Thu, 9 Mar 2023 18:19:09 +0000 (19:19 +0100)]
[SystemZ] Clear NW flags on an ISD::SUB when reused as comparison.
The SystemZ backend will try to reuse an existing subtraction of two values
whenever they are to be compared for equality. This depends on the SystemZ
subtraction instruction setting the condition code, which can also signal
overflow.
A later pass will remove the compare and reuse the CC from the subtraction
directly. However, if that subtraction has the NSW flag set it will not
include the overflow bit in the updated CC user. That was a bug which can
lead to wrong results, as shown by a csmith program.
Fixes: https://github.com/llvm/llvm-project/issues/61268
Reviewed By: nikic, uweigand
Differential Revision: https://reviews.llvm.org/D145811
Michael Jones [Fri, 10 Mar 2023 19:53:50 +0000 (11:53 -0800)]
[libc][NFC] add an atof test for a fuzz failure
The differential fuzzer found that glibc and our libc disagree on the
result for "0x30000002222225p-1077", with ours being rounded up and
theirs rounded down. Ours is more correct for the nearest rounding mode,
so only a test is added.
Reviewed By: lntue, sivachandra
Differential Revision: https://reviews.llvm.org/D145821
Anlun Xu [Tue, 14 Mar 2023 18:36:25 +0000 (11:36 -0700)]
[mlir][vector] Add bazel dependency to TestVector
Dependency was introduced in https://reviews.llvm.org/D145942
Reviewed By: cota
Differential Revision: https://reviews.llvm.org/D146072
Nikolas Klauser [Sun, 8 Jan 2023 13:07:44 +0000 (14:07 +0100)]
[libc++] Use __verbose_abort instead of std::abort in __throw_ functions
This results in proper error messages instead of just an abort.
Reviewed By: ldionne, Mordante, #libc
Spies: #libc_vendors, smeenai, libcxx-commits
Differential Revision: https://reviews.llvm.org/D141222
Philip Reames [Tue, 14 Mar 2023 18:11:27 +0000 (11:11 -0700)]
[MSAN] Add (fixed) vector load/store test coverage [nfc]
Alexander Shaposhnikov [Tue, 14 Mar 2023 18:12:19 +0000 (18:12 +0000)]
[Clang][CodeGen] Fix linkage and visibility of template parameter objects
This diff fixes linkage and visibility of template parameter objects.
The associated GitHub issue: https://github.com/llvm/llvm-project/issues/51571#
Test plan:
1/ ninja check-all
2/ bootstrapped Clang passes tests
Differential revision: https://reviews.llvm.org/D145859
Snehasish Kumar [Mon, 13 Mar 2023 20:11:58 +0000 (20:11 +0000)]
[memprof] Record BuildIDs in the raw profile.
This patch adds support for recording BuildIds usng the sanitizer
ListOfModules API. We add another entry to the SegmentEntry struct and
change the memprof raw version.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D145190
Joseph Huber [Mon, 13 Mar 2023 14:33:08 +0000 (09:33 -0500)]
[Clang] Always use --no-undefined when linking AMDGPU images
AMDGPU uses ELF shared libraries to implement their executable device
images. One downside to this method is that it disables regular warnings
on undefined symbols. This is because shared libraries expect these to
be resolves by later loads. However, the GPU images do not support
dynamic linking so any undefined symbol is going to cause a runtime
error. This patch adds `--no-undefined` to the `ld.lld` invocation to guarantee
that undefined symbols are always caught as linking errors rather than
runtime errors.
Reviewed By: arsenm, MaskRay, #amdgpu
Differential Revision: https://reviews.llvm.org/D145941
Teresa Johnson [Tue, 14 Mar 2023 03:29:02 +0000 (20:29 -0700)]
[docs] Document MemProf metadata in LangRef
Add documentation for memprof and callsite metadata in LangRef.
Differential Revision: https://reviews.llvm.org/D146007
Alex Bradbury [Tue, 14 Mar 2023 17:55:11 +0000 (17:55 +0000)]
[RISCV] Fix regression due to interaction of MachineOutliner and MachineCopyPropagation
D144535 enabled machine copy propagation for RISC-V and added it to the
pass pipeline in addPreEmitPass2 (after the MachineOutliner).
Unfortunately, the MachineCopyPropagation pass is unable to correctly
analyse outlined functions, and will delete copy instructions where a
register is set that is intended to be live-out.
RISCVInstrInfo::buildOutlinedFrame will directly insert a JALR, while a
similar function going through the normal codegen path would have a
PseudoRet with operands indicating registers that are live-out.
This patch does the simplest fix, which is to run MachineCopyPropagation
before the MachineOutliner.
Differential Revision: https://reviews.llvm.org/D146037
Mark de Wever [Fri, 17 Feb 2023 20:27:08 +0000 (21:27 +0100)]
[NFC][libc++][format] Improves diagnostics.
While implementing the tests for LWG3720 I noticed the std::format
errors for non-formattable types are not user friendly (and thus hard to
write a .verify test too).
The issue stems from using a deleted function for invalid types. By
using a function that returns an invalid value the diagnostics become a
lot better. Before this change the existing "invalid value"
static_assert could never trigger. Now it can be triggered by user
code, therefore a diagnostic message has been added.
Before this change using a non-formattable type resulted in list of
error messages along the line of
.../include/c++/v1/__format/format_arg_store.h:167:29: error: call to deleted function '__determine_arg_t'
constexpr __arg_t __arg = __determine_arg_t<_Context, remove_cvref_t<_Tp>>();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../include/c++/v1/__format/format_arg_store.h:210:54: note: in instantiation of function template specialization 'std::__format::__create_format_arg<std::format_context, char16_t &>' requested here
basic_format_arg<_Context> __arg = __format::__create_format_arg<_Context>(__args);
^
.../include/c++/v1/__format/format_arg_store.h:246:19: note: in instantiation of function template specialization 'std::__format::__create_packed_storage<std::format_context, int &, char16_t &>' requested here
__format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
^
.../include/c++/v1/__format/format_functions.h:73:10: note: in instantiation of member function 'std::__format_arg_store<std::format_context, int &, char16_t &>::__format_arg_store' requested here
return _VSTD::__format_arg_store<_Context, _Args...>(__args...);
^
.../include/c++/v1/__config:664:17: note: expanded from macro '_VSTD'
# define _VSTD std
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:46:50: note: in instantiation of function template specialization 'std::make_format_args<std::format_context, int &, char16_t &>' requested here
TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...));
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:69:3: note: in instantiation of function template specialization 'test_exception<char, int, char16_t>' requested here
test_exception(SV("{:{}}"), 42, u'0');
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:97:3: note: in instantiation of function template specialization 'test<char>' requested here
test<char>();
^
.../include/c++/v1/__format/format_arg_store.h:154:19: note: candidate function [with _Context = std::format_context, _Tp = char16_t] has been explicitly deleted
consteval __arg_t __determine_arg_t()
^
.../include/c++/v1/__format/format_arg_store.h:148:19: note: candidate function [with _Context = std::format_context, _Tp = char16_t]
consteval __arg_t __determine_arg_t() {
<more errors omitted>
.../include/c++/v1/__format/format_arg_store.h:185:22: note: initializer of '__arg' is not a constant expression
.../include/c++/v1/__format/format_arg_store.h:167:21: note: declared here
constexpr __arg_t __arg = __determine_arg_t<_Context, remove_cvref_t<_Tp>>();
^
.../build/include/c++/v1/__format/format_arg_store.h:194:73: error: member reference base type 'char16_t' is not a structure or union
__arg, basic_string_view<typename _Context::char_type>{__value.data(), __value.size()}};
~~~~~~~^~~~~
11 errors generated.
After the change using the same non-formmatable type gives the following
diagnostics
.../include/c++/v1/__format/format_arg_store.h:168:3: error: static assertion failed due to requirement '__arg != __arg_t::__none': the supplied type is not formattable
static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
^ ~~~~~~~~~~~~~~~~~~~~~~~~
.../include/c++/v1/__format/format_arg_store.h:210:54: note: in instantiation of function template specialization 'std::__format::__create_format_arg<std::format_context, char16_t &>' requested here
basic_format_arg<_Context> __arg = __format::__create_format_arg<_Context>(__args);
^
.../include/c++/v1/__format/format_arg_store.h:246:19: note: in instantiation of function template specialization 'std::__format::__create_packed_storage<std::format_context, int &, char16_t &>' requested here
__format::__create_packed_storage(__storage.__types_, __storage.__values_, __args...);
^
.../include/c++/v1/__format/format_functions.h:73:10: note: in instantiation of member function 'std::__format_arg_store<std::format_context, int &, char16_t &>::__format_arg_store' requested here
return _VSTD::__format_arg_store<_Context, _Args...>(__args...);
^
.../include/c++/v1/__config:664:17: note: expanded from macro '_VSTD'
# define _VSTD std
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:46:50: note: in instantiation of function template specialization 'std::make_format_args<std::format_context, int &, char16_t &>' requested here
TEST_IGNORE_NODISCARD std::vformat(fmt, std::make_format_args<context_t<CharT>>(args...));
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:69:3: note: in instantiation of function template specialization 'test_exception<char, int, char16_t>' requested here
test_exception(SV("{:{}}"), 42, u'0');
^
.../libcxx/test/std/utilities/format/format.string/format.string.std/lwg3720_arg_id_width_precision_allowed_types.pass.cpp:97:3: note: in instantiation of function template specialization 'test<char>' requested here
test<char>();
^
.../include/c++/v1/__format/format_arg_store.h:168:23: note: expression evaluates to '0 != 0'
static_assert(__arg != __arg_t::__none, "the supplied type is not formattable");
~~~~~~^~~~~~~~~~~~~~~~~~
1 error generated.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D144325
Arthur Eubanks [Tue, 14 Mar 2023 17:48:10 +0000 (10:48 -0700)]
[StructuralHash][NFC] Use anonymous namespace
Philip Reames [Tue, 14 Mar 2023 15:39:19 +0000 (08:39 -0700)]
Move utility for acting on each lane of ElementCount to common code [nfc]
This was first written for AddressSanitizer, but I'm about to reuse it for MemorySanitizer as well.
Nico Weber [Tue, 14 Mar 2023 17:35:02 +0000 (18:35 +0100)]
[gn] reformat all gn files
I ran:
git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format
Nico Weber [Tue, 14 Mar 2023 17:34:25 +0000 (18:34 +0100)]
[gn] minor cleanup after
33a55c3d8c73
Mark de Wever [Sat, 18 Feb 2023 12:30:14 +0000 (13:30 +0100)]
[libc++][format] Addresses LWG3825.
LWG3825 Missing compile-time argument id check in
basic_format_parse_context::next_arg_id
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D144327
Alexey Bataev [Mon, 13 Mar 2023 21:40:54 +0000 (14:40 -0700)]
[SLP]Remove CreateShuffle lambda and reuse ShuffleBuilder functions.
After merging main part of the gather/buildvector code, CreateShuffle
lambda can removed and ShuffleBuilder add functions can be used instead.
Also, part of the code from CreateShuffle migrated to createShuffle of
the BaseShuffleAnalysis::createShuffle function for better code emission.
Differential Revision: https://reviews.llvm.org/D145988
Congcong Cai [Tue, 14 Mar 2023 17:07:55 +0000 (01:07 +0800)]
[SemaCXX]use CorrectDelayedTyposInExpr in ActOnCXXFoldExpr only when Diag
PR #61326
- fix clang crash when fold expression contains a delayed typos correction.
code snippet in `ActOnCXXFoldExpr`
``` if (!LHS || !RHS) {
Expr *Pack = LHS ? LHS : RHS;
assert(Pack && "fold expression with neither LHS nor RHS");
DiscardOperands();
if (!Pack->containsUnexpandedParameterPack())
return Diag(EllipsisLoc, diag::err_pack_expansion_without_parameter_packs)
<< Pack->getSourceRange();
}
```
`DiscardOperands` will be triggered when LHS/RHS is delayed typo correction expression.
It will output and clean all diagnose but still return a valid expression. (in else branch)
valid expression will be handled in caller function. When caller wants to output the diagnose, the diagnose in delayed typo correction expression has been consumed in `ActOnCXXFoldExpr`. It causes clang crash.
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D145892
Arthur Eubanks [Tue, 14 Mar 2023 17:04:16 +0000 (10:04 -0700)]
[StandardInstrumentations][NFC] Minor code cleanup
Paul Walker [Mon, 27 Feb 2023 20:16:07 +0000 (20:16 +0000)]
[LLVM] Remove support for constant scalable vector GEPs.
This work has fallen out from D134648 as a requirement to loosen
the "constness" of vscale.
Differential Revision: https://reviews.llvm.org/D145404
Nikita Popov [Tue, 14 Mar 2023 16:45:38 +0000 (17:45 +0100)]
Revert "[InstCombine] Return instruction from replaceUse()"
This reverts commit
27c4e233104ba765cd986b3f8b0dcd3a6c3a9f89.
I think I made a mistake with the use in RemoveConditionFromAssume(),
because the instruction being changed is not the current one, but
the next assume. Revert the change for now.
Alex Bradbury [Tue, 14 Mar 2023 16:36:16 +0000 (16:36 +0000)]
[RISCV][NFC] Small refactor in RISCVISAInfo::parseArchString
Slightly refactor handling of version extraction for the 'baseline' ISA,
to make an upcoming patch easier to review.
Arthur Eubanks [Tue, 14 Mar 2023 16:32:49 +0000 (09:32 -0700)]
[CoroCleanup] Invalidate analyses on changed functions before running SimplifyCFG
Or else the sub-FunctionPassManager may see out of date analyses.
Mark de Wever [Wed, 22 Feb 2023 18:48:01 +0000 (19:48 +0100)]
[libc++][CI] Improves Dockerfile
- Remove temporary apt files
- Removes LLVM16 TODO
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D144575
Mark de Wever [Sun, 12 Mar 2023 16:11:29 +0000 (17:11 +0100)]
[libc++] Qualifies uint32_t and friends.
This has been done using the following command
find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)(?<!::u)u?int(_[a-z]+)?[0-9]{1,2}_t)|\1std::\2|' \{} \;
And manually removed some false positives in std/depr/depr.c.headers.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D145880