469183 Commits

Author SHA1 Message Date
Timm Bäder
8c0246c7f5 [clang][Interp] Reject reinterpret_casts
Add a new InvalidCast op for this purpose and emit a diagnostic.

Differential Revision: https://reviews.llvm.org/D153276
2023-07-26 09:56:29 +02:00
Zhongyunde
67005c8e6f [AArch64][NFC] Call the API getVScaleRange directly
Use the maximum 64 for BitWidth of getVScaleRange to
avoid returning an empty range.

Reviewed By: sdesmalen, nikic, dmgreen
Differential Revision: https://reviews.llvm.org/D155708
2023-07-26 15:54:04 +08:00
Timm Bäder
c7251385c8 [clang][Interp] Check pointers for live-ness when returning them
We might be trying to return a pointer or reference to a local variable,
which doesn't work.

Differential Revision: https://reviews.llvm.org/D154795
2023-07-26 09:52:09 +02:00
Jim Lin
fca4a9d5fc [RISCV] Update Zvk shorthand extension to 1.0.0-rc1
1. Zvbc is not part of Zvkn.
2. Zvbc is not part of Zvks.
3. Add extensions implied into shorthand extension.

Also arrange its definition order as more closely its order in document.

Please refer to https://reviews.llvm.org/D152117 and https://reviews.llvm.org/D153836.

Document: https://github.com/riscv/riscv-crypto/releases/download/v20230620/riscv-crypto-spec-vector.pdf

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D156084
2023-07-26 15:43:45 +08:00
Timm Bäder
b2e6516fd1 [clang][Interp][NFC] Return std::nullopt explicitly from classify() 2023-07-26 09:34:26 +02:00
Freddy Ye
cafbcfa086 [X86] Update Model value for Raptor Lake.
Reviewed By: pengfei, skan

Differential Revision: https://reviews.llvm.org/D156285
2023-07-26 15:33:15 +08:00
Fangrui Song
2d40bd1e49 [llvm-objdump] Remove bool MachOOnlyFirst from printPrivateHeaders after D155045. NFC
Mach-O can just use the global variable `FirstPrivateHeader`.
If we ever manage to remove global variables, we can add a Config
variable to Dumper. Either case, the parameter is not needed.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D156291
2023-07-26 00:25:55 -07:00
Sander de Smalen
907fb338a2 [Clang][AArch64] Fix up immediate range of f64f64 mopa/mops intrinsics
Reviewed By: bryanpkc

Differential Revision: https://reviews.llvm.org/D156128
2023-07-26 07:13:18 +00:00
Timm Bäder
7a3ad8ed77 [clang] Provide source range to 'invalid subexpr in const expr' diags
Differential Revision: https://reviews.llvm.org/D150566
2023-07-26 09:12:11 +02:00
pvanhout
fc12fd71cf [TableGen][GlobalISel] Fix unused variable warnings
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D156208
2023-07-26 09:12:05 +02:00
Chuanqi Xu
3b48613f2d [docs] [C++20] [Modules] Mark the compatiblity issue within clang-cl.exe
See
https://discourse.llvm.org/t/clang-cl-exe-support-for-c-modules/72257
for details. Simply, the user of clang-cl.exe can't get a good
experience with C++20 modules now. While we don't have resources to
support it well now, we should make it clear in the documentation.
2023-07-26 15:06:13 +08:00
Johannes Doerfert
2f7ef7be1f [Attributor][FIX] Swap cases in ternary op to avoid nullptr reference
The case was wrong before, and somehow I only looked at the condition
before.
2023-07-26 00:03:06 -07:00
Johannes Doerfert
a598e39063 [AAInterFnReachabilityFunction][NFC] Remove unused members 2023-07-26 00:03:06 -07:00
Timm Bäder
7d876c62a3 [clang][Interp] Add 'Invalid' opcode and use it for throw stmts
We will use this opcode for conditionally executed statements that are
invalid in a constant expression.

Differential Revision: https://reviews.llvm.org/D150364
2023-07-26 08:59:53 +02:00
NAKAMURA Takumi
6563b6d507 [Bazel] Update sancov (D155119) 2023-07-26 15:55:35 +09:00
Timm Bäder
8a4bbeb916 [clang][Interp] Remove args from called functions in more cases
When calling functions in the checkingPotentialConstantExpression mode,
we cannot have arguments (including This + RVO pointers) for the
toplevel callee, but the functions called from within can work just
fine, or at least we succeed in pushing their arguments on the stack, so
we must also succeed in removing them again.

Differential Revision: https://reviews.llvm.org/D150358
2023-07-26 08:47:54 +02:00
Timm Bäder
6d2e141e5c [clang][Interp] Handle lambda static invokers
Differential Revision: https://reviews.llvm.org/D150111
2023-07-26 08:42:16 +02:00
Jianjian GUAN
1f5d75c0bc [AVR][NFC] Simplify AVRSubtarget
The flags, initialization of the flags, and the getter methods for features defined in AVR.td can be generated by TableGen.

Reviewed By: benshi001

