Nikita Popov [Tue, 7 Mar 2023 14:31:41 +0000 (15:31 +0100)]
[IndVars] Add test for PR60944 (NFC)
Aaron Ballman [Tue, 7 Mar 2023 14:31:45 +0000 (09:31 -0500)]
Fix build failures with libclang unittest; NFC
This addresses the issue found by:
https://lab.llvm.org/buildbot/#/builders/57/builds/25217
https://lab.llvm.org/buildbot/#/builders/36/builds/31018
Ingo Müller [Tue, 7 Mar 2023 13:56:23 +0000 (13:56 +0000)]
[mlir][complex] Minor fixes in ComplexToStandard test cases.
One FileCheck line was hard-coding variable names. Another line
mis-indented the second line of a function header.
Reviewed By: akuegel
Differential Revision: https://reviews.llvm.org/D145498
Michael Buch [Tue, 7 Mar 2023 12:08:07 +0000 (12:08 +0000)]
[lldb][test] TestDataFormatterCpp.py: add test-case for member function pointer format
This patch adds a test for formatting of member function pointers.
This was split from https://reviews.llvm.org/D145242, which caused
this test case to fail on Windows buildbots.
I split this out in order to make sure that this indeed works on Windows
without the D145242 patch.
Differential Revision: https://reviews.llvm.org/D145487
Zain Jaffal [Tue, 7 Mar 2023 14:03:35 +0000 (14:03 +0000)]
[ConstraintElimination] Decompose or instruction if the constant operand < 2^known_zero_bits of the first operand.
The or operation can be represented as an add instruction.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D142546
Nikita Popov [Tue, 7 Mar 2023 13:57:06 +0000 (14:57 +0100)]
[IR] Add operator<< overload for CmpInst::Predicate (NFC)
I regularly try and fail to use this while debugging.
Louis Dionne [Mon, 6 Mar 2023 19:04:22 +0000 (14:04 -0500)]
[libc++] Extract std::fprintf into a function for use within the test suite
This provides a single place for downstream to customize (or turn off)
printing information to stderr within the test suite.
Differential Revision: https://reviews.llvm.org/D145405
Simon Pilgrim [Tue, 7 Mar 2023 13:59:54 +0000 (13:59 +0000)]
[DAG] isNarrowingProfitable - consistently use SrcVT/DestVT argument names. NFC.
Make it more obvious what order the narrowing types are in.
Guillaume Chatelet [Tue, 7 Mar 2023 13:26:29 +0000 (13:26 +0000)]
Revert D143678 "[bazel] Add layering-check"
This broke build bots with MPFR issue.
This reverts commit
5916decfc2ba3f5ce5c5c0fe8de72ea2f8b4c3bf.
Igor Kushnir [Tue, 7 Mar 2023 13:24:23 +0000 (08:24 -0500)]
[libclang] Add API to override preamble storage path
TempPCHFile::create() calls llvm::sys::fs::createTemporaryFile() to
create a file named preamble-*.pch in a system temporary directory. This
commit allows overriding the directory where these often many and large
preamble-*.pch files are stored.
The referenced bug report requests the ability to override the temporary
directory path used by libclang. However, overriding the return value of
llvm::sys::path::system_temp_directory() was rejected during code review
as improper and because it would negatively affect multithreading
performance. Finding all places where libclang uses the temporary
directory is very difficult. Therefore this commit is limited to
override libclang's single known use of the temporary directory.
This commit allows to override the preamble storage path only during
CXIndex construction to avoid multithreading issues and ensure that all
preambles are stored in the same directory. For the same multithreading
and consistency reasons, this commit deprecates
clang_CXIndex_setGlobalOptions() and
clang_CXIndex_setInvocationEmissionPathOption() in favor of specifying
these options during CXIndex construction.
Adding a new CXIndex constructor function each time a new initialization
argument is needed leads to either a large number of function parameters
unneeded by most libclang users or to an exponential number of overloads
that support different usage requirements. Therefore this commit
introduces a new extensible struct CXIndexOptions and a general function
clang_createIndexWithOptions().
A libclang user passes a desired preamble storage path to
clang_createIndexWithOptions(), which stores it in
CIndexer::PreambleStoragePath. Whenever
clang_parseTranslationUnit_Impl() is called, it passes
CIndexer::PreambleStoragePath to ASTUnit::LoadFromCommandLine(), which
stores this argument in ASTUnit::PreambleStoragePath. Whenever
ASTUnit::getMainBufferWithPrecompiledPreamble() is called, it passes
ASTUnit::PreambleStoragePath to PrecompiledPreamble::Build().
PrecompiledPreamble::Build() forwards the corresponding StoragePath
argument to TempPCHFile::create(). If StoragePath is not empty,
TempPCHFile::create() stores the preamble-*.pch file in the directory at
the specified path rather than in the system temporary directory.
The analysis below proves that this passing around of the
PreambleStoragePath string is sufficient to guarantee that the libclang
user override is used in TempPCHFile::create(). The analysis ignores API
uses in test code.
TempPCHFile::create() is called only in PrecompiledPreamble::Build().
PrecompiledPreamble::Build() is called only in two places: one in
clangd, which is not used by libclang, and one in
ASTUnit::getMainBufferWithPrecompiledPreamble().
ASTUnit::getMainBufferWithPrecompiledPreamble() is called in 3 places:
ASTUnit::LoadFromCompilerInvocation() [analyzed below].
ASTUnit::Reparse(), which in turn is called only from
clang_reparseTranslationUnit_Impl(), which in turn is called only from
clang_reparseTranslationUnit(). clang_reparseTranslationUnit() is never
called in LLVM code, but is part of public libclang API. This function's
documentation requires its translation unit argument to have been built
with clang_createTranslationUnitFromSourceFile().
clang_createTranslationUnitFromSourceFile() delegates its work to
clang_parseTranslationUnit(), which delegates to
clang_parseTranslationUnit2(), which delegates to
clang_parseTranslationUnit2FullArgv(), which delegates to
clang_parseTranslationUnit_Impl(), which passes
CIndexer::PreambleStoragePath to the ASTUnit it creates.
ASTUnit::CodeComplete() passes AllowRebuild = false to
ASTUnit::getMainBufferWithPrecompiledPreamble(), which makes it return
nullptr before calling PrecompiledPreamble::Build().
Both ASTUnit::LoadFromCompilerInvocation() overloads (one of which
delegates its work to another) call
ASTUnit::getMainBufferWithPrecompiledPreamble() only if their argument
PrecompilePreambleAfterNParses > 0. LoadFromCompilerInvocation() is
called in:
ASTBuilderAction::runInvocation() keeps the default parameter value
of PrecompilePreambleAfterNParses = 0, meaning that the preamble file is
never created from here.
ASTUnit::LoadFromCommandLine().
ASTUnit::LoadFromCommandLine() is called in two places:
CrossTranslationUnitContext::ASTLoader::loadFromSource() keeps the
default parameter value of PrecompilePreambleAfterNParses = 0, meaning
that the preamble file is never created from here.
clang_parseTranslationUnit_Impl(), which passes
CIndexer::PreambleStoragePath to the ASTUnit it creates.
Therefore, the overridden preamble storage path is always used in
TempPCHFile::create().
TempPCHFile::create() uses PreambleStoragePath in the same way as
LibclangInvocationReporter() uses InvocationEmissionPath. The existing
documentation for clang_CXIndex_setInvocationEmissionPathOption() does
not specify ownership, encoding, separator or relative vs absolute path
requirements. So the documentation for
CXIndexOptions::PreambleStoragePath doesn't either. The assumptions are:
no ownership transfer;
UTF-8 encoding;
native separators.
Both relative and absolute paths are supported.
The added API works as expected in KDevelop:
https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/283
Fixes: https://github.com/llvm/llvm-project/issues/51847
Differential Revision: https://reviews.llvm.org/D143418
Guillaume Chatelet [Thu, 9 Feb 2023 21:36:59 +0000 (21:36 +0000)]
[bazel] Add layering-check
In the same vein as https://reviews.llvm.org/D141553
Enable the feature globally to ensure layering and catch circular dependencies
(https://llvm.org/docs/CodingStandards.html#library-layering).
Differential Revision: https://reviews.llvm.org/D143678
Matt Devereau [Tue, 7 Mar 2023 13:15:07 +0000 (13:15 +0000)]
Fix DISABLE-NOT: cc1 check in debug-info-codeview-buildinfo.c test
This check is checking for the cc1 flag but this test has been seen to fail
when FILEPATHVAL has contained cc1 in generated SHAs
Guillaume Chatelet [Tue, 7 Mar 2023 13:18:46 +0000 (13:18 +0000)]
[libc][bazel] Fix missing dependency for math tests
David Green [Tue, 7 Mar 2023 13:21:18 +0000 (13:21 +0000)]
[AArch64] Tests for dup in load vs mul. NFC
See D145184.
Florian Hahn [Tue, 7 Mar 2023 12:59:13 +0000 (13:59 +0100)]
[GlobalOpt] Use structured bindings to access TypesVector (NFC).
This helps to reduce the diff of a follow-up change and improves
readability of the existing code.
Jay Foad [Tue, 7 Mar 2023 12:57:39 +0000 (12:57 +0000)]
Fix "compatiable" typos
Zain Jaffal [Tue, 7 Mar 2023 12:38:40 +0000 (12:38 +0000)]
[TableGen] add !toupper and !tolower operators to change the casing of strings.
Reviewed By: fpetrogalli
Differential Revision: https://reviews.llvm.org/D145300
Mel Chen [Tue, 21 Feb 2023 07:11:54 +0000 (23:11 -0800)]
[RISCV] Enable ordered reduction.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144455
Graham Hunter [Mon, 6 Mar 2023 16:12:33 +0000 (16:12 +0000)]
[AArch64] Don't map llvm sqrt intrinsics to veclib functions
Since AArch64 has sqrt instructions, we want to use those instead of
calls to vector math routines for llvm sqrt intrinsics (since those
don't imply some of the constraints that libm calls might have) so
we just remove the mappings.
Code originally written by mgabka
Reviewed By: danielkiss, paulwalker-arm
Differential Revision: https://reviews.llvm.org/D145392
Michael Buch [Tue, 7 Mar 2023 11:25:36 +0000 (11:25 +0000)]
Revert "[lldb] Ignore libcxx std::ranges global variables in frame var"
Reverting because Xcode requires this to be handled elsewhere.
The global variable list gets constructed using the SBAPI
This reverts commit
de10c1a824405833a0f49b22e7fa3f32a1393cc3.
Michael Buch [Tue, 7 Mar 2023 11:25:24 +0000 (11:25 +0000)]
Revert "[lldb] Build fix: variable name typo"
Reverted because dependecy had to be reverted.
This reverts commit
4d909c556e2caa8e150b892384fe8d42e774f8b0.
Michael Buch [Tue, 7 Mar 2023 11:16:14 +0000 (11:16 +0000)]
Revert "[lldb][TypeSystemClang] Format pointers to member functions as eFormatHex"
Reverted because Windows buildbot started failing
This reverts commit
b642fd5ee250247ccefb38099169b4ee8ac4112b.
Michael Buch [Tue, 7 Mar 2023 11:16:12 +0000 (11:16 +0000)]
Revert "[lldb][TypeSystemClang] Use the CXXFunctionPointerSummaryProvider for member-function pointers"
Reverted because Windows buildbot started failing
This reverts commit
6bd46e713c6d8deda7bdae8b1efadb99c88b4443.
Michael Buch [Tue, 7 Mar 2023 11:16:10 +0000 (11:16 +0000)]
Revert "[lldb][test] NativePDB/ast-types: fix expected pointer format"
Reverted because dependecies had to be reverted.
This reverts commit
96e39fdbb90b26191fc79b6226f299e3c10e559b.
Nikita Popov [Tue, 7 Mar 2023 11:15:50 +0000 (12:15 +0100)]
[SCEV] Add test for PR54191 (NFC)
sgokhale [Tue, 7 Mar 2023 11:12:21 +0000 (16:42 +0530)]
[LV][AArch64] Resolve test failure due use of unordered container
AArch64/reg-usage.ll has an issue with the output ordering due to use of unordered container. This was discovered by -DLLVM_REVERSE_ITERATION:BOOL=ON
cmake option.
This patch tries to address it by making use of ordered container.
Differential Revision: https://reviews.llvm.org/D145472/
Tomas Matheson [Mon, 6 Mar 2023 12:59:03 +0000 (12:59 +0000)]
[AArch64TargetParser] reinstate assert for optional
D145206 changed value() to value_or(0), removing the assert that checks
that there is a minor version. Add it back explicitly.
Differential Revision: https://reviews.llvm.org/D145371
pvanhout [Thu, 2 Mar 2023 14:42:24 +0000 (15:42 +0100)]
[AMDGPU] Match med3 for (max (min ..))
We previously only matched (min (max ...))
Depends on D144728
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D145159
Florian Hahn [Tue, 7 Mar 2023 10:08:06 +0000 (11:08 +0100)]
[GlobalOpt] Extend logic in SRA heuristic to skip stores of initializer.
If all stores only store the initializer value of a global, consider it
as not stored in the heuristic. GlobalOpt will remove such stores later
on.
Depends on D129857.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D144476
pvanhout [Fri, 24 Feb 2023 13:46:35 +0000 (14:46 +0100)]
[AMDGPU] Precommit test: v_sat_pk_u8_i16.ll
Differential Revision: https://reviews.llvm.org/D144728
wangpc [Tue, 7 Mar 2023 08:22:39 +0000 (16:22 +0800)]
[RISCV] Enable machine copy propagation for copy-like instructions
Like what has been done in AArch64 (D125335).
We enable this under `-O2` to show the codegen diffs here but we
may only do this under `-O3` like AArch64.
There are two cases that we may produce these eliminable copies:
1. ISel of `FrameIndex`. Like `rvv/fixed-vectors-calling-conv.ll`.
2. Tail duplication. Like `select-optimize-multiple.ll`.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D144535
wangpc [Wed, 1 Mar 2023 08:49:28 +0000 (16:49 +0800)]
[RISCV] Add classes to define SchedWrite list
SchedWrites are relevant to LMUL for most instructions, so we have
to enumerate all defined SchedWrites when defining ReadAdcance.
This patch adds some classes to simplify these definitions.
Reviewed By: michaelmaitland
Differential Revision: https://reviews.llvm.org/D145041
Nikita Popov [Thu, 2 Mar 2023 09:25:48 +0000 (10:25 +0100)]
[UTC] Enable --function-signature by default
This patch enables --function-signature by default under --version 2
and makes --version 2 the default. This means that all newly created
tests will check the function signature, while leaving old tests alone.
There's two motivations for this change:
* Without --function-signature, the generated check lines may fail
in a very hard to understand way if the test both includes a
function definition and a call to that function. (Though we could
address this by making the CHECK-LABEL stricter, without checking
the full signature.)
* This actually checks that uses of the arguments in the function
body use the correct argument, instead of matching against any
variable.
This is a replacement for D139006 and D140212 based on the
--version mechanism.
I did not include an opt-out flag --no-function-signature because
I'm not sure we need it. Would be happy to include it though,
if desired.
Differential Revision: https://reviews.llvm.org/D145149
Anonymous [Tue, 7 Mar 2023 08:56:00 +0000 (14:26 +0530)]
run-clang-tidy.py should only search for the clang-apply-replacements if really needed
run-clang-tidy.py should only search for the clang-apply-replacements if really needed.
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D145477
Dmitry Makogon [Mon, 6 Mar 2023 11:58:31 +0000 (18:58 +0700)]
[SCEV] Use fallthoughs in predicate switch when collecting rewrites for loop guard (NFC)
sgokhale [Tue, 7 Mar 2023 08:28:34 +0000 (13:58 +0530)]
[CodeGen][AArch64] Precommit additional tests for integer MLA/MAD/MLS/MSB (NFC)
This forms the base for upcoming patch to generate pseudo instructions for MLA/MAD/MLS/MSB.
Differential Revision: https://reviews.llvm.org/D142998
Jean Perier [Tue, 7 Mar 2023 07:59:57 +0000 (08:59 +0100)]
[flang][hlfir] Map scalar character symbols in internal procedures
I missed `addCharSymbol` in the patch adding the hlfir.declare in
internal procedures for "captured" entities (https://reviews.llvm.org/D143481).
Differential Revision: https://reviews.llvm.org/D145361
Siva Chandra Reddy [Tue, 7 Mar 2023 07:46:16 +0000 (07:46 +0000)]
[libc] Add a headers.txt for linux/arm config.
danix800 [Tue, 7 Mar 2023 07:41:30 +0000 (08:41 +0100)]
[analyzer] Explicit cast on customized offsetof should not be ignored when evaluating as const
If ignored, the subexpr is a UnaryOperator (&) which cannot be evaluated
(assertion failed).
#define offsetof(type,memb) ((unsigned long)&((type*)0)->memb)
Patch By danix800!
Differential Revision: https://reviews.llvm.org/D144780
Chuanqi Xu [Tue, 7 Mar 2023 07:16:23 +0000 (15:16 +0800)]
[C++20] [Modules] Handle the linkage of defaulted friend function
definition correctly
Close https://github.com/llvm/llvm-project/issues/61067
Previously we will only handle the defaulted member functions as
discardable ODR. But we need to handle defaulted friend function in this
way too. Otherwise we may run into the problems the above issue report
mentions.
Mehdi Amini [Sat, 4 Feb 2023 22:16:35 +0000 (14:16 -0800)]
Delete ActionManager and replace it with a simple callback on the Context
The concept of the ActionManager acts as a sort of "Hub" that can receive
various types of action and dispatch them to a set of registered handlers.
One handler will handle the action or it'll cascade to other handlers.
This model does not really fit the current evolution of the Action tracing
and debugging: we can't foresee a good case where this behavior compose with
the use-case behind the handlers. Instead we simplify it with a single
callback installed on the Context.
Differential Revision: https://reviews.llvm.org/D144811
Adrian Kuegel [Tue, 7 Mar 2023 06:41:47 +0000 (07:41 +0100)]
[mlir][Bazel] Add missing dependency.
Fangrui Song [Tue, 7 Mar 2023 06:33:42 +0000 (22:33 -0800)]
[test] Improve MC/RISCV/riscv64-64b-pcrel.s to demonstrate regression due to D132262
Jun Sha (Joshua) [Tue, 7 Mar 2023 06:27:48 +0000 (14:27 +0800)]
[RISCV][CodeGen] Add codegen pattern for FLI instruction in experimental zfa extension
This patch 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 codegen support for load-immediate instructions (fli.s/fli.d/fli.h).
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D141560
Jun Sha (Joshua) [Tue, 7 Mar 2023 06:17:35 +0000 (14:17 +0800)]
Add missing roundtointegral builtin functions for some FP instructions to be generated from C-written codes
To generate FROUND instructions in https://reviews.llvm.org/D143982, we need to use llvm intrinsics in IR files. Now I add some corresponding builtin functions to make sure these roundtointegral instructions can be generated from C codes.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D144935
Jun Sha (Joshua) [Tue, 7 Mar 2023 06:06:01 +0000 (14:06 +0800)]
[RISCV][MC] Add FLI instruction support for the experimental zfa extension
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 load-immediate instructions (fli.s/fli.d/fli.h). The assembly prefers decimal constants in C-like syntax. In my implementation, an integer encoding ranging from 0 to 31 can also be accepted, but for the MCInst printer, the constant is specified in decimal notation by default.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D140460
Fangrui Song [Tue, 7 Mar 2023 05:59:56 +0000 (21:59 -0800)]
[test] Improve MC/RISCV/riscv64-64b-pcrel.s
Tue Ly [Mon, 6 Mar 2023 03:57:51 +0000 (22:57 -0500)]
[libc][math] Switch math functions to use libc_errno and fix some errno and floating point exceptions.
Switch math functions to use libc_errno and fix some errno and
floating point exceptions
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D145349
Fangrui Song [Tue, 7 Mar 2023 05:50:19 +0000 (21:50 -0800)]
RISCVELFObjectWriter: de-capitalize some error messages
These are unfortunately untested.
I'll add some tests in a subsequent change.
Craig Topper [Tue, 7 Mar 2023 03:59:45 +0000 (19:59 -0800)]
[RISCV] Make D extension imply F extension.
I believe this implies relationship is documented in the current
spec but may have been less clear in an older spec.
We used to report an error so I think it should be ok to change this.
Only someone expecting the error should be impacted.
Reviewed By: asb, luismarques
Differential Revision: https://reviews.llvm.org/D145125
Craig Topper [Tue, 7 Mar 2023 03:56:43 +0000 (19:56 -0800)]
[TableGen] Fix error message that called Record::getName on a possibly anonymous record.
Record::getName only works for named records. Use getNameInitAsString
to handle anonymous records without crashing.
Leonard Chan [Tue, 7 Mar 2023 03:44:57 +0000 (03:44 +0000)]
[hwasan] Add non-exception variant of operator delete[] for hwasan
Differential Revision: https://reviews.llvm.org/D145459
Kazu Hirata [Tue, 7 Mar 2023 03:45:34 +0000 (19:45 -0800)]
[X86] Precommit a test
This patch precommits a test for:
https://github.com/llvm/llvm-project/issues/61073
Vitaly Buka [Tue, 7 Mar 2023 03:31:07 +0000 (19:31 -0800)]
[sanitizer] Disabled test for DLLs
Similar to compiler-rt/test/asan/TestCases/default_options.cpp
Kazu Hirata [Tue, 7 Mar 2023 03:28:35 +0000 (19:28 -0800)]
[DebugInfo] Fix a warning
This patch fixes:
llvm/lib/DebugInfo/GSYM/GsymCreator.cpp:117:18: error: unused
variable 'MaxAddressOffset' [-Werror,-Wunused-variable]
Haohai Wen [Tue, 7 Mar 2023 00:20:35 +0000 (08:20 +0800)]
Revert "[X86] Revise Alderlake P-Core schedule model"
This reverts commit
3083b65c3494b912e622a006a1b563a7e9f1d508.
Since latency from intel doc doesn't reflect worst case.
Noah Goldstein [Tue, 7 Mar 2023 00:14:46 +0000 (18:14 -0600)]
[DAGCombiner] Add fold for `~x + x` -> `-1`
This is generally done by the InstCombine, but can be emitted as an
intermediate step and is cheap to handle.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D145177
Noah Goldstein [Thu, 2 Mar 2023 17:40:00 +0000 (11:40 -0600)]
[DAGCombiner] Add fold for `~x & x` -> `0`
This is generally done by the InstCombine, but can be emitted as an
intermediate step and is cheap to handle.
Differential Revision: https://reviews.llvm.org/D145143
Noah Goldstein [Thu, 2 Mar 2023 07:30:44 +0000 (01:30 -0600)]
[X86] Add test for `~x & x` -> `0` and `~x + x` -> `-1` in DAG Lowering; NFC
Differential Revision: https://reviews.llvm.org/D145142
Noah Goldstein [Tue, 7 Mar 2023 00:13:21 +0000 (18:13 -0600)]
[InstCombine] Transform `(shift X,Or(Y,BitWidth-1))` -> `(shift X,BitWidth-1)`
shl : https://alive2.llvm.org/ce/z/_B7Qca
lshr: https://alive2.llvm.org/ce/z/6eXz_W
ashr: https://alive2.llvm.org/ce/z/oGEx-q
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145326
Noah Goldstein [Sun, 5 Mar 2023 22:37:17 +0000 (16:37 -0600)]
[InstCombine] Add tests for transform `(shift X,(Or Y, BitWidth-1))`; NFC
Differential Revision: https://reviews.llvm.org/D145334
Noah Goldstein [Tue, 7 Mar 2023 00:12:49 +0000 (18:12 -0600)]
[InstSimplify] Simplify `(shl nsw nuw X, BitWidth - 1)` -> `0`
https://alive2.llvm.org/ce/z/uFy5zT
Reviewed By: nikic, spatel
Differential Revision: https://reviews.llvm.org/D145327
Noah Goldstein [Sun, 5 Mar 2023 22:43:28 +0000 (16:43 -0600)]
[InstSimplify] Add tests for `(shl nuw nsw X, BitWidth - 1)` -> `0`; NFC
Differential Revision: https://reviews.llvm.org/D145335
Noah Goldstein [Tue, 7 Mar 2023 00:12:09 +0000 (18:12 -0600)]
[InstCombine] Add transform `(icmp eq/ne bitreverse(x), C)` -> `(icmp eq/ne x, bitreverse(C))`
EQ: https://alive2.llvm.org/ce/z/TESofr
NE: https://alive2.llvm.org/ce/z/mwloaT
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145339
Noah Goldstein [Sun, 5 Mar 2023 23:22:57 +0000 (17:22 -0600)]
[InstCombine] Add tests for `(icmp eq/ne bitreverse(x), C)`; NFC
Differential Revision: https://reviews.llvm.org/D145338
Sam Clegg [Mon, 6 Mar 2023 17:18:03 +0000 (09:18 -0800)]
[lld][WebAssembly] Implement --why-extract flag from the ELF backend
See https://reviews.llvm.org/D109572 for the original ELF version.
Differential Revision: https://reviews.llvm.org/D145431
Muhammad Omair Javaid [Tue, 7 Mar 2023 01:36:27 +0000 (05:36 +0400)]
Fix LLDB windows build
LLDB WoA buildbot is failing due to pid_t redefinition after recent changes in
lldb/source/Plugins/ScriptInterpreter/Python/ScriptedProcessPythonInterface.cpp.
Process.h includes PosixApi.h which defines pid_t. Python.h on windows also typedefs
pid_t. To make sure that we include Python.h before PosixApi this patch renforces
the workaround previously set up to guard this issue.
https://lab.llvm.org/buildbot/#/builders/219
Reviewed By: mib
Differential Revision: https://reviews.llvm.org/D145446
Igor Zhukov [Tue, 7 Mar 2023 00:44:47 +0000 (07:44 +0700)]
[CMake] Allow custom `CMAKE_BUILD_TYPE`s
Fixes #60975
Reviewed By: bogner
Differential Revision: https://reviews.llvm.org/D144835
Alex Langford [Tue, 7 Mar 2023 00:43:31 +0000 (16:43 -0800)]
[lldb] Stop opening Console.app and TextEdit.app when running the testsuite on macOS
Dave MacLachlan [Mon, 6 Mar 2023 23:47:13 +0000 (15:47 -0800)]
[asan darwin] Allow clients to implement `__sanitizer_report_error_summary`
`__sanitizer_report_error_summary` is declared `llvm/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_interface_internal.h` as being able to be overridden by the client. On darwin the sanitizer runtime uses this symbol to find references to the sanitizer libraries, so if you override it you end up with the error `=ERROR: Interceptors are not working. This may be because AddressSanitizer is loaded too late (e.g. via dlopen). Please launch the executable with:` at launch time.
Replace uses of `__sanitizer_report_error_summary` for finding the sanitizer libraries with using the address of a local function.
Reviewed By: yln, vitalybuka
Differential Revision: https://reviews.llvm.org/D144830
Med Ismail Bennani [Tue, 7 Mar 2023 00:35:03 +0000 (16:35 -0800)]
[lldb] Fix stack-use-after-scope issue in ScriptedInterface.h
This patch should fix a `stack-use-after-scope` in the helper function
`ScriptedInterface::ErrorWithMessage`.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Jakub Kuderski [Tue, 7 Mar 2023 00:28:39 +0000 (19:28 -0500)]
[mlir][arith] Canonicalize `addi(x, muli(y, -1))` -> `subi(x, y)`
These propagate all the way down to SPIR-V and result in some fishy code
with large constants.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D145423
Yeting Kuo [Mon, 6 Mar 2023 15:52:09 +0000 (23:52 +0800)]
[ADT][NFC] Use declval to suppress warning for nullptr use.
The patch uses declval instead of nullptr to suppress warning for calling member
function by nullptr. Also the patch replace is_same<*>::value with is_same_v<*>.
Reviewed By: dexonsmith, kuhar
Differential Revision: https://reviews.llvm.org/D145388
Greg Clayton [Mon, 6 Mar 2023 23:57:17 +0000 (15:57 -0800)]
Add the ability to segment GSYM files.
Some workflows can generate large GSYM files and sharding GSYM files into segments can help some performant workflows that can take advantage of smaller GSYM files. This patch add a new --segment-size option to llvm-gsymutil. This option can specify a rough size in bytes of how large each segment should be.
Segmented GSYM files contain only the strings and files that are needed for the FunctionInfo objects that are added to each shard. The output file path gets the first address of the first contained function info appended as a suffix to the filename. If a base address of an image is set in the GsymCreator, then all segments will use this same base address which allows lookups for symbolication to happen correctly when the image has been slid in memory.
Code has been addeed to refactor and re-use methods within the GsymCreator to allow for segments to be created easily and tested.
Example of segmenting GSYM files:
$ llvm-gsymutil --convert llvm-gsymutil.dSYM -o llvm-gsymutil.gsym --segment-size
10485760
$ ls -l llvm-gsymutil.gsym-*
-rw-r--r-- 1 gclayton staff
10485839 Feb 9 10:45 llvm-gsymutil.gsym-0x1000030c0
-rw-r--r-- 1 gclayton staff
10485765 Feb 9 10:45 llvm-gsymutil.gsym-0x100668888
-rw-r--r-- 1 gclayton staff
10485881 Feb 9 10:45 llvm-gsymutil.gsym-0x100c948b8
-rw-r--r-- 1 gclayton staff
10485954 Feb 9 10:45 llvm-gsymutil.gsym-0x101659e70
-rw-r--r-- 1 gclayton staff
10485792 Feb 9 10:45 llvm-gsymutil.gsym-0x1022b1dc0
-rw-r--r-- 1 gclayton staff
10485889 Feb 9 10:45 llvm-gsymutil.gsym-0x102a18b10
-rw-r--r-- 1 gclayton staff
10485893 Feb 9 10:45 llvm-gsymutil.gsym-0x1030b05d0
-rw-r--r-- 1 gclayton staff
10485802 Feb 9 10:45 llvm-gsymutil.gsym-0x1037caaac
-rw-r--r-- 1 gclayton staff
10485781 Feb 9 10:45 llvm-gsymutil.gsym-0x103e767a0
-rw-r--r-- 1 gclayton staff
10485832 Feb 9 10:45 llvm-gsymutil.gsym-0x10452d0d4
-rw-r--r-- 1 gclayton staff
10485782 Feb 9 10:45 llvm-gsymutil.gsym-0x104b93310
-rw-r--r-- 1 gclayton staff 6255785 Feb 9 10:45 llvm-gsymutil.gsym-0x10526bf34
Differential Revision: https://reviews.llvm.org/D145448
Sam Clegg [Mon, 6 Mar 2023 22:44:08 +0000 (14:44 -0800)]
[lld][ELF] Remove unused enum value. NFC
The usage was removed in https://reviews.llvm.org/D119074
Differential Revision: https://reviews.llvm.org/D145434
Snehasish Kumar [Mon, 6 Mar 2023 23:48:52 +0000 (23:48 +0000)]
Revert "[memprof] Refactor tests to generate binaries and profiles on the fly."
This reverts commit
599b7690fa917ea4e9cd67275e34d0b5a0f51aa9. Since
adding a cross project dependency is a concern.
Arthur Eubanks [Fri, 3 Mar 2023 23:50:10 +0000 (15:50 -0800)]
[LLParser] Error out if a name is too long and gets renamed
Typically names longer than -non-global-value-max-name-size will just get renamed if there is a collision after truncating. This is fine since we typically don't reference Values by name.
However LLParser does reference Values by name, so report an error when that happens, otherwise weird issues can crop up if there are name collisions (e.g. verifier issues with the changed test case because we end up reusing the same block for `testz` and `testa`).
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D145282
Ben Shi [Mon, 6 Mar 2023 06:53:58 +0000 (14:53 +0800)]
[LoopVectorize][NFC] Fix incorrect comment in LoopVectorize.h
Reviewed By: david-arm, fhahn
Differential Revision: https://reviews.llvm.org/D145356
Chia-hung Duan [Mon, 6 Mar 2023 23:26:20 +0000 (23:26 +0000)]
Revert "[scudo] Mitigate page releasing thrashing"
This reverts commit
436ea5485d02c529e26a7a1007b82d581be016c4.
David Green [Mon, 6 Mar 2023 23:26:08 +0000 (23:26 +0000)]
[AArch64] Extend load insert into zero patterns to SVE.
This extends the patterns for loading into the zeroth lane of a zero vector
from D144086 to SVE, which work in the same way as the existing patterns. Only
full length vectors are added here, not the narrower floating point vector
types.
Dave Lee [Mon, 6 Mar 2023 23:04:32 +0000 (15:04 -0800)]
Revert "[lldb] Redefine p alias to dwim-print command"
This reverts commit
a00801d94b02eaebd1385b03fb9e549c07cc8585.
Broke TestVSCode_completions.py
Siva Chandra [Mon, 6 Mar 2023 22:19:37 +0000 (22:19 +0000)]
[libc] Add riscv64 config.
Memory functions get the basic implementation. They can be tuned
as a follow up.
Reviewed By: michaelrj, lntue
Differential Revision: https://reviews.llvm.org/D145433
Siva Chandra Reddy [Fri, 3 Mar 2023 07:09:58 +0000 (07:09 +0000)]
[libc][NFC] Switch dirent, fcntl, inttypes and sched to use libc_errno.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D145222
wren romano [Mon, 6 Mar 2023 21:46:12 +0000 (13:46 -0800)]
[mlir][sparse] Fixing -Wsign-compare error in D144773
Reviewed By: aartbik, Peiming
Differential Revision: https://reviews.llvm.org/D145420
Siva Chandra Reddy [Mon, 6 Mar 2023 19:15:50 +0000 (19:15 +0000)]
[libc] Add ALIAS option to add_object_library rule.
This ALIAS option is now used with threads/callonce target.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D145409
Med Ismail Bennani [Mon, 6 Mar 2023 21:59:47 +0000 (13:59 -0800)]
[lldb] Fix cyclic dependency issue in ScriptedMetadata
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Kazu Hirata [Mon, 6 Mar 2023 21:57:16 +0000 (13:57 -0800)]
[mlir] Fix a warning
This patch fixes:
mlir/lib/Dialect/SparseTensor/IR/SparseTensorDialect.cpp:675:56:
error: comparison of integers of different signs: 'long const' and
'const mlir::sparse_tensor::Level' (aka 'const unsigned long')
[-Werror,-Wsign-compare]
Alexey Bataev [Mon, 6 Mar 2023 20:09:45 +0000 (12:09 -0800)]
[SLP]Fix PR61224: Compiler hits infinite loop.
IRBuilder in many cases is able to fold constant code automatically,
but in some cases (for some intrinsics) it cannot do it. Need to perform
manual calculation, if constant provided in these corner cases, to avoid
infinite loop.
Robert Suderman [Mon, 6 Mar 2023 19:09:11 +0000 (11:09 -0800)]
[mlir][math] Add math.cbrt polynomial approximation
Cbrt can be approximated with some relatively simple polynomial
operators. This includes a lit test validating the implementation
and some run tests that validate numerical correct.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D145019
Snehasish Kumar [Wed, 1 Mar 2023 01:33:19 +0000 (01:33 +0000)]
[memprof] Refactor tests to generate binaries and profiles on the fly.
This change replaces the binary profiles and executables used for
testing the memprof profile reader with tests where the profiles are
generated on the fly. This reduces toil when the profile version
changes. The tests are moved from tools/llvm-profdata to
compiler-rt/test/memprof due to the following reasons:
1. Adding dependency on memprof lit.cfg.py for llvm-profdata is
preferable to adding a dependency on compiler-rt for llvm/test.
2. All the tests can now be run with `ninja check-memprof`.
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D145023
Med Ismail Bennani [Mon, 6 Mar 2023 21:17:46 +0000 (13:17 -0800)]
Revert "[lldb] Add an example of interactive scripted process debugging (NFC)"
This reverts commit
70b9822ef3b0774609c72d380504c9abfa717f81.
Med Ismail Bennani [Mon, 6 Mar 2023 21:17:45 +0000 (13:17 -0800)]
Revert "[lldb/Plugin] Add breakpoint setting support to ScriptedProcesses."
This reverts commit
cfe06f495beb520ab366957d1108bb80c7c92832.
Med Ismail Bennani [Mon, 6 Mar 2023 21:17:43 +0000 (13:17 -0800)]
Revert "[lldb] Move ScriptedProcess private state update to implementation"
This reverts commit
3c33d72e7fa83beb8a9b39fb3b8ecf4ee00c697d.
Med Ismail Bennani [Mon, 6 Mar 2023 21:17:40 +0000 (13:17 -0800)]
Revert "[lldb/API] Introduce SBProcess::ForceScriptedState method"
This reverts commit
3675e0bb67fa86b8476a67bb1a7623a6b1a373b3.
Med Ismail Bennani [Mon, 6 Mar 2023 19:53:09 +0000 (11:53 -0800)]
[lldb/Utility] Fix layering violation caused by ScriptedMetadata
This patch moves `ScriptedMetadata.h` from the `Interpreter` directory to
the `Utility` sub-directory since `ProcessInfo.h` depends on it.
It also gets rid of the unused `OptionGroupPythonClassWithDict`
constructor for `ScriptedMetadata` which would address the layering
violation.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 4 Mar 2023 05:44:51 +0000 (21:44 -0800)]
[lldb] Add an example of interactive scripted process debugging (NFC)
This patch is a proof of concept that shows how a scripted process could
be used with real process to perform interactive debugging.
In this example, we run a process that spawns 10 threads. Then, we
create a intermediary scripted process who's job will be to wrap the
real process while intercepting it's process events and dispatching them
back either to the real process or to other child scripted processes.
In this example, we have 2 child scripted processes, with even and odd
thread indices. The goal is to be able to do thread filtering and
explore the various interactive debugging approaches, by letting a child
process running when stopping the other process and inspecting it.
Another approach would be to have the child processes execution in-sync
to force running every child process when one of them starts running.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 4 Mar 2023 05:40:51 +0000 (21:40 -0800)]
[lldb/Plugin] Add breakpoint setting support to ScriptedProcesses.
This patch adds support for breakpoint setting to Scripted Processes.
For now, Scripted Processes only support setting software breakpoints.
When doing interactive scripted process debugging, it makes use of the
memory writing capability to write the trap opcodes in the memory of the
driving process. However the real process' target doesn't keep track of
the breakpoints that got added by the scripted process. This is a design
that we might need to change in the future, since we'll probably need to
do some book keeping to handle breakpoints that were set by different
scripted processes.
Differential Revision: https://reviews.llvm.org/D145296
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 4 Mar 2023 05:39:36 +0000 (21:39 -0800)]
[lldb] Move ScriptedProcess private state update to implementation
While debugging a Scripted Process, in order to update its state and
work nicely with lldb's execution model, it needs to toggle its private
state from running to stopped, which will result in broadcasting a
process state changed event to the debugger listener.
Originally, this state update was done systematically in the Scripted
Process C++ plugin, however in order to make scripted process
interactive, we need to be able to update their state dynamically.
This patch makes use of the recent addition of the
`SBProcess::ForceScriptedState` to programatically, and moves the
process private state update to the python implementation of the `resume`
method instead of doing it in `ScriptedProcess::DoResume`.
This patch also removes the unused `ShouldStop` & `Stop` scripted
process APIs, and adds new ScriptedInterface transform methods for
boolean arguments. This allow the user to programmatically decide if
after running the process, we should stop it (which is the default setting).
Differential Revision: https://reviews.llvm.org/D145295
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 4 Mar 2023 05:37:45 +0000 (21:37 -0800)]
[lldb/API] Introduce SBProcess::ForceScriptedState method
This patch introduces a new method to the SBProcess API called
ForceScriptedState. As the name suggests, this affordance will allow the
user to alter the private state of the scripted process programatically.
This is necessary to update the scripted process state when perform
interactive debugging.
Differential Revision: https://reviews.llvm.org/D145294
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Owen Pan [Mon, 6 Mar 2023 01:52:42 +0000 (17:52 -0800)]
[clang-format] Don't annotate left brace of class as FunctionLBrace
The l_brace of class/struct/union was incorrectly annotated as
TT_FunctionLBrace in the presence of attributes. This in turn
would cause the RemoveSemicolon option to remove the semicolon
at the end of the declaration, resulting in invalid code being
generated.
Fixes #61188.
Differential Revision: https://reviews.llvm.org/D145344