Commit Graph

438627 Commits

Author SHA1 Message Date
David Green 1e723b7ab3 Revert "[AArch64] Add support for 128-bit non temporal loads."
This reverts commit 661403b85c as the
custom lowering of loads prevents expanding unaligned loads with
strict-align.
2022-10-12 11:11:32 +01:00
Martin Storsjö a07787c9a5 [AArch64] Exclude instructions after setting the FP from SEH prologues
After setting up the FP, the rest of the prologue doesn't need to
be replayed for unwinding the stack frame.

This allows reverting the functional parts of
2f7fbf8376 (but fixing inconsistent
duplicate setting of HasWinCFI).

Differential Revision: https://reviews.llvm.org/D135686
2022-10-12 12:36:21 +03:00
David Spickett d1b83b984f [LLDB] Fix x86_64 build
28e65a6a63 changed the parameter
type of SetType but I forgot to build on x86 as well as arm64.
2022-10-12 09:19:29 +00:00
Cullen Rhodes 388cacb341 [AArch64][SVE] Add instcombine for PTEST_ANY(X=OP(PG,...), X) -> PTEST_ANY(PG, X))
Given this is an OR reduction the two are equivalent and later
optimizations (AArch64InstrInfo::optimizePTestInstr) may rewrite the
sequence to use the flag-setting variant of instruction X, to remove the
PTEST altogether.

Reviewed By: paulwalker-arm, bsmith

Differential Revision: https://reviews.llvm.org/D134946
2022-10-12 09:14:08 +00:00
Cullen Rhodes 5b5756e6e3 [AArch64][SVE] NFC: auto-generate llvm/test/Transforms/InstCombine/AArch64/sve-intrinsics-ptest.ll 2022-10-12 09:14:08 +00:00
Tobias Hieta fc651a0669
[CMake] Add option LLVM_FORCE_CREATE_SYMLINKS
On Windows we don't create symlinks for the binaries (clang++, clang-cl)
since the support requires special setup (group policy settings and
you need to know exactly our distribution story). But if you know
about these things and have a controlled environment there is a lot
of storage to be saved, so let's add a manual opt-in for using symlinks
on Windows with LLVM_FORCE_CREATE_SYMLINKS=ON.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D135578
2022-10-12 11:06:32 +02:00
Dmitry Polukhin 5d12b13b0b [clang-tidy] Dump effective diagnostics level in YAML output
Before this patch YAML output had default diagnostic level instead of effective level reported to the user on stdout. Wrapper scripts for clang-tidy usually use YAML output and they pick wrong diagnostics level without this patch.

Test Plan: check-clang-tools

Differential Revision: https://reviews.llvm.org/D135367
2022-10-12 02:03:56 -07:00
Nikita Popov 2a26a445b3 [Attributes] Make intrinsic attribute generation more flexible (NFC)
Currently attributes for intrinsics are emitted using the
ArrayRef<AttrKind> based constructor for AttributeLists. This works
out fine for simple enum attributes, but doesn't really generalize
to attributes that accept values. We're already doing something
awkward for alignment attributes, and I'd like to have a cleaner
solution to this with
https://discourse.llvm.org/t/rfc-unify-memory-effect-attributes/65579 in mind.

The new generation approach is to instead directly construct
Attributes, giving us access to the full generality of that
interface. To avoid significantly increasing the size of the
generated code, we now also deduplicate the attribute sets. The
code generated per unique AttributeList looks like this:

  case 204: {
    AS[0] = {1, getIntrinsicArgAttributeSet(C, 5)};
    AS[1] = {AttributeList::FunctionIndex, getIntrinsicFnAttributeSet(C, 10)};
    NumAttrs = 2;
    break;
  }

and then the helper functions contain something like

  case 5:
    return AttributeSet::get(C, {
      Attribute::get(C, Attribute::NoCapture),
    });

and

  case 10:
    return AttributeSet::get(C, {
      Attribute::get(C, Attribute::NoUnwind),
      Attribute::get(C, Attribute::ArgMemOnly),
    });

A casualty of this change is the intrin-properties.td test, as I
don't think that FileCheck allows matching this kind of output.

Differential Revision: https://reviews.llvm.org/D135679
2022-10-12 10:56:01 +02:00
David Spickett 0577a9f8d0 [LLDB] Change EmulateInstriction::ReadRegister to return Optional
Making it easier to understand and harder to misuse.
This only applies to the ReadRegister(const RegisterInfo &reg_info) variant.

