Felipe de Azevedo Piovezan [Fri, 14 Jul 2023 17:34:27 +0000 (13:34 -0400)]
[lldb][NFC] Factor out CommandObject code filtering results based on scope
We will need this code in a subsequent commit.
Differential Revision: https://reviews.llvm.org/D155332
Simon Pilgrim [Wed, 19 Jul 2023 13:04:30 +0000 (14:04 +0100)]
[X86] Add test coverage for Issue #63946
Simon Pilgrim [Wed, 19 Jul 2023 12:55:11 +0000 (13:55 +0100)]
[X86] matchUnaryShuffle - match SIGN_EXTEND_VECTOR_INREG patterns for 'all-signbits' sources
Adapt the existing ANY/ZERO_EXTEND_VECTOR_INREG shuffle matching to also recognise SIGN_EXTEND_VECTOR_INREG patterns to handle cases where we're effectively "splatting" all-signbits sources.
John Brawn [Wed, 5 Jul 2023 15:21:51 +0000 (16:21 +0100)]
[ARM] Correctly handle execute-only in EmitStructByval
Currently when compiling for an execute-only target without movt then
EmitStructByval will generate a constant pool load which isn't
compatible with execute-only. Handle this by emitting tMOVi32imm,
and also simplify the existing movt handling by emitting t2MOVi32imm
or MOVi32imm.
Differential Revision: https://reviews.llvm.org/D154944
John Brawn [Thu, 6 Jul 2023 09:43:40 +0000 (10:43 +0100)]
[ARM] Restructure MOVi32imm expansion to not do pointless instructions
The expansion of the various MOVi32imm pseudo-instructions works by
splitting the operand into components (either halfwords or bytes) and
emitting instructions to combine those components into the final
result. When the operand is an immediate with some components being
zero this can result in pointless instructions that just add zero.
Avoid this by restructuring things so that a separate function handles
splitting the operand into components, then don't emit the component
if it is a zero immediate. This is straightforward for movw/movt,
where we just don't emit the movt if it's zero, but the thumb1
expansion using mov/add/lsl is more complex, as even when we don't
emit a given byte we still need to get the shift correct.
Differential Revision: https://reviews.llvm.org/D154943
Ties Stuij [Wed, 19 Jul 2023 10:26:01 +0000 (11:26 +0100)]
[ARM] don't emit constant pool for Thumb1 XO/stack guard combo
Currently for armv6-m and armv8-m.baseline, we emit constant pool code when we
use execute-only (XO) in combination with stack guards.
XO is a new feature for armv6-m, and this patch is part of a series of patches
that substitutes constant pool generation with the tMOVi32imm equivalent.
However XO for armv8-m.baseline has been available for about 6 years, and so
for armv8-m.baseline this is a bugfix.
Reviewed By: simonwallis2, olista01
Differential Revision: https://reviews.llvm.org/D155170
Kelvin Li [Tue, 18 Jul 2023 14:40:39 +0000 (10:40 -0400)]
[flang] Simplify macros for the vec_sld and vec_sldw intrinsics
The ignore_tkr directive is applied to the third argument so that the number of
interfaces can be reduced.
Differential Revision: https://reviews.llvm.org/D155624
Carlos Galvez [Mon, 17 Jul 2023 19:54:23 +0000 (19:54 +0000)]
[clang-tidy] Warn only for copyable/movable classes in cppcoreguidelines-avoid-const-or-ref-members
Since that's what the guidelines require.
Fixes #63733
Differential Revision: https://reviews.llvm.org/D155625
Piyou Chen [Wed, 19 Jul 2023 08:58:02 +0000 (01:58 -0700)]
[RISCV] Replace zihintntl with zicond in ISAInfo unittest
Some ISAInfo unittest base on experimental-zihintntl, but zihintntl will become none-experimental. This patch use another experimental extension zicond to replace zihintntl.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D155673
pvanhout [Tue, 11 Jul 2023 10:22:57 +0000 (12:22 +0200)]
[TableGen] Deprecate old GI Combiner Emitter
Will be removed in a month or so.
Reviewed By: aemerson
Differential Revision: https://reviews.llvm.org/D154939
Igor Kirillov [Mon, 26 Jun 2023 17:26:43 +0000 (17:26 +0000)]
[CodeGen] Extend ComplexDeinterleaving pass to recognise patterns using integer types
AArch64 introduced CMLA and CADD instructions as part of SVE2. This
change allows to generate such instructions when this architecture
feature is available.
Differential Revision: https://reviews.llvm.org/D153808
Simon Pilgrim [Wed, 19 Jul 2023 10:56:14 +0000 (11:56 +0100)]
[DAG] hoistLogicOpWithSameOpcodeHands - add support for SIGN_EXTEND_INREG nodes.
This can reuse the existing *_EXTEND node handling (with special handling for the valuetype arg)
Ivan Kosarev [Wed, 19 Jul 2023 10:34:25 +0000 (11:34 +0100)]
[AMDGPU] Combine the SDAG and GISel versions of the fmed3.ll test.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D155590
Ivan Kosarev [Wed, 19 Jul 2023 10:00:13 +0000 (11:00 +0100)]
[AMDGPU][AsmParser][NFC] Translate parsed DS instructions to MCInsts automatically.
Part of <https://github.com/llvm/llvm-project/issues/62629>.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D155620
Jie Fu [Wed, 19 Jul 2023 09:50:11 +0000 (17:50 +0800)]
[InstrProf] Ignore -Wcast-qual after D153911 to fix build failure (NFC)
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:46:60: error: cast from 'const char *' to 'struct __llvm_profile_header *' drops const qualifier [-Werror,-Wcast-qual]
__llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:49:30: error: cast from 'const char *' to 'struct __llvm_profile_data *' drops const qualifier [-Werror,-Wcast-qual]
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:77:41: error: cast from 'const struct __llvm_profile_data *' to 'struct __llvm_profile_data *' drops const qualifier [-Werror,-Wcast-qual]
DstData = (__llvm_profile_data *)__llvm_profile_begin_data();
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:109:60: error: cast from 'const char *' to 'struct __llvm_profile_header *' drops const qualifier [-Werror,-Wcast-qual]
__llvm_profile_header *Header = (__llvm_profile_header *)ProfileData;
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:116:30: error: cast from 'const char *' to 'struct __llvm_profile_data *' drops const qualifier [-Werror,-Wcast-qual]
(__llvm_profile_data *)(ProfileData + sizeof(__llvm_profile_header) +
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:129:40: error: cast from 'const struct __llvm_profile_data *' to 'struct __llvm_profile_data *' drops const qualifier [-Werror,-Wcast-qual]
DstData = (__llvm_profile_data *)__llvm_profile_begin_data(),
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:179:34: error: cast from 'const char *' to 'struct ValueProfData *' drops const qualifier [-Werror,-Wcast-qual]
VPMergeHook((ValueProfData *)SrcValueProfData, DstData);
^
/data/llvm-project/compiler-rt/lib/profile/InstrProfilingMerge.c:181:46: error: cast from 'const char *' to 'struct ValueProfData *' drops const qualifier [-Werror,-Wcast-qual]
SrcValueProfData + ((ValueProfData *)SrcValueProfData)->TotalSize;
^
...
Simon Pilgrim [Wed, 19 Jul 2023 09:50:07 +0000 (10:50 +0100)]
[DAG] hoistLogicOpWithSameOpcodeHands - add support for *_EXTEND_VECTOR_INREG nodes.
This can reuse the existing *_EXTEND node handling.
Mikhail Goncharov [Wed, 19 Jul 2023 09:21:42 +0000 (11:21 +0200)]
[bazel] remove PythonAttr TD after
67a910bbff772ebf4c47e8b434b59cdc4820bb68
Differential Revision: https://reviews.llvm.org/D155686
Guray Ozen [Wed, 19 Jul 2023 08:29:41 +0000 (10:29 +0200)]
[mlir][nvvm] Introduce Syncronization Ops for WGMMA
This work introduces : `wgmma.fence.aligned`, `wgmma.commit.group.sync.aligned` and `wgmma.wait.group.sync.aligned` Ops. They are used to syncronize warpgroup level matrix multiply-accumulate instructions, as known as WGMMA.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D155676
Jay Foad [Wed, 19 Jul 2023 07:29:14 +0000 (08:29 +0100)]
[AMDGPU] Insert s_nop before s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
Differential Revision: https://reviews.llvm.org/D155681
Jay Foad [Mon, 17 Jul 2023 15:20:32 +0000 (16:20 +0100)]
[ARM] Add a regression test for D154281
This is a reduced version of one of the tests that was broken by the
original commit of D154281 "[CodeGen] Store SP adjustment in
MachineBasicBlock. NFCI.".
Differential Revision: https://reviews.llvm.org/D155471
Jingu Kang [Wed, 19 Jul 2023 09:30:30 +0000 (10:30 +0100)]
Revert "[MachineLICM] Handle Subloops"
This reverts commit
33e60484d750291e99301e29e60fe72c8fa48ccd.
Shivam Gupta [Wed, 19 Jul 2023 09:19:43 +0000 (14:49 +0530)]
[clang][Docs] Added release note for D142609
Nuno Lopes [Wed, 19 Jul 2023 09:24:41 +0000 (10:24 +0100)]
[VectorCombine] Use poison insteaf of undef as placeholder [NFC]
These vector lanes are never accessed. They are used for shifting a value into the right lane
and therefore only 1 value of the whole vector is actually used
khei4 [Tue, 18 Jul 2023 09:58:20 +0000 (18:58 +0900)]
Reapply: [MemCpyOpt] implement single BB stack-move optimization which unify the static unescaped allocas
This reverts commit
8f3864ba4323a253bcf29825d23cd325b52c4106.
Differential Revision: https://reviews.llvm.org/D153453
khei4 [Tue, 18 Jul 2023 09:55:26 +0000 (18:55 +0900)]
[MemCpyOpt] add terminator user test for D153453(NFC)
Differential Revision: https://reviews.llvm.org/D155571
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