Aiden Grossman [Thu, 24 Nov 2022 03:36:13 +0000 (03:36 +0000)]
[MLGO] Fix InlineAdvisor and ModelUnderTrainingRunner after hasValue removal
Recentlyin 4b6b248, llvm::Optional's hasValue method was removed as
described in
https://discourse.llvm.org/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor
This breaks InlineAdvisor and ModelUnderTrainingRunner. This patch fixes
them by changing the method to has_value, which hasValue was evaluating
to before.
Differential Revision: https://reviews.llvm.org/D138635
wangpc [Thu, 24 Nov 2022 03:08:59 +0000 (11:08 +0800)]
[RISCV] Lower unmasked zero-stride vector load to (scalar load + splat)
So we have the opportunity to fold splat into .vx instruction as what
D101138 has done. If failed, we can select zero-stride vector load
again.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D138101
wangpc [Thu, 24 Nov 2022 02:36:06 +0000 (10:36 +0800)]
[RISCV] Precommit test for D138101
Add a test that splat can't be folded.
Reviewed By: pcwang-thead
Differential Revision: https://reviews.llvm.org/D138543
Hanhan Wang [Thu, 24 Nov 2022 03:04:21 +0000 (19:04 -0800)]
Revert "[mlir][linalg] Add a new pattern to handle folding unit reduction dims."
This reverts commit
6eee66d12ab33f35a37a1514342b51ae93d175e8.
It breaks builds, see https://lab.llvm.org/buildbot/#/builders/61/builds/35742
Differential Revision: https://reviews.llvm.org/D138633
gonglingqin [Thu, 24 Nov 2022 02:15:18 +0000 (10:15 +0800)]
[LoongArch] Diagnose the behavior of reading and writing registers that do not conform to the hardware register size
When reading or writing a register that does not conform to the size of a
hardware register, an error message is generated instead of a compiler crash.
Differential Revision: https://reviews.llvm.org/D138008
Luo, Yuanke [Wed, 23 Nov 2022 08:44:54 +0000 (16:44 +0800)]
[X86][AMX] Fix typo of the headerfile.
Differential Revision: https://reviews.llvm.org/D138547
Michał Górny [Wed, 23 Nov 2022 15:07:03 +0000 (16:07 +0100)]
[flang] Harmonize standalone gtest support with other projects
Use the CMake rules of unittest libraries via `add_subdirectory()`
when using standalone builds, similarly to how e.g. Clang does that.
Besides making things more consistent, I hope this also unblocks D137035
and effectively we'll be able to simplify things further and have LLVM
semi-automatically include gtest support for us in the future.
Differential Revision: https://reviews.llvm.org/D138573
Fangrui Song [Thu, 24 Nov 2022 01:46:59 +0000 (17:46 -0800)]
[Object] Internalize readBBAddrMapImpl
Fangrui Song [Thu, 24 Nov 2022 01:44:04 +0000 (17:44 -0800)]
Host: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreads
Fangrui Song [Thu, 24 Nov 2022 01:33:34 +0000 (17:33 -0800)]
ModuleSummaryAnalysis: Internalize some cl::opt
Vasileios Porpodas [Wed, 23 Nov 2022 22:30:18 +0000 (14:30 -0800)]
[NFC] Use BB->size() instead of BB->getInstList().size().
Differential Revision: https://reviews.llvm.org/D138616
Fangrui Song [Thu, 24 Nov 2022 01:22:49 +0000 (17:22 -0800)]
RISCVISAInfo: Internalize struct FindByName
chenglin.bi [Thu, 24 Nov 2022 01:04:33 +0000 (09:04 +0800)]
[InstSimplify] Add precommit test for D138542; NFC
Kazu Hirata [Thu, 24 Nov 2022 00:50:34 +0000 (16:50 -0800)]
[ADT] Deprecate Optional::getPointer
This patch deprecates Optional::getPointer. Note that I've converted
all known occurrences of X.getPointer() to &*X on Nov 21, 2022 in
commit
1f914944b6c9a5e4229ceb9f06140fdf178c5ea0.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138621
Kazu Hirata [Thu, 24 Nov 2022 00:33:10 +0000 (16:33 -0800)]
[ADT] Deprecate llvm::NoneType
I've migrated all known uses of NoneType to std::nullopt_t. This
patch deprecates NoneType.
I'm using "typedef" instead of "using" because somehow
"[[deprecated]]" and "using" do not seem to get along.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138623
bixia1 [Tue, 22 Nov 2022 22:52:47 +0000 (14:52 -0800)]
[mlir][sparse] Add expand_symmetry attribute to the new operator.
The attribute tells the operator to handle symmetric structures for 2D tensors.
By default, the operator assumes the input tensor is not symmetric.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D138230
Ben Dunbobbin [Thu, 24 Nov 2022 00:12:11 +0000 (00:12 +0000)]
[windows-itanium] Propagate DLL storage class to Initialisation Guard Variables
Initialisation Guard Variables should take their DLL storage class
from the guarded variable. Otherwise, there will be a link error if
the compiler inlines a reference to the guard variable into another
module but that guard variable is not exported from the defining
module.
This is required for platforms such as PlayStation and
windows-itanium, that are aiming for source compatibility with MSVC
w.r.t. dllimport/export annotations, given Clang's existing design
which allows for inlining of a dllimport function as long as all the
variables/functions referenced are also marked dllimport.
A similar change exists for the MSVC ABI:
https://reviews.llvm.org/D4136.
I have added a run test for windows-itanium for this issue to the
build recipe: https://reviews.llvm.org/D88124.
Differential Revision: https://reviews.llvm.org/D138463
Jakub Kuderski [Thu, 24 Nov 2022 00:04:43 +0000 (19:04 -0500)]
[mlir][spirv] Define `OpSMulExtended` and `OpUMulExtended` ops
These perform exact multiplication and return the high half as a second
result.
Also factor out common code shared between 'extended binary ops'.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D138624
Jakub Kuderski [Wed, 23 Nov 2022 23:57:02 +0000 (18:57 -0500)]
[mlir][vector] Simplify fold pattern for ExtractOp(constant). NFC.
Use helper functions. Reuse array element attributes.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D138609
Kazu Hirata [Wed, 23 Nov 2022 23:55:05 +0000 (15:55 -0800)]
[lldb] Fix a warning
This patch fixes:
lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp:105:18:
warning: comparison of unsigned expression in ‘>= 0’ is always true
[-Wtype-limits]
Nikolas Klauser [Thu, 10 Nov 2022 22:57:43 +0000 (23:57 +0100)]
[libc++][clang-tidy] Enable readability-simplify-boolean-expr
Reviewed By: ldionne, #libc
Spies: Eugene.Zelenko, aheejin, libcxx-commits, xazax.hun
Differential Revision: https://reviews.llvm.org/D137804
Kazu Hirata [Wed, 23 Nov 2022 23:08:40 +0000 (15:08 -0800)]
[ADT] Remove Optional::{has_value,value}, etc (NFC)
This patch removes methods that I deprecated on August, 2022 in
commits
b5f8d42efe3e246d582d4a1a328fac915e4ce8dc and
eeac9e923283d8535e4175fef35e132e796fa78e.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Kazu Hirata [Wed, 23 Nov 2022 22:16:04 +0000 (14:16 -0800)]
Use std::nullopt_t instead of NoneType (NFC)
This patch replaces those occurrences of NoneType that would trigger
an error if the definition of NoneType were missing in None.h.
To keep this patch focused, I am deliberately not replacing None with
std::nullopt in this patch or updating comments. They will be
addressed in subsequent patches.
This is part of an effort to migrate from llvm::Optional to
std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138539
Florian Hahn [Wed, 23 Nov 2022 22:09:49 +0000 (22:09 +0000)]
[BasicAA] Add tests with __memcpy_chk.
WuXinlong [Wed, 23 Nov 2022 13:19:43 +0000 (21:19 +0800)]
Add MC support of RISCV Zcd Extension
This patch add the instructions of Zcd extension.
Zcd is a subset of C Ext which include the double-precision floating-point instructions (c.fld, c.fldsp, c.fsd, c.fsdsp).
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D134177
Krzysztof Parzyszek [Wed, 23 Nov 2022 20:56:16 +0000 (12:56 -0800)]
[Hexagon] Fix deinterleaving after vmpyh
Krzysztof Parzyszek [Wed, 23 Nov 2022 20:54:05 +0000 (12:54 -0800)]
[Hexagon] Fix order of operands in V6_vmpyhus
The unsigned operand is second: Vdd32.w = vmpy(Vu32.h,Vv32.uh)
Fangrui Song [Wed, 23 Nov 2022 21:22:44 +0000 (13:22 -0800)]
[ASTReader] Fix zlib header detection 0x78 after D137885
D137885 picked an incorrect magic so it would fail when zstd is not
enabled.
Benjamin Kramer [Wed, 23 Nov 2022 20:09:33 +0000 (21:09 +0100)]
[PowerPC][NFC] Merge LLVM_DEBUG statements to avoid unused variable warnings
Benjamin Kramer [Wed, 23 Nov 2022 20:01:47 +0000 (21:01 +0100)]
Unbreak lldb build broken by
d941fceca8e9
Maryam Moghadas [Mon, 12 Sep 2022 14:27:57 +0000 (09:27 -0500)]
[PowerPC] Exploit xxperm, check for dead vectors and substitute vperm with xxperm
vperm instruction requires the data to be in the Altivec registers, if one of
the vector operands is not used after this vperm instruction then it can be
substituted by xxperm which doubles the number of available registers.
Reviewed By: stefanp
Differential Revision: https://reviews.llvm.org/D133700
Fangrui Song [Wed, 23 Nov 2022 19:27:49 +0000 (11:27 -0800)]
[modules] Support zstd in .pcm file
Extend SM_SLOC_BUFFER_BLOB_COMPRESSED to allow zstd, which is much faster
(compression/decompression) than zlib with a similar compression ratio.
An alternative is to add a value beside SM_SLOC_BUFFER_BLOB_COMPRESSED, but
reusing SM_SLOC_BUFFER_BLOB_COMPRESSED slightly simplifies the implementation
and leads to better diagnostics when a slightly older Clang consumes zstd
compressed blob.
Compressing AST takes a small portion of WriteAST, so we can pick a higher
compression level.
Compiling a relatively large .pcm (absl endian) with -fmodules-embed-all-files,
zstd level 9 has comparable performance with zlib-chromium level 6 (default),
but provides smaller output (5809156 => 5796016). Higher zstd levels will make
"Compress AST" notably slower and do not provide significant more size saving.
```
2.219345 Total ExecuteCompiler
0.746799 Total Frontend
0.736862 Total Source
0.339434 Total ReadAST
0.165452 Total WriteAST
0.043045 Total Compress AST
0.008236 Total ParseClass
0.00633 Total InstantiateClass
0.001887 Total isPotentialConstantExpr
0.001808 Total InstantiateFunction
0.001535 Total EvaluateForOverflow
0.000986 Total EvaluateAsRValue
0.000536 Total EvaluateAsBooleanCondition
0.000308 Total EvaluateAsConstantExpr
0.000156 Total EvaluateAsInt
3.4e-05 Total EvaluateKnownConstInt
8e-06 Total EvaluateAsInitializer
0 Total PerformPendingInstantiations
```
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D137885
Luca Boasso [Wed, 23 Nov 2022 19:26:02 +0000 (13:26 -0600)]
[mlir][index] Add and, or, and xor ops
This patch adds the and, or, and xor bitwise operations to
the index dialects with folders and LLVM lowerings.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D138590
Snehasish Kumar [Wed, 23 Nov 2022 19:00:03 +0000 (19:00 +0000)]
[memprof] Fix RAII usage of SpinMutexLock, remove unused headers.
For the RAII lock usage we need to create a local var. There were some headers which clang-tidy identified as unused.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D138593
Uday Bondhugula [Fri, 7 Oct 2022 10:38:23 +0000 (16:08 +0530)]
[MLIR] Fix bug in simplify affine map with operands
Fix bug in simplify affine map with operands utility; the wrong LHS and
RHS were being used in some cases post simplification. While on this,
also handle a corner case of undefined expressions.
Differential Revision: https://reviews.llvm.org/D138584
Hanhan Wang [Wed, 23 Nov 2022 18:46:46 +0000 (10:46 -0800)]
[mlir][linalg] Add a new pattern to handle folding unit reduction dims.
The output operands will be added to input operands if the generic op (on tensors)
becomes an elementwise operation. The outputs of the generic op is still the same.
They will be cleaned up by ReplaceWithEmptyTensorIfUnused pattern.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D138251
Alexey Kreshchuk [Tue, 22 Nov 2022 23:47:20 +0000 (23:47 +0000)]
Do not suggest taking the address of a const pointer to get void*
It's more likely the user needs a const cast, but probably not sure
enough that we should suggest that either - so err on the side of
caution and offer no suggestion.
Fixes pr58958
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D138426
Alexander Belyaev [Wed, 23 Nov 2022 17:17:13 +0000 (18:17 +0100)]
[mlir] Remove clone methods from DPS interface.
Differential Revision: https://reviews.llvm.org/D138586
Greg Clayton [Mon, 10 Oct 2022 23:30:49 +0000 (16:30 -0700)]
Add the ability to see when a type in incomplete.
-flimit-debug-info and other compiler options might end up removing debug info that is needed for debugging. LLDB marks these types as being forcefully completed in the metadata in the TypeSystem. These types should have been complete in the debug info but were not because the compiler omitted them to save space. When we can't find a suitable replacement for the type, we should let the user know that these types are incomplete to indicate there was an issue instead of just showing nothing for a type.
The solution is to display presented in this patch is to display "<incomplete type>" as the summary for any incomplete types. If there is a summary string or function that is provided for a type, but the type is currently forcefully completed, the installed summary will be ignored and we will display "<incomplete type>". This patch also exposes the ability to ask a SBType if it was forcefully completed with:
bool SBType::IsTypeForcefullyCompleted();
This will allow the user interface for a debugger to also detect this issue and possibly mark the variable display up on some way to indicate to the user the type is incomplete.
To show how this is diplayed, we can look at the existing output first for the example source file from the file: lldb/test/API/functionalities/limit-debug-info/main.cpp
(lldb) frame variable inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one
(InheritsFromOne) ::inherits_from_one = (member = 47)
(InheritsFromTwo) ::inherits_from_two = (member = 47)
(OneAsMember) ::one_as_member = (one = member::One @ 0x0000000100008028, member = 47)
(TwoAsMember) ::two_as_member = (two = member::Two @ 0x0000000100008040, member = 47)
(array::One [3]) ::array_of_one = ([0] = array::One @ 0x0000000100008068, [1] = array::One @ 0x0000000100008069, [2] = array::One @ 0x000000010000806a)
(array::Two [3]) ::array_of_two = ([0] = array::Two @ 0x0000000100008098, [1] = array::Two @ 0x0000000100008099, [2] = array::Two @ 0x000000010000809a)
(ShadowedOne) ::shadowed_one = (member = 47)
(lldb) frame variable --show-types inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one
(InheritsFromOne) ::inherits_from_one = {
(int) member = 47
}
(InheritsFromTwo) ::inherits_from_two = {
(int) member = 47
}
(OneAsMember) ::one_as_member = {
(member::One) one = {}
(int) member = 47
}
(TwoAsMember) ::two_as_member = {
(member::Two) two = {}
(int) member = 47
}
(array::One [3]) ::array_of_one = {
(array::One) [0] = {}
(array::One) [1] = {}
(array::One) [2] = {}
}
(array::Two [3]) ::array_of_two = {
(array::Two) [0] = {}
(array::Two) [1] = {}
(array::Two) [2] = {}
}
(ShadowedOne) ::shadowed_one = {
(int) member = 47
}
With this patch in place we can now see any classes that were forcefully completed to let us know that we are missing information:
(lldb) frame variable inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one
(InheritsFromOne) ::inherits_from_one = (One = <incomplete type>, member = 47)
(InheritsFromTwo) ::inherits_from_two = (Two = <incomplete type>, member = 47)
(OneAsMember) ::one_as_member = (one = <incomplete type>, member = 47)
(TwoAsMember) ::two_as_member = (two = <incomplete type>, member = 47)
(array::One[3]) ::array_of_one = ([0] = <incomplete type>, [1] = <incomplete type>, [2] = <incomplete type>)
(array::Two[3]) ::array_of_two = ([0] = <incomplete type>, [1] = <incomplete type>, [2] = <incomplete type>)
(ShadowedOne) ::shadowed_one = (func_shadow::One = <incomplete type>, member = 47)
(lldb) frame variable --show-types inherits_from_one inherits_from_two one_as_member two_as_member array_of_one array_of_two shadowed_one
(InheritsFromOne) ::inherits_from_one = {
(One) One = <incomplete type> {}
(int) member = 47
}
(InheritsFromTwo) ::inherits_from_two = {
(Two) Two = <incomplete type> {}
(int) member = 47
}
(OneAsMember) ::one_as_member = {
(member::One) one = <incomplete type> {}
(int) member = 47
}
(TwoAsMember) ::two_as_member = {
(member::Two) two = <incomplete type> {}
(int) member = 47
}
(array::One[3]) ::array_of_one = {
(array::One) [0] = <incomplete type> {}
(array::One) [1] = <incomplete type> {}
(array::One) [2] = <incomplete type> {}
}
(array::Two[3]) ::array_of_two = {
(array::Two) [0] = <incomplete type> {}
(array::Two) [1] = <incomplete type> {}
(array::Two) [2] = <incomplete type> {}
}
(ShadowedOne) ::shadowed_one = {
(func_shadow::One) func_shadow::One = <incomplete type> {}
(int) member = 47
}
Differential Revision: https://reviews.llvm.org/D138259
Paulo Matos [Tue, 22 Nov 2022 14:58:58 +0000 (15:58 +0100)]
[WebAssembly] Remove unnecessary GEP insts from table tests
Removes the unnecessary GEP instructions from WebAssembly Table tests.
Differential Revision: https://reviews.llvm.org/D138569
Matt Arsenault [Tue, 22 Nov 2022 19:53:43 +0000 (14:53 -0500)]
CloneModule: Handling cloning ifuncs
This is tested in a future llvm-reduce patch.
Hassnaa Hamdi [Wed, 23 Nov 2022 15:48:46 +0000 (15:48 +0000)]
[AArch64][SME]: Generate streaming-compatible code for int-minmax, fp-minmax
1-To generate code compatible to streaming mode:
- enable custom lowering for SMIN, SMAX, UMIN, UMAX,
FMAXNUM, FMINNUM, FMAXIMUM, FMINIMUM.
2-Testing files:
- int-minmax.ll
- fp-minmax.ll
Reviewed By: david-arm, sdesmalen
Differential Revision: https://reviews.llvm.org/D138292
Hassnaa Hamdi [Fri, 18 Nov 2022 13:42:38 +0000 (13:42 +0000)]
[AArch64][SME]: Add precursory tests for D138292
Add testing files:
- int-minmax.ll
- fp-minmax.ll
Louis Dionne [Wed, 23 Nov 2022 15:31:21 +0000 (10:31 -0500)]
[libc++][NFC] Fix documentation build
Hans Wennborg [Wed, 23 Nov 2022 15:07:07 +0000 (16:07 +0100)]
Revert "Make -fsanitize=scudo use scudo_standalone. Delete check-scudo."
It broke the build, see comments on code review.
> Leaves the implementation and tests files in-place for right now, but
> deletes the ability to build the old sanitizer-common based scudo. This
> has been on life-support for a long time, and the newer scudo_standalone
> is much better supported and maintained.
>
> Also patches up some GWP-ASan wording, primarily related to the fact
> that -fsanitize=scudo now is scudo_standalone, and therefore the way to
> reference the GWP-ASan options through the environment variable has
> changed.
>
> Future follow-up patches will delete the original scudo, and migrate all
> its tests over to be part of the scudo_standalone test suite.
>
> Reviewed By: vitalybuka
>
> Differential Revision: https://reviews.llvm.org/D138157
This reverts commit
ab1a5991fe765d71c0f3262f25726d6b4d66a545.
Jonas Paulsson [Fri, 18 Nov 2022 20:22:01 +0000 (15:22 -0500)]
[SystemZ] Extend combineGET_CCMASK() to handle a truncated SELECT_CCMASK.
In cases where the SELECT_CCMASK has an additional user of the carry, a
truncated SELECT_CCMASK may result as the input to the GET_CCMASK, which need
to be recognized.
Fixes https://github.com/llvm/llvm-project/issues/59054
Reviewed By: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D138324
Balazs Benics [Wed, 23 Nov 2022 14:52:11 +0000 (15:52 +0100)]
[analyzer] getBinding should auto-detect type only if it was not given
Casting a pointer to a suitably large integral type by reinterpret-cast
should result in the same value as by using the `__builtin_bit_cast()`.
The compiler exploits this: https://godbolt.org/z/zMP3sG683
However, the analyzer does not bind the same symbolic value to these
expressions, resulting in weird situations, such as failing equality
checks and even results in crashes: https://godbolt.org/z/oeMP7cj8q
Previously, in the `RegionStoreManager::getBinding()` even if `T` was
non-null, we replaced it with `TVR->getValueType()` in case the `MR` was
`TypedValueRegion`.
It doesn't make much sense to auto-detect the type if the type is
already given. By not doing the auto-detection, we would just do the
right thing and perform the load by that type.
This means that we will cast the value to that type.
So, in this patch, I'm proposing to do auto-detection only if the type
was null.
Here is a snippet of code, annotated by the previous and new dump values.
`LocAsInteger` should wrap the `SymRegion`, since we want to load the
address as if it was an integer.
In none of the following cases should type auto-detection be triggered,
hence we should eventually reach an `evalCast()` to lazily cast the loaded
value into that type.
```lang=C++
void LValueToRValueBitCast_dumps(void *p, char (*array)[8]) {
clang_analyzer_dump(p); // remained: &SymRegion{reg_$0<void * p>}
clang_analyzer_dump(array); // remained: {{&SymRegion{reg_$1<char (*)[8] array>}
clang_analyzer_dump((unsigned long)p);
// remained: {{&SymRegion{reg_$0<void * p>} [as 64 bit integer]}}
clang_analyzer_dump(__builtin_bit_cast(unsigned long, p)); <--------- change #1
// previously: {{&SymRegion{reg_$0<void * p>}}}
// now: {{&SymRegion{reg_$0<void * p>} [as 64 bit integer]}}
clang_analyzer_dump((unsigned long)array); // remained: {{&SymRegion{reg_$1<char (*)[8] array>} [as 64 bit integer]}}
clang_analyzer_dump(__builtin_bit_cast(unsigned long, array)); <--------- change #2
// previously: {{&SymRegion{reg_$1<char (*)[8] array>}}}
// now: {{&SymRegion{reg_$1<char (*)[8] array>} [as 64 bit integer]}}
}
```
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D136603
Louis Dionne [Thu, 17 Nov 2022 15:47:18 +0000 (10:47 -0500)]
[libc++] Remove default definition of std::char_traits
This patch removes the base template implementation for std::char_traits.
If my reading of http://eel.is/c++draft/char.traits is correct, the
Standard mandates that the library provides specializations for several
types like char and wchar_t, but not any implementation in the base
template. Indeed, such an implementation is bound to be incorrect for
most types anyways, since things like `eof()` and `int_type` will definitely
have to be customized.
Since the base template implementation should not have worked for anyone,
this shouldn't be a breaking change (I expect that anyone defining a
custom character type today will already have to provide their own
specialization of char_traits). However, since we're aware of some users
of char_traits for unsigned char and signed char, we're keeping those two
specializations around for two releases to give people some time to migrate.
Differential Revision: https://reviews.llvm.org/D138307
Louis Dionne [Tue, 22 Nov 2022 18:42:33 +0000 (13:42 -0500)]
[libc++] Add missing __has_include checks for C headers not provided by libc++
This makes the library consistent in how it handles C library headers. For C headers provided by libc++,
we unconditionally include <foo.h> from <cfoo>, and then <foo.h> conditionally include_next <foo.h>.
For headers not provided by libc++, <cfoo> conditionally includes the system's <foo.h> directly.
Differential Revision: https://reviews.llvm.org/D138512
Nico Weber [Wed, 23 Nov 2022 14:40:17 +0000 (09:40 -0500)]
[lld/mac] Reorder an assert() and a printArchiveMemberLoad() call
No behavior difference in practice, but makes it possible to use `-t`
for debugging when that assert fails.
Michał Górny [Wed, 23 Nov 2022 12:19:47 +0000 (13:19 +0100)]
[flang] Fix unittests in standalone build for third-party move
Update external unittest rules for flang standalone builds to account
for the unittest components (gtest, gmock) being moved to `third-party`
directory, in
a11cd0d94ed3cabf0998a0289aead05da94c86eb.
Differential Revision: https://reviews.llvm.org/D138562
Emmmer [Sun, 6 Nov 2022 13:36:44 +0000 (21:36 +0800)]
[LLDB][RISCV] Add RV32F instruction support for EmulateInstructionRISCV
Add:
- RV32F instruction set.
- corresponding unittests.
Further work:
- RV32FC, RV64F and RV64FC instructions support.
- update execution exceptions to fcsr register in RVM instructions.
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D138447
OCHyams [Wed, 23 Nov 2022 13:32:53 +0000 (13:32 +0000)]
[Assignment Tracking] Fix DbgVariableIntrinsic::replaceVariableLocationOp
Fix replaceVariableLocationOp unconditionally replacing the first operand of a
dbg.assign.
Reviewed By: jryans
Differential Revision: https://reviews.llvm.org/D138561
Matt Arsenault [Wed, 23 Nov 2022 04:59:26 +0000 (23:59 -0500)]
Utils: Fix deleting calls to null in non-0 address spaces
Louis Dionne [Wed, 23 Nov 2022 13:49:01 +0000 (08:49 -0500)]
[libc++][NFC] Use if-else chain instead of match, which is a Python 3.10 construct
Matt Devereau [Wed, 23 Nov 2022 07:51:42 +0000 (07:51 +0000)]
[VectorCombine] Enable scalarizeBinopOrCmp for scalable vectors
This reverts a change to exclude scalarizeBinopOrCmp in VectorCombine for
scalable vectors which caused poor scalable Binop codegen.
Differential Revision: https://reviews.llvm.org/D138545
Matthias Springer [Wed, 23 Nov 2022 10:56:07 +0000 (11:56 +0100)]
[mlir][utils] Fix invalid reshapes in ComposeCollapseOfExpandOp
Do not generate CollapseShapeOps/ExpandShapeOps that have the same source and result shape. Generate casts instead. Such reshapes became invalid with D138498.
Differential Revision: https://reviews.llvm.org/D138557
Sam McCall [Thu, 17 Nov 2022 17:06:28 +0000 (18:06 +0100)]
[include-cleaner] Show includes matched by refs in HTML report.
Demo: https://htmlpreview.github.io/?https://gist.githubusercontent.com/sam-mccall/
ecee6869e37af3db28089b64d8dce806/raw/
8736e64c45af411e2c2d72adaed2dfc4410a5b36/ASTTests.html%25202
Differential Revision: https://reviews.llvm.org/D138219
Pavel Labath [Wed, 23 Nov 2022 11:22:03 +0000 (12:22 +0100)]
Revert "Add runToBinaryEntry option for lldb-vscode"
This reverts commit
f0c16f89124f2dc0630162ff9ea23934f5b2b75b because it
breaks linux and mac bots.
Benjamin Kramer [Wed, 23 Nov 2022 12:02:58 +0000 (13:02 +0100)]
Revert "[SROA] `isVectorPromotionViable()`: memory intrinsics operate on vectors of bytes"
This reverts commit
cf624b23bc5d5a6161706d1663def49380ff816a. It
triggers crashes in clang, see the comments on github on the original
change.
David Green [Wed, 23 Nov 2022 12:10:54 +0000 (12:10 +0000)]
[AArch64] Add Host identifiers for cortex-a55, cortex-a510, cortex-a710 and cortex-x2.
I noticed these were missing, so this adds Host identifiers for
cortex-a55, cortex-a510, cortex-a710 and cortex-x2, taken from their
respective TRMs.
Differential Revision: https://reviews.llvm.org/D138497
zhongyunde [Wed, 23 Nov 2022 11:43:29 +0000 (19:43 +0800)]
[AArch64] Optimize cmp chain before legalization
* For case bcmp9, there is extras AND and EXTEND int the chain of OR/XOR,
which prevent the transform, so enable the optimize before legalization.
* The key IR frag related:
t37: i32,ch = load<(load (s8) from %ir.4), anyext from i8> t0, t11, undef:i64
t12: i64 = add t4, Constant:i64<8>
t38: i32,ch = load<(load (s8) from %ir.5), anyext from i8> t0, t12, undef:i64
t39: i32 = xor t37, t38
t40: i64 = any_extend t39
t42: i64 = and t40, Constant:i64<255>
Depends on D138398 to fix combine_setcc_glue
Reviewed By: dmgreen, bcl5980
Differential Revision: https://reviews.llvm.org/D137936
Haohai Wen [Wed, 23 Nov 2022 10:56:07 +0000 (18:56 +0800)]
[CostModel][X86] Fix permute latency cost
Avx512 permute latency should be 3 instead of 1.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D138427
Stefan Gränitz [Wed, 23 Nov 2022 10:03:57 +0000 (11:03 +0100)]
Reland "[CGObjC] Add run line for release mode in test arc-exceptions-seh.mm (NFC)"
This reverts commit
a37807ac8a3e9d2880a483940dcd33194f354bf8.
Differential Revision: https://reviews.llvm.org/D137942
Stefan Gränitz [Wed, 23 Nov 2022 10:19:13 +0000 (11:19 +0100)]
[ObjC][ARC] Fix UB in ObjCARCOpt with -enable-objc-arc-opts=false
When ObjCARCOpt::run() returned early, Changed and CFGChanged were never initialized. CFGChanged is read unconditionally afterwards. This came up in the course of D137942.
Benjamin Kramer [Wed, 23 Nov 2022 09:45:15 +0000 (10:45 +0100)]
[bazel] Add missing dependencies after
7a69a9d7ae
Alex Richardson [Mon, 20 Jun 2022 14:44:57 +0000 (15:44 +0100)]
[libc++] Fix __regex_word value when using newlib/picolibc
The ctype mask for newlib/picolibc is fully saturated, so __regex_word
has to overlap with one of the values. This commit uses the same workaround
as bionic did (uint16_t for char_class_type inside regex_traits). It
should be possible to have libc++ provide the default rune table instead,
but that will require a new mechanism to detect newlib inside __config
since the header defining the newlib/picolibc macros has not been included
yet inside __config. Doing it this way also avoids duplicating the ctype
table for newlib, reducing the global data size.
Differential Revision: https://reviews.llvm.org/D138195
Alex Richardson [Mon, 21 Nov 2022 12:46:00 +0000 (12:46 +0000)]
[SelectionDAG] Remove deprecated MemSDNode->getAlignment()
I noticed a an assertion error when building MIPS code that loaded from
NULL. Loading from NULL ends up being a load with maximum alignment, and
due to integer truncation the value maximum was interpreted as 0 and the
assertion in MipsDAGToDAGISel::Select() failed. This previously happened
to work, but the maximum alignment was increased in
df84c1fe78130a86445d57563dea742e1b85156a, so it no longer fits into a 32
bit integer.
Instead of just fixing the one MIPS case, this patch removes all uses of
the deprecated getAlignment() call and replaces them with getAlign().
Differential Revision: https://reviews.llvm.org/D138420
Alex Richardson [Tue, 22 Nov 2022 10:01:18 +0000 (10:01 +0000)]
[ASTContext][NFC] Remove getTargetAddressSpace(Qualifiers Q)
This simply calls getTargetAddressSpace(Q.getAddressSpace()) and there
are only two callers, so adjust those caller instead.
Kito Cheng [Mon, 21 Nov 2022 14:18:54 +0000 (22:18 +0800)]
[clang][RISCV][NFC] Prevent data race in RVVType::computeType
Introduce a RVVTypeCache to hold the cache instead of using a local
static variable to maintain a cache.
Also made construct of RVVType to private, make sure that could be only
created by a cache manager.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D138429
Akshay Baviskar [Wed, 23 Nov 2022 08:16:18 +0000 (13:46 +0530)]
Add RegionBranchOpInterface for AffineIf Op
Adds RegionBranchOpInterface for AffineIf Op and tests it
using buffer deallocation pass.
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D130962
Matthias Springer [Wed, 23 Nov 2022 08:19:00 +0000 (09:19 +0100)]
[mlir][tensor/memref] Disallow Collapse/ExpandShapeOps that do not reduce/increase the rank
CollapseShapeOp/ExpandShapeOp that do not change the rank (or increase/reduce it) are invalid.
Differential Revision: https://reviews.llvm.org/D138498
Nicolas Vasilache [Tue, 22 Nov 2022 10:55:58 +0000 (02:55 -0800)]
[NFC][mlir] VectorUtils / IndexingUtils simplifications and cleanups
This revision refactors and cleans up a bunch of infra related to vector, shapes and indexing into more reusable APIs.
Differential Revision: https://reviews.llvm.org/D138501
Max Kazantsev [Wed, 23 Nov 2022 07:38:24 +0000 (14:38 +0700)]
[SCEV][NFC] Fix typo in comment
WuXinlong [Tue, 22 Nov 2022 09:35:36 +0000 (17:35 +0800)]
Add MC support of RISCV Zcf Extension
This patch add the instructions of Zcf extension.
Zcf is a subset of C Ext which include the single-precision floating-point instructions.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D134176
Tom Stellard [Wed, 23 Nov 2022 06:56:55 +0000 (22:56 -0800)]
libclc: Use cmake files instead of llvm-config
Reviewed By: mgorny
Differential Revision: https://reviews.llvm.org/D137854
Michał Górny [Sat, 19 Nov 2022 19:54:54 +0000 (20:54 +0100)]
[cmake] Fix Findzstd.cmake to handle OpenBSD shared libraries
Fix Findzstd CMake to handle shared libraries on OpenBSD correctly.
This userland does not use shared library symlinks without SOVERSION,
so the result of find_library() does not ever end with
zstd_SHARED_LIBRARY_SUFFIX. To work around this, reverse the logic
to compare the result against zstd_STATIC_LIBRARY_SUFFIX and assume
shared library otherwise.
While at it, fix the conditions not to fall back to "result is static
library" path if it actually was recognized as a shared library but
zstd_shared target already existed.
Fixes #59056
Differential Revision: https://reviews.llvm.org/D138361
Fangrui Song [Wed, 23 Nov 2022 04:09:15 +0000 (20:09 -0800)]
[ELF] createSyntheticSections: simplify config->relocatable. NFC
We can add .riscv.attributes synthetic section here in the future.
Philip Reames [Wed, 23 Nov 2022 02:51:23 +0000 (18:51 -0800)]
[RISCV] Add callback plumbing for getArithmeticInstrCost [nfc]
Most of the code for this was taken from https://reviews.llvm.org/D133552, with one bug fix by me. I'm landing the plumbing so that we can focus on the cost model pieces in the review.
Daniel Rodríguez Troitiño [Wed, 23 Nov 2022 02:27:23 +0000 (18:27 -0800)]
[MachO][ObjCopy] Handle exports trie in LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIE
The exports trie used to be pointed by the information in LC_DYLD_INFO,
but when chained fixups are present, the exports trie is pointed by
LC_DYLD_EXPORTS_TRIE instead.
Modify ObjCopy code to calculate the right offset and size needed
depending on the existence of LC_DYLD_INFO or LC_DYLD_EXPORTS_TRIE, read
the exports from either of those places, and write the export
information as pointed to either of those places.
Depends on D134571.
Reviewed By: alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D137879
Matt Arsenault [Wed, 23 Nov 2022 02:02:20 +0000 (21:02 -0500)]
GlobalIFunc: Make ifunc respect function address spaces
Matt Arsenault [Fri, 11 Nov 2022 19:54:55 +0000 (11:54 -0800)]
InstCombine: Fold some identities for canonicalize
Equality is directly stated as true in the LangRef,
and I believe this works for every compare type.
Matt Arsenault [Fri, 11 Nov 2022 19:24:09 +0000 (11:24 -0800)]
InstCombine: Add baseline tests for canonicalize identities
Haohai Wen [Wed, 23 Nov 2022 01:40:50 +0000 (09:40 +0800)]
[CostModel][X86] Add CostKinds test coverage for shufflevector instruction
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D138485
Ruiling Song [Mon, 21 Nov 2022 07:33:18 +0000 (15:33 +0800)]
[AMDGPU][InsertWaits] No wait for WAW for global/scratch_load
global/scratch_load will return in order they are issued. No
need to insert a s_waitcnt for WAW hazard.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D138476
Daniel Rodríguez Troitiño [Tue, 22 Nov 2022 23:12:27 +0000 (15:12 -0800)]
[MachO] Support exports trie in both LC_DYLD_INFO and LC_DYLD_EXPORTS_TRIE
The exports trie used to be pointed by the information in LC_DYLD_INFO,
but when chained fixups are present, the exports trie is pointed by
LC_DYLD_EXPORTS_TRIE instead.
Modify the Object library to give access to the information pointed by
each of the load commands, and to fallback from one into the other when
the exports are requested.
Modify ObjectYAML to support dumping the export trie when pointed by
LC_DYLD_EXPORTS_TRIE and to parse the existence of a export trie also
when the load command is present.
This is a split of D134250 with improvements on top.
Reviewed By: alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D134571
Phoebe Wang [Wed, 23 Nov 2022 01:05:59 +0000 (09:05 +0800)]
[X86] Use lock add/sub/or/and/xor for cases that we only care about the EFLAGS (negated cases)
This fixes #58685
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D138428
Xiang Li [Wed, 23 Nov 2022 01:34:45 +0000 (17:34 -0800)]
[NFC][DirectX backend] Update header to fix build error.
Fix build error caused by createPrintModulePass moving to diffrent
header.
Ben Shi [Thu, 17 Nov 2022 12:35:55 +0000 (20:35 +0800)]
[AVR] Fix wrong ABI of AVRTiny.
A scalar which exceeds 4 bytes should be returned via stack, other
than via registers, on an AVRTiny device.
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D138201
Nico Weber [Fri, 18 Nov 2022 21:02:34 +0000 (16:02 -0500)]
[bolt] Stop setting config.llvm_plugin_ext in lit.site.cfg.py.in
config.llvm_plugin_ext is used by lit to set the %pluginext
substitution. bolt's tests don't use %pluginext, so they don't
need to set config.llvm_plugin_ext.
Differential Revision: https://reviews.llvm.org/D138325
chenglin.bi [Wed, 23 Nov 2022 01:27:26 +0000 (09:27 +0800)]
[DAGCombiner] fold or (xor x, y),? patterns
or (xor x, y), x --> or x, y
or (xor x, y), y --> or x, y
or (xor x, y), (and x, y) --> or x, y
or (xor x, y), (or x, y) --> or x, y
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D138401
Fangrui Song [Wed, 23 Nov 2022 01:01:39 +0000 (17:01 -0800)]
[PPC] Undefine __ppc64__ to match GCC
GCC only defines `__ppc64__` for darwin while the darwin support has been
removed from llvm-project. The existence of `__ppc64__` makes some software
think we are compiling for big-endian PowerPC Mac; also it lures users to write
code which is not portable to GCC.
It is straightforward if a distro wants to keep the macro: add
`-D__ppc64__=1` to a Clang configuration file.
Reviewed By: thesamesam, nemanjai
Differential Revision: https://reviews.llvm.org/D137511
Peiming Liu [Wed, 23 Nov 2022 00:43:10 +0000 (00:43 +0000)]
[mlir][sparse] fix compiler warning when using release build.
Differential Revision: https://reviews.llvm.org/D138533
Mehdi Amini [Thu, 17 Nov 2022 10:40:56 +0000 (10:40 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in CSE.cpp (NFC)
Mehdi Amini [Thu, 17 Nov 2022 10:15:21 +0000 (10:15 +0000)]
Apply clang-tidy fixes for llvm-include-order in FileUtilities.cpp (NFC)
Fangrui Song [Wed, 23 Nov 2022 00:47:33 +0000 (16:47 -0800)]
[asan] Don't demangle __odr_asan_gen_* symbols
This relands the ODR indicator part of D138095 (reverted by
06c74b5e7367b41e9b4ea3d74c971aace5681fb8):
a `__odr_asan_gen_*` symbol should use a mangled name as its associated symbol does.
Alexander Yermolovich [Wed, 23 Nov 2022 00:28:11 +0000 (16:28 -0800)]
[BOLT][DWARF] Re-enable DWARF5 for asm-func-debug tests
Now that BOLT supports DWARF5 re-enabling it for these two tests. This is update
to https://reviews.llvm.org/D125366
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D138338
Fangrui Song [Wed, 23 Nov 2022 00:29:24 +0000 (16:29 -0800)]
Revert D138095 Use InernalAlloc in DemangleCXXABI
Broke 2/3 tests on macOS which seem to be related to
`free(demangled_name)` in DemangleCXXABI.
Roman Lebedev [Wed, 23 Nov 2022 00:21:25 +0000 (03:21 +0300)]
[SROA] `isVectorPromotionViable()`: avoid allowing overly large vectors
Otherwise, `compiler-rt/test/asan/TestCases/pr33372.cpp` fails with an assertion:
```
clang-16: /repositories/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:11988: void llvm::SelectionDAG::createOperands(llvm::SDNode *, ArrayRef<llvm::SDValue>): Assertion `SDNode::getMaxNumOperands() >= Vals.size() && "too many operands to fit into SDNode"' failed.
```
I'm not sure if this should be even more conservative,
or if we have a named constant for this in middle-end.
Ayke van Laethem [Mon, 7 Nov 2022 17:46:38 +0000 (18:46 +0100)]
[AVR][Clang] Implement __AVR_HAVE_*__ macros
These macros are defined in avr-gcc and are useful when working with
assembly. For example, startup code needs to copy the contents of .data
from flash to RAM, but should use elpm (instead of lpm) on devices with
more than 64kB flash. Without __AVR_HAVE_ELPM__, there is no way to know
whether the elpm instruction is supported.
This partially fixes https://github.com/llvm/llvm-project/issues/56157.
Differential Revision: https://reviews.llvm.org/D137572