NAKAMURA Takumi [Fri, 17 Feb 2023 14:25:40 +0000 (23:25 +0900)]
llvm-tblgen: Anonymize some functions.
Craig Topper [Sun, 19 Feb 2023 01:24:10 +0000 (17:24 -0800)]
[RISCV] Add Zfa test cases for strict ONE and UEQ comparisons. NFC
These correspond to islessgreater and it inverse.
Fabian [Sat, 18 Feb 2023 20:31:37 +0000 (21:31 +0100)]
[mlir] Execute all requested translations in MlirTranslateMain
Currently, MlirTranslateMain only executes one of the requested translations, and does not error if multiple are specified. This commit enables translations to be chained in the specified order.
This makes round-trip tests easier, since existing import/export passes can be reused and no combined round-trip passes have to be registered (example: mlir-translate -serialize-spirv -deserialize-spirv).
Additionally, by leveraging TranslateRegistration with file-to-file TranslateFunctions, generic pre- and post-processing can be added before/after conversion to/from MLIR.
Reviewed By: lattner, Mogball
Differential Revision: https://reviews.llvm.org/D143719
Craig Topper [Sun, 19 Feb 2023 00:43:50 +0000 (16:43 -0800)]
[RISCV] Handle RISCVISD::SplitF64 and RISCVISD::BuildPairF64 during isel with Zfa.
Instead of special casing Zfa in the custom inserters, select the
correct instructions during isel.
BuildPairF64 we can do with pattern, but SplitF64 requires custom
selection due to the two destinations.
If we didn't need SplitF64 without Zfa, I would have an extract low
and extract high ISD opcode for Zfa to avoid that issue.
Juneyoung Lee [Sat, 18 Feb 2023 20:43:26 +0000 (20:43 +0000)]
[DivRemPairs] Strip division's poison generating flag
Given this transformation: X % Y -> X - (X / Y) * Y
This patch strips off the poison-generating flag of X / Y such as exact, because it may make the optimized form result poison whereas X % Y does not.
The issue was reported here: https://github.com/llvm/llvm-project/issues/60748
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D144333
Juneyoung Lee [Sat, 18 Feb 2023 20:03:15 +0000 (20:03 +0000)]
Add a test for D144333
Michael Kirk [Sat, 18 Feb 2023 20:50:44 +0000 (12:50 -0800)]
[clang-format] Handle tabs in file path for git-clang-format
Vitaly Buka [Sat, 18 Feb 2023 02:29:42 +0000 (18:29 -0800)]
[SCEV] Fix FoldID::addInteger(unsigned long I)
"unsigned long" can be 8 bytes, but the code assumes 4.
This this the real root cause D122215 was reverted.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D144316
Vitaly Buka [Sat, 18 Feb 2023 20:21:10 +0000 (12:21 -0800)]
Revert "[SimplifyCFG] Check if the return instruction causes undefined behavior"
Breaks bots
https://lab.llvm.org/buildbot/#/builders/236/builds/2349
https://lab.llvm.org/buildbot/#/builders/74/builds/17361
https://lab.llvm.org/buildbot/#/builders/168/builds/11972
This reverts commit
7be55b007698f6b6398cbbea69c327b5a971938a.
David Green [Sat, 18 Feb 2023 19:54:29 +0000 (19:54 +0000)]
[AArch64] Concat zip1 and zip2 is a wider zip1
Given concat(zip1(a, b), zip2(a, b)), we can convert that to a 128bit zip1(a, b)
if we widen a and b out first.
Fixes #54226
Differential Revision: https://reviews.llvm.org/D121088
Noah Goldstein [Sat, 18 Feb 2023 19:36:06 +0000 (13:36 -0600)]
[ValueTracking] Add cases for additional ops in `isKnownNonZero`
Add cases for the following ops:
- 0-X -- https://alive2.llvm.org/ce/z/6C75Li
- bitreverse(X) -- https://alive2.llvm.org/ce/z/SGG1q9
- bswap(X) -- https://alive2.llvm.org/ce/z/p7pzwh
- ctpop(X) -- https://alive2.llvm.org/ce/z/c5y3BC
- abs(X) -- https://alive2.llvm.org/ce/z/yxXGz_
https://alive2.llvm.org/ce/z/rSRg4K
- uadd_sat(X, Y) -- https://alive2.llvm.org/ce/z/Zw-y4W
https://alive2.llvm.org/ce/z/2NRqRz
https://alive2.llvm.org/ce/z/M1OpF8
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D142828
Noah Goldstein [Sat, 18 Feb 2023 19:36:24 +0000 (13:36 -0600)]
[ValueTracking] Add tests for additional `isKnownNonZero` cases; NFC
Add cases for the following ops:
- 0-X
- bitreverse(X)
- bswap(X)
- ctpop(X)
- abs(X)
- uadd_sat(X, Y)
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D142827
Noah Goldstein [Thu, 26 Jan 2023 17:36:05 +0000 (11:36 -0600)]
[ValueTracking] Add KnownBits patterns `xor(x, x - 1)` and `and(x, -x)` for knowing upper bits to be zero
These two BMI pattern will clear the upper bits of result past the
first set bit. So if we know a single bit in `x` is set, we know that
`results[bitwidth - 1, log2(x) + 1] = 0`.
Alive2:
blsmsk: https://alive2.llvm.org/ce/z/a397BS
blsi: https://alive2.llvm.org/ce/z/tsbQhC
Differential Revision: https://reviews.llvm.org/D142271
Noah Goldstein [Thu, 26 Jan 2023 17:36:16 +0000 (11:36 -0600)]
[ValueTracking] Add tests for known bits after common BMI pattern (blsmsk/blsi); NFC
Differential Revision: https://reviews.llvm.org/D142270
Jay Foad [Thu, 26 Jan 2023 17:34:50 +0000 (11:34 -0600)]
[KnownBits] Add blsi and blsmsk
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D142519
Cyndy Ishida [Sat, 18 Feb 2023 19:27:44 +0000 (11:27 -0800)]
[llvm-tapi-diff] add default case to switch for symbol flags
Cyndy Ishida [Sat, 18 Feb 2023 18:37:44 +0000 (10:37 -0800)]
[TextAPI] Capture new properties from TBD to InterfaceFile
* Deployment Versions for targets
* Run Search Paths
* Text vs Data Segment attributes to symbols
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D144158
NAKAMURA Takumi [Sat, 18 Feb 2023 17:52:39 +0000 (02:52 +0900)]
llvm-tblgen: Add "TableGenBackends.h" to each emitter.
"TableGenBackends.h" has declarations of emitters.
NAKAMURA Takumi [Sat, 18 Feb 2023 18:01:00 +0000 (03:01 +0900)]
llvm-tblgen: Add missing includes
NAKAMURA Takumi [Sat, 18 Feb 2023 14:15:23 +0000 (23:15 +0900)]
llvm-tblgen: Reformat
Amara Emerson [Sat, 18 Feb 2023 17:51:17 +0000 (09:51 -0800)]
[GlobalISel] Fix G_ZEXTLOAD being converted to G_SEXTLOAD incorrectly.
The extending loads combine tries to prefer sign-extends folding into loads vs
zexts, and in cases where a G_ZEXTLOAD is first used by a G_ZEXT, and then used
by a G_SEXT, it would select the G_SEXT even though the load is already
zero-extending.
Fixes issue #59630
Florian Hahn [Sat, 18 Feb 2023 18:00:18 +0000 (18:00 +0000)]
Revert "[SCCP] Remove legacy SCCP pass."
This reverts commit
5356fefc19df3fbf32d180b1b10e6226e8743541.
It looks like Polly still relies on the legacy SCCP pass. Bring it back
until the best way forward is determined.
Mark de Wever [Sat, 18 Feb 2023 17:30:56 +0000 (18:30 +0100)]
[NFC][libc++][format] Small improvements.
While working on the formatter for the thread::id several minor issues
where spotted. This fixes them.
Florian Hahn [Sat, 18 Feb 2023 17:54:29 +0000 (17:54 +0000)]
[SCCP] Remove legacy SCCP pass.
This is part of the optimization pipeline, of which the legacy pass manager version is deprecated.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D144201
Mark de Wever [Sat, 18 Feb 2023 17:30:56 +0000 (18:30 +0100)]
[NFC][libc++][doc] Fixes formatting.
Kelvin Li [Sat, 18 Feb 2023 05:09:13 +0000 (00:09 -0500)]
[Flang] Add PowerPC intrinsics
This patch adds a subset of PowerPC intrinsics - fmadd,
fmsub, fnmadd and fnmsub.
Differential Revision: https://reviews.llvm.org/D143951
Kristina Bessonova [Sat, 18 Feb 2023 16:31:21 +0000 (18:31 +0200)]
[AArch64InstPrinter][llvm-objdump] Print ADR PC-relative label as a target address hexadecimal form
This is similar to ADRP and matches GNU objdump:
GNU objdump:
```
0000000000200100 <_start>:
200100: adr x0, 201000 <_start+0xf00>
```
llvm-objdump (before patch):
```
0000000000200100 <_start>:
200100: adr x0, #3840
```
llvm-objdump (after patch):
```
0000000000200100 <_start>:
200100: adr x0, 0x201000 <_start+0xf00>
```
Reviewed By: simon_tatham, peter.smith
Differential Revision: https://reviews.llvm.org/D144079
DianQK [Sat, 18 Feb 2023 15:09:07 +0000 (23:09 +0800)]
[SimplifyCFG] Check if the return instruction causes undefined behavior
This should fix https://github.com/rust-lang/rust/issues/107681.
Return undefined to a noundef return value is undefined.
Example:
```
define noundef i32 @test_ret_noundef(i1 %cond) {
entry:
br i1 %cond, label %bb1, label %bb2
bb1:
br label %bb2
bb2:
%r = phi i32 [ undef, %entry ], [ 1, %bb1 ]
ret i32 %r
}
```
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D144319
Tue Ly [Sat, 18 Feb 2023 15:16:13 +0000 (10:16 -0500)]
[libc][bazel] Fix missing dependency in test/src/stdlib targets.
Sanjay Patel [Sat, 18 Feb 2023 12:19:04 +0000 (07:19 -0500)]
[InstCombine] add tests for 1<<cttz(x); NFC
issue #60799
issue #60801
Nikolas Klauser [Sat, 18 Feb 2023 00:27:24 +0000 (01:27 +0100)]
[libc++] Fix header includes in <__atomic/cxx_atomic_impl.h>
Reviewed By: #libc, philnik
Spies: Mordante, paulkirth, libcxx-commits
Differential Revision: https://reviews.llvm.org/D144307
Mark de Wever [Sat, 21 Jan 2023 12:35:30 +0000 (13:35 +0100)]
[libc++][test] Removes rapid-cxx-test.h.
Depends on D142808
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D143383
eopXD [Sat, 18 Feb 2023 10:12:24 +0000 (02:12 -0800)]
[Doc] Fix type-o under LangRef
Signed-off-by: eop Chen <eop.chen@sifive.com>
Amara Emerson [Sat, 18 Feb 2023 09:48:25 +0000 (01:48 -0800)]
[NFC][GlobalISel] Regenerate test checks for extending-loads test.
Benjamin Kramer [Sat, 18 Feb 2023 08:38:18 +0000 (09:38 +0100)]
[WebAssembly] assert(false) -> llvm_unreachable
Avoids warnings in -asserts builds.
ASTContext.cpp:4098:1: error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]
}
^
Ethan Luis McDonough [Sat, 18 Feb 2023 07:56:15 +0000 (01:56 -0600)]
[flang] Remove macro replacement in angular bracket includes
Addresses Github issue [[ https://github.com/llvm/llvm-project/issues/60317 | #60317 ]].
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D143469
LLVM GN Syncbot [Sat, 18 Feb 2023 06:30:26 +0000 (06:30 +0000)]
[gn build] Port
79320a0c3f82
Cyndy Ishida [Sat, 18 Feb 2023 03:55:47 +0000 (19:55 -0800)]
Reland "[TextAPI] Implement TBDv5 Reader"
Introduce initial reader for TBDv5 which is in JSON. This captures all
the currently understood fields within the internal structure
`InterfaceFile`.
New fields will be followed up in future PRs.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D144156
Shengchen Kan [Sat, 18 Feb 2023 06:11:52 +0000 (14:11 +0800)]
[X86][NFC] Assert MRMr0 format from emitREXPrefix
The only instruction of this format is VEX encoding
Lang Hames [Sat, 18 Feb 2023 04:16:16 +0000 (20:16 -0800)]
[llvm-jitlink] Discard allocation actions in -noexec mode.
Allocation actions may run JIT'd code, which isn't permitted in -noexec mode.
Testcases that depend on actions running should be moved to the ORC runtime.
Kirill Stoimenov [Sat, 18 Feb 2023 00:02:06 +0000 (00:02 +0000)]
[LSAN] Mask out tags from pointers on ARM in MaybeUserPointer heuristic
This caused false positives because the existing logic was not taking into account that pointers could have a tag in them.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D144305
Paulo Matos [Sat, 18 Feb 2023 02:38:58 +0000 (18:38 -0800)]
[WebAssembly] Initial support for reference type externref in clang
This patch introduces a new type __externref_t that denotes a WebAssembly opaque
reference type. It also implements builtin __builtin_wasm_ref_null_extern(),
that returns a null value of __externref_t. This lays the ground work
for further builtins and reference types.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D122215
Ye Luo [Sat, 18 Feb 2023 01:55:40 +0000 (19:55 -0600)]
[OpenMP] Make isDone lightweight without calling synchronize
~TaskAsyncInfoWrapperTy() calls isDone. With synchronize inside isDone, we need to handle the error return from synchronize in the destructor.
The consumers of TaskAsyncInfoWrapperTy, targetDataMapper and targetKernel, both call AsyncInfo.synchronize() before exiting.
For this reason in ~TaskAsyncInfoWrapperTy(), calling synchronize() via isDone() is redundant.
This patch removes synchronize() call inside isDone() and makes it a lightweight check.
__tgt_target_nowait_query needs to call synchronize() before checking isDone().
Differential Revision: https://reviews.llvm.org/D144315
Matt Arsenault [Mon, 26 Dec 2022 17:14:36 +0000 (12:14 -0500)]
IROutliner: cast instead of dyn_cast and assert
Matt Arsenault [Thu, 5 Jan 2023 16:13:44 +0000 (11:13 -0500)]
CodeExtractor: Fix creating addrspacecasts for lifetime markers
Also stop caring about typed pointers.
Fangrui Song [Sat, 18 Feb 2023 02:22:24 +0000 (18:22 -0800)]
Simplify with hasFeature. NFC
Renaud-K [Fri, 17 Feb 2023 20:44:33 +0000 (12:44 -0800)]
[flang] Adding fir::getSymbolAttrName attribute to the function corresponding to the main subprogram.
This is because the source name cannot be deconstructed from _QQmain
Differential revision: https://reviews.llvm.org/D144295
Philip Reames [Sat, 18 Feb 2023 00:25:01 +0000 (16:25 -0800)]
[RISCV] Add missing plumbing and tests for zfa
Experimental support for the zfa extension was recently added in https://reviews.llvm.org/D141984. A couple of the normal test changes and clang plumbing got missed in that change. This commit updates the usual suspects.
Differential Revision: https://reviews.llvm.org/D144288
Dave Lee [Thu, 16 Feb 2023 23:39:09 +0000 (15:39 -0800)]
[lldb] Make persisting result variables configurable
Context: The `expression` command uses artificial variables to store the expression
result. This result variable is unconditionally kept around after the expression command
has completed. These variables are known as persistent results. These are the variables
`$0`, `$1`, etc, that are displayed when running `p` or `expression`.
This change allows users to control whether result variables are persisted, by
introducing a `--persistent-result` flag.
This change keeps the current default behavior, persistent results are created by
default. This change gives users the ability to opt-out by re-aliasing `p`. For example:
```
command unalias p
command alias p expression --persistent-result false --
```
For consistency, this flag is also adopted by `dwim-print`. Of note, if asked,
`dwim-print` will create a persistent result even for frame variables.
Differential Revision: https://reviews.llvm.org/D144230
Dave Lee [Wed, 15 Feb 2023 16:23:57 +0000 (08:23 -0800)]
[lldb] Add expression command options in dwim-print
Adopt `expression`'s options in `dwim-print`.
This is primarily added to support the `--language`/`-l` flag.
Differential Revision: https://reviews.llvm.org/D144114
LLVM GN Syncbot [Sat, 18 Feb 2023 00:29:10 +0000 (00:29 +0000)]
[gn build] Port
07e3ca238e68
Cyndy Ishida [Sat, 18 Feb 2023 00:25:33 +0000 (16:25 -0800)]
Revert "[TextAPI] Implement TBDv5 Reader"
This reverts commit
b861b1225380175a5a724e2a677754f5f74e5b0d.
This reverts commit
4be17641b05df1e63fa8e069af92676f1246eb83.
This patch wont build on some compilers on buildbot.
Cyndy Ishida [Sat, 18 Feb 2023 00:15:12 +0000 (16:15 -0800)]
[TextAPI] wrap returned Errors in std::move
LLVM GN Syncbot [Sat, 18 Feb 2023 00:06:09 +0000 (00:06 +0000)]
[gn build] Port
b861b1225380
Cyndy Ishida [Fri, 17 Feb 2023 23:58:04 +0000 (15:58 -0800)]
[TextAPI] Implement TBDv5 Reader
[TextAPI] Implement TBDv5 Reader
Introduce initial reader for TBDv5 which is in JSON. This captures all
the currently understood fields within the internal structure
`InterfaceFile`.
New fields & follow up tests will be followed up in future PRs.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D144156
Amara Emerson [Fri, 17 Feb 2023 22:35:22 +0000 (14:35 -0800)]
[GlobalISel] Combine out-of-range shifts to undef.
Differential Revision: https://reviews.llvm.org/D144303
Shafik Yaghmour [Fri, 17 Feb 2023 22:56:02 +0000 (14:56 -0800)]
[Clang] Fix __VA_OPT__ implementation so that it treats the concatenation of a non-placemaker token and placemaker token as a non-placemaker token
Currently the implementation of __VA_OPT__ will treat the concatenation of a
non-placemaker token and placemaker token as a placemaker token which is not
correct. This will fix the implementation and treat the result as a
non-placemaker token.
This fixes: https://github.com/llvm/llvm-project/issues/60268
Differential Revision: https://reviews.llvm.org/D142604
Craig Topper [Fri, 17 Feb 2023 22:36:48 +0000 (14:36 -0800)]
[RISCV] Use MCSubtargetInfo::hasFeature where possible. NFC
Rather than using operator[] on getFeatureBits we can use
hasFeature to shorten the code.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D144300
Fangrui Song [Fri, 17 Feb 2023 22:29:21 +0000 (14:29 -0800)]
[AArch64] Simplify with MCSubtargetInfo::hasFeature. NFC
Alex Brachet [Fri, 17 Feb 2023 21:29:14 +0000 (21:29 +0000)]
Revert "[Fuchsia] Enable llvm-driver build"
This reverts commit
4eadd19cc423b860f7ce0217000276da769b7809.
Doesn't work on macos. I'll investigate more
Nikolas Klauser [Fri, 17 Feb 2023 21:17:45 +0000 (22:17 +0100)]
[libc++][NFC] Remove TODOs that are already done
Daniel Thornburgh [Wed, 15 Feb 2023 23:27:21 +0000 (15:27 -0800)]
[llvm-cov] Create syntax to pass source w/o binary.
Since binary ID lookup makes CLI object arguments optional, it should be
possible to pass a list of source files without a binary. Unfortunately,
the current syntax will always interpret the first source file as a
binary. This change adds a `-sources` option to cause all later
positional arguments to be considered sources.
Reviewed By: gulfem
Differential Revision: https://reviews.llvm.org/D144207
Alex Brachet [Fri, 17 Feb 2023 21:02:18 +0000 (21:02 +0000)]
[Fuchsia] Enable llvm-driver build
Differential Revision: https://reviews.llvm.org/D144287
Nikolas Klauser [Fri, 17 Feb 2023 12:00:21 +0000 (13:00 +0100)]
[libc++][NFC] Replace _VSTD and _LIBCPP_INLINE_VISIBILITY in <__atomic/*>
Reviewed By: Mordante, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D144258
Philipp Tomsich [Fri, 17 Feb 2023 20:11:51 +0000 (21:11 +0100)]
[RISCV] Select signed and unsigned bitfield extracts for XTHeadBb
The XTHeadBb extension hab both signed and unsigned bitfield
extraction instructions (TH.EXT and TH.EXTU, respectively) which have
previously only been supported for sign extension on byte, halfword,
and word-boundaries.
This adds the infrastructure to use TH.EXT and TH.EXTU for arbitrary
bitfield extraction.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144229
Alex Langford [Fri, 17 Feb 2023 02:17:59 +0000 (18:17 -0800)]
[lldb] StructuredData should not truncate uint64_t values
In json::Value, getAsInteger returns an optional<int64_t> and getAsNumber
returns an optional<double>. If a value is larger than what an int64_t
can hold but smaller than what a uint64_t can hold, the getAsInteger
function will fail but the getAsNumber will succeed. However, the value
shouldn't be interpreted as a double.
rdar://
105556974
Differential Revision: https://reviews.llvm.org/D144238
Mark de Wever [Fri, 17 Feb 2023 17:10:14 +0000 (18:10 +0100)]
[libc++][format] Addresses LWG3810.
LWG3810 CTAD for std::basic_format_args
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D144275
Pavel Kopyl [Fri, 13 Jan 2023 18:02:49 +0000 (19:02 +0100)]
[NVPTX] Use by default 'sm_60' architecture when expanding %ptxas-verify macro.
Also get rid of explicitly specified '-march' values for old architectures.
This simplifies %ptxas-verify statements.
After the change, we can potentially miss cases where a new functionality
is added to the architecture without appropriate checks in the
backend. On the other hand, this is mostly true for old architectures
that have been thoroughly tested.
Differential Revision: https://reviews.llvm.org/D141736
Konstantin Varlamov [Fri, 17 Feb 2023 19:20:29 +0000 (11:20 -0800)]
[libc++] Mark a test relying on `typeid` as unsupported without RTTI.
Michael Jones [Fri, 10 Feb 2023 23:00:32 +0000 (15:00 -0800)]
[libc] Add basic fuzz target for the printf parser
The goal is to fuzz the entirety of printf, but the plan is to do it in
pieces for simplicity. This test fuzzes just the parser, while later
tests will fuzz the converters. This also adds a mock version of the
arg_list class.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D143784
Michael Jones [Thu, 16 Feb 2023 00:03:04 +0000 (16:03 -0800)]
[libc] add mock arg list
For testing purposes we need to be able to mock out the ArgList class.
This patch adds a mock version of that class as well as a flag to enable
it.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D144145
Hanhan Wang [Thu, 16 Feb 2023 01:36:21 +0000 (17:36 -0800)]
[mlir][tensor] Do not use affine ops on non-perfect-tiling unpack cases.
Do not create an Affine ops for expanded size because the affine op is
too complicated which would hit an assertion in affine ops
simplification.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D144151
Craig Topper [Fri, 17 Feb 2023 18:53:44 +0000 (10:53 -0800)]
[RISCV] For rv32, accept constants like 0xfffff800 as a valid simm12.
Internally we store constants in int64_t after parsing, but this is
kind of an implementation detail. If we only supported rv32, we might
have chosen int32_t.
For rv32, I think it makes sense to accept the constants that we
would accept if int32_t was the internal type. In fact we already
do this for the `li` alias. This patch extends this to sign
extended constants for other instructions.
This matches the GNU assembler. The difference between LLVM and gcc
was previously noted here. https://github.com/riscv-non-isa/riscv-asm-manual/pull/71
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D144166
Philipp Tomsich [Fri, 17 Feb 2023 18:46:13 +0000 (19:46 +0100)]
Revert "[RISCV] Add performMULcombine to perform strength-reduction"
This reverts commit
20cc23c708f04ca3fbc4289a68302a4b684ce448.
Philipp Tomsich [Fri, 17 Feb 2023 18:45:55 +0000 (19:45 +0100)]
Revert "[RISCV] Add vendor-defined XTheadMemPair (two-GPR Memory Operations) extension"
This reverts commit
d2918544a7fc4b5443879fe12f32a712e6dfe325.
Manolis Tsamis [Fri, 17 Feb 2023 18:32:07 +0000 (19:32 +0100)]
[RISCV] xtheadmac: fix commutativity issue for the in/out register
The instructions in the XTHeadMac extension (multiply accumulate
instructions) were marked as commutative but because the destination
register was also an input (accumulate) register and was connected to
the destination register with a register allocator constraint, all
three operands (instead of two) were incorrectly considered
commutative. To fix that an appropriate fixCommutedOpIndices call was
added for these instructions in findCommutedOpIndices
New test functions have been added to test the correct behaviour in
xtheadmac.ll.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144278
Philipp Tomsich [Fri, 3 Feb 2023 21:03:07 +0000 (22:03 +0100)]
[RISCV] Add performMULcombine to perform strength-reduction
The RISC-V backend thus far does not provide strength-reduction, which
causes a long (but not complete) list of 3-instruction patterns listed
to utilize the shift-and-add instruction from Zba and XTHeadBa in
strength-reduction.
This adds the logic to perform strength-reduction through the DAG
combine for ISD::MUL. Initially, we wire this up for XTheadBa only,
until this has had some time to settle and get real-world test
exposure.
The following strength-reductions strategies are currently supported:
- XTheadBa
- C = (n + 1) // th.addsl
- C = (n + 1)k // th.addsl, slli
- C = (n + 1)(m + 1) // th.addsl, th.addsl
- C = (n + 1)(m + 1)k // th.addsl, th.addsl, slli
- C = ((n + 1)m + 1) // th.addsl, th.addsl
- C = ((n + 1)m + 1)k // th.addslm th.addsl, slli
- base ISA
- C being 2 set-bits // slli, slli, add
(possibly slli, th.addsl)
Even though the slli+slli+add sequence would we supported without
XTheadBa, this currently is gated to avoid having to update a large
number of test cases (i.e., anything that has a multiplication with a
constant where only 2 bits are set) in this commit.
With the strength reduction now being performed in performMUL combine,
we drop the (now redundant) patterns from RISCVInstrInfoXTHead.td.
Depends on D143029
Differential Revision: https://reviews.llvm.org/D143394
Manolis Tsamis [Mon, 13 Feb 2023 13:07:45 +0000 (14:07 +0100)]
[RISCV] Add vendor-defined XTheadMemPair (two-GPR Memory Operations) extension
The vendor-defined XTHeadMemPair (no comparable standard extension exists
at the time of writing) extension adds two-GPR load/store pair instructions.
It is supported by the C9xx cores (e.g., found in the wild in the
Allwinner D1) by Alibaba T-Head.
The current (as of this commit) public documentation for this
extension is available at:
https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.2.2/xthead-2023-01-30-2.2.2.pdf
Support for these instructions has already landed in GNU Binutils:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=
6e17ae625570ff8f3c12c8765b8d45d4db8694bd
Depends on D143847
Differential Revision: https://reviews.llvm.org/D144002
Nikolas Klauser [Fri, 17 Feb 2023 18:33:16 +0000 (19:33 +0100)]
[libc++] Add missing include in <__atomic/cxx_atomic_impl.h>
Jun Sha (Joshua) [Fri, 17 Feb 2023 17:36:18 +0000 (09:36 -0800)]
[RISCV][CodeGen] Add codegen patterns for experimental zfa extension (try 2)
Recommit by preames with commit message, various style cleanups, and unaddressed review comments corrected.
This patch implements experimental codegen support for the RISCV Zfa extension as specified here: https://github.com/riscv/riscv-isa-manual/releases/download/draft-
20221119-5234c63/riscv-spec.pdf, Ch. 25. This extension has not been ratified.
This change does not include support for FLI (upcoming in a follow up change) or FCVTMOD (not relevant for C/C++).
Differential Revision: https://reviews.llvm.org/D143982
Kazu Hirata [Fri, 17 Feb 2023 18:21:10 +0000 (10:21 -0800)]
[IR] Fix a warning
This patch fixes:
llvm/lib/IR/Instruction.cpp:141:20: warning: unused variable ‘CB’ [-Wunused-variable]
Jeff Niu [Thu, 16 Feb 2023 18:27:10 +0000 (10:27 -0800)]
[mlir] Reintroduce API for creating operations with a DictionaryAttr
This patch reintroduces an API to create operations with a pre-existing
DictionaryAttr. This API does not populate the attributes with any
default attributes the operation may have, like the API that takes a
NamedAttrList does. NamedAttrList is effective at not re-hashing the
attributes if no default attributes were added, but this new API speeds
up clone-heavy workloads slightly (~5%).
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D144204
Ryan Guo [Fri, 17 Feb 2023 17:07:35 +0000 (09:07 -0800)]
[ADT] Fix tests for `StringMap::at` and `DenseMap::at`
These methods won't assert for release build.
Craig Topper [Fri, 17 Feb 2023 18:00:40 +0000 (10:00 -0800)]
[RISCV] Improve isInterleaveShuffle to handle interleaving the high half and low half of the same source.
This is needed to support the new interleave intrinsics from D141924 for
fixed vectors.
I've reworked the core loop to operate in terms of half of a source. Making 4
possible half sources. The first element of the half is used to indicate which
source using the same numbering as the shuffle where the second source elements
are numbered after the first source.
I've added restrictions to only match the first half of two vectors or the
first and second half of a single vector. This was done to prevent regressions
on the cases we have coverage for. I saw cases where generic DAG combine split
a single interleave into 2 smaller interleaves a concat. We can revisit in the
future.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D144143
Moshe Berman [Fri, 17 Feb 2023 17:18:14 +0000 (17:18 +0000)]
[ELF][llvm-objcopy] Reject duplicate SHT_SYMTAB sections
The gABI prohibits multiple SH_SYMTAB sections. As a result,
llvm-objcopy was crashing in SymbolTableSection::removeSymbols(). This
patch fixes the issue by emitting an error if multiple SH_SYMTAB
sections are encountered when building an ELF object.
Fixes: https://github.com/llvm/llvm-project/issues/60448
Differential Revision: https://reviews.llvm.org/D143508
Arthur Eubanks [Wed, 8 Feb 2023 02:11:35 +0000 (18:11 -0800)]
Reland [gn build] Support linux/win compiler-rt cross compilation
Differential Revision: https://reviews.llvm.org/D143545
Arthur Eubanks [Fri, 17 Feb 2023 17:56:51 +0000 (09:56 -0800)]
Revert "[gn build] Support linux/win compiler-rt cross compilation"
This reverts commit
d73eb92cc673acf532b396537d78fe041dc9a9c2.
Breaks win/mac, e.g. http://45.33.8.238/win/75236/step_4.txt
Mark de Wever [Sat, 21 Jan 2023 12:35:30 +0000 (13:35 +0100)]
[lib++][format] Uses the new exception test macros.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D143393
Jun Sha (Joshua) [Fri, 17 Feb 2023 17:02:15 +0000 (09:02 -0800)]
[RISCV][MC] Add support for experimental zfa extension (FLI instruction not included) (try 3)
(Opening comment by preames - submitter, not patch author)
Try 1 was reverted because it had been landed in pieces, none of which had a meaningful commit message.
Try 2 was reverted because of a buildbot failure. It turns out this was a spurious revert on my (preames) part. The buildbots were failing, and it was from one of my changes in this sequence, but not the recommit. I had reverted both of the try 1 commits in a single git push, but in separate *commits*. Some of the builders decided to build the broken state between the original try 1 commit, and I'd not noticed that. I'd assumed the breakage was because of the try2 re-commit. So the revert of the try 2 recommit was spurious.
Original commit message:
This implements experimental support for the RISCV Zfa extension as specified here: https://github.com/riscv/riscv-isa-manual/releases/download/draft-
20221119-5234c63/riscv-spec.pdf, Ch. 25. This extension has not been ratified. Once ratified, it'll move out of experimental status.
This change adds assembly support for all instructions except load-immediate instructions (fli.s/fli.d/fli.h). Assembly support for that instruction and codegen support will follow in separate patches.
Differential Revision: https://reviews.llvm.org/D141984
Arthur Eubanks [Wed, 8 Feb 2023 02:11:35 +0000 (18:11 -0800)]
[gn build] Support linux/win compiler-rt cross compilation
Differential Revision: https://reviews.llvm.org/D143545
Nick Desaulniers [Fri, 17 Feb 2023 17:19:36 +0000 (09:19 -0800)]
[M68k] fix test regression introduced by D140180
I added a new pass, callbrprepare, to the pass pipelines in
commit
a3a84c9e2511 ("[llvm] add CallBrPrepare pass to pipelines")
but did not test experimental backends.
Mark de Wever [Sat, 11 Feb 2023 15:45:35 +0000 (16:45 +0100)]
[libc++] Fixes a flaky test.
While investigating the flaky tests on the mac backdeployment targets
it seems the tests are different than suggested in the LWG issue.
That tests "does work", grabs the mutex, marks the task as done, and
finally calls the notifier.
Our test emulated "does work" after the notification, effectively
sleeping with a lock held. This has been fixed.
A second improvement is that the test fails when, due to OS
scheduling, the condition variable is not used in the main thread.
During discussing the approach of the patch with @ldionne, he
noticed the real reason why the test is flaky; the Apple
backdeployment targets use a dylib, which does not contain the
fix. So the test can't be tested on that platform; it only
proves the LWG issue was correct and the Standard contained
a bug.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D143816
Arthur Eubanks [Wed, 8 Feb 2023 19:05:38 +0000 (11:05 -0800)]
[gn build] Support building x86/64 Android libraries
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D143598
Jan Dupej [Thu, 16 Feb 2023 20:37:16 +0000 (12:37 -0800)]
Port PlaceSafepoints pass to the new pass manager
This patch ports the PlaceSafepoints pass to the new pass manager as it is used by .NET/Mono. Compatibility with the legacy pass manager is maintained by adding PlaceSafepointsLegacyPass. This pass also depends on PlaceBackedgeSafepointsLegacyPass, which has been kept in the legacy-only variant, since it is apparently used only from PlaceSafepointsPass. It has been renamed, though, to indicate its legacy interface.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D136163
Peter Klausler [Fri, 17 Feb 2023 00:30:38 +0000 (16:30 -0800)]
[flang][runtime] Support DT edit descriptor in result of READ(SIZE=)
When a formatted I/O READ statement processes a DT edit descriptor to call a
user-defined I/O subroutine to read a derived type data item, all of the
characters that that subroutine reads via child I/O count as charecters
read by an edit descriptor and should accumulate in the result returned
by a SIZE= item in the original READ statement's control list.
Differential Revision: https://reviews.llvm.org/D144234
Mark de Wever [Wed, 15 Feb 2023 20:00:06 +0000 (21:00 +0100)]
[libc++][CI] Switches to clang-format-16.
Uses an absolute path to the selected binary.
Updates the formatting of two files to match clang-format-16 style.
Depends on D144126
Reviewed By: #libc, philnik
Differential Revision: https://reviews.llvm.org/D144132
Mark de Wever [Wed, 15 Feb 2023 18:50:55 +0000 (19:50 +0100)]
[libc++] Improve the format ignorelist generation.
Several improvements
- Only add files that we actually want to format.
- Sort according to a fixed locale.
Some drive-by fixes
- Rename a text file, this avoids a filter exception.
- Adds a some missing source files extensions.
- Removes unused extensions hh, hxx, cc, and cxx from clang-format.
Reviewed By: philnik, #libc
Differential Revision: https://reviews.llvm.org/D144126
Craig Topper [Fri, 17 Feb 2023 16:43:40 +0000 (08:43 -0800)]
[RISCV] Add preferred function and loop alignment RISCVSubtarget. NFC
These seem like properties we will want to adjust based on -mtune.
Move them to subtarget like is done on ARM and AArch64. Don't add
any overrides yet.
Note there's a slight change here. We are now passing Align(1) for
preferred function alignment where we previously passed the minimum
alignment. As far as I could tell, it will be maxed with min when
it used so this should be ok.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D144048
Nikolas Klauser [Thu, 2 Feb 2023 10:47:01 +0000 (11:47 +0100)]
[libc++][NFC] Rename _LIBCPP_NO_EXCEPTIONS to _LIBCPP_HAS_NO_EXCEPTIONS
Other macros that disable parts of the library are named `_LIBCPP_HAS_NO_WHATEVER`.
Reviewed By: ldionne, Mordante, #libc
Spies: libcxx-commits, smeenai
Differential Revision: https://reviews.llvm.org/D143163
Ryan Guo [Tue, 14 Feb 2023 04:06:44 +0000 (20:06 -0800)]
[ADT] Add `at` method (assertive lookup) to DenseMap and StringMap
This patch makes it easier for users when they want to use validated
lookup on DenseMap/StringMap as a composable C++ expression. For
instance:
```
// instead of
if (auto val = map.lookup(key))
return val;
assert("...");
// we can write
return map.at(key);
```
Differential Revision: https://reviews.llvm.org/D143976