Ingo Müller [Tue, 18 Jul 2023 09:07:17 +0000 (09:07 +0000)]
[mlir][linalg][transform][python] Add type arg to MatchOp extension.
The extension class to MatchOp has a class method called match_op_names.
The previous version of that function did not allow to specify the
result type. This, however, may be useful/necessary if the op consuming
the resulting handle requires a particular type (such as the
bufferization.EmptyTensorToAllocTensorOp). This patch adds an overload
to match_op_names that allows to specify the result type.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D155567
Simon Pilgrim [Wed, 19 Jul 2023 09:10:15 +0000 (10:10 +0100)]
[X86] LowerEXTEND_VECTOR_INREG - add sign_extend_vector_inreg fast path for all-signbits source values
If the source operand is already all-signbits we don't need to create the sign extended elements - just splat the source element to the destination element width
Oleg Shyshkov [Wed, 19 Jul 2023 09:10:53 +0000 (11:10 +0200)]
[mlir][bazel] Fix build.
Guillaume Chatelet [Tue, 18 Jul 2023 15:29:42 +0000 (15:29 +0000)]
[libc][NFC] Rename files
This patch mostly renames files so it better reflects the function they declare.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D155607
David Spickett [Wed, 19 Jul 2023 09:04:13 +0000 (09:04 +0000)]
[lldb] XFAIL command-disassemble-mixed.c on Windows
Either clang-cl has different assembly output or we're not mapping
source to assembly properly on Windows. We (Linaro) will find out which.
https://lab.llvm.org/buildbot/#/builders/219/builds/4195
Chuanqi Xu [Wed, 19 Jul 2023 08:50:26 +0000 (16:50 +0800)]
[NFC] Adjust test for pr63595
The original test case is not strictly correct but our ODR checking
system doesn't find it.
Kadir Cetinkaya [Wed, 19 Jul 2023 08:45:06 +0000 (10:45 +0200)]
Revert "[clangd] Remove unused private field 'Opts' in UpdateIndexCallbacks (NFC)"
This reverts commit
c4fa97fca7e92c736fcb09779c84b42c25ffae70.
Guillaume Chatelet [Tue, 18 Jul 2023 16:32:04 +0000 (16:32 +0000)]
[libc][memfunctions] Explicit error when platform in not supported
Reviewed By: JonChesterfield, jhuber6
Differential Revision: https://reviews.llvm.org/D155597
Nikita Popov [Mon, 26 Jun 2023 13:33:09 +0000 (15:33 +0200)]
[LoopPeel] Clear dispositions after peeling
Block dispositions of values defined inside the loop may change
during peeling, so clear them. We already do this for other kinds
of unrolling.
Differential Revision: https://reviews.llvm.org/D153762
Kadir Cetinkaya [Wed, 19 Jul 2023 07:14:23 +0000 (09:14 +0200)]
Revert "[clangd] Always run preamble indexing on a separate thread"
This reverts commit
036a1b2202cb71aacfa72ef15145a88dc50a02cf.
Triggering failures under tsan, https://lab.llvm.org/buildbot/#/builders/131/builds/48349
Simi Pallipurath [Fri, 30 Jun 2023 10:48:47 +0000 (11:48 +0100)]
[Clang][Driver] Pass through the --be8 endian flag to linker in BareMetal driver For Arm.
When linking a big-endian image for Arm, clang has
to select between BE8 and BE32 formats. The default
is dependent on the selected target architecture.
For ARMv6 and later architectures the default is
BE8, for older architectures the default is BE32.
For BE8 and BE32, compiler outputs a big endian ELF
relocatable object file with the instructions and
data both big endian. The difference is that at
link time, for BE8 a linker must endian reverse
the instructions to little endian. For BE8, the
clang has to pass --be8 to the linker for Arm.
At the moment clang is not passing the --be8 flag
to linker for the baremetal target architectures
above ArmV6 for Arm. This patch passes through --be8
and -BE or EL to the linker, taking into account the
target and the -mbig-endian and -mlittle-endian flag.
Also there are few more changes in the baremetal
driver so that the code can cope with AArch64 being
big-endian as well.
Reviewed By: michaelplatings, MaskRay
Differential Revision: https://reviews.llvm.org/D154786
Viktoriia Bakalova [Tue, 18 Jul 2023 15:48:24 +0000 (15:48 +0000)]
[clangd] Make an include always refer to itself. Background: clang-review expects all referents to have definition, declaration or reference(s).
Differential Revision: https://reviews.llvm.org/D155614
Jay Foad [Wed, 19 Jul 2023 08:20:08 +0000 (09:20 +0100)]
[AMDGPU] Regenerate is.fpclass checks
Martin Storsjö [Sun, 16 Jul 2023 21:35:04 +0000 (00:35 +0300)]
[libcxx] Link to fewer MSVC CRT libraries
The library msvcrt.lib pulls in ucrt.lib and vcruntime.lib anyway,
there's no need to manually link against the individual dependencies.
This matches how the tests link against libraries - they only link
against msvcrt and msvcprt, not directly against ucrt and vcruntime.
Differential Revision: https://reviews.llvm.org/D155555
Andrew Ng [Fri, 14 Jul 2023 08:49:24 +0000 (11:49 +0300)]
[libcxx] [test] Remove a stray double space from a test config. NFC.
Differential Revision: https://reviews.llvm.org/D155553
Andrzej Warzynski [Mon, 10 Apr 2023 13:43:39 +0000 (13:43 +0000)]
[mlir] Update SVE integration tests to use mlir-cpu-runner
With the recent addition of "-mattr" and "-march" to the list of options
supported by mlir-cpu-runner [1], the SVE integration
tests can be updated to use mlir-cpu-runner instead of lli. This will
allow better code re-use and more consistency
This patch updates 2 tests to demonstrate the new logic. The remaining
tests will be updated in the follow-up patches.
[1] https://reviews.llvm.org/D146917
Depends on D155403
Differential Revision: https://reviews.llvm.org/D155405
Martin Storsjö [Mon, 17 Jul 2023 08:16:05 +0000 (11:16 +0300)]
[CMake] Clean up old code for handling MSVC runtime setting the old way
This was left in place to reduce the risk of breaking anything,
and to keep the diff smaller, in D155233.
Differential Revision: https://reviews.llvm.org/D155431
Nikita Popov [Tue, 18 Jul 2023 10:13:59 +0000 (12:13 +0200)]
[IR] Deprecate opaque pointer compatibility APIs
This deprecates various compatibility APIs that have been
introduced as part of the opaque pointer migration.
These will be removed at some point after the LLVM 17 release.
Differential Revision: https://reviews.llvm.org/D155585
Martin Storsjö [Mon, 17 Jul 2023 12:19:14 +0000 (15:19 +0300)]
Reland [AArch64] Fix an immediate out of range for large realignments on Windows
Also add a missing FrameSetup flag on the existing add instruction.
This fixes https://github.com/llvm/llvm-project/issues/63701.
Since the previous iteration, change ADDXrr to ADDXrx64, which
works with this use of SP.
Differential Revision: https://reviews.llvm.org/D155447
Freddy Ye [Wed, 19 Jul 2023 08:14:06 +0000 (16:14 +0800)]
[X86] Add PBNDKB instruction.
For more details about this instruction, please refer to the latest ISE document: https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html
Reviewed By: pengfei, skan
Differential Revision: https://reviews.llvm.org/D155142
Chuanqi Xu [Wed, 19 Jul 2023 08:10:55 +0000 (16:10 +0800)]
[NFC] Add a blank line after directives in StandardCPlusPlusModules.rst
Balázs Kéri [Wed, 19 Jul 2023 07:23:32 +0000 (09:23 +0200)]
[clang][analyzer] StdLibraryFunctionsChecker: Allow NULL buffer in `fread` and `fwrite` if size is zero.
Reviewed By: donat.nagy
Differential Revision: https://reviews.llvm.org/D154509
Juan Manuel MARTINEZ CAAMAÑO [Wed, 19 Jul 2023 07:37:42 +0000 (09:37 +0200)]
[NFC][AMDGPULowerModuleLDSPass] Use shorter APIs in markUsedByKernel
* Use shorter versions of the LLVM API
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D155589
Juan Manuel MARTINEZ CAAMAÑO [Wed, 19 Jul 2023 07:37:29 +0000 (09:37 +0200)]
[NFC][AMDGPULowerModuleLDSPass] Cleanup of getTableLookupKernelIndex
* Do a single lookup when querying the map
* Use shorter versions of the LLVM API
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D155588
Markus Böck [Wed, 19 Jul 2023 07:32:17 +0000 (09:32 +0200)]
[mlir][LLVM] add `llvm.ssa.copy` intrinsic
This is quite the niche intrinsic, whose whole purpose is to be able to essentially split an SSA value to be able to attach additional information to the new value.
It therefore really acts like a noop that just passes through its argument. It interestingly does not have any support in CodeGen and is therefore required to also be deleted by any pass creating it.
Differential Revision: https://reviews.llvm.org/D155678
Nikita Popov [Wed, 19 Jul 2023 07:40:48 +0000 (09:40 +0200)]
[IR] Remove Type::getPointerElementType() (NFC)
This method has been deprecated since the LLVM 15 release and
can no longer meaningfully be used, so remove it.
Chuanqi Xu [Wed, 19 Jul 2023 07:46:52 +0000 (15:46 +0800)]
[NFC] [C++20] [Modules] Add a performance tip to the document
It is a known problem that the compiler isn't efficiency when there are
a lot of duplications in the modules to developers. But it may not be
verbose to the (potential) new users of C++20 modules.
It may be necessary to mention this in the document.
Jie Fu [Wed, 19 Jul 2023 07:28:38 +0000 (15:28 +0800)]
[clangd] Remove unused private field 'Opts' in UpdateIndexCallbacks (NFC)
/Users/jiefu/llvm-project/clang-tools-extra/clangd/ClangdServer.cpp:167:32: error: private field 'Opts' is not used [-Werror,-Wunused-private-field]
const ClangdServer::Options &Opts;
^
1 error generated.
Matthias Springer [Wed, 19 Jul 2023 06:59:02 +0000 (08:59 +0200)]
[mlir][NFC] Avoid `OpBuilder::setListener` when possible
`setListener` is dangerous because an already registered listener may accidentally be overwritten/replaced. (A `ForwardingListener` must be used in such cases.) This change updates a few trivial call sites of `setListener`, where no forwarding listener is needed.
Differential Revision: https://reviews.llvm.org/D155599
Craig Topper [Wed, 19 Jul 2023 07:12:19 +0000 (00:12 -0700)]
[RISCV] Make SubtargetFeature description strings consistent with AssemblerPredicate.
Mostily capitalizing 'Z' for multi-letter extensions.
tomasz-kaminski-sonarsource [Tue, 18 Jul 2023 14:55:50 +0000 (16:55 +0200)]
[analyzer] Model lifetime of a variable declared in for condition in CFG correctly
Per [stmt.for] p1 (https://eel.is/c++draft/stmt.for#1) the following
`for` and `while` statements are equivalent
```
for (; A c = b; b.c) {
A d;
}
while (A c = b) {
A d;
b.c;
}
```
As a consequence, the variable declared for the condition expression
should be destroyed after the increment expression.
This fixed the handling of the object lifetime `continue`, and now
destructors, scope and lifetime elements are present for continue
path in following code:
```
for (; A c = b; b.c) {
if (cond)
continue;
A d;
}
```
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D155547
Andrzej Warzynski [Fri, 14 Jul 2023 11:55:13 +0000 (11:55 +0000)]
[mlir][nfc] Clarify the limitation on scalable vectors
When converting/lowering to LLVM, MLIR does not support n-D scalable
vectors at the moment. This patch simply clarifies an assert that's
meant to catch such unsupported cases.
Note that we may want to relax this condition in the future.
Differential Revision: https://reviews.llvm.org/D154302
Jie Fu [Wed, 19 Jul 2023 06:37:12 +0000 (14:37 +0800)]
[examples] Fix -Wcast-qual in OrcV2Examples after D153911 (NFC)
/Users/jiefu/llvm-project/llvm/examples/OrcV2Examples/OrcV2CBindingsBasicUsage/OrcV2CBindingsBasicUsage.c:77:52: error: cast from 'char **' to 'const char **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]
LLVMParseCommandLineOptions(argc, (const char **)argv, "");
^
/Users/jiefu/llvm-project/llvm/examples/OrcV2Examples/OrcV2CBindingsAddObjectFile/OrcV2CBindingsAddObjectFile.c:63:52: error: cast from 'char **' to 'const char **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]
LLVMParseCommandLineOptions(argc, (const char **)argv, "");
^
/Users/jiefu/llvm-project/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/OrcV2CBindingsDumpObjects.c:62:52: error: cast from 'char **' to 'const char **' must have all intermediate pointers const qualified to be safe [-Werror,-Wcast-qual]
LLVMParseCommandLineOptions(argc, (const char **)argv, "");
^
...
Corentin Jabot [Tue, 18 Jul 2023 10:16:16 +0000 (12:16 +0200)]
[Clang] Fix the location of default init expressions
Default member initializations constructed from
a parenthesized aggregate initialization should be constructed
at the location of the left paren, to be consistent with
brace initialization.
Otherwise we get diagmostics and source_location in the wrong places.
Fixes #63903
Reviewed By: aaron.ballman, #clang-language-wg
Differential Revision: https://reviews.llvm.org/D155573
Kadir Cetinkaya [Tue, 18 Jul 2023 16:12:32 +0000 (18:12 +0200)]
[clangd] Always run preamble indexing on a separate thread
This has been the default in our production setup for weeks now,
showing great improvements to latency and no problems around stability or
correctness of the results.
Differential Revision: https://reviews.llvm.org/D155619
Shivam Gupta [Wed, 19 Jul 2023 05:01:35 +0000 (10:31 +0530)]
[Clang] Fix -Wconstant-logical-operand when LHS is a constant
This fix PR37919
The below code produces -Wconstant-logical-operand for the first statement,
but not the second.
void foo(int x) {
if (x && 5) {}
if (5 && x) {}
}
Reviewed By: nickdesaulniers
Differential Revision: https://reviews.llvm.org/D142609
Chuanqi Xu [Wed, 19 Jul 2023 06:11:32 +0000 (14:11 +0800)]
[NFC] [C++20] [Modules] Add C++20 modules related changes to Release Note
Given LLVM17 is going to be branched, add some uncovered C++20 modules related changes
to the Release Notes.
Chuanqi Xu [Wed, 19 Jul 2023 06:28:07 +0000 (14:28 +0800)]
Revert "[NFC] [C++20] [Modules] Add C++20 modules related changes to Release Note"
This reverts commit
95bdd6eed6f3f4b8a95523516120068ac18eccff. The bot
shows there are some grammar issues.
Alexander Belyaev [Mon, 10 Jul 2023 10:40:50 +0000 (12:40 +0200)]
[mlir] Remove dead code in Analysis/FlatLinearValueConstraints.
Differential Revision: https://reviews.llvm.org/D154830
Chuanqi Xu [Wed, 19 Jul 2023 06:11:32 +0000 (14:11 +0800)]
[NFC] [C++20] [Modules] Add C++20 modules related changes to Release Note
Given LLVM17 is going to be branched, add some uncovered C++20 modules related changes
to the Release Notes.
Fangrui Song [Wed, 19 Jul 2023 05:11:27 +0000 (22:11 -0700)]
[test] Make fuzzer/value-profile-div.test x86 specific
The test requires that an integer division by zero causes a trap, leading to a
signal like SIGFPE. This is the case on x86. On many other architectures, such
as Arm (unless software division is used and `__aeabi_idiv0` is patched),
Power, RISC-V, LoongArch, there is no trap. Therefore, it's more appropriate to
invert the condition to run the test.
Reviewed By: Ami-zhang
Differential Revision: https://reviews.llvm.org/D155644
Fangrui Song [Wed, 19 Jul 2023 05:10:58 +0000 (22:10 -0700)]
[Demangle] Include <exception> for IWYU
The called std::terminate currently gets the declaration transitively
through llvm/Demangle/Utility.h, removing <exception> from Utility.h
would break ItaniumDemangle.cpp.
Weining Lu [Wed, 19 Jul 2023 05:07:06 +0000 (13:07 +0800)]
Revert "[LoongArch] Change 'using namespace llvm;' to 'namespace llvm {' in LoongArchTargetParser.cpp. NFC"
This reverts commit
586321467a0d48573ae643e837a6c4eaf6bc75db.
Reason to revert:
These changes are inconsistent with the [[https://llvm.org/docs/CodingStandards.html#use-namespace-qualifiers-to-implement-previously-declared-functions|LLVM stype guide]].
Jie Fu [Wed, 19 Jul 2023 04:05:05 +0000 (12:05 +0800)]
[tools] Use "#pragma GCC" instead of "#pragma clang" to ignore -Wcast-qual in c-index-test.c (NFC)
Patryk Wychowaniec [Wed, 19 Jul 2023 03:54:34 +0000 (11:54 +0800)]
[AVR] Expand shifts of all types except int8 and int16
Currently our AVRShiftExpand pass expands only 32-bit shifts, with the
assumption that other kinds of shifts (e.g. 64-bit ones) are
automatically reduced to 8-bit ones by LLVM during ISel.
However this is not always true and causes problems in the rust-lang runtime.
This commit changes the logic a bit, so that instead of expanding only
32-bit shifts, we expand shifts of all types except 8-bit and 16-bit.
This is not the most optimal solution, because 64-bit shifts can be
expanded to 32-bit shifts which has been deeply optimized.
I've checked the generated code using rustc + simavr, and all shifts
seem to behave correctly.
Spotted in the wild in rustc:
https://github.com/rust-lang/compiler-builtins/issues/523
https://github.com/rust-lang/rust/issues/112140
Reviewed By: benshi001
Differential Revision: https://reviews.llvm.org/D154785
Jianjian GUAN [Tue, 18 Jul 2023 09:37:01 +0000 (17:37 +0800)]
[AVR] Enable verifyInstructionPredicates for AVR
This patch fixes the failed test of verifyInstructionPredicates which is caused by verifyInstructionPredicates. verifyInstructionPredicates will add JMPk without checking the target predicate.
Reviewed By: benshi001
Differential Revision: https://reviews.llvm.org/D155570
Jie Fu [Wed, 19 Jul 2023 03:39:00 +0000 (11:39 +0800)]
[tools] Fix buildbot build failure
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:234: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:235: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:236:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:237:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:238: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:3765: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:3766: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:3767:10: warning: cast discards 'const' qualifier from pointer target type [-Wcast-qual]
/buildbot/worker/arc-folder/llvm-project/clang/tools/c-index-test/c-index-test.c:3768: warning: ignoring '#pragma clang diagnostic' [-Wunknown-pragmas]
Jake Egan [Wed, 19 Jul 2023 03:33:48 +0000 (23:33 -0400)]
[NFC][XCOFF] Remove curly braces from single line if statement
Missed this detail from D155199.
WANG Xuerui [Wed, 19 Jul 2023 01:20:53 +0000 (09:20 +0800)]
[LoongArch] Align functions and loops better according to uarch
The LA464 micro-architecture is very sensitive to alignment of hot code,
with performance variation of up to ~12% in the go1 benchmark suite of
the Go language (as observed by me during my work on the Go loong64
port).
[[ https://go.dev/cl/479816 | Manual alignment of certain loops ]] and [[ https://go.dev/cl/479817 | automatic alignment of loop heads ]]
helps a lot there, by reducing much of the random variation and
generally increasing performance, so we naturally want to do the same
here.
Practically, LA464 is the only LoongArch micro-architecture in wide use,
and we are currently supporting just that. The first "4" in "LA464"
stands for "4-issue", in particular its instruction fetch and decode
stages are 4-wide; so functions and branch targets should be preferably
aligned to at least 16 bytes for best throughput.
The Loongson team has benchmarked various combinations of function,
loop, and branch target alignments with GCC.
[[ https://gcc.gnu.org/pipermail/gcc-patches/2023-May/619980.html | The results ]]
show that "16-byte label alignment together with 32-byte function
alignment gives best results in terms of SPEC score". A "label" in GCC
means a branch target; while we don't currently align branch targets,
we do align loops, so in this patch we default to 32-byte function
alignment and 16-byte loop alignment.
Reviewed By: SixWeining
Differential Revision: https://reviews.llvm.org/D148622
Jie Fu [Wed, 19 Jul 2023 03:16:55 +0000 (11:16 +0800)]
[mlir] Fix -Wcast-qual in mlir/test/CAPI/ir.c after D153911 (NFC)
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1120:18: error: cast from 'const void *' to 'unsigned char *' drops const qualifier [-Werror,-Wcast-qual]
(uint8_t *)mlirDenseElementsAttrGetRawData(uint8Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1121:35: error: cast from 'const void *' to 'signed char *' drops const qualifier [-Werror,-Wcast-qual]
int8_t *int8RawData = (int8_t *)mlirDenseElementsAttrGetRawData(int8Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1123:19: error: cast from 'const void *' to 'unsigned int *' drops const qualifier [-Werror,-Wcast-qual]
(uint32_t *)mlirDenseElementsAttrGetRawData(uint32Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1125:18: error: cast from 'const void *' to 'int *' drops const qualifier [-Werror,-Wcast-qual]
(int32_t *)mlirDenseElementsAttrGetRawData(int32Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1127:19: error: cast from 'const void *' to 'unsigned long long *' drops const qualifier [-Werror,-Wcast-qual]
(uint64_t *)mlirDenseElementsAttrGetRawData(uint64Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1129:18: error: cast from 'const void *' to 'long long *' drops const qualifier [-Werror,-Wcast-qual]
(int64_t *)mlirDenseElementsAttrGetRawData(int64Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1130:34: error: cast from 'const void *' to 'float *' drops const qualifier [-Werror,-Wcast-qual]
float *floatRawData = (float *)mlirDenseElementsAttrGetRawData(floatElements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1132:17: error: cast from 'const void *' to 'double *' drops const qualifier [-Werror,-Wcast-qual]
(double *)mlirDenseElementsAttrGetRawData(doubleElements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1134:19: error: cast from 'const void *' to 'unsigned short *' drops const qualifier [-Werror,-Wcast-qual]
(uint16_t *)mlirDenseElementsAttrGetRawData(bf16Elements);
^
/Users/jiefu/llvm-project/mlir/test/CAPI/ir.c:1136:19: error: cast from 'const void *' to 'unsigned short *' drops const qualifier [-Werror,-Wcast-qual]
(uint16_t *)mlirDenseElementsAttrGetRawData(f16Elements);
^
10 errors generated.
Jie Fu [Wed, 19 Jul 2023 02:55:12 +0000 (10:55 +0800)]
[tools] Ignore -Wcast-qual in c-index-test.c after D153911 (NFC)
/Users/jiefu/llvm-project/clang/tools/c-index-test/c-index-test.c:234:18: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
free((char *)unsaved_files[i].Filename);
^
/Users/jiefu/llvm-project/clang/tools/c-index-test/c-index-test.c:235:18: error: cast from 'const char *' to 'char *' drops const qualifier [-Werror,-Wcast-qual]
free((char *)unsaved_files[i].Contents);
^
/Users/jiefu/llvm-project/clang/tools/c-index-test/c-index-test.c:3762:32: error: cast from 'const char *' to 'void *' drops const qualifier [-Werror,-Wcast-qual]
return (CXIdxClientContainer)"TU";
^
3 errors generated.
eopXD [Mon, 17 Jul 2023 19:30:00 +0000 (12:30 -0700)]
[RISCV] Use the stack for MVT::f16 for fastcc when there are no other registers available
In D155502, we added code for the compiler to check GPR-s for f16
under zhinx. This commit adds code to hit the stack when we run out of
GPR-s.
With this patch and D155502, resolves #63922
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155507
Amir Ayupov [Wed, 19 Jul 2023 02:43:08 +0000 (19:43 -0700)]
[BOLT][Utils] Pass cmp-rev to nfc-check-setup
Pass the revision to checkout to (cmp-rev) as nfc-check-setup option.
Simpifies the comparison against arbitrary commit, not just the previous one.
Reviewed By: #bolt, rafauler
Differential Revision: https://reviews.llvm.org/D155657
eopXD [Mon, 17 Jul 2023 03:18:11 +0000 (20:18 -0700)]
[Clang][RISCV] Improve diagnostic message for full multiply intrinsics
The full multiply intrinsics are not included for EEW=64 in Zve64*.
They require the V extension to be enabled.
This commit improves diagnostic message from
```
<source>:4:10: error: call to undeclared function '__riscv_vsmul_vv_i64m1';
4 | return __riscv_vsmul_vv_i64m1(op1, op2, __RISCV_VXRM_RNU, vl);
```
to
```
test.c:5:10: error: builtin requires: v
5 | return __riscv_vsmul_vv_i64m1(op1, op2, __RISCV_VXRM_RNU, vl);
```
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155416
Jake Egan [Wed, 19 Jul 2023 02:08:46 +0000 (22:08 -0400)]
[NFC][XCOFF] Use common function to calculate file offset
The file offset code is repeated in nearly identical form for every derivation of SectionEntry, so make it into a method in SectionEntry instead.
Reviewed By: scott.linder
Differential Revision: https://reviews.llvm.org/D155199
eopXD [Mon, 17 Jul 2023 02:24:09 +0000 (19:24 -0700)]
[Clang][RISCV] Guard RVV intrinsics types that is not available when ELEN < 64
(ELEN, LMUL) pairs of (8, mf8), (16, mf4), (32, mf2), (64, m1)
requires at least `zve64x`.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155414
Owen Pan [Wed, 19 Jul 2023 01:23:55 +0000 (18:23 -0700)]
[clang-format][doc] Replace single back quotes with double ones
Akira Hatanaka [Wed, 19 Jul 2023 01:15:56 +0000 (18:15 -0700)]
Fix types of arm64 MSVC __readx18/__writex18 intrinsics
Using `L` for type `long` results in clang passing 64-bit integers to
these intrinsics on LP64 operating systems. This isn't correct as the
intrinsics accept 32-bit integers.
Use `N` instead of `L` so that 32-bit integers are passed to the
intrinsics on LP64 operating systems too. This is the same fix as the
following two commits:
33703fb9f908113f93bd9af83a79eb56f5131735
afa47c91ce5085d446ebb5ac1312dc98b6a68a6c
Differential Revision: https://reviews.llvm.org/D155012
LLVM GN Syncbot [Wed, 19 Jul 2023 01:09:48 +0000 (01:09 +0000)]
[gn build] Port
ef70fe4d264d
Nico Weber [Wed, 19 Jul 2023 01:09:32 +0000 (21:09 -0400)]
Nico Weber [Wed, 19 Jul 2023 01:00:16 +0000 (21:00 -0400)]
Fangrui Song [Wed, 19 Jul 2023 00:57:31 +0000 (17:57 -0700)]
[ELF] --icf: switch to xxh3_64bits
for more efficient section content hashing. Also clean up the tests a
bit and properly test the formatting of --print-icf-sections.
Johannes Doerfert [Tue, 18 Jul 2023 23:33:31 +0000 (16:33 -0700)]
[OpenMP][NFCI] Avoid storing non-constant values in ICV
If we store a constant in an ICV it is easier for the optimizer to
propagate it. Since we often use the full block for the thread limit and
the parallel team size, we can instead replace that dynamic value with a
constant that otherwise cannot occur, here 0.
Johannes Doerfert [Tue, 18 Jul 2023 23:05:08 +0000 (16:05 -0700)]
[OpenMP][NFCI] Split assertion message from assertion expression
We ended up with `llvm.assume(icmp ne ptr as(4) null, as(4) @str)`
because the string in address space 4 was not known to be non-null.
There is no need to create these assumes.
Alex MacLean [Tue, 18 Jul 2023 23:44:26 +0000 (23:44 +0000)]
[cmake] Add -Wcast-qual to C flags if LLVM_ENABLE_WARNINGS is defined.
Disable this warning for specific cast in llvm_regcomp().
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D153911
David Blaikie [Tue, 18 Jul 2023 23:40:19 +0000 (23:40 +0000)]
PseudoObjectExpr: Prefer ArrayRef over iterator_range when iterating with pointers
Simpler to use ArrayRef directly here rather than a more
generic/customizable range helper like iterator_range
Craig Topper [Tue, 18 Jul 2023 23:39:40 +0000 (16:39 -0700)]
[RISCV] Simplify VROR_IV_V_X_I multiclass. NFC
Remove template parameters that always have their default value.
Michael Maitland [Tue, 18 Jul 2023 20:08:58 +0000 (13:08 -0700)]
[RISCV] Remove unused classes VPseudoTernary, VPseudoTernaryNoMaskNoPolicy, and VPseudoConversionW_V
These classes are dead and can be removed.
Differential Revision: https://reviews.llvm.org/D155634
Michael Jones [Tue, 11 Jul 2023 22:06:08 +0000 (15:06 -0700)]
[libc][NFC] reuse variable in printf string conv
The amount of spaces to pad with is stored in the variable
padding_spaces, previously the actual write calls used the same formula
to calculate the value. This simplifies and clarifies the values by just
reusing the variable.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D155113
Michael Jones [Wed, 12 Jul 2023 22:21:52 +0000 (15:21 -0700)]
[libc] Set min precision for strtofloat fuzz
MPFR has a minimum precision of 2, but the strtofloat fuzz sometimes
would request a precision of 1 for the case of the minimum subnormal.
This patch tells the fuzzer to ignore any case where the precision would
go below 2.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D155130
Po-yao Chang [Thu, 13 Jul 2023 15:42:51 +0000 (23:42 +0800)]
[Clang] Add warnings for CWG2521
1. Teach -Wuser-defined-literals to warn on using double underscores in
literal suffix identifiers.
2. Add -Wdeprecated-literal-operator to warn about the use of the first
grammar production of literal-operator-id, which defaults to off for now.
Differential Revision: https://reviews.llvm.org/D152632
Matthew Voss [Tue, 18 Jul 2023 23:13:58 +0000 (16:13 -0700)]
[lld] A Unified LTO Bitcode Frontend
The unified LTO pipeline creates a single LTO bitcode structure that can
be used by Thin or Full LTO. This means that the LTO mode can be chosen
at link time and that all LTO bitcode produced by the pipeline is
compatible, from an optimization perspective. This makes the behavior of
LTO a bit more predictable by normalizing the set of LTO features
supported by each LTO bitcode file.
Example usage:
clang -flto -funified-lto -fuse-ld=lld foo.c
clang -flto=thin -funified-lto -fuse-ld=lld foo.c
clang -c -flto -funified-lto foo.c # -flto={full,thin} are identical in
terms of compilation actions
clang -flto=thin -fuse-ld=lld foo.o # pass --lto=thin to ld.lld
clang -c -flto -funified-lto foo.c clang -flto -fuse-ld=lld foo.o
The RFC discussing the details and rational for this change is here:
https://discourse.llvm.org/t/rfc-a-unified-lto-bitcode-frontend/61774
Differential Revision: https://reviews.llvm.org/D123805
Rashmi Mudduluru [Tue, 18 Jul 2023 22:27:33 +0000 (15:27 -0700)]
[clang][docs] Defensively turn off exception behavior in dump_ast_matchers.py
Differential Revision: https://reviews.llvm.org/D155134
Rashmi Mudduluru [Fri, 14 Jul 2023 15:50:15 +0000 (08:50 -0700)]
[clang][docs] Update LibASTMatchersReference.html
Differential Revision: https://reviews.llvm.org/D155304
Yitzhak Mandelbaum [Tue, 18 Jul 2023 20:28:35 +0000 (20:28 +0000)]
[clang][dataflow] Add function to `WatchedLiteralsSolver` that reports whether the iteration limit has been reached.
This change provides a centralized record of whether the solver is
"exhausted". In general, once the solver is exhausted, further uses do not
produce meaningful conclusions. Clients can use this information, for example,
to choose to discard all results based on the solver, instead of trying to
distinguish those reached before the limit was reached. Providing it at in the
solver avoids the need to propagate it from each callsite to the client of the
solver.
Differential Revision: https://reviews.llvm.org/D155636
Amir Ayupov [Tue, 18 Jul 2023 21:29:34 +0000 (14:29 -0700)]
[BOLT] Switch to using layout order in YAML
Use layout order in YAML profile reading/writing. Preserve old behavior (DFS order)
under `-profile-use-dfs` option.
Reviewed By: spupyrev
Differential Revision: https://reviews.llvm.org/D155514
Amir Ayupov [Tue, 18 Jul 2023 21:29:29 +0000 (14:29 -0700)]
[BOLT][NFC] Rename icf-dfs option variable to ICFUseDFS
Rename to avoid collision with profile-use-dfs.
Differential Revision: https://reviews.llvm.org/D155513
Owen Pan [Fri, 14 Jul 2023 08:25:34 +0000 (01:25 -0700)]
[clang-format] Add TypeNames option to disambiguate types/objects
If a non-keyword identifier is found in TypeNames, then a *, &, or && that
follows it is annotated as TT_PointerOrReference.
Differential Revision: https://reviews.llvm.org/D155273
Valentin Clement [Tue, 18 Jul 2023 21:13:46 +0000 (14:13 -0700)]
[flang][openacc] Support static slice in reduction lowering
Lower static array slices reduction with the correct
type.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155519
Piotr Zegar [Tue, 18 Jul 2023 20:26:30 +0000 (20:26 +0000)]
[clang-tidy] Allow explicit throwing in bugprone-exception-escape for special functions
Functions declared explicitly with noexcept(false) or throw(exception)
will be excluded from the analysis, as even though it is not recommended for
functions like swap, main, move constructors and assignment operators,
and destructors, it is a clear indication of the developer's intention and
should be respected.
Fixes: #40583, #55143
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D153423
Sedenion [Tue, 18 Jul 2023 20:39:14 +0000 (13:39 -0700)]
[clang-format] Fix indent for selective formatting
The problem was that the LevelIndentTracker remembered
the indentation level of previous deeper levels when
leaving a scope. Afterwards, when it entered again a
deeper level, it blindly reused the previous
indentation level. In case the --lines option was used
such that the previous deeper level was not formatted,
that previous level was whatever happened to be there
in the source code. The formatter simply believed it.
This is fixed by letting the LevelIndentTracker forget
the previous deeper levels when stepping out of them
(=> change in LevelIndentTracker::nextLine()).
Note that this used to be the case until LLVM 14.0.6,
but was changed in https://reviews.llvm.org/D129064
(#56352) to fix a crash. Our commit here essentially
reverts that crash fix. It was incorrect/incomplete.
Fixes #58464.
Fixes #59178.
Fixes #62799.
Differential Revision: https://reviews.llvm.org/D151047
Daniil Suchkov [Tue, 18 Jul 2023 19:57:52 +0000 (12:57 -0700)]
[AArch64] NFC. Add a test exposing a bug in FixupStatepointCallerSaved pass
This pass doesn't take register classes into account, so it ends up
trying to spill a non-GP register onto stack which is not correct.
Christopher Ferris [Tue, 18 Jul 2023 02:33:16 +0000 (19:33 -0700)]
[scudo] Fix memtag tests.
A few memtag tests were using EXPECT_DEBUG_DEATH which executes the
statement unless NDEBUG is set. This meant the statement would
cause an abort, but the EXPECT_DEATH part was not done. Change these
to simply EXPECT_DEATH, these tests already verify that SCUDO_DEBUG
is set before checking for DEATH.
Reviewed By: Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D155538
Amanda Tang [Tue, 18 Jul 2023 20:34:08 +0000 (20:34 +0000)]
[ODS] Quick fix
Quick fix for a failing test in https://reviews.llvm.org/rG5267ed05bc4612e91409d63b4dbc4e01751acb75
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D155637
Fangrui Song [Tue, 18 Jul 2023 20:36:11 +0000 (13:36 -0700)]
[Support] Add llvm::xxh3_64bits
ld.lld SHF_MERGE|SHF_STRINGS duplicate elimination is computation heavy
and utilitizes llvm::xxHash64, a simplified version of XXH64.
Externally many sources confirm that a new variant XXH3 is much faster.
I have picked a few hash implementations and computed the
proportion of time spent on hashing in the overall link time (a debug
build of clang 16 on a machine using AMD Zen 2 architecture):
* llvm::xxHash64: 3.63%
* official XXH64 (`#define XXH_VECTOR XXH_SCALAR`): 3.53%
* official XXH3_64bits (`#define XXH_VECTOR XXH_SCALAR`): 1.21%
* official XXH3_64bits (default, essentially `XXH_SSE2`): 1.22%
* this patch llvm::xxh3_64bits: 1.19%
The remaining part of lld remains unchanged. Consequently, a lower ratio
indicates that hashing is faster. Therefore, it is evident that XXH3 from xxhash
is significantly faster than both the official version and our llvm::xxHash64.
(
string length: count
1-3: 393434
4-8: 2084056
9-16: 2846249
17-128: 5598928
129-240: 1317989
241-: 328058
)
This patch adds heavily simplified https://github.com/Cyan4973/xxHash,
taking account of many simplification ideas from Devin Hussey's xxhash-clean.
Important x86-64 optimization ideas:
* Make XXH3_len_129to240_64b and XXH3_hashLong_64b noinline
* Unroll XXH3_len_17to128_64b
* __restrict does not affect Clang code generation
Beside SHF_MERGE|SHF_STRINGS duplicate elimination, llvm/ADT/StringMap.h
StringMapImpl::LookupBucketFor and a few places in lld can potentially be
accelerated by switching to llvm::xxh3_64bits.
Link: https://github.com/llvm/llvm-project/issues/63750
Reviewed By: serge-sans-paille
Differential Revision: https://reviews.llvm.org/D154812
Sedenion [Tue, 18 Jul 2023 20:23:45 +0000 (13:23 -0700)]
[clang-format] Refactoring and asserts in LevelIndentTracker. (NFC)
adjustToUnmodifiedLine: The code does something only for non-PP-directives.
This is now reflected by putting the if-check to the top. This also ensures
that the assert() there is executed only if IndentForLevel is actually
accessed.
getIndent(): assert valid index into IndentForLevel.
Added explanation regarding the intention of IndentForLevel.
Differential Revision: https://reviews.llvm.org/D155094
Alexey Bataev [Mon, 17 Jul 2023 16:47:01 +0000 (09:47 -0700)]
[SLP][NFC]Improve compile-time by using map {TreeEntry *, Instruction *}
in getLastInstructionInBundle(), NFC.
Instead of building EntryToLastInstruction before the vectorization,
build it automatically during the calls to getLastInstructionInBundle()
function.
Mark de Wever [Tue, 18 Jul 2023 20:21:10 +0000 (22:21 +0200)]
[libc++][test] Fixes transitives includes.
Andrew Gozillon [Tue, 18 Jul 2023 20:08:58 +0000 (15:08 -0500)]
[Flang][OpenMP] Disable function filtering for host
This should be a temporary fix while we work
towards enabling function filtering for host
again via a future patch.
Mikhail Goncharov [Tue, 18 Jul 2023 20:05:14 +0000 (22:05 +0200)]
[bazel] fix layering check to run bazel with 16.x
Preparation to update bazel builder to use LLVM 16 release
where layering check was enabled https://reviews.llvm.org/D132779
Current setup missed some backsliding in layering check as it has
only on for projects with the check enforced.
Disabled it completely for libc and fixed for DWARFLinkerParallel.
It would be great to re-enable it for libc later.
Craig Topper [Tue, 18 Jul 2023 19:55:26 +0000 (12:55 -0700)]
[RISCV] Remove unnecessary _32 and _64 suffixes from some scalar crypto builtins.
The names of these builtins aren't ambiguous so they don't need the suffix.
Mark de Wever [Tue, 18 Jul 2023 19:49:26 +0000 (21:49 +0200)]
[libc++][print] Fixes tests.
The exception message improvements for `<format>` were not applied to
print. The issue has been reported by Ian Anderson.
River Riddle [Tue, 18 Jul 2023 08:34:57 +0000 (01:34 -0700)]
[mlir-lsp] Add client information to the InitializationParams
This is specified in the spec, but we just never really needed it. This
allows for users of the LSP libraries to inspect information about the
client that is connected to the server.
Differential Revision: https://reviews.llvm.org/D155566
Philip Reames [Tue, 18 Jul 2023 19:22:08 +0000 (12:22 -0700)]
[RISCV] Minor style cleanups in post ISEL combines
Mark de Wever [Mon, 10 Jul 2023 05:59:58 +0000 (07:59 +0200)]
[libc++][format] Fixes times before epoch.
The number of days should be rounded down, for both positive and
negative times since epoch. The original code truncated, which is
correct for positive values, but wrong for negative values.
Depends on D138826
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D154865
Tulio Magno Quites Machado Filho [Tue, 18 Jul 2023 19:09:50 +0000 (16:09 -0300)]
[clang] scan-view: Remove unused python import
Python's module imp is not being used and is not available on Python
3.12 anymore.
Reviewed By: tbaeder
Differential Revision: https://reviews.llvm.org/D155192
Mark de Wever [Sun, 4 Jun 2023 19:32:10 +0000 (21:32 +0200)]
[libc++][format] Improves diagnostics.
Improves both the compile-time and run-time errors.
At compile-time it does a bit more work to get more specific errors.
This could be done at run-time too, but that has a performance penalty.
Since it's expected most use-cases use format* instead of vformat* the
compile-time errors are more common.
For example when using
std::format_to("{:-c}", 42);
Before compile output would contain
std::__throw_format_error("The format-spec should consume the input or end with a '}'");
Now it contains
std::__throw_format_error("The format specifier does not allow the sign option");
Given a better indication the sign option is not allowed. Note the
output is still not user-friendly; C++ doesn't have good facilities to
generate nice messages from the library.
In general all messages have been reviewed and improved, using a more
consistent style and using less terms used in the standard. For example
format-spec -> format specifier
arg-id -> argument index
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D152624
Craig Topper [Tue, 18 Jul 2023 18:15:44 +0000 (11:15 -0700)]
[RISCV] Remove 'Z' from Zbb builtin type strings. NFC
'Z' means uint32_t, but 'i' is always 32 bits for RISC-V so
we don't need this.
Kirill Stoimenov [Fri, 14 Jul 2023 20:07:29 +0000 (20:07 +0000)]
[HWASAN][LSAN] Fix false positive memory leak reports on X86_64
Before this patch when running HWASAN on x86_64 with with memory tagging support we got a bunch of false memory leak reports. The reason for that is that the heuristic used to detect if an 8 bytes could be a user pointer was not valid when memory tagging is used as the top byte could contain non-zero information.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D155338
Mark de Wever [Sun, 4 Jun 2023 19:32:10 +0000 (21:32 +0200)]
[libc++][format] Improves run-time diagnostics.
After parsing a std-format-spec it's validated, depending on the type used some
format options are not allowed. This improves the error messages in the
exceptions thrown upon failure.
Depends on D155364
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D155366