Depends on D135671

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D135672
2022-10-12 08:37:36 +00:00
Cullen Rhodes a17fcb2230 [AArch64][SVE] Fix BRKNS bug in optimizePTestInstr
The BRKNS instruction is unlike the other instructions that set flags
since it has an all active implicit predicate, so the existing

  PTEST(PG, BRKN(PG, A, B)) -> BRKNS(PG, A, B)

in AArch64InstrInfo::optimizePTestInstr is incorrect, however

  PTEST(PTRUE_B(31), BRKN(PG, A, B)) -> BRKNS(PG, A, B)

is correct.

Spotted by @paulwalker-arm in D134946.

Reviewed By: paulwalker-arm

Differential Revision: https://reviews.llvm.org/D135655
2022-10-12 08:34:41 +00:00
Cullen Rhodes 495d9e1f3f [AArch64] NFC: Auto-generate llvm/test/CodeGen/AArch64/sve-ptest-removal-brk.ll 2022-10-12 08:34:41 +00:00
David Spickett 28e65a6a63 [LLDB] Change RegisterValue::SetType param to const RegisterInfo&
No one was pasing nullptr here.

Depends on D135670

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D135671
2022-10-12 08:25:14 +00:00
David Spickett 6faa345da9 [LLDB] Pass const RegisterInfo& to RegisterValue::SetValueFromData
Familiar story, callers are either checking upfront that the pointer
wasn't null or not checking at all. SetValueFromData itself didn't
check either.

So make the parameter a ref and fixup the few places where a nullptr
check seems needed.

Depends on D135668

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D135670
2022-10-12 08:19:30 +00:00
Alex Zinenko 32f0bde548 [mlir] add transform dialect entry point
Introduce `transform::applyTransforms` as a top-level entry point to the
Transform dialect-driven transformation infrastructure, by analogy with
`applyFull/PartialConversion`. Clients are expected to use this function
and no longer need to maintain the transformation state. Make the
constructor of the TransformState private for that purpose.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D135681
2022-10-12 08:16:28 +00:00
David Spickett 812ad2167b [LLDB] Change RegisterValue::SetFromMemoryData to const RegisterInfo&
All callers were either assuming their pointer was not null before calling
this, or checking beforehand.

Reviewed By: clayborg

Differential Revision: https://reviews.llvm.org/D135668
2022-10-12 08:10:24 +00:00
Martin Storsjö e75c87f22c [LLD] [MinGW] Look for libs named "<libname>.lib" even with -static
This matches how ld.bfd works in practice; this fixes
https://github.com/mstorsjo/llvm-mingw/issues/305.