Differential Revision: https://reviews.llvm.org/D155918
2023-07-26 14:35:42 +08:00
Petr Hosek
28f5322770 [CMake] Include riscv32-unknown-elf runtimes in Fuchsia toolchain
This contains compiler-rt builtins and llvm-libc for baremetal use.

Differential Revision: https://reviews.llvm.org/D155337
2023-07-26 06:09:42 +00:00
Timm Bäder
2606545b02 [clang][Interp] Fix ignoring conditional operators
Differential Revision: https://reviews.llvm.org/D148982
2023-07-26 07:46:04 +02:00
Timm Bäder
aed9646d8e [clang][Interp] Fix discarding void-typed comma expressions
First, we need to handle void types in visitExpr, so we don't run into
an assertion there when we try to pop a return value from the stack
that isn't there.

Secondly, we need to handle it when visiting comma expressions so we
don't do the same thing there.

Differential Revision: https://reviews.llvm.org/D148925
2023-07-26 07:45:02 +02:00
Timm Bäder
e45d199768 [clang][Interp] Handle CXXTemporaryObjectExprs
This is a CXXConstructExpr, so create a local temporary variable and
initialize it.

Differential Revision: https://reviews.llvm.org/D147591
2023-07-26 07:36:26 +02:00
Timm Bäder
10020791b1 [clang][Interp] Call invalid destructors
We need to call them like any other function, so we can generate proper
diagnostics.

Differential Revision: https://reviews.llvm.org/D150040
2023-07-26 07:19:02 +02:00
Timm Bäder
78e774e0c8 [clang][Interp] Handle __extension__ unary operators
Differential Revision: https://reviews.llvm.org/D148690
2023-07-26 07:16:45 +02:00
Jim Lin
2f726c22ce [RISCV] Merge rv32/rv64 vector slideup and slidedown intrinsic tests that have the same content. NFC. 2023-07-26 13:13:55 +08:00
Timm Bäder
5b78868661 [clang][Interp][NFC] Make some locals const 2023-07-26 07:12:47 +02:00
Timm Bäder
8cb6e476cc [clang][Interp] Handle PtrMemOps
Differential Revision: https://reviews.llvm.org/D144164
2023-07-26 07:04:21 +02:00
David CARLIER
b2a253855f [Fuzzer] Assign names to workers
Allow to have a name for workers in case the fuzzed code is itself using threads.

Reviewers: vitalybuka

Reviewed-By: vitalybuka

Differential Revision: https://reviews.llvm.org/D155754
2023-07-26 05:49:35 +01:00
Johannes Doerfert
b3fec1067a [Attributor] Improve NonNull deduction
We can improve our deduction if we stop at PHI and select instructions
and also iterate the returned values explicitly. The latter helps with
isImpliedByIR deductions.
2023-07-25 20:31:21 -07:00
Johannes Doerfert
be22b90994 [Attributor][NFC] Precommit tests 2023-07-25 20:31:21 -07:00
Johannes Doerfert
88b5d23021 [Attributor] Allow multiple LHS/RHS values when simplifying comparisons
We use to deal with multiple values but not in the handleCmp function.
Now we also allow multiple simplified operands there.
2023-07-25 20:31:21 -07:00
Johannes Doerfert
160ae648d6 [Attributor][NFC] Fix nofpclass test 2023-07-25 20:31:21 -07:00
Jianjian GUAN
84d4618a02 [RISCV] Fix the check assertion in hasMergeOp and hasMaskOp
Because we have STRICT_FCVT_W_RV64 equal to ISD::FIRST_TARGET_STRICTFP_OPCODE, the check needs to be splitted into 2 parts.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D155683
2023-07-26 11:21:50 +08:00
Kai Luo
11a02de782 [JITLink][PowerPC] Change method to check if a symbol is external to current object
After PrePrunePass `claimOrExternalizeWeakAndCommonSymbols`, a defined symbol might become external. So determine a function call is external or not when building the linkgraph is not accurate. This largely affects updating TOC pointer on PowerPC. TOC pointer is supposed to be the same in one object file(if no mulitple TOC appears) and is updated when control flow transferred to another object file.

This patch defers checking a function call is external or not, in `buildTables_ELF_ppc64` which is a PostPrunePass.

This patch fixes failures when `jitlink -orc-runtime=/path/to/libort_rt.a` is used.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D155925
2023-07-26 03:20:56 +00:00
Michael Maitland
cdffaac6ad [RISCV] Add Zbs instructions to SiFive7 SchedModel
BEXT[I] is available on A and B pipes, and has single-cycle latency. The other
instructions are only available on B-pipe, but otherwise have single-cycle
latency.
2023-07-25 19:54:17 -07:00
esmeyi
e83b8a5e71 [XCOFF] Enable available_externally linkage for functions.
Summary: D80642 added support for emitting AvailableExternally Linkage on AIX. However, an assertion of "Trying to get csect representation of this symbol but none was set." occurred when a function is declared as available_externally. This is due to we missing to generate a csect for the function. This patch fixes it.

Reviewed By: hubert.reinterpretcast, shchenz

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

