platform/upstream/llvm.git
19 months agoFix split-dwarf-dwp-invalid test to be Windows-path-separator compatible
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

19 months ago[BOLT][NFC] Move addRelocation{X86,AArch64} into MCPlusBuilder
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

19 months ago[RISCV][NFC] Combine identical switch cases in TTI
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

19 months ago[BOLT][NFC] Simplify MCPlusBuilder::getRegSize
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

19 months ago[compiler-rt][builtins] Support builtins for armv8m.base
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

19 months ago[BOLT][NFC] Provide default impl for MIB methods that are only overridden on X86
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

19 months ago[lli] Register profiling support for ORC in lli
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

19 months ago[VPlan] VPWidenIntOrFpInductionRecipe inherits from VPHeaderPHIRecipe
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

19 months ago[mlir][spirv] Fix UnifyAliasedResourcePass for 64-bit index
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

19 months agoJITLink: Add missing EHFrame NULL terminator on aarch64/ELF
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

19 months ago[RISCV] Support ISD::STRICT_FADD/FSUB/FMUL/FDIV for vector types.
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

19 months ago[Clang] Fix ClassifyImplicitMemberAccess to handle cases where the access in an uneva...
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

19 months agoLet IntrinsicEmitter free from CodeGenTarget.h
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

19 months agollvm-tblgen: Split out CodeGenIntrinsics.cpp from CodeGenTarget.cpp
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

19 months agoclang/test/Driver/clang-offload-bundler-standardize.c REQUIRES asserts. (fixup D145770)
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)

19 months ago[bazel][libc] Re-add dependency on errno to strtol_test_helper.
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.

19 months ago[test] Improve MC/AArch64/elf-reloc-plt32.s to check defined symbol
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

19 months ago[mlir][spirv] Fix scf.yield pattern conversion
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

19 months ago[mlir][spirv][NFC] Clean up scf-to-spirv pass
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

19 months agoAdd missing test for 35fd37177b9b201f26390fe963767be548c8c2e9
David Blaikie [Tue, 14 Mar 2023 22:43:53 +0000 (22:43 +0000)]
Add missing test for 35fd37177b9b201f26390fe963767be548c8c2e9

19 months ago[BOLT][NFC] Use llvm::is_contained
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

19 months ago[BOLT][NFC] Remove BB::getBranchInfo accepting MCSymbol ptr
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

19 months ago[RISCV][MC] Adjust conditions to emit R_RISCV_ADD*/R_RISCV_SUB* pairs
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

19 months ago[RISCV] A@plt-B+C: emit R_RISCV_PLT32 even if A is defined
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.

19 months ago[SimplifyLibCalls] Return Value from optimizeSinCosPi when making change
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

19 months ago[mlir][sparse] Improve sort operation by generating inlined code to compare values.
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

19 months ago[MLIR] : Add integer mul in scf to openmp conversion
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

19 months ago[Flang][OpenMP] Add support for OpenMP max reduction
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

19 months ago[AArch64] Add FP16 broadcast and transpose costs
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

19 months agoRemove -lower-global-dtors-via-cxa-atexit flag
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

19 months ago[clang-offload-bundler] Standardize TargetID field for bundler
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

19 months ago[BasicBlockUtils] Expose an internal utility in API [nfc]
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.

19 months ago[SLP] Outline GEP chain cost modeling into new TTI interface - NFCI.
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

19 months ago[flang] Fixed linaro-flang-aarch64-sharedlibs after D145992.
Slava Zakharin [Tue, 14 Mar 2023 20:58:58 +0000 (13:58 -0700)]
[flang] Fixed linaro-flang-aarch64-sharedlibs after D145992.

19 months agoRevert "[LLVM][OHOS] Clang toolchain and targets"
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

19 months ago[flang] Load fir.ref<fir.class<T>> instead of creating a wrong box
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

19 months ago[Passes] Remove some legacy passes
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.

19 months ago[MSAN] Minor refactor to reduce future diff [nfc]
Philip Reames [Tue, 14 Mar 2023 20:18:05 +0000 (13:18 -0700)]
[MSAN] Minor refactor to reduce future diff [nfc]

19 months ago[libc] Remove leftover debug prints
Joseph Huber [Tue, 14 Mar 2023 20:11:30 +0000 (15:11 -0500)]
[libc] Remove leftover debug prints

19 months ago[InlineOrder] Plugin Inline Order
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

19 months ago[RISCV] Merge getLoadFP*Imm into a single function.
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

