Simon Moll [Mon, 6 Dec 2021 15:44:36 +0000 (16:44 +0100)]
Revert "[Clang] Ignore CLANG_DEFAULT_LINKER for custom-linker toolchains"
Reverted until all Toolchains are fixed for the new behavior.
This reverts commit
34a43f2115af79f896c889433c57f3b400e9f2c6.
Jon Chesterfield [Mon, 6 Dec 2021 15:26:17 +0000 (15:26 +0000)]
[openmp] Enable tests on new devicertl on amdgpu
Reviewed By: pdhaliwal
Differential Revision: https://reviews.llvm.org/D114891
Ties Stuij [Mon, 6 Dec 2021 15:03:14 +0000 (15:03 +0000)]
[ARM][clang] Add back branch protection tests
When committing the PACBTI-M frontend support
patch (https://reviews.llvm.org/D112421), the tests in
arm-invalid-branch-protection.c were failing on certain test setups, so it was
removed to make the llvm test suite pass. The fix is to require
arm-registered-target.
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
Reviewed By: erichkeane
Differential Revision: https://reviews.llvm.org/D115141
Nikita Popov [Mon, 6 Dec 2021 14:59:28 +0000 (15:59 +0100)]
[llvm-c] Avoid use of deprecated APIs in unit tests
As pointed out in https://reviews.llvm.org/D114936#3173327,
unit tests were still using deprecated C APIs.
James Farrell [Wed, 1 Dec 2021 16:54:32 +0000 (16:54 +0000)]
Use VersionTuple for parsing versions in Triple, fixing issues that caused the original change to be reverted. This makes it possible to distinguish between "16" and "16.0" after parsing, which previously was not possible.
This reverts commit
40d5eeac6cd89a2360c3ba997cbaa816abca828c.
Differential Revision: https://reviews.llvm.org/D114885
Chuanqi Xu [Mon, 6 Dec 2021 14:52:51 +0000 (22:52 +0800)]
[Coroutines] Handle CallBrInst in SalvageDebugInfo
Reviewed by: StephenTozer
Differential Revision: https://reviews.llvm.org/D115139
Valentin Clement [Mon, 6 Dec 2021 14:51:45 +0000 (15:51 +0100)]
[fir] Add fircg.ext_array_coor conversion
This patch adds the conversion pattern for the fircg.ext_array_coor
operation. It applies the address arithmetic on a dynamically shaped, shifted
and/or sliced array.
This patch is part of the upstreaming effort from fir-dev branch.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D113968
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Jean Perier <jperier@nvidia.com>
Jake Egan [Mon, 6 Dec 2021 14:26:04 +0000 (09:26 -0500)]
[MC] Add emitXCOFFSymbolLinkageWithVisibility to MCNullStreamer
This patch adds `emitXCOFFSymbolLinkageWithVisibility` to MCNullStreamer to fix llvm_unreachable getting reached when using option `-filetype=null` on AIX.
Reviewed By: DiggerLin
Differential Revision: https://reviews.llvm.org/D114876
Pavel Labath [Fri, 26 Nov 2021 08:00:35 +0000 (09:00 +0100)]
[lldb/qemu] Add support for pty redirection
Lldb uses a pty to read/write to the standard input and output of the
debugged process. For host processes this would be automatically set up
by Target::FinalizeFileActions. The Qemu platform is in a unique
position of not really being a host platform, but not being remote
either. It reports IsHost() = false, but it is sufficiently host-like
that we can use the usual pty mechanism.
This patch adds the necessary glue code to enable pty redirection. It
includes a small refactor of Target::FinalizeFileActions and
ProcessLaunchInfo::SetUpPtyRedirection to reduce the amount of
boilerplate that would need to be copied.
I will note that qemu is not able to separate output from the emulated
program from the output of the emulator itself, so the two will arrive
intertwined. Normally this should not be a problem since qemu should not
produce any output during regular operation, but some output can slip
through in case of errors. This situation should be pretty obvious (to a
human), and it is the best we can do anyway.
For testing purposes, and inspired by lldb-server tests, I have extended
the mock emulator with the ability "program" the behavior of the
"emulated" program via command-line arguments.
Differential Revision: https://reviews.llvm.org/D114796
Pavel Labath [Mon, 6 Dec 2021 13:58:39 +0000 (14:58 +0100)]
[lldb/lua] Add a file that should have been a part of
a52af6d3
Pavel Labath [Mon, 6 Dec 2021 13:56:40 +0000 (14:56 +0100)]
[lldb] Remove extern "C" from lldb-swig-lua interface
This is the lua equivalent of
9a14adeae0.
Michał Górny [Thu, 2 Dec 2021 17:34:28 +0000 (18:34 +0100)]
[lldb] [Process/elf-core] Disable for FreeBSD vmcores
Recognize FreeBSD vmcores (kernel core dumps) through OS ABI = 0xFF
+ ELF version = 0, and do not process them via the elf-core plugin.
While these files use ELF as a container format, they contain raw memory
dump rather than proper VM segments and therefore are not usable
to the elf-core plugin.
Differential Revision: https://reviews.llvm.org/D114967
Jon Chesterfield [Mon, 6 Dec 2021 13:25:22 +0000 (13:25 +0000)]
[openmp][amdgpu] Disable tests requiring USM on amdgcn
These tests tend to hang or crash on hardware that doesn't
support USM. Disabling them helps diagnose other issues. To safely
enable we require a means of testing whether USM is expected to work.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D115144
Florian Hahn [Mon, 6 Dec 2021 13:06:11 +0000 (13:06 +0000)]
[DSE] Add additional memset_chk tests.
Alex Zinenko [Fri, 3 Dec 2021 12:13:43 +0000 (13:13 +0100)]
[mlir] Avoid needlessly converting LLVM named structs with compatible elements
Conversion of LLVM named structs leads to them being renamed since we cannot
modify the body of the struct type once it is set. Previously, this applied to
all named struct types, even if their element types were not affected by the
conversion. Make this behvaior only applicable when element types are changed.
This requires making the LLVM dialect type-compatibility check recursively look
at the element types (arguably, it should have been doing than since the moment
the LLVM dialect type system stopped being closed). In addition, have a more
lax check for outer types only to avoid repeated check when necessary (e.g.,
parser, verifiers that are going to also look at the inner type).
Reviewed By: wsmoses
Differential Revision: https://reviews.llvm.org/D115037
Simon Moll [Mon, 6 Dec 2021 10:00:38 +0000 (11:00 +0100)]
[Clang] Ignore CLANG_DEFAULT_LINKER for custom-linker toolchains
Before, the CLANG_DEFAULT_LINKER cmake option was a global override for
the linker that shall be used on all toolchains. The linker binary
specified that way may not be available on toolchains with custom
linkers. Eg, the only linker for VE is named 'nld' - any other linker
invalidates the toolchain.
This patch removes the hard override and instead lets the generic
toolchain implementation default to CLANG_DEFAULT_LINKER. Toolchains
can now deviate with a custom linker name or deliberatly default to
CLANG_DEFAULT_LINKER.
Reviewed By: MaskRay, phosek
Differential Revision: https://reviews.llvm.org/D115045
Dmitry Vyukov [Mon, 6 Dec 2021 11:24:10 +0000 (12:24 +0100)]
tsan: disable dlopen_static_tls.cpp test on powerpc64
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D115142
Sander de Smalen [Mon, 6 Dec 2021 11:14:27 +0000 (11:14 +0000)]
[LV] Pass compare predicate to getCmpSelInstrCost.
If the condition of a select is a compare, pass its predicate to
TTI::getCmpSelInstrCost to get a more accurate cost value instead
of passing BAD_ICMP_PREDICATE.
I noticed that the commit message from D90070 had a comment about the
vectorized select predicate possibly being composed of other compares with
different predicate values, but I wasn't able to construct an example
where this was an actual issue. If this is an issue, I guess we could
add another check that the block isn't predicated for any reason.
Reviewed By: dmgreen, fhahn
Differential Revision: https://reviews.llvm.org/D114646
Dmitri Gribenko [Fri, 19 Nov 2021 10:54:50 +0000 (11:54 +0100)]
[clang][docs][dataflow] Added an introduction to dataflow analysis
This documentation supports the dataflow analysis framework (see "[RFC]
A dataflow analysis framework for Clang AST" on cfe-dev).
Since the implementation of the framework has not been committed yet,
right now the doc describes dataflow analysis in general.
Since this is the first markdown document in clang/docs, I added support
for Markdown to clang/docs/conf.py in the same way as it is done in
llvm/docs.
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D114231
Kazushi (Jam) Marukawa [Sun, 5 Dec 2021 18:52:26 +0000 (03:52 +0900)]
[VE] Support VE specific data directives in MC
Support VE specific data directives, .word/.long/.llong, in MC layer.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D115120
Ties Stuij [Mon, 6 Dec 2021 11:00:10 +0000 (11:00 +0000)]
[ARM] Implement setjmp BTI placement for PACBTI-M
This patch intends to guard indirect branches performed by longjmp
by inserting BTI instructions after calls to setjmp.
Calls with 'returns-twice' are lowered to a new pseudo-instruction
named t2CALL_BTI that is later expanded to a bundle of {tBL,t2BTI}.
This patch is part of a series that adds support for the PACBTI-M extension of
the Armv8.1-M architecture, as detailed here:
https://community.arm.com/arm-community-blogs/b/architectures-and-processors-blog/posts/armv8-1-m-pointer-authentication-and-branch-target-identification-extension
The PACBTI-M specification can be found in the Armv8-M Architecture Reference
Manual:
https://developer.arm.com/documentation/ddi0553/latest
The following people contributed to this patch:
- Alexandros Lamprineas
- Ties Stuij
Reviewed By: labrinea
Differential Revision: https://reviews.llvm.org/D112427
Kazushi (Jam) Marukawa [Sun, 28 Nov 2021 16:10:45 +0000 (01:10 +0900)]
[VE] Change to use R_VE_SREL32
Change to use R_VE_SREL32 for relative branch instructions instead of
R_VE_PC_LO32 in order to check ranges of relative branch isntructions
at link time correctly.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D115097
David Green [Mon, 6 Dec 2021 11:06:25 +0000 (11:06 +0000)]
[ARM] Add a vrinta.f16.f16 alias
The v8.1-m ARMARM uses the vrinta.f16.f16 names, as opposed to
vrinta.f16. This adds an alias for it in the same way that we have for
f32 and f64.
Differential Revision: https://reviews.llvm.org/D68127
Djordje Todorovic [Mon, 6 Dec 2021 10:58:50 +0000 (02:58 -0800)]
[NFC][LICM] Update the comment in the scalar-promote.ll
The comment was stale after the https://reviews.llvm.org/D113289
was committed.
Kazushi (Jam) Marukawa [Fri, 19 Nov 2021 11:43:19 +0000 (20:43 +0900)]
[VE] Support multiple architectures installation
Change C++ header files placement to support multiple LLVM_RUNTIME_TARGETS
build. Also modifies regression test for it.
Reviewed By: simoll
Differential Revision: https://reviews.llvm.org/D114527
Kristina Bessonova [Mon, 6 Dec 2021 10:19:09 +0000 (12:19 +0200)]
[clang][DebugInfo] Allow function-local statics and types to be scoped within a lexical block
This is almost a reincarnation of https://reviews.llvm.org/D15977 originally
implemented by Amjad Aboud. It was discussed on llvm-dev [0], committed
with its backend counterpart [1], but finally reverted [2].
This patch makes clang to emit debug info for function-local static variables,
records (classes, structs and unions) and typdefs correctly scoped if
those function-local entites defined within a lexical (bracketed) block.
Before this patch, clang emits all those entities directly scoped in
DISubprogram no matter where they were really defined, causing
debug info loss (reported several times in [3], [4], [5]).
[0] https://lists.llvm.org/pipermail/llvm-dev/2015-November/092551.html
[1] https://reviews.llvm.org/rG30e7a8f694a19553f64b3a3a5de81ce317b9ec2f
[2] https://reviews.llvm.org/rGdc4531e552af6c880a69d226d3666756198fbdc8
[3] https://bugs.llvm.org/show_bug.cgi?id=19238
[4] https://bugs.llvm.org/show_bug.cgi?id=23164
[5] https://bugs.llvm.org/show_bug.cgi?id=44695
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D113743
Matthias Springer [Mon, 6 Dec 2021 09:06:41 +0000 (18:06 +0900)]
[mlir][linalg][bufferize][NFC] Utilize isWritable for FuncOps
This is a cleanup of ModuleBufferization. Instead of storing information about writable function arguments in BufferizationAliasInfo, we can use isWritable and make the decision there, based on dialect-specifc bufferization state.
Differential Revision: https://reviews.llvm.org/D114930
Balazs Benics [Mon, 6 Dec 2021 09:20:17 +0000 (10:20 +0100)]
[analyzer] Ignore flex generated files
Some projects [1,2,3] have flex-generated files besides bison-generated
ones.
Unfortunately, the comment `"/* A lexical scanner generated by flex */"`
generated by the tools is not necessarily at the beginning of the file,
thus we need to quickly skim through the file for this needle string.
Luckily, StringRef can do this operation in an efficient way.
That being said, now the bison comment is not required to be at the very
beginning of the file. This allows us to detect a couple more cases
[4,5,6].
Alternatively, we could say that we only allow whitespace characters
before matching the bison/flex header comment. That would prevent the
(probably) unnecessary string search in the buffer. However, I could not
verify that these tools would actually respect this assumption.
Additionally to this, e.g. the Twin project [1] has other non-whitespace
characters (some preprocessor directives) before the flex-generated
header comment. So the heuristic in the previous paragraph won't work
with that.
Thus, I would advocate the current implementation.
According to my measurement, this patch won't introduce measurable
performance degradation, even though we will do 2 linear scans.
I introduce the ignore-bison-generated-files and
ignore-flex-generated-files to disable skipping these files.
Both of these options are true by default.
[1]: https://github.com/cosmos72/twin/blob/master/server/rcparse_lex.cpp#L7
[2]: https://github.com/marcauresoar/make-examples/blob/
22362cdcf9dd7c597b5049ce7f176621e2e9ac7a/sandbox/count-words/lexer.c#L6
[3]: https://github.com/vladcmanea/2nd-faculty-year-Formal-Languages---Automata-assignments/blob/
11abdf64629d9eb741438ba69f04636769d5a374/lab1/lex.yy.c#L6
[4]: https://github.com/KritikaChoudhary/System-Software-Lab/blob/
47f5b2cfe2a2738fd54eae9f8439817f6a22034e/B_yacc/1/y1.tab.h#L2
[5]: https://github.com/VirtualMonitor/VirtualMonitor/blob/
71d1bf9b1e7b392a7bd0c73dc217138dc5865651/src/VBox/Additions/x11/x11include/xorg-server-1.8.0/parser.h#L2
[6]: https://github.com/bspaulding/DrawTest/blob/
3f773ceb13de14275429036b9cbc5aa19e29bab9/Framework/OpenEars.framework/Versions/A/Headers/jsgf_parser.h#L2
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D114510
Matthias Springer [Mon, 6 Dec 2021 08:40:08 +0000 (17:40 +0900)]
[mlir][linalg][bufferize] Remove buffer equivalence from bufferize
Remove all function calls related to buffer equivalence from bufferize implementations.
Add a new PostAnalysisStep for scf.for that ensures that yielded values are equivalent to the corresponding BBArgs. (This was previously checked in `bufferize`.) This will be relaxed in a subsequent commit.
Note: This commit changes two test cases. These were broken by design
and should not have passed. With the new scf.for PostAnalysisStep, this
bug was fixed.
Differential Revision: https://reviews.llvm.org/D114927
Paulo Matos [Sun, 5 Dec 2021 12:50:47 +0000 (13:50 +0100)]
[WebAssembly] Implementation of intrinsic for ref.null and HeapType removal
This patch implements the intrinsic for ref.null.
In the process of implementing int_wasm_ref_null_func() and
int_wasm_ref_null_extern() intrinsics, it removes the redundant
HeapType.
This also causes the textual assembler syntax for ref.null to
change. Instead of receiving an argument: `func` or `extern`, the
instruction mnemonic is either ref.null_func or ref.null_extern,
without the need for a further operand.
Reviewed By: tlively
Differential Revision: https://reviews.llvm.org/D114979
MaheshRavishankar [Mon, 6 Dec 2021 08:35:47 +0000 (08:35 +0000)]
[mlir] Add default implementations for methods in `TilingInterface`.
Adding the default implementation of `getLoopIteratorTypes` and
`getLoopBounds` allows ExternalModels to override these methods.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D115101
Matthias Springer [Mon, 6 Dec 2021 08:25:13 +0000 (17:25 +0900)]
[mlir][linalg][bufferize][NFC] Collect equivalent FuncOp BBArgs in PostAnalysisStep
Collect equivalent BBArgs right after the equivalence analysis of the FuncOp and before bufferizing. This is in preparation of decoupling bufferization from aliasInfo.
Also gather equivalence info for CallOps, which was missing in the
previous commit.
Differential Revision: https://reviews.llvm.org/D114847
Nikita Popov [Sun, 4 Jul 2021 16:14:09 +0000 (18:14 +0200)]
[llvm-c] Add header deprecations
This adds support for header deprecation using
LLVM_ATTRIBUTE_C_DEPRECATED (note that we can't use
LLVM_ATTRIBUTE_DEPRECATED, which is C++ specific). This will not
help people using the FFI interface, but may help people using the
C headers.
Differential Revision: https://reviews.llvm.org/D114936
Michal Terepeta [Mon, 6 Dec 2021 07:59:49 +0000 (07:59 +0000)]
[mlir][Vector] Support 0-D vectors in `ConstantMaskOp`
To support creating both a mask with just a single `true` and `false` values,
I had to relax the restriction in the verifier that the rank is always equal to
the length of the attribute array, in other words, we now allow:
- `vector.constant_mask [0] : vector<i1>` which gets lowered to
`arith.constant dense<false> : vector<i1>`
- `vector.constant_mask [1] : vector<i1>` which gets lowered to
`arith.constant dense<true> : vector<i1>`
(the attribute list for the 0-D case must be a singleton containing
either `0` or `1`)
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D115023
gysit [Mon, 6 Dec 2021 07:25:24 +0000 (07:25 +0000)]
[mlir][linalg] Pad independent of application order (NFC).
This revision makes the padding pattern independent of the application order. It addresses the concern that we cannot rely on the execution order of the greedy rewriter (https://reviews.llvm.org/D114689). Instead, the pattern is updated to apply repeatedly till all operations are padded.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D114851
Tan S. B [Mon, 6 Dec 2021 06:32:48 +0000 (22:32 -0800)]
[clang-format] Adjust braced list detection
This avoids mishandling nested compound statements that are followed by another compound statement.
Fixes https://llvm.org/PR38314 and https://llvm.org/PR48305.
Differential Revision: https://reviews.llvm.org/D114583
Zi Xuan Wu [Mon, 6 Dec 2021 05:36:20 +0000 (13:36 +0800)]
[CSKY] Add compressed instruction mapping between 32-bit and 16-bit instruction
Add all CompressPat to map instructions between 16-bit and 32-bit with using the CompressInstEmitter infra.
Although it's only used in asm printer, also enable it in asm parser to debug mapping when -enable-csky-asm-compressed-inst is on.
Differential Revision: https://reviews.llvm.org/D115026
Noah Shutty [Mon, 6 Dec 2021 05:39:05 +0000 (05:39 +0000)]
Revert "[llvm] [Debuginfo] Debuginfod client library."
This reverts commit
af69947e7028274573cfc927aabead8326b63367 because it
caused buildbot failures.
Noah Shutty [Mon, 6 Dec 2021 04:27:53 +0000 (04:27 +0000)]
[llvm] [Debuginfo] Debuginfod client library.
This adds a Debuginfod library containing the `fetchDebuginfo` function which queries servers specified by the `DEBUGINFOD_URLS` environment variable for the debuginfo, executable, or a specified source file associated with a given build id.
This diff was split out from D111252.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D112758
Shivam Gupta [Mon, 6 Dec 2021 03:57:08 +0000 (09:27 +0530)]
[Docs] Fix a link
current link is pointing to https://llvm.org/docs/CodeGenerator.html#segmented-stacks while it point to https://llvm.org/docs/CodeGenerator.html#tail-call-optimization or id81.
Differential Revision: https://reviews.llvm.org/D115119
Qiu Chaofan [Mon, 6 Dec 2021 02:15:05 +0000 (10:15 +0800)]
[PowerPC] Implement general back2back fusion
Implement 'back-to-back' FX fusion according to Power10 User Manual
'19.1.5.4 Fusion', not enabled by default.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D114345
Nikolas Klauser [Thu, 2 Dec 2021 20:09:38 +0000 (21:09 +0100)]
[libc++][NFC] Disable clang-tidy checks
Disable clang-tidy checks as discussed in D114915
Reviewed By: ldionne, #libc
Spies: cjdb, aheejin, libcxx-commits
Differential Revision: https://reviews.llvm.org/D114985
Arthur O'Dwyer [Sun, 5 Dec 2021 23:56:58 +0000 (18:56 -0500)]
[libc++] Remove space-alignment of trailing braces in module.modulemap. NFC.
As discussed on the Discord, 2021-12-01 through 2021-12-05.
Our new consistent style for this is "don't align the right-braces"
(but still align the left-braces, as shown).
Jack Andersen [Sun, 5 Dec 2021 19:55:20 +0000 (14:55 -0500)]
[GlobalISel] Allow DBG_VALUE to use undefined vregs before LiveDebugValues.
Expanding on D109750.
Since `DBG_VALUE` instructions have final register validity determined in
`LDVImpl::handleDebugValue`, there is no apparent reason to immediately prune
unused register operands as their defs are erased. Consequently, this renders
`MachineInstr::eraseFromParentAndMarkDBGValuesForRemoval` moot; gaining a
substantial performance improvement.
The only necessary changes involve making relevant passes consider invalid
DBG_VALUE vregs uses as valid.
Reviewed By: MatzeB
Differential Revision: https://reviews.llvm.org/D112852
Jez Ng [Sat, 4 Dec 2021 02:26:32 +0000 (21:26 -0500)]
[lld-macho] Unreferenced weak dylib symbols shouldn't fetch archive symbols
We were fetching archive symbols too eagerly, bloating binary size as well as
just screwing up binaries that expected to look up certain symbols only at
runtime.
Reviewed By: #lld-macho, oontvoo
Differential Revision: https://reviews.llvm.org/D115092
Jack Andersen [Sun, 5 Dec 2021 19:45:33 +0000 (14:45 -0500)]
[CMake] Installable find modules for terminfo and libffi
Improves cross-distro portability of LLVM cmake package by resolving paths for
terminfo and libffi via import targets.
When LLVMExports.cmake is generated for installation, it contains absolute
library paths which are likely to be a common cause of portability issues. To
mitigate this, the discovery logic for these dependencies is refactored into
find modules which get installed alongside LLVMConfig.cmake. The result is
cleaner, cmake-friendly management of these dependencies that respect the
environment of the LLVM package importer.
Reviewed By: JDevlieghere
Differential Revision: https://reviews.llvm.org/D114327
Jack Andersen [Sun, 5 Dec 2021 19:35:33 +0000 (14:35 -0500)]
Test commit to check access.
Mehdi Amini [Sun, 5 Dec 2021 19:16:54 +0000 (19:16 +0000)]
Fix TOSA verifier to emit verbose errors
Also as a test for invalid ops which was missing.
Michael Liao [Sun, 5 Dec 2021 18:39:48 +0000 (13:39 -0500)]
Fix `-Wunused-variable` warning. NFC.
Arthur O'Dwyer [Sun, 5 Dec 2021 18:21:01 +0000 (13:21 -0500)]
[libc++] Adjust space-alignment in module.modulemap. NFC.
Arthur O'Dwyer [Sun, 5 Dec 2021 18:08:36 +0000 (13:08 -0500)]
[libc++] Add missing `#pragma GCC system_header` in a few headers. NFCI.
Arthur O'Dwyer [Sun, 5 Dec 2021 18:05:21 +0000 (13:05 -0500)]
[libc++] Fix an include-guard comment. NFC.
Nico Weber [Sun, 5 Dec 2021 18:15:56 +0000 (13:15 -0500)]
[gn build] port
a8025e06fc0f more
src/ryu/*.cpp includes files relative to src, so src/ needs
to be passes as -I flag now.
Mark de Wever [Sun, 5 Dec 2021 16:44:24 +0000 (17:44 +0100)]
[libc++][doc] Update format implementation status.
Kazu Hirata [Sun, 5 Dec 2021 16:33:02 +0000 (08:33 -0800)]
[llvm] Use range-based for loops (NFC)
Sanjay Patel [Sun, 5 Dec 2021 14:47:17 +0000 (09:47 -0500)]
[InstSimplify] fix logic fold of 'or' for vectors
Reduce code duplication for commutative pattern matching
and fix a miscompile.
We can't safely propagate an undef element in this transform:
https://alive2.llvm.org/ce/z/s5xy55
Sanjay Patel [Sun, 5 Dec 2021 14:28:11 +0000 (09:28 -0500)]
[InstSimplify] add/adjust tests for 'or' logic fold; NFC
The last test shows a miscompile:
https://alive2.llvm.org/ce/z/s5xy55
Sanjay Patel [Fri, 3 Dec 2021 14:14:41 +0000 (09:14 -0500)]
[InstCombine] add tests for icmp with mul op with known bits; NFC
D114962
Kristina Bessonova [Sun, 5 Dec 2021 13:31:25 +0000 (15:31 +0200)]
Follow-up for D113741: fix DebugInfo/Generic/lexical_block_static.ll on MachO
Nilay Vaish [Sun, 5 Dec 2021 13:02:32 +0000 (14:02 +0100)]
Remove duplicate comment
The same comment appears in the very next line.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D115018
Nico Weber [Sun, 5 Dec 2021 12:52:43 +0000 (07:52 -0500)]
[gn build] (semiautomaticallly) port
a8025e06fc0f (libc++ ryu)
Mark de Wever [Tue, 9 Feb 2021 16:52:41 +0000 (17:52 +0100)]
Microsoft's floating-point to_chars powered by Ryu and Ryu Printf
Microsoft would like to contribute its implementation of floating-point to_chars to libc++. This uses the impossibly fast Ryu and Ryu Printf algorithms invented by Ulf Adams at Google. Upstream repos: https://github.com/microsoft/STL and https://github.com/ulfjack/ryu .
Licensing notes: MSVC's STL is available under the Apache License v2.0 with LLVM Exception, intentionally chosen to match libc++. We've used Ryu under the Boost Software License.
This patch contains minor changes from Jorg Brown at Google, to adapt the code to libc++. He verified that it works in Google's Linux-based environment, but then I applied more changes on top of his, so any compiler errors are my fault. (I haven't tried to build and test libc++ yet.) Please tell me if we need to do anything else in order to follow https://llvm.org/docs/DeveloperPolicy.html#attribution-of-changes .
Notes:
* libc++'s integer charconv is unchanged (except for a small refactoring). MSVC's integer charconv hasn't been tuned for performance yet, so you're not missing anything.
* Floating-point from_chars isn't part of this patch because Jorg found that MSVC's implementation (derived from our CRT's strtod) was slower than Abseil's. If you're unable to use Abseil or another implementation due to licensing or technical considerations, Microsoft would be delighted if you used MSVC's from_chars (and you can just take it, or ask us to provide a patch like this). Ulf is also working on a novel algorithm for from_chars.
* This assumes that float is IEEE 32-bit, double is IEEE 64-bit, and long double is also IEEE 64-bit.
* I have added MSVC's charconv tests (the whole thing: integer/floating from_chars/to_chars), but haven't adapted them to libcxx's harness at all. (These tests will be available in the microsoft/STL repo soon.)
* Jorg added int128 codepaths. These were originally present in upstream Ryu, and I removed them from microsoft/STL purely for performance reasons (MSVC doesn't support int128; Clang on Windows does, but I found that x64 intrinsics were slightly faster).
* The implementation is split into 3 headers. In MSVC's STL, charconv contains only Microsoft-written code. xcharconv_ryu.h contains code derived from Ryu (with significant modifications and additions). xcharconv_ryu_tables.h contains Ryu's large lookup tables (they were sufficiently large to make editing inconvenient, hence the separate file). The xmeow.h convention is MSVC's for internal headers; you may wish to rename them.
* You should consider separately compiling the lookup tables (see https://github.com/microsoft/STL/issues/172 ) for compiler throughput and reduced object file size.
* See https://github.com/StephanTLavavej/llvm-project/commits/charconv for fine-grained history. (If necessary, I can perform some rebase surgery to show you what Jorg changed relative to the microsoft/STL repo; currently that's all fused into the first commit.)
Differential Revision: https://reviews.llvm.org/D70631
Mark de Wever [Sun, 5 Dec 2021 12:22:58 +0000 (13:22 +0100)]
[libc++][ci] Disable generating debug information.
In the bootstrap build generating debug information causes an ICE.
This is a work-around for llvm.org/PR52584
Florian Hahn [Sun, 5 Dec 2021 12:14:58 +0000 (12:14 +0000)]
[VPlan] Separate ctors for VPWidenIntOrFpInduction. (NFC)
VPWidenIntOrFpInductionRecipes can either be constructed with a PHI and
an optional cast or a PHI and a trunc instruction. Reflect this in 2
separate constructors. This also simplifies a follow-up change.
Kristina Bessonova [Sat, 4 Dec 2021 15:12:47 +0000 (17:12 +0200)]
Reland [DwarfDebug] Support emitting function-local declaration for a lexical block
This is another attempt to make function-local declarations
(like static variables, structs/classes and other) be correctly
emitted within a lexical (bracketed) block.
Fixes https://bugs.llvm.org/show_bug.cgi?id=19238.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D113741
Kristina Bessonova [Sat, 4 Dec 2021 12:08:10 +0000 (14:08 +0200)]
Reland [DwarfDebug] Move emission of global vars, types and imports to endModule()
This patch proposes to move emission of global variables, types,
imported entities, etc from DwarfDebug::beginModule() to DwarfDebug::endModule().
Effectively, this changes nothing but the order of debug entities which
will be as follows:
* subprograms (including related context, local variables/labels,
local imported entities; related types can be created as a part of
the emission of local entities of an abstract subprogram);
* global variables (including related context and types);
* retained types and enums;
* non-local-scoped imported entities;
* basic types;
* other types left (as a part of local variables attributes emission).
Note that the order of emitted compile units may also be changed as now we emit
units that contain subprograms first and then all other non-empty units.
The motivation behind this change is the following:
(1) DwarfDebug::beginModule() is run at the very beginning of backend's pipeline,
from this time IR can be significantly changed by target-specific passes.
If it happens for debug metadata of global entities, those changes will not
be reflected in the emitted DWARF.
(2) imported subprogram names should refer to an abstract subprogram if it exists,
but it isn't known in DwarfDebug::beginModule() (it's possible to make some
guesses based on location info, but it's not quite reliable);
(3) aforementioned entities if they are scoped within a bracketed block
(subject of D113741) couldn't be emitted in DwarfDebug::beginModule()
(they need parent emitted first). Another problem is if to try to gather
some information about local entities and defer their emission
(till subprogram's processing or DwarfDebug::endModule()) all the gathered
details might be irrelevant / invalid by the time the entities are being
emitted (because of (1)).
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D114705
Phoebe Wang [Sun, 5 Dec 2021 11:17:12 +0000 (19:17 +0800)]
[X86][FP16] Replace vXi16 to vXf16 instead of v8f16
Fixes pr52561
Reviewed By: LuoYuanke
Differential Revision: https://reviews.llvm.org/D114304
Florian Hahn [Sun, 5 Dec 2021 11:12:44 +0000 (11:12 +0000)]
[MemoryLocation] Use getForArgument in getForSource/getForDest. (NFC)
getForArgument already knows how to extract a memory location for all
memory intrinsics. Use it instead of duplicating the logic.
Lang Hames [Sun, 5 Dec 2021 09:31:03 +0000 (20:31 +1100)]
[JITLink][ELF][x86-64] Adjust addends for R_X86_64_PLT32 relocations.
R_X86_64_PLT32 explicitly represents the '-4' PC-adjustment in the relocation's
addend, but JITLink's x86_64::Branch32PCRel includes the PC-adjustment
implicitly. We have been zeroing the addend to account for the difference, but
this breaks for branches to non-zero offsets past labels. This patch updates the
relocation parsing code to unconditionally adjust the offset by '+4' instead.
For branches directly to labels the result is still 0, for branches to offsets
past labels the result is the correct addend for x86_64::Branch32PCRel.
David Green [Sun, 5 Dec 2021 09:25:52 +0000 (09:25 +0000)]
[DAG] Create fptoui.sat from clamped fptosi
As an extension to D111976, this converts clamp fptosi, clamped between
0 and (2^n)-1 to a fptoui.sat. This can greatly help on targets with
conversions that naturally saturate, such as Arm.
X86 disables the transform as some of the test cases increases in size.
A fptoui.sat necessitates a fp clamp without native support, so there is
little use in converting if the instruction is just going to be
expanded.
Differential Revision: https://reviews.llvm.org/D112428
Lang Hames [Sun, 5 Dec 2021 06:12:39 +0000 (17:12 +1100)]
[JITLink][ELF][x86-64] Use the right edge-naming function for debugging output.
Graph edges use the generic x86-64 edge set (the ELF specific edges are only
used during parsing).
Lang Hames [Fri, 3 Dec 2021 23:15:15 +0000 (10:15 +1100)]
[llvm-jitlink] Allow -entry option to find hidden symbols.
This is useful when debugging failures in object files compiled with
visibility=hidden.
Michael Liao [Sat, 4 Dec 2021 23:20:21 +0000 (18:20 -0500)]
Fix `-Wunused-variable` warning. NFC.
Nico Weber [Sun, 5 Dec 2021 03:29:05 +0000 (22:29 -0500)]
[gn build] port
f1585a4b47cc
Leonard Grey [Sun, 5 Dec 2021 03:24:58 +0000 (22:24 -0500)]
[Support] Use final filename for Caching buffer identifier
Mach-O LLD uses the buffer identifier of the memory buffer backing an object
file to generate stabs which are used by `dsymutil` to find the object file for
dSYM generation.
When using thinLTO, these buffers are provided by the cache which initially
saves them to disk as temporary files beginning with "Thin-" but renames them
to persistent files beginning with "llvmcache-" before the buffer is provided
to the cache user.
However, the buffer is created before the file is renamed and is given the temp
file's name as an identifier. This causes the generated stabs to point to
nonexistent files.
This change names the buffer with the eventual persistent filename. I think
this is safe because failing to rename the temp file is a fatal error.
Differential Revision: https://reviews.llvm.org/D115055
Kazu Hirata [Sun, 5 Dec 2021 02:34:29 +0000 (18:34 -0800)]
[lldb] Fix a warning
This patch fixes:
lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp:386:13:
error: comparison between NULL and non-pointer ('lldb::addr_t' (aka
'unsigned long') and NULL) [-Werror,-Wnull-arithmetic]
Peter Klausler [Fri, 3 Dec 2021 00:36:09 +0000 (16:36 -0800)]
[flang] OPEN(RECL=) handling for sequential formatted I/O
RECL= is required for direct access I/O, but is permitted
as well for sequential I/O, where it is defined by the
standard to specify a maximum record (line) length.
The standard does not say what should happen when an
sequential formatted input record appears whose length is
unequal to RECL= when it is specified.
Precedents from other compilers are unclear: one raises an error,
some honor RECL= as an effective truncation, and a few ignore the
situation. On output, all other compilers tested raised an
error when an attempt is made to emit a record longer than RECL=.
This patch treats RECL= as effective truncation on input and
as a hard limit with error on output, and also ensures that
RECL= can be set *longer* than the actual input record lengths.
Differential Revision: https://reviews.llvm.org/D115102
Zhihao Yuan [Wed, 24 Nov 2021 00:38:53 +0000 (16:38 -0800)]
[PowerPC] Drop stdlib paths in freestanding tests
When targeting FreeBSD on a Linux host with a copy
of system libc++, Clang prepends /usr/include/c++/v1
to the search paths even with -ffreestanding, and
fails to compile a program with a
single #include <xmmintrin.h>
Dropping the path with -nostdlibinc.
Differential Revision: https://reviews.llvm.org/D114497
Florian Hahn [Sat, 4 Dec 2021 22:18:38 +0000 (22:18 +0000)]
[MemoryLocation] Support missing atomic intrinsics in getForArg.
getForArgument is missing support for atomic memory transfer
intrinsics. In terms of accessed locations they behave like regular
memory transfer intrinsics and we already support them as such in
getForSource/getForDest.
Butygin [Thu, 28 Oct 2021 16:04:35 +0000 (19:04 +0300)]
[mlir] Add InlinerInterface to bufferization dialect
Differential Revision: https://reviews.llvm.org/D115080
Björn Schäpers [Fri, 3 Dec 2021 15:59:34 +0000 (16:59 +0100)]
[clang-format][NFC] Use member directly
Instead of passing it as argument to the member function.
Differential Revision: https://reviews.llvm.org/D115072
Björn Schäpers [Fri, 3 Dec 2021 15:40:52 +0000 (16:40 +0100)]
[clang-format][NFC] Use range based for for fake l parens
Differential Revision: https://reviews.llvm.org/D115071
Björn Schäpers [Fri, 3 Dec 2021 15:38:10 +0000 (16:38 +0100)]
[clang-format][NFC] Early return when nothing to do
Do not compute SkipFirstExtraIndent just to see that there are no fake l
parens.
Differential Revision: https://reviews.llvm.org/D115070
Björn Schäpers [Fri, 3 Dec 2021 08:25:45 +0000 (09:25 +0100)]
[clang-format][NFC] Move static variable in scope
Let only the JS/TS users pay for the initialistation.
Differential Revision: https://reviews.llvm.org/D115068
Björn Schäpers [Fri, 3 Dec 2021 07:47:38 +0000 (08:47 +0100)]
[clang-format][NFC] Use range based for
That's much easier to read.
Differential Revision: https://reviews.llvm.org/D115067
Björn Schäpers [Fri, 3 Dec 2021 07:45:56 +0000 (08:45 +0100)]
[clang-format][NFC] Reorder conditions
Prefer to check the local variables first before dereferencing the
pointer.
Differential Revision: https://reviews.llvm.org/D115066
Björn Schäpers [Fri, 3 Dec 2021 07:29:47 +0000 (08:29 +0100)]
[clang-format][NFC] Merge two calls of isOneOf
Differential Revision: https://reviews.llvm.org/D115065
Björn Schäpers [Fri, 3 Dec 2021 07:25:23 +0000 (08:25 +0100)]
[clang-format][NFC] Rename variable so no shadowing happens
In the loop there is also a Node.
Differential Revision: https://reviews.llvm.org/D115063
Björn Schäpers [Fri, 3 Dec 2021 07:24:02 +0000 (08:24 +0100)]
[clang-format][NFC] Prefer pass by reference
Differential Revision: https://reviews.llvm.org/D115061
Mehrnoosh Heidarpour [Fri, 3 Dec 2021 15:04:43 +0000 (10:04 -0500)]
[InstSimplify] Add logic 'or' fold to -1
Adding the following folding opportunity:
(~A | B) | (A ^ B) --> -1
https://alive2.llvm.org/ce/z/PMtdYB
Differential revision: https://reviews.llvm.org/D114996
Peter Klausler [Thu, 2 Dec 2021 20:34:37 +0000 (12:34 -0800)]
[flang] Fix folding of EXPONENT() intrinsic function
The definition of the EXPONENT() intrinsic function differs by one
from the real arithmetic folding templates concept of an unbiased
exponent, and also needs special handling for zero. Fix, and add
more tests.
Differential Revision: https://reviews.llvm.org/D115084
Saleem Abdulrasool [Mon, 29 Nov 2021 04:05:31 +0000 (20:05 -0800)]
Windows: support `DoLoadImage`
This implements `DoLoadImage` and `UnloadImage` in the Windows platform
plugin modelled after the POSIX platform plugin. This was previously
unimplemented and resulted in a difficult to decipher error without any
logging.
This implementation is intended to support enables the use of LLDB's
Swift REPL on Windows.
Paths which are added to the library search path are persistent and
applied to all subsequent loads. This can be adjusted in the future by
storing all the cookies and restoring the path prior to returning from
the helper. However, the dynamic path count makes this a bit more
challenging.
Reviewed By: @JDevlieghere
Differential Revision: https://reviews.llvm.org/D77287
Dimitry Andric [Tue, 23 Nov 2021 20:21:02 +0000 (21:21 +0100)]
[XRay] fix more -Wformat warnings
Building xray with recent clang on a 64-bit system results in a number
of -Wformat warnings:
compiler-rt/lib/xray/xray_allocator.h:70:11: warning: format specifies type 'int' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
RoundedSize, B);
^~~~~~~~~~~
compiler-rt/lib/xray/xray_allocator.h:119:11: warning: format specifies type 'int' but the argument has type '__sanitizer::uptr' (aka 'unsigned long') [-Wformat]
RoundedSize, B);
^~~~~~~~~~~
Since `__sanitizer::uptr` has the same size as `size_t`, these can be
fixed by using the printf specifier `%zu`.
compiler-rt/lib/xray/xray_basic_logging.cpp:348:46: warning: format specifies type 'int' but the argument has type '__sanitizer::tid_t' (aka 'unsigned long long') [-Wformat]
Report("Cleaned up log for TID: %d\n", GetTid());
~~ ^~~~~~~~
%llu
compiler-rt/lib/xray/xray_basic_logging.cpp:353:62: warning: format specifies type 'int' but the argument has type '__sanitizer::tid_t' (aka 'unsigned long long') [-Wformat]
Report("Skipping buffer for TID: %d; Offset = %llu\n", GetTid(),
~~ ^~~~~~~~
%llu
Since `__sanitizer::tid_t` is effectively declared as `unsigned long
long`, these can be fixed by using the printf specifier `%llu`.
compiler-rt/lib/xray/xray_basic_logging.cpp:354:14: warning: format specifies type 'unsigned long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
TLD.BufferOffset);
^~~~~~~~~~~~~~~~
Since `BufferOffset` is declared as `size_t`, this one can be fixed by
using `%zu` as a printf specifier.
compiler-rt/lib/xray/xray_interface.cpp:172:50: warning: format specifies type 'int' but the argument has type 'uint64_t' (aka 'unsigned long') [-Wformat]
Report("Unsupported sled kind '%d' @%04x\n", Sled.Address, int(Sled.Kind));
~~ ^~~~~~~~~~~~
%lu
Since ``xray::SledEntry::Address` is declared as `uint64_t`, this one
can be fixed by using `PRIu64`, and adding `<cinttypes>`.
compiler-rt/lib/xray/xray_interface.cpp:308:62: warning: format specifies type 'long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
Report("System page size is not a power of two: %lld\n", PageSize);
~~~~ ^~~~~~~~
%zu
compiler-rt/lib/xray/xray_interface.cpp:359:64: warning: format specifies type 'long long' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
Report("Provided page size is not a power of two: %lld\n", PageSize);
~~~~ ^~~~~~~~
%zu
Since `PageSize` is declared as `size_t`, these can be fixed by using
`%zu` as a printf specifier.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D114469
Nikita Popov [Sat, 4 Dec 2021 17:54:36 +0000 (18:54 +0100)]
[llvm-c] Avoid deprecated APIs in tests
Avoid the use of deprecated (opaque pointer incompatible) APIs
in C API tests, in preparation for header deprecation. Add a
LLVMGetGEPSourceElementType() to cover a bit of functionality
that is necessary for the echo test.
This change is split out from https://reviews.llvm.org/D114936.
Kazu Hirata [Sat, 4 Dec 2021 16:48:04 +0000 (08:48 -0800)]
[CodeGen] Use range-based for loops (NFC)
Nikita Popov [Sat, 4 Dec 2021 16:24:07 +0000 (17:24 +0100)]
[NewPM] Test more options in pipeline test (NFC)
As suggested on D115098, this tests the positioning of
HotColdSplitting, IROutliner and MergeFunctions in the optimization
pipeline.
Nikita Popov [Sat, 4 Dec 2021 12:14:15 +0000 (13:14 +0100)]
[NewPM] Fix MergeFunctions scheduling
MergeFunctions (as well as HotColdSplitting an IROutliner) are
incorrectly scheduled under the new pass manager. The code makes
it look like they run towards the end of the module optimization
pipeline (as they should), while in reality the run at the start.
This is because the OptimizePM populated around them is only
scheduled later.
I'm fixing this by moving these three passes until after OptimizePM
to avoid splitting the function pass pipeline. It doesn't seem
important to me that some of the function passes run after these
late module passes.
Differential Revision: https://reviews.llvm.org/D115098
Matt Arsenault [Sat, 4 Dec 2021 16:17:39 +0000 (11:17 -0500)]
Attributor: Fix typo in function name
Matt Arsenault [Sat, 4 Dec 2021 16:24:28 +0000 (11:24 -0500)]
OpenMP: Un-xfail tests that pass now
729bf9b26b657df8ddad2e5a63377e6afb349a18 should have fixed these
Kristina Bessonova [Sat, 4 Dec 2021 16:03:46 +0000 (18:03 +0200)]
Revert "[DwarfDebug] Support emitting function-local declaration for a lexical block"
This reverts commits
*
ee691970a9a85470948ada623c31f0ab8773617c (D113741),
*
79d3132998b2828be8f7d2ec411f91fb11b3e01f (D114705)
due to lldb and dexter test failures.