Adding a test for the new lib name combination that this allows, but
also adding a few negative tests for combinations that aren't
matched when -static is specified (because this change in itself
didn't break any of the existing tests either).

The logic in how ld.bfd looks for various libraries based on
an -l<libname> argument is rather complex; the
ldemul_open_dynamic_archive function looks for various combinations:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/emultempl/pep.em;h=e68d1e69f17ad73af065b6bed19ae89ded913172;hb=b51c2fec1da205ea3e7354cbb3e253018d64873c#l2066
This function is only called if looking for dynamic libraries
(i.e. if -static wasn't specified):
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/ldfile.c;h=731ae5f7aedcf921bd36a1b32a3e0f5bfa189071;hb=b51c2fec1da205ea3e7354cbb3e253018d64873c#l365

However even this function is skipped, it still looks for libraries
in the form of "lib<libname>.a" (this is what lld did before):
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/ldfile.c;h=731ae5f7aedcf921bd36a1b32a3e0f5bfa189071;hb=b51c2fec1da205ea3e7354cbb3e253018d64873c#l440
But it also calls a format specific function called
ldemul_find_potential_libraries, which for PE targets looks for
files named "<libname>.lib":
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=ld/emultempl/pep.em;h=e68d1e69f17ad73af065b6bed19ae89ded913172;hb=b51c2fec1da205ea3e7354cbb3e253018d64873c#l2175

Differential Revision: https://reviews.llvm.org/D135651
2022-10-12 11:07:12 +03:00
Martin Storsjö afa6bb643f [MC] [Win64EH] Generate ARM64 packed unwind info with signed return addresses
Differential Revision: https://reviews.llvm.org/D135660
2022-10-12 11:07:12 +03:00
Martin Storsjö c43bff64e9 [AArch64] Add support for the SEH opcode for return address signing
This was documented upstream in
https://github.com/MicrosoftDocs/cpp-docs/pull/4202.

Differential Revision: https://reviews.llvm.org/D135276
2022-10-12 11:07:11 +03:00
Petr Hosek 2a66abb17e [runtimes] Use a response file for runtimes test suites
We don't know which test suites are going to be included by runtimes
builds so we cannot include those before running the sub-build, but
that's not possible during the LLVM build configuration. We instead use
a response file that's populated by the runtimes build as a level of
indirection.

This addresses the issue described in:
https://discourse.llvm.org/t/cmake-regeneration-is-broken/62788

Differential Revision: https://reviews.llvm.org/D132438
2022-10-12 08:01:19 +00:00
jacquesguan a4ace22c05 [mlir][Math] Change regex to match fp value on different target.
Link: https://github.com/llvm/llvm-project/issues/58048

Reviewed By: ftynse, Mogball

Differential Revision: https://reviews.llvm.org/D134850
2022-10-12 15:08:21 +08:00
Vitaly Buka bfe5e81826 Revert "Fix locating of COMPILER_RT_LIBCXX_PATH"
clang-aarch64-sve-vla crashes in msan
clang-s390x-linux-lnt fails to compile libcxx

This reverts commit 14b2b67cd7.
2022-10-11 23:50:48 -07:00
Max Kazantsev 6bfcac612f [SimpleLoopUnswitch][NFC] Separate legality checks from cost computation
These are semantically two different stages, but were entwined in the
old implementation. Now cost computation does not do legality checks,
and they all are done beforehead.
2022-10-12 13:31:36 +07:00
Max Kazantsev 421728b40c [NFC] Factor out computation of best unswitch cost candidate
Split out a major peice of this method to make code more readable.
2022-10-12 12:36:46 +07:00
Michał Górny 56f94ede2a [llvm] [cmake] Support finding both static and shared zstd via FindZstd
Improve the logic in FindZstd to support finding both shared and static
variants of the zstd library simultaneously.  Otherwise, if the shared
library is installed, zstd::libzstd_static is not declared at all
and CMake fails if LLVM_USE_STATIC_ZSTD is used.

Differential Revision: https://reviews.llvm.org/D135457
2022-10-12 07:14:28 +02:00
Michał Górny d3ce133926 [clang] Do not override libclang.so's SOVERSION if CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION
Instead of setting libclang.so's SOVERSION to CLANG_MAJOR_VERSION
when CLANG_FORCE_MATCHING_LIBCLANG_SOVERSION is enabled, do not override
it and let LLVM set the correct SOVERSION.  This fixes libclang.so
missing LLVM_VERSION_SUFFIX, and harmonizes the SOVERSION with other
shared libraries.

Differential Revision: https://reviews.llvm.org/D135701
2022-10-12 07:14:28 +02:00
rkayaith ec1a419143 [mlir][async] Fix missing dialect dependency in async-to-async-runtime
The specific case I hit this was when lowering an `async.execute` that's
not inside a `func.func` op, e.g.:
```
llvm.func @foo() {
  %token = async.execute {
    async.yield
  }
  llvm.return
}
```

Reviewed By: bondhugula

Differential Revision: https://reviews.llvm.org/D135742
2022-10-12 01:10:08 -04:00
Mehdi Amini 6d4baa7442 Apply clang-tidy fixes for performance-unnecessary-value-param in TileUsingInterface.cpp (NFC) 2022-10-12 05:03:45 +00:00
Mehdi Amini 2a6f0fb34a Apply clang-tidy fixes for performance-for-range-copy in TileUsingInterface.cpp (NFC) 2022-10-12 05:03:45 +00:00
Mehdi Amini 735b22de80 Fix typo in tablegen option: '-gen-typedef-docs' -> '-gen-typedef-doc' 2022-10-12 05:03:05 +00:00
Vitaly Buka 14b2b67cd7 Fix locating of COMPILER_RT_LIBCXX_PATH
COMPILER_RT_LIBCXX_PATH is required for msan unittests.
2022-10-11 21:40:02 -07:00
Michael Wyman 1fbb6d8b34 Fix assert in generated `direct` property getter/setters due to removal of `_cmd` parameter.
This fixes a bug from https://reviews.llvm.org/D131424 that removed the implicit `_cmd` parameter as an argument to `objc_direct` method implementations. In many cases the generated getter/setter will call `objc_getProperty` or `objc_setProperty`, both of which require the selector of the getter/setter; since `_cmd` didn't automatically have backing storage, attempting to load the address asserted.

For direct property generated getters/setters, this now passes an undefined/uninitialized/poison value as the `_cmd` argument to `objc_getProperty`/`objc_setProperty`. Prior to removing the `_cmd` argument from the ABI of direct methods, it was left uninitialized/undefined; although references within hand-implemented methods would load the selector in the method prologue, generated getters/setters never did and just forwarded the undefined value that was passed as the argument.

This change keeps the generated code mostly similar to before, passing an uninitialized/undefined/poison value; for setters, the value argument may be moved to another register.

Added a test that triggers the assert prior to the implementation code.

Differential Revision: https://reviews.llvm.org/D135091
2022-10-11 21:15:53 -07:00
Jez Ng 7b45dfc681 [lld-macho] Canonicalize personality pointers in EH frames
We already do this for personality pointers referenced from compact
unwind entries; this patch extends that behavior to personalities
referenced via EH frames as well.

This reduces the number of distinct personalities we need in the final
binary, and helps us avoid hitting the "too many personalities" error.

I renamed `UnwindInfoSection::prepareRelocations()` to simply `prepare`
since we now do some non-reloc-specific stuff within.

Fixes #58277.

Reviewed By: #lld-macho, oontvoo

Differential Revision: https://reviews.llvm.org/D135728
2022-10-11 23:50:46 -04:00
chenglin.bi 41f5bbe18b [AArch64][Windows] Check sret attribute also for inreg attribute
Fix the issue: #57684

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D135512
2022-10-12 09:58:50 +08:00
Yeting Kuo 2749b942e9 [RISCV] Add isel patterns for vmacc, vnmsac.
The patch selects VSELECT/VP_MERGE_VL which uses fmadd/fnmsub as true operand
and the adden of the fmadd/fnmsub as false operand.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D135330
2022-10-12 09:19:01 +08:00
Mehdi Amini 23f989a2e3 Apply clang-tidy fixes for readability-simplify-boolean-expr in BufferizableOpInterfaceImpl.cpp (NFC) 2022-10-12 01:16:36 +00:00
Mehdi Amini 3739fd5775 Apply clang-tidy fixes for llvm-else-after-return in MultiBuffer.cpp (NFC) 2022-10-12 01:16:35 +00:00
Craig Topper 1bdf21d55c [RISCV] Use mask/tail agnostic if tied source is IMPLICIT_DEF regardless of the policy operand.
If the source is implicit_def, the register allocator won't have
any constraint on what register it picks for the destination. This
doesn't give the user much control of what register is being used.

So in my mind that means the only reason to honor the policy operand
is to control what policy is used in vsetvli to maybe avoid a vtype
change. Given the other optimizations we do on the policy field, I
don't think allowing the user this control is reliable.

Therefore, I think we should use agnostic policies if the source is
undef.

This should give better performance on some CPUs for VP intrinsics where
there is no merge operand and the backend adds IMPLICIT_DEF to the instruction.

Differential Revision: https://reviews.llvm.org/D135396
2022-10-11 16:40:16 -07:00
Craig Topper ac9209751a Revert "[DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y))"
This reverts commit 0148df8157.

Getting a lit test failures on AMDGPU but I can't reproduce it so far.
Reverting to investigate.
2022-10-11 16:30:40 -07:00
Craig Topper 902c1b3c2f [RISCV] Remove unused SchedClass WriteVFCvtFToFV. NFC
This isn't bound to any instruction. From the section comment it
was for single-width F-to-F conversions, but those don't exist.
2022-10-11 16:26:06 -07:00
Alan Hu d226244ae0 [llvm-ocaml] Replace all typed pointer functions with opaque pointer functions
Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D135524
2022-10-11 16:25:38 -07:00
bixia1 f2b73f517b [mlir][sparse] Add MLIR interface for sparse tensor file input and output.
Reviewed By: aartbik, wrengr

Differential Revision: https://reviews.llvm.org/D135480
2022-10-11 16:25:13 -07:00
Craig Topper 0148df8157 [DAGCombiner] Fold (mul (sra X, BW-1), Y) -> (neg (and (sra X, BW-1), Y))
(sra X, BW-1) is either 0 or -1. So the multiply is a conditional
negate of Y.

This pattern shows up when type legalizing wide multiplies involving
a sign extended value.

Fixes PR57549.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D133399
2022-10-11 16:20:55 -07:00
Keith Smiley 47f9722c32
[lld-macho] Add --ignore-auto-link-option
This provides a workaround for a small difference in ld64 behavior where
ld64 ignores invalid LC_LINKER_OPTIONS unless the link fails. Instead of
fully adopting that behavior, this provides an escape hatch by allowing
users to specify `--ignore-auto-link-option` passing the invalid library
or framework name

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

Differential Revision: https://reviews.llvm.org/D135530
2022-10-11 16:10:24 -07:00
Jan Svoboda c1c72302fe [clang][deps] Prevent emitting diagnostics outside of source file
The dependency scanner needs to report the module map file describing the module whose implementation is being compiled (see D134222). However, calling `Preprocessor::getCurrentModuleImplementation()` in the scanner might cause a diagnostic during module map parsing and emitting a diagnostic without being "in" a source file is illegal (e.g. in `TextDiagnosticPrinter`). This patch ensures the module map parse is triggered while the compiler is still "in" a source file, avoiding the failure case.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D135637
2022-10-11 15:57:20 -07:00
Jan Svoboda 060b25346b [clang][deps] Remove more codegen options
Codegen options are typically unused by modules. Reset some of them to increase sharing between TUs with different flags.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D135720
2022-10-11 15:57:19 -07:00
Joseph Huber adf36ea328 [Clang] Do not build the OffloadActionBuilder when using the new driver
The Offloading toolchain currently has two methods for construction the
requires actions. The "new" driver and the old `OffloadActionBuilder`.
Using either one is mutually exclusive, so we should not initialize this
when using the new driver. This was causing some error messages to be
printed multiple times because we were checking them in both the old and
the new driver.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D135715
2022-10-11 17:46:20 -05:00
Jeffrey Tan ef25a21726 Prevent lldb-vscode tests from source lldbinit file
lldb-vscode is hard-coded to source .lldbinit file which causes some tests to
fail on my machine.
This patch adds a new option to control this:
1. vscode.py and lldb-vscode tests will not source .lldbinit by default
2. lldb-vscode will source .lldbinit in production if not specified otherwise

Differential Revision: https://reviews.llvm.org/D135620
2022-10-11 15:43:35 -07:00
Jessica Paquette 0f1a51e173 [GlobalISel] Allow vectors in redundant or + add combines
We support KnownBits for vectors, so we can enable these.

https://godbolt.org/z/r9a9W4Gj1

Differential Revision: https://reviews.llvm.org/D135719
2022-10-11 15:31:09 -07:00
Leonard Chan 0ecf796592 [llvm] Update WPD tests to use opaque pointers
Differential Revision: https://reviews.llvm.org/D135611
2022-10-11 22:30:24 +00:00
Fangrui Song 8ef3fd8d59 [LTO] Make local linkage GlobalValue in non-prevailing COMDAT available_externally
For a local linkage GlobalObject in a non-prevailing COMDAT, it remains defined while its
leader has been made available_externally. This violates the COMDAT rule that
its members must be retained or discarded as a unit.

To fix this, update the regular LTO change D34803 to track local linkage
GlobalValues, and port the code to ThinLTO (GlobalAliases are not handled.)

This fixes two problems.

(a) `__cxx_global_var_init` in a non-prevailing COMDAT group used to
linger around (unreferenced, hence benign), and is now correctly discarded.
```
int foo();
inline int v = foo();
```

(b) Fix https://github.com/llvm/llvm-project/issues/58215:
as a size optimization, we place private `__profd_` in a COMDAT with a
`__profc_` key. When FuncImport.cpp makes `__profc_` available_externally due to
a non-prevailing COMDAT, `__profd_` incorrectly remains private. This change
makes the `__profd_` available_externally.

```
cat > c.h <<'eof'
extern void bar();
inline __attribute__((noinline)) void foo() {}
eof
cat > m1.cc <<'eof'
int main() {
  bar();
  foo();
}
eof
cat > m2.cc <<'eof'
__attribute__((noinline)) void bar() {
  foo();
}
eof

clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw

clang -O2 -fprofile-generate=./t m1.cc m2.cc -flto=thin -fuse-ld=lld -o t_gen
rm -fr t && ./t_gen && llvm-profdata show -function=foo t/default_*.profraw
```

Reviewed By: tejohnson

Differential Revision: https://reviews.llvm.org/D135427
2022-10-11 15:30:07 -07:00