19 months ago[RISCV] Pre-commit tests for D145897. NFC
Craig Topper [Tue, 14 Mar 2023 20:01:28 +0000 (13:01 -0700)]
[RISCV] Pre-commit tests for D145897. NFC

19 months ago[flang] Handle Flang examples consistently with LLVM.
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

19 months ago[BOLT] Add writable segment for allocatable sections
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

19 months ago[libc] Fix CMake deduplication `-Xclang` arguments
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.

19 months ago[libc] Fix GPU fatbinary dependencies for multi-source object libraries
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.

19 months ago[TableGen][RISCV][Hexagon][LoongArch] Add a list of Predicates to HwMode.
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

19 months ago[clang][docs] Clarify the semantics of -fexceptions
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

19 months ago[AutoUpgrade] Add flag to disable autoupgrading debug info
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

19 months ago[RISCV] Consistently error for arch strings with trailing _
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

19 months ago[mlir][tosa] Add FFT2d operation
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

19 months ago[FuncSpec] Do not run pre-link when doing LTO.
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

19 months ago[mlir][tosa] Swap reshape at end of reduce op with expand_shape
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

19 months ago[mlir][sparse] Cleaning up names in {Merger,LoopEmitter,CodegenEnv}.{h,cpp}
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

19 months ago[SystemZ] Clear NW flags on an ISD::SUB when reused as comparison.
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

19 months ago[libc][NFC] add an atof test for a fuzz failure
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

19 months ago[mlir][vector] Add bazel dependency to TestVector
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

19 months ago[libc++] Use __verbose_abort instead of std::abort in __throw_ functions
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

19 months ago[MSAN] Add (fixed) vector load/store test coverage [nfc]
Philip Reames [Tue, 14 Mar 2023 18:11:27 +0000 (11:11 -0700)]
[MSAN] Add (fixed) vector load/store test coverage [nfc]

19 months ago[Clang][CodeGen] Fix linkage and visibility of template parameter objects
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

19 months ago[memprof] Record BuildIDs in the raw profile.
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

19 months ago[Clang] Always use --no-undefined when linking AMDGPU images
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

19 months ago[docs] Document MemProf metadata in LangRef
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

19 months ago[RISCV] Fix regression due to interaction of MachineOutliner and MachineCopyPropagation
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

19 months ago[NFC][libc++][format] Improves diagnostics.
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

19 months ago[StructuralHash][NFC] Use anonymous namespace
Arthur Eubanks [Tue, 14 Mar 2023 17:48:10 +0000 (10:48 -0700)]
[StructuralHash][NFC] Use anonymous namespace

19 months agoMove utility for acting on each lane of ElementCount to common code [nfc]
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.

19 months ago[gn] reformat all gn files
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

19 months ago[gn] minor cleanup after 33a55c3d8c73
Nico Weber [Tue, 14 Mar 2023 17:34:25 +0000 (18:34 +0100)]
[gn] minor cleanup after 33a55c3d8c73

19 months ago[libc++][format] Addresses LWG3825.
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

19 months ago[SLP]Remove CreateShuffle lambda and reuse ShuffleBuilder functions.
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

19 months ago[SemaCXX]use CorrectDelayedTyposInExpr in ActOnCXXFoldExpr only when Diag
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

19 months ago[StandardInstrumentations][NFC] Minor code cleanup
Arthur Eubanks [Tue, 14 Mar 2023 17:04:16 +0000 (10:04 -0700)]
[StandardInstrumentations][NFC] Minor code cleanup

19 months ago[LLVM] Remove support for constant scalable vector GEPs.
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

19 months agoRevert "[InstCombine] Return instruction from replaceUse()"
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.

19 months ago[RISCV][NFC] Small refactor in RISCVISAInfo::parseArchString
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.

19 months ago[CoroCleanup] Invalidate analyses on changed functions before running SimplifyCFG
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.

19 months ago[libc++][CI] Improves Dockerfile
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

19 months ago[libc++] Qualifies uint32_t and friends.
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

19 months ago[AssumeBundleBuilder] Fix PreservedAnalyses reporting
Arthur Eubanks [Tue, 14 Mar 2023 16:22:38 +0000 (09:22 -0700)]
[AssumeBundleBuilder] Fix PreservedAnalyses reporting

These weren't properly reporting changes.

19 months agoRevert "[Flang][OpenMP] Add support for OpenMP max reduction"
Kiran Chandramohan [Tue, 14 Mar 2023 16:26:58 +0000 (16:26 +0000)]
Revert "[Flang][OpenMP] Add support for OpenMP max reduction"