Signed-off-by: Esme Yi <esme.yi@ibm.com>
2023-07-25 22:47:11 -04:00
Weining Lu
c56514f21b Reland "[LoongArch] Support -march=native and -mtune="
As described in [1][2], `-mtune=` is used to select the type of target
microarchitecture, defaults to the value of `-march`. The set of
possible values should be a superset of `-march` values. Currently
possible values of `-march=` and `-mtune=` are `native`, `loongarch64`
and `la464`.

D136146 has supported `-march={loongarch64,la464}` and this patch adds
support for `-march=native` and `-mtune=`.

A new ProcessorModel called `loongarch64` is defined in LoongArch.td
to support `-mtune=loongarch64`.

`llvm::sys::getHostCPUName()` returns `generic` on unknown or future
LoongArch CPUs, e.g. the not yet added `la664`, leading to
`llvm::LoongArch::isValidArchName()` failing to parse the arch name.
In this case, use `loongarch64` as the default arch name for 64-bit
CPUs.

And these two preprocessor macros are defined:
- __loongarch_arch
- __loongarch_tune

[1]: https://github.com/loongson/LoongArch-Documentation/blob/2023.04.20/docs/LoongArch-toolchain-conventions-EN.adoc
[2]: https://github.com/loongson/la-softdev-convention/blob/v0.1/la-softdev-convention.adoc

Reviewed By: xen0n, wangleiat

Differential Revision: https://reviews.llvm.org/D155824
2023-07-26 10:26:38 +08:00
Fangrui Song
4553dc46a0 [Support] Rewrite GlobPattern
The current implementation has two primary issues:

* Matching `a*a*a*b` against `aaaaaa` has exponential complexity.
* BitVector harms data cache and is inefficient for literal matching.

and a minor issue that `\` at the end may cause an out of bounds access
in `StringRef::operator[]`.

Switch to an O(|S|*|P|) greedy algorithm instead: factor the pattern
into segments split by '*'. The segment is matched sequentianlly by
finding the first occurrence past the end of the previous match. This
algorithm is used by lots of fnmatch implementations, including musl and
NetBSD's.

In addition, `optional<StringRef> Exact, Suffix, Prefix` wastes space.
Instead, match the non-metacharacter prefix against the haystack, then
match the pattern with the rest.

In practice `*suffix` style patterns are less common and our new
algorithm is fast enough, so don't bother storing the non-metacharacter
suffix.

Note: brace expansions (D153587) can leverage the `matchOne` function.

Differential Revision: https://reviews.llvm.org/D156046
2023-07-25 18:46:55 -07:00
Fangrui Song
16b2569f8e [unittest] Add [*] test to GlobPatternTest.cpp 2023-07-25 18:31:09 -07:00
Craig Topper
02c11c5aed [RISCV] Remove stale TODOs from RISCVISAInfo.cpp. NFC
Q extension does not require RV64.
E extenion is not incompatible with F or D extensions.
2023-07-25 17:47:48 -07:00
Johannes Doerfert
0cd8a28941 [Attributor][FIX] No IntraFnReachability does not mean unreachable
Also, first check inter fn reachability as it seems to be cheaper in
practise.
2023-07-25 17:47:33 -07:00
Johannes Doerfert
ba0be698c5 [Attributor][NFC] Rename variable to be less confusing 2023-07-25 17:47:33 -07:00
Johannes Doerfert
4223c9b354 [Attributor] Always deduce nosync from readonly + non-convergent
This adds the deduction also if the function is not IPO amendable.
2023-07-25 17:47:33 -07:00
Johannes Doerfert
ae6ad31763 [Attributor] Try to remove argmem effects after signature rewrite
If the new signature has only readnone pointers we can remove any argmem
effect from the function signature.
2023-07-25 17:47:33 -07:00
Johannes Doerfert
e31724f1a6 [Attributor] Check readonly call sites for nosync in AANoSync
See @nosync_convergent_callee_test() in nosync.ll. The other changes are
call sites now annotated with `nosync`.
2023-07-25 17:47:33 -07:00
Johannes Doerfert
0f7aa38223 [Attributor][NFC] Precommit test 2023-07-25 17:47:32 -07:00
Jonas Devlieghere
94e8fefe38
[lldb] Increase the default timeouts when running under ASan
Increase the default timeouts when running under ASan. We had something
similar before we adopted tablegen, but the larger timeouts got lost in
the transition, possibly because tablegen's preprocessor support is very
limited. This patch passes a new define (LLDB_SANITIZED) to
lldb-tablegen on which we can base the default value.

Differential revision: https://reviews.llvm.org/D156279
2023-07-25 17:45:19 -07:00
Florian Mayer
6cc9244baa Enable hwasan-use-after-scope by default
This has been in use for a long time without any issues.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D156267
2023-07-25 17:36:15 -07:00
Jim Lin
5555b9f739 [RISCV] Reuse FrameIdx for emitting cfi offset. NFC. 2023-07-26 08:33:58 +08:00
Mehdi Amini
5f2d4ef767 [mlir][doc] Fix TOC markdown tag in release notes page 2023-07-25 17:32:16 -07:00