Reverting to fix a buildbot failure.

This reverts commit a7d80f43cb8d3a2deb09f57d0904732d40020752.

19 months ago[gn build] Fix gn build
Arthur Eubanks [Tue, 14 Mar 2023 16:21:20 +0000 (09:21 -0700)]
[gn build] Fix gn build

19 months ago[OpenMP]Skip generating this[:1] map info for non-member variable.
Jennifer Yu [Mon, 13 Mar 2023 21:12:06 +0000 (14:12 -0700)]
[OpenMP]Skip generating this[:1] map info for non-member variable.

My change of D14093 is only fixed problem for "pragma target data".

The problem still here for "pragma target"
what I am missing is:
When processing "pragma target data", the VD is passed when call to
emitCombinedEntry, so check VD is null as map for this pointer.

But when processing "pragma target" the VD is passed as nullptr, so
check VD is null is not working.

To fix this I add a new parameter IsMapThis. During the call to
emitCombinedEntry passes true if it is capturing this pointer and use
that instead check of "!VD".

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

19 months ago[RISCV][test][llvm-objdump] Add test cases for objdump's handling of RISCV arch attri...
Alex Bradbury [Tue, 14 Mar 2023 16:05:14 +0000 (16:05 +0000)]
[RISCV][test][llvm-objdump] Add test cases for objdump's handling of RISCV arch attributes

In preparation for a follow-up patch to adjust the policy. The error for
an unrecognized version of the base ISA is particularly problematic, as
binaries produced from a current GCC are rejected.

The testing approach is modeled on the riscv-attributes.s file in
lld/test/ELF.

19 months ago[Flang][OpenMP] Add support for OpenMP max reduction
Kiran Chandramohan [Tue, 14 Mar 2023 15:26:24 +0000 (15:26 +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

19 months ago[Pipeline] Move some GlobalOpt/GlobalDCE runs into simplification pipeline
Arthur Eubanks [Mon, 13 Mar 2023 17:45:32 +0000 (10:45 -0700)]
[Pipeline] Move some GlobalOpt/GlobalDCE runs into simplification pipeline

These are very clearly more simplification than optimization.

Mostly NFC, except for some ordering around passes that don't really matter.

Reviewed By: nikic

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

19 months ago[Pipelines] Restore old DAE position in LTO pipeline
Nikita Popov [Tue, 14 Mar 2023 14:26:41 +0000 (15:26 +0100)]
[Pipelines] Restore old DAE position in LTO pipeline

This is a partial revert of D128830, restoring the previous
position of DeadArgElim in the fat LTO pipeline. The motivation
for this is a major code size regression observed in Rust and
illustrated in the PhaseOrdering test.

This is a conservative fix restoring the previous pipeline order.
The real problem is that the LTO pipeline is conceptually broken:
It doesn't have a CGSCC function simplification pipeline. The
inliner is just being run by itself. This wouldn't be a problem
if fat LTO used a standard design where ArgPromotion and DAE are
only run after functions have already been simplified by the
CGSCC inliner pipeline.

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

19 months ago[mlir] relax value handle updates when operation is replaced
Alex Zinenko [Fri, 3 Mar 2023 17:23:00 +0000 (17:23 +0000)]
[mlir] relax value handle updates when operation is replaced

The initial implementaiton of value handle update when the payload
operation defining the values associated with value handles was being
replaced required the replacement operation to have the same number of
results. This is not strictly necessary. The replacement operation may
have more results, or less results provided that there are no handles to
the results that have no equivalent in the replacement op.

Reviewed By: springerm

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

19 months ago[InstCombine] Return instruction from replaceUse()
Nikita Popov [Tue, 14 Mar 2023 15:50:31 +0000 (16:50 +0100)]
[InstCombine] Return instruction from replaceUse()

Same as with other replacement methods, it's generally necessary
to report a change on the instruction itself, e.g. by returning
it from the visit method (or possibly explicitly adding it to the
worklist).

Return Instruction * from replaceUse() to encourage the usual
"return replaceXYZ" pattern.

19 months ago[AIX] change "llvm-ar" to "env OBJECT_MODE=any llvm-ar" in clang/test for AIX OS
zhijian [Tue, 14 Mar 2023 15:50:20 +0000 (11:50 -0400)]
[AIX] change "llvm-ar" to "env OBJECT_MODE=any llvm-ar" in clang/test for AIX OS

Summary:

In patch https://reviews.llvm.org/D127864. we add a new option -X for AIX OS, and default value is -X32. In order not effect the test cases in clang/test. we need to change "llvm-ar" to "env OBJECT_MODE=any llvm-ar" in clang/test for AIX OS

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

19 months ago[InstCombine] Fix infinite combine loop (PR61361)
Nikita Popov [Tue, 14 Mar 2023 15:41:36 +0000 (16:41 +0100)]
[InstCombine] Fix infinite combine loop (PR61361)

In the degenerate case where the select is fed by an unsimplified
icmp with two constant operands, don't try to replace one constant
with another. Wait for the icmp to be simplified first instead.

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

19 months agoRemove an unused private data member; NFC
Aaron Ballman [Tue, 14 Mar 2023 15:31:45 +0000 (11:31 -0400)]
Remove an unused private data member; NFC

19 months ago[libc] Set the stub filename to the target name instead of the source
Joseph Huber [Tue, 14 Mar 2023 15:27:09 +0000 (10:27 -0500)]
[libc] Set the stub filename to the target name instead of the source

The GPU target requires some weird special case handling to create fat
binaries. CMake offers no way to set the name of an object library. The
only way to do this is to create a file with the desired name and use
that. Currently we name it after the source filename. However, this
breaks if there is more than a single source. This patch changes the
logic to instead look up the object target name and use that. E.g.
`src.__support.OSUtil.osutil` will be `osutil.cpp`.

Reviewed By: sivachandra

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

19 months ago[X86] Add test coverage for D137388
Simon Pilgrim [Tue, 14 Mar 2023 15:26:35 +0000 (15:26 +0000)]
[X86] Add test coverage for D137388

Issue #58914 reported an example of the TwoAddressInstruction crash that was fixed (without test case) in D137388

19 months ago[Docs] Added llvm-reduce docs in CommandGuide
aabhinavg [Tue, 14 Mar 2023 08:19:24 +0000 (13:49 +0530)]
[Docs] Added llvm-reduce docs in CommandGuide

[Docs] Added llvm-reduce docs in CommandGuide

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

19 months ago[DAG] Match select(icmp(x,y),sub(x,y),sub(y,x)) -> abd(x,y) patterns
Simon Pilgrim [Tue, 14 Mar 2023 15:10:24 +0000 (15:10 +0000)]
[DAG] Match select(icmp(x,y),sub(x,y),sub(y,x)) -> abd(x,y) patterns

Pulled out of PowerPC, and added ABDS support as well (hence the additional v4i32 PPC matches)

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

19 months agoFix false positive with unreachable C++ catch handlers
Aaron Ballman [Tue, 14 Mar 2023 15:07:14 +0000 (11:07 -0400)]
Fix false positive with unreachable C++ catch handlers

This addresses an issue found by WG21 and tracked by CWG2699 (which is
not yet publicly published). The basic problem is that Clang issues a
diagnostic about not being able to reach a handler, but that handler
*is* reached at runtime. Clang's diagnostic behavior was matching the
standard wording, and our runtime behavior was matching the standard's
intent.

This fixes the diagnostic so that it matches the runtime behavior more
closely, and reduces the number of false positives. This is the
direction of choice taken by Core for CWG2699 and it seems unlikely
that WG21 will change direction here.

Fixes https://github.com/llvm/llvm-project/issues/61177
Differential Revision: https://reviews.llvm.org/D145408

19 months ago[CodeGen] Use *{Set,Map}::contains (NFC)
Kazu Hirata [Tue, 14 Mar 2023 15:07:42 +0000 (08:07 -0700)]
[CodeGen] Use *{Set,Map}::contains (NFC)

19 months ago[mlir][vector] Clarify OOB semantics of remaining load/store ops
Jakub Kuderski [Tue, 14 Mar 2023 15:01:13 +0000 (11:01 -0400)]
[mlir][vector] Clarify OOB semantics of remaining load/store ops

This is a follow up for https://reviews.llvm.org/D145824 that clarifies
the out-of-bounds behavior for other masked load/store ops. It uses the
same wording and informal semantics syntax as `gather` and `scatter`.

Issue: https://github.com/llvm/llvm-project/issues/60905

Reviewed By: aartbik

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

19 months ago[flang] Handle parent component on the LHS of intrinsic assignment
Valentin Clement [Tue, 14 Mar 2023 15:01:36 +0000 (16:01 +0100)]
[flang] Handle parent component on the LHS of intrinsic assignment

When the LHS is referring to a parent component the box need to be
reboxed to the parent component type so the runtime can handle the
assignment correctly.

Reviewed By: PeteSteinfeld

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