Aiden Grossman [Fri, 7 Jul 2023 02:40:19 +0000 (19:40 -0700)]
[llvm-exegesis] Switch to using PTRACE_ATTACH instead of PTRACE_SEIZE
This patch switches from using PTRACE_SEIZE within the subprocess
benchmark runner for llvm-exegesis as PTRACE_SEIZE was introduced in
Linux kernel 3.4. Some LLVM users were reporting build failures as they
are using Kernel versions older than 3.4 (such as on CentOS/RHEL 6),
hence the patch.
Aiden Grossman [Fri, 7 Jul 2023 02:11:04 +0000 (19:11 -0700)]
[llvm-exegesis] Disable SubprocessMemory class on Android
Having the SubprocessMemory class available on Android was causing build
failures in downstream builds as Android doesn't implement the SystemV
IPC specification that supplies shm_open and other functions that the
class relies on. This patch simply makes it unavailable on Android using
preprocessor directives.
wren romano [Thu, 6 Jul 2023 22:29:09 +0000 (15:29 -0700)]
[mlir][sparse] Correcting RTTI implementation for the Var class
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D154662
Jason Molenda [Fri, 7 Jul 2023 01:23:54 +0000 (18:23 -0700)]
Revert "Change the dyld notification function that lldb puts a breakpoint in"
This reverts commit
c3192196aea279eea0a87247a02f224ebe067c44.
Reverting my second attempt at https://reviews.llvm.org/D139453
changing which dyld notification method is being used.
The Intel macOS CI bot is still failing with this
rewrite at https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/
I'll need to set up an Intel macOS system running a matching
OS version to debug this directly I think.
Matt Arsenault [Thu, 2 Feb 2023 12:26:54 +0000 (08:26 -0400)]
DAG: Handle inversion of fcSubnormal | fcZero
There are a number of more test combinations here that
can be done together and reduce the number of instructions.
https://reviews.llvm.org/D143191
Eduard Zingerman [Thu, 6 Jul 2023 23:23:56 +0000 (02:23 +0300)]
Revert "[BPF] Undo transformation for LICM.cpp:hoistMinMax()"
This reverts commit
09feee559a294611257ee157dba039fb05fe4f68.
Revert because of a testbot failure:
https://lab.llvm.org/buildbot/#/builders/5/builds/34931
Jason Molenda [Fri, 7 Jul 2023 00:59:09 +0000 (17:59 -0700)]
Change the dyld notification function that lldb puts a breakpoint in
On Darwin systems, the dynamic linker dyld has an empty function
it calls when binaries are added/removed from the process. lldb puts
a breakpoint on this dyld function to catch the notifications. The
function arguments are used by lldb to tell what is happening.
The linker has a natural representation when the addresses of
binaries being added/removed are in the pointer size of the process.
There is then a second function where the addresses of the binaries
are in a uint64_t array, which the debugger has been using before -
dyld allocates memory for the array, copies the values in to it,
and calls it for lldb's benefit.
This changes to using the native notifier function, with pointer-sized
addresses.
This is the second time landing this change; this time correct the
size of the image_count argument, and add a fallback if the
notification function "lldb_image_notifier" can't be found.
Differential Revision: https://reviews.llvm.org/D139453
Lang Hames [Fri, 7 Jul 2023 00:37:49 +0000 (17:37 -0700)]
[ORC][AArch64] Guard against negative offsets in writeIndirectStubsBlock.
In OrcAArch64::writeIndirectStubsBlock, masks the high bits of the immediate
operand to the stub's ldr instruction so that negative offsets to the stub
pointer do not overflow.
No testcase -- this fixes most of the OrcLazy testcases for AArch64 (at least on
Darwin), but we still need to fix the exception-handling test before we can turn
them on.
Alexander Yermolovich [Fri, 7 Jul 2023 00:55:05 +0000 (17:55 -0700)]
[BOLT][DWARF] Don't check string offsets
With different linker, the offset of strings can change.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D154670
Douglas Yung [Fri, 7 Jul 2023 00:40:06 +0000 (17:40 -0700)]
Make test more flexible for platforms that may emit extra arguments.
Alexander Yermolovich [Fri, 7 Jul 2023 00:37:42 +0000 (17:37 -0700)]
[BOLT][DWARF] Don't check string offsets
With different linker, the offset of strings can change.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D154669
Thurston Dang [Fri, 7 Jul 2023 00:26:41 +0000 (00:26 +0000)]
Revert "[gn build] Manually port
015dabd7"
I've temporarily reverted D154272 (which this commit depends on)
due to a build breakage, so also reverting this for now.
This reverts commit
c1e283851772ba494113311405d48cfb883751d1.
Craig Topper [Fri, 7 Jul 2023 00:24:15 +0000 (17:24 -0700)]
[RISCV] Support i32 brev8 intrinsic on RV64.
Similar to what we do for orc.b. Another patch will expose this
as a builtin in clang.
Thurston Dang [Fri, 7 Jul 2023 00:21:28 +0000 (00:21 +0000)]
Revert "Reland '[msan] Intercept dladdr1, and refactor dladdr'"
This reverts my commit
015dabd7672f936cdb5bdcad20fe80b17f05c9ca
due to breaking non-glibc builds.
Volodymyr Sapsai [Fri, 7 Jul 2023 00:18:43 +0000 (17:18 -0700)]
[clang] Fix a typo "mdoule" in comments. NFC.
Alexander Yermolovich [Thu, 6 Jul 2023 23:46:09 +0000 (16:46 -0700)]
[BOLT][DWARF] Fix references in tests
Fixed invalid assembly, where references were not correct.
Reviewed By: rafauler
Differential Revision: https://reviews.llvm.org/D154667
Joseph Huber [Thu, 6 Jul 2023 23:25:52 +0000 (18:25 -0500)]
Revert "[libc] Add support for creating wrapper headers for offloading in clang"
This reverts commit
a4a26374aa11d48ac6bf65c78c2aaf8f16414287.
This was causing some problems with the CPU build and CUDA buildbot.
Revert until I can figure out what those issues are and fix them. I
believe it is just some CMake.
Rob Suderman [Thu, 6 Jul 2023 23:19:44 +0000 (16:19 -0700)]
[mlir][complex] Add a `complex.bitcast` operation
Converting between a complex<f32> to i64 could be useful for handling interop
between the `arith` and `complex` dialects.
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D154663
Jim Ingham [Tue, 23 May 2023 18:13:36 +0000 (11:13 -0700)]
Refine the reporting mechanism for interruption.
Also, make it possible for new Targets which haven't been added to
the TargetList yet to check for interruption, and add a few more
places in building modules where we can check for interruption.
Differential Revision: https://reviews.llvm.org/D154542
Joseph Huber [Thu, 29 Jun 2023 01:17:56 +0000 (20:17 -0500)]
[libc] Add support for creating wrapper headers for offloading in clang
This is an alternate approach to the patches proposed in D153897 and
D153794. Rather than exporting a single header that can be included on
the GPU in all circumstances, this patch chooses to instead generate a
separate set of headers that only provides the declarations. This can
then be used by external tooling to set up what's on the GPU. This
leaves room for header hacks for offloading languages without needing to
worry about the `libc` implementation.
Currently this generates a set of headers that only contain the
declarations. These will then be installed to a new clang resource
directory called `llvm_libc_wrappers/` which will house the shim code.
We can then automaticlaly include this from `clang` when offloading to
wrap around the headers while specifying what's on the GPU.
Reviewed By: jdoerfert, JonChesterfield
Differential Revision: https://reviews.llvm.org/D154036
Michael Maitland [Wed, 5 Jul 2023 17:04:06 +0000 (10:04 -0700)]
[llvm-mca][RISCV] vsetivli and vsetvli act as instruments
Since the LMUL data that is needed to create an instrument is
avaliable statically from vsetivli and vsetvli instructions,
LMUL instruments can be automatically generated so that clients
of the tool do no need to manually insert instrument comments.
Instrument comments may be placed after a vset{i}vli instruction,
which will override instrument that was automatically inserted.
As a result, clients of llvm-mca instruments do not need to update
their existing instrument comments. However, if the instrument
has the same LMUL as the vset{i}vli, then it is reccomended to
remove the instrument comment as it becomes redundant.
Differential Revision: https://reviews.llvm.org/D154526
Michael Maitland [Fri, 30 Jun 2023 00:44:17 +0000 (17:44 -0700)]
[LAA] Add test that shows MaxSafeDepDistBytes is incorrect. NFC.
This precommit patch shows MaxSafeDepBytesDist is 24 when it should
be 8.
Differential Revision: https://reviews.llvm.org/D154173
Med Ismail Bennani [Thu, 6 Jul 2023 21:32:05 +0000 (14:32 -0700)]
[lldb] Fix dead lock issue when loading modules in Scripted Process
This patch attempts to fix a dead lock when loading modules in a Scripted
Process.
This issue was triggered by loading the modules after the process did resume,
but before the process actually stop, causing the language runtime mutex to
be locked by a separate thread, responsible to unwind the stack (using
the runtime unwind plan), while the module loading thread was trying to
notify the runtimes of the newly loaded module.
To address that, this patch moves the module loading logic to be done before
sending the stop event, to prevent the dead lock situation described above.
Differential Revision: https://reviews.llvm.org/D154649
Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
Alexander Yermolovich [Mon, 15 May 2023 21:23:21 +0000 (14:23 -0700)]
[BOLT][DWARF] Change to process and write out TUs first then CUs in batches
Summary:
To reduce memory footprint changed so that we process and write out TUs first,
reset DIEBuilder and process CUs. CUs are processed in buckets. First bucket
contains all the CUs with cross CU references. Rest processd one at a time.
clang-17 build in debug mode, by clang-17.
before
8:25.81 real, 834.37 user, 86.03 sys, 0 amem,
79525064 mmem
8:02.20 real, 820.46 user, 81.81 sys, 0 amem,
79501616 mmem
7:52.69 real, 802.01 user, 83.99 sys, 0 amem,
79534392 mmem
after
7:49.35 real, 822.04 user, 66.19 sys, 0 amem,
34934260 mmem
7:42.16 real, 825.46 user, 63.52 sys, 0 amem,
34951660 mmem
7:46.71 real, 821.11 user, 63.14 sys, 0 amem,
34981164 mmem
Differential Revision: https://phabricator.intern.facebook.com/
D45883198
Alexander Yermolovich [Mon, 1 May 2023 21:56:10 +0000 (14:56 -0700)]
[BOLT][DWARF] Output DWO files as they are being processed
Summary:
Changed how we handle writing out .dwo and .dwp files. We now write out DWO
sections sooner and destroy DIEBuilder. This should decrease memory footprint.
Ran on clang-17 build in debug mode with split-dwarf.
before
8:07.49 real, 664.62 user, 69.00 sys, 0 amem,
41601612 mmem
8:07.06 real, 669.60 user, 68.75 sys, 0 amem,
41822588 mmem
8:00.36 real, 664.14 user, 66.36 sys, 0 amem,
41561548 mmem
after
8:21.85 real, 682.23 user, 69.64 sys, 0 amem,
39379880 mmem
8:04.58 real, 671.62 user, 66.50 sys, 0 amem,
39735800 mmem
8:10.02 real, 680.67 user, 67.24 sys, 0 amem,
39662888 mmem
Differential Revision: https://phabricator.intern.facebook.com/
D45458889
Alexander Yermolovich [Thu, 15 Sep 2022 20:40:54 +0000 (13:40 -0700)]
[BOLT][DWARF] Numerous fixes for a new DWARFRewriter
Summary:
* Some cleanup and minor fixes for the new debug information re-writer before moving on
to productatization.
* The new rewriter wasn't handling binary with DWARF5 and DWARF4 with
-fdebug-types-sections.
* Removed dead cross cu reference code.
* Added support for DW_AT_sibling.
* With the new re-writer abbrev number can change which can lead to offset of Type
Units changing. Before we would just copy raw data. Changed to write out Type
Unit List. This is generated by gdb-add-index.
* Fixed how bolt handles gdb-index generated by gdb-11 with types sections.
Simplified logic that handles variations of gdb-index.
* Clang can generate two type units with the same hash, but different content. LLD
does not de-duplicate when ThinLTO is involved. Changed so that TU hash and
offset are used to make TU's unique.
* It is possible to have references within location expression to another DIE.
Fixed it so that relative offset is updated correctly.
* Removed all the code related to patching.
* Removed dead code. Changed how we handling writting out TUs and TU Index. It now
should fully work for DWARF4 and DWARF5.
* Removed unused arguments from some APIs, changed return type to void, and other
small cleanups.
Test Plan:
Reviewers:
Subscribers:
Tasks:
Tags:
Differential Revision: https://phabricator.intern.facebook.com/
D46168257
Alexander Yermolovich [Mon, 12 Sep 2022 23:39:02 +0000 (16:39 -0700)]
[DWARF][BOLT] Implement new mechanism for DWARFRewriter
Summary:
This revision implement new mechanism for DWARFRewriter.
In the new mechanism, we adopt the same way with DWARFLinker did.
By parsing Debug information into IR, we are allowed to handle debug information more flexible.
Now the debug information updating process relies on IR and IR will be written out to binary once the updating finished.
A new class was added: DIEBuilder. This class is responsible for parsing debug information and raising it to the IR level.
This class is also used to write out the .debug_info and .debug_abbrev sections.
Since we output brand new Abbrev section we won't need to always convert low_pc/high_pc into ranges.
When conversion does happen we can also remove low_pc entry.
Differential Revision: https://phabricator.intern.facebook.com/
D39484421
Tasks: T117448832
Scott Linder [Thu, 29 Jun 2023 16:07:05 +0000 (16:07 +0000)]
[AMDGPU] Improve assembler + disassembler handling of kernel descriptors
* Relax the AsmParser to accept `.amdhsa_wavefront_size32 0` when the
`.amdhsa_shared_vgpr_count` directive is present.
* Teach the KD disassembler to respect the setting of
KERNEL_CODE_PROPERTY_ENABLE_WAVEFRONT_SIZE32 when calculating the
value of `.amdhsa_next_free_vgpr`.
* Teach the KD disassembler to disassemble COMPUTE_PGM_RSRC3 for gfx90a
and gfx10+.
* Include "pseudo directive" comments for gfx10 fields which are not
controlled by any assembler directive.
* Fix disassembleObject failure diagnostic in llvm-objdump to not
hard-code a comment string, and to follow the convention of not
capitalizing the first sentence.
Reviewed By: rochauha
Differential Revision: https://reviews.llvm.org/D128014
Felipe de Azevedo Piovezan [Thu, 6 Jul 2023 15:12:27 +0000 (11:12 -0400)]
[lldb][DebugNamesDWARF] Also use mangled name when matching regex
When LLDB queries the debug names index with a regex, we should use the
`Mangled` class wrapper, which attempts to match regex first against the mangled
name and then against the demangled name. It is important to do so, otherwise
queries like `frame var --regex A::` would never work. This is what is done for
the Apple index as well.
This fixes test/API/lang/cpp/class_static/main.cpp when compiled with DWARF 5.
Differential Revision: https://reviews.llvm.org/D154617
Felipe de Azevedo Piovezan [Thu, 6 Jul 2023 14:32:50 +0000 (10:32 -0400)]
[lldb][NFC] Remove unused parameter from DebugNames::ProcessEntry
Differential Revision: https://reviews.llvm.org/D154610
Arthur Eubanks [Sat, 10 Jun 2023 00:56:13 +0000 (17:56 -0700)]
[DSE] Don't eagerly optimize MemorySSA uses
Compile time improvements:
https://llvm-compile-time-tracker.com/compare.php?from=
a4a2b62495a63516a4f782acff1b19361906546b&to=
a408521f71702a5c5fb65077adc23413d8631cfc&stat=instructions:u
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D152744
Arthur Eubanks [Tue, 13 Jun 2023 21:06:16 +0000 (14:06 -0700)]
[MemorySSA] Always perform MemoryUses liveOnEntry optimization on MSSA construction
Fixes invariant memory regressions in future DSE patches.
Also add a flag to print<memoryssa> to not ensure optimized uses to test this.
Noticeable compile time regression [1], but a future DSE change that depends on this more than makes up for it.
[1] https://llvm-compile-time-tracker.com/compare.php?from=
9d5466849a770eeab222d5a5890376d3596e8ad6&to=
95682dbe11d76a3342870437377216e96b167504&stat=instructions:u
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D152859
Valentin Clement [Thu, 6 Jul 2023 21:07:45 +0000 (14:07 -0700)]
[flang][openacc] Support array slices when creating private recipe
The return type of the recipe must match the array slice provided by
the user. This patch enhance the recipe creation to take into account
the constant slices.
Depends on D154259
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D154648
Valentin Clement [Thu, 6 Jul 2023 20:55:21 +0000 (13:55 -0700)]
[flang][openacc] Populate the init region for acc.private.recipe for simple type
Generate code to allocate privates for trivial scalars and arrays.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D154259
Louis Dionne [Thu, 6 Jul 2023 14:45:55 +0000 (10:45 -0400)]
[libc++][NFC] Add 'const' to some operator()
This is NFC because the function object is stateless anyway. This is
done solely for consistency with surrounding code and this was probably
an oversight in https://reviews.llvm.org/D132505.
Differential Revision: https://reviews.llvm.org/D154612
Maksim Panchenko [Thu, 6 Jul 2023 20:28:35 +0000 (13:28 -0700)]
[BOLT] Fix buildbot failure
GCC requires "class" keyword when variable name matches class name.
Reviewed By: ayermolo
Differential Revision: https://reviews.llvm.org/D154654
Gedare Bloom [Thu, 6 Jul 2023 20:37:42 +0000 (13:37 -0700)]
[clang-format] Support block indenting array/struct list initializers
C89 and C99 list initializers are treated differently than Cpp11 braced
initializers. This patch identifies the C array/struct initializer lists by
finding the preceding equal sign before a left brace, and applies formatting
rules for BracketAlignmentStyle.BlockIndent to those list initializers.
Fixes #57878.
Differential Revision: https://reviews.llvm.org/D153205
Derek Schuff [Thu, 6 Jul 2023 17:24:07 +0000 (10:24 -0700)]
[WebAssembly] Add frexp{f,l} libcall signatures
The llvm.frexp.* family of intrinsics and their corresponding libcalls were
recently added, which means we need to know their signatures.
Differential Revision: https://reviews.llvm.org/D154639
Fixed: https://github.com/llvm/llvm-project/issues/63657
John Harrison [Thu, 6 Jul 2023 19:54:13 +0000 (15:54 -0400)]
[lldb-vscode] Adding support for column break points.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D154029
Slava Zakharin [Thu, 6 Jul 2023 17:07:02 +0000 (10:07 -0700)]
[flang][hlfir] Lower char length inquiry via hlfir.get_length.
ApplyOp provides the type parameters in its argument, so we can
take it from there. For hlfir.expr block arguments (such as with
user-defined assignments) we use hlfir.get_length in lowering.
Depends on D154561
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D154562
Slava Zakharin [Thu, 6 Jul 2023 17:07:02 +0000 (10:07 -0700)]
[flang][hlfir] Codegen for hlfir.get_length.
Lower hlfir.get_length into the char length inquiry of the bufferized
entity. In some cases the codegen will fail with
`hlfir.associate of hlfir.expr with more than one use` - this will be fixed
separately (after D154521).
Depends on D154560
Reviewed By: tblah, jeanPerier
Differential Revision: https://reviews.llvm.org/D154561
Slava Zakharin [Thu, 6 Jul 2023 17:06:57 +0000 (10:06 -0700)]
[flang][hlfir] Added hlfir.get_length to inquire char length from hlfir.expr.
We will use hlfir.get_length to lower inquiries of char length
applied to hlfir.expr character values.
Reviewed By: tblah, jeanPerier
Differential Revision: https://reviews.llvm.org/D154560
Yuze Chi [Thu, 6 Jul 2023 19:59:05 +0000 (12:59 -0700)]
[DebugInfo] Enable debug info emission for extern variables in C++
Debug info emission for extern variables in C++ was previously disabled
when the functionality was added in https://reviews.llvm.org/D71818 and
originally in https://reviews.llvm.org/D70696, because there was no use
case. We are enabling it now, as we start to deploy BPF programs
compiled from C++, leveraging C++ features like templates to reduce code
complexity. This patch is required so that we can still use kconfig in
such BPF programs compiled from C++.
Reviewed By: rnk, dblaikie, MaskRay, yonghong-song
Differential Revision: https://reviews.llvm.org/D153898
Noah Goldstein [Thu, 6 Jul 2023 18:16:53 +0000 (13:16 -0500)]
[InstCombine] Add transforms for `(rem (shl Y, X), (shl Z, X))`
This is just filling in a missing case from D144225.
We treat `(shl Y, X)` and `(shl Z, X)` as `(mul Z, 1 << X)` and `(mul
Y, 1 << X)` then reuse the same transformations that already exist.
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D147108
Noah Goldstein [Wed, 29 Mar 2023 03:52:36 +0000 (22:52 -0500)]
[InstCombine] Add test cases for `(rem (shl Y, X), (shl Z, X))`; NFC
Differential Revision: https://reviews.llvm.org/D147107
Noah Goldstein [Thu, 16 Feb 2023 23:03:09 +0000 (17:03 -0600)]
[InstCombine] Add constant combines for `(urem/srem (shl X, Y), (shl X, Z))`
Forked from D142901 to deduce more `nsw`/`nuw` flag for the output
`shl`.
We can handle the following cases + some `nsw`/`nuw` flags:
The rationale for doing this all in `InstCombine` rather than handling
the constant `shl` cases in `InstSimplify` is we often create a new
instruction because we are able to deduce more `nsw`/`nuw` flags than
the original instruction had.
Differential Revision: https://reviews.llvm.org/D144225
Noah Goldstein [Thu, 6 Jul 2023 16:44:35 +0000 (11:44 -0500)]
[emacs] Highlight 'zeroext' and 'signext' keywords as an attribute
Seems natural to highlight 'nocapture' along with other attributes
like 'nonnull', 'noundef', etc..
Differential Revision: https://reviews.llvm.org/D154571
Jennifer Yu [Wed, 5 Jul 2023 15:04:07 +0000 (08:04 -0700)]
[OPENMP52] Support Support omp_cur_iteration modifier for doacross
clause.
This is just syntax to make it easier for the user. It doesn't add any
new functionality.
for
doacross(sink: omp_cur_iteration - 1)
Equivalent to
doacross(sink: ConterVar - 1, ...)
doacross(source: omp_cur_iteration)
Equivalent to
doacross(source)
And restriction is:
OMP5.2 p.327
If vector is specified with the omp_cur_iteration keyword and with
sink as the dependence-type then it must be omp_cur_iteration - 1.
If vector is specified with source as the dependence-type then it must be
omp_cur_iteration.
Differential Revision: https://reviews.llvm.org/D154556
Alexander Yermolovich [Thu, 6 Jul 2023 18:34:18 +0000 (11:34 -0700)]
[BOLT][DWARF] Fix for .debug_line with DWARF5
There was a bug in a code that pre-populated line string for a case where parts
of .debug_line are not processed by BOLT, but copied as raw data. We were not
switching sections. This resulted in parts of the binary being over-written with
debug data.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D154544
LLVM GN Syncbot [Thu, 6 Jul 2023 18:30:23 +0000 (18:30 +0000)]
[gn build] Port
c9b1f062887d
LLVM GN Syncbot [Thu, 6 Jul 2023 18:30:22 +0000 (18:30 +0000)]
[gn build] Port
98e2d630277e
LLVM GN Syncbot [Thu, 6 Jul 2023 18:30:21 +0000 (18:30 +0000)]
[gn build] Port
43dce27c06e4
LLVM GN Syncbot [Thu, 6 Jul 2023 18:30:20 +0000 (18:30 +0000)]
[gn build] Port
38639a8159b2
Maksim Panchenko [Wed, 28 Jun 2023 21:35:05 +0000 (14:35 -0700)]
[BOLT][NFCI] Migrate Linux Kernel handling code to MetadataRewriter
Create LinuxKernelRewriter and move kernel-specific code to this class.
Depends on D154023
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D154024
Maksim Panchenko [Wed, 28 Jun 2023 06:37:14 +0000 (23:37 -0700)]
[BOLT][NFCI] Migrate pseudo probes to MetadataRewriter interface
Use new MetdataRewriter interface to update pseudo probes and move
ProbeDecoder out of BinaryContext into new PseudoProbeRewriter class.
Depends on D154021
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D154022
Differential Revision: https://reviews.llvm.org/D154023
Maksim Panchenko [Wed, 28 Jun 2023 05:56:47 +0000 (22:56 -0700)]
[BOLT][NFCI] Use MetadataRewriter interface to update SDT markers
Migrate SDT markers processing to the new MetadataRewriter interface.
Depends on D154020
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D154021
Maksim Panchenko [Wed, 28 Jun 2023 05:55:53 +0000 (22:55 -0700)]
[BOLT] Introduce MetadataRewriter interface
Introduce the MetadataRewriter interface to handle updates for various
types of auxiliary data stored in a binary file.
To implement metadata processing using this new interface, all metadata
rewriters should derive from the RewriterBase class and implement
one or more of the following methods, depending on the timing of metadata
read and write operations:
* preCFGInitializer()
* postCFGInitializer() // TBD
* preEmitFinalizer() // TBD
* postEmitFinalizer()
By adopting this approach, we aim to simplify the RewriteInstance class
and improve its scalability to accommodate new extensions of file formats,
including various metadata types of the Linux Kernel.
Differential Revision: https://reviews.llvm.org/D154020
Arthur Eubanks [Thu, 6 Jul 2023 18:07:48 +0000 (11:07 -0700)]
[gn build] Manually port
015dabd7
Liam Fitzpatrick [Tue, 4 Jul 2023 16:00:57 +0000 (17:00 +0100)]
[MLIR][Tosa] Turn reshape(const()) from canonicalization into fold; fix dynamic shape case
1) Turns the canonicalization into a fold, so it can cleanup IR within other passes.
2) When the output of the reshape is a dynamic shaped tensor,
we cannot apply the fold to the constant, because constants are required to have
static shape.
Differential Revision: https://reviews.llvm.org/D154615
Thurston Dang [Thu, 6 Jul 2023 17:58:04 +0000 (17:58 +0000)]
[msan] Fix -Wcast-qual error in msan_dl.cpp
Attempt 2 at fixing a buildbot error https://lab.llvm.org/buildbot#builders/57/builds/28143
that I had introduced in D154272
Paul Robinson [Mon, 3 Jul 2023 18:41:09 +0000 (11:41 -0700)]
[UTC] Add do-not-autogenerate capability
Differential Revision: https://reviews.llvm.org/D154383
Chia-hung Duan [Wed, 5 Jul 2023 20:39:21 +0000 (20:39 +0000)]
[scudo] Try to release pages after unlocking the TSDs
This increases the parallelism and the usage of TSDs
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D152988
Chia-hung Duan [Wed, 5 Jul 2023 20:36:41 +0000 (20:36 +0000)]
[scudo] Verify the size of free blocks in primary allocator
When all the blocks (local caches are included) are freed, the size of
free blocks should be equal to `AllocatedUser`.
Reviewed By: cferris
Differential Revision: https://reviews.llvm.org/D152769
Jonathan Peyton [Thu, 6 Jul 2023 17:31:47 +0000 (12:31 -0500)]
[OpenMP] Ensure socket layer is not first in CPUID topology detection
* Return 0 length topology if socket layer is detected first
* Fix DEBUG ASSERT
Fangrui Song [Thu, 6 Jul 2023 17:31:45 +0000 (10:31 -0700)]
[ELF] Use compression::getReasonIfUnsupported for zlib/zstd unavailable error
The error message now matches llvm-objcopy --compress-debug-sections=[zlib|zstd].
Tom Stellard [Thu, 6 Jul 2023 03:21:04 +0000 (20:21 -0700)]
[Support] Use C++11 attribute syntax for visibility attributes
The gnu extension __attribute syntax cannot be mixed with the
C++11 alignas specifier, so in order to use visibility attributes on
classes that also use alignas, we need to use the C++11 standard syntax.
Also fix a few warnings introduced by this change.
Reviewed By: compnerd
Differential Revision: https://reviews.llvm.org/D152043
Nicole Rabjohn [Thu, 6 Jul 2023 17:12:05 +0000 (17:12 +0000)]
Fixing conflicting macro definitions between curses.h and the standard library.
POSIX allows certain macros to exist with generic names (i.e. refresh(), move(), and erase()) to exist in `curses.h` which conflict with functions found in std::filesystem, among others. This patch undefs the macros in question and adds them to LIBCPP_PUSH_MACROS and LIBCPP_POP_MACROS.
Reviewed By: #libc, philnik, ldionne
Differential Revision: https://reviews.llvm.org/D147356
varconst [Thu, 6 Jul 2023 17:17:02 +0000 (10:17 -0700)]
[libc++][hardening][NFC] Rename the `has-debug-mode` feature to `has-legacy-debug-mode`.
This will allow reusing the `has-debug-mode` feature for the new debug
mode without accidentally reenabling old debug mode tests. The
`has-legacy-debug-mode` feature is deliberately never set -- the old
tests are left checked in to have a point of reference for the level of
checking that was supported by the legacy debug mode, making it easier
to verify we've reached feature parity in the future.
Amir Ayupov [Thu, 6 Jul 2023 17:16:20 +0000 (10:16 -0700)]
[YAML][NFC] Replace if-else with switch in createHNodes
BOLT YAML profile reading time gets marginally faster (14.1572->13.9207 s) for
a large YAML profile (121MB/31K functions). Not claiming stat significance
though.
Reviewed By: hintonda
Differential Revision: https://reviews.llvm.org/D154553
Matt Arsenault [Thu, 2 Feb 2023 14:28:05 +0000 (10:28 -0400)]
CodeGen: Optimize lowering of is.fpclass fcZero|fcSubnormal
Combine the two checks into a check if the exponent bits are 0. The
inverted case isn't reachable until a future change, and GlobalISel
currently doesn't attempt the inversion optimization.
https://reviews.llvm.org/D143182
Leonard Grey [Fri, 23 Jun 2023 17:26:32 +0000 (13:26 -0400)]
[gn] Add check-lsan target for Mac
Only supports ASAN mode right now. Standalone requires a some more plumbing so it will be a follow-up.
Mac-only but I suspect this will be fine on Linux also since it's based on the check-asan file, will follow up after testing.
Differential Revision: https://reviews.llvm.org/D153651
Matt Arsenault [Sun, 4 Jun 2023 10:55:04 +0000 (06:55 -0400)]
DAG: Check isCondCodeLegal in is_fpclass expansion to fcmp eq 0
Results in some x86 codegen diffs. Some look better, some look worse.
https://reviews.llvm.org/D152094
Aart Bik [Thu, 6 Jul 2023 05:17:52 +0000 (22:17 -0700)]
[mlir][sparse][gpu] fix missing dealloc
This dealloc was incorrectly removed in
https://reviews.llvm.org/D153173
Reviewed By: K-Wu
Differential Revision: https://reviews.llvm.org/D154564
Jonathan Peyton [Thu, 6 Jul 2023 16:45:58 +0000 (11:45 -0500)]
[OpenMP] Remove gcc-12 warnings from libomp
Joseph Huber [Thu, 6 Jul 2023 16:40:13 +0000 (11:40 -0500)]
[Libomptarget] Disable the 'mapping/prelock.cpp' test on AMDGPU
Summary:
This test was not functional on the new plugins, now that the old ones
have been deleted it doesn't work. Disable until we get a fix.
Thurston Dang [Wed, 5 Jul 2023 20:49:42 +0000 (20:49 +0000)]
Reland '[msan] Intercept dladdr1, and refactor dladdr'
Reland with -Wcast-qual issue fixed
Original commit message:
This patch adds an msan interceptor for dladdr1 (with support for RTLD_DL_LINKMAP and RTLD_DL_SYMENT) and an accompanying test. It also adds a helper file, msan_dl.cpp, that contains UnpoisonDllAddrInfo (refactored out of the dladdr interceptor) and UnpoisonDllAddr1ExtraInfo.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D154272
Matt Arsenault [Thu, 6 Jul 2023 15:58:35 +0000 (11:58 -0400)]
AMDGPU: Fix not applying the correct default memcpy expansion threshold
Fixes
3c848194f28decca41b7362f9dd35d4939797724. The TTI hook name got
renamed at some point in the process and the target implementation was
left behind.
Fixes: SWDEV-407329
Yusra Syeda [Thu, 6 Jul 2023 16:01:53 +0000 (12:01 -0400)]
[SystemZ][z/OS] Address single comment in ADA patch for EmittedBytes unused in -Asserts
Jeremy Furtek [Thu, 6 Jul 2023 15:56:05 +0000 (08:56 -0700)]
[mlir] Add support for TF32 as a Builtin FloatType
This diff adds support for TF32 as a Builtin floating point type. This
supplements the recent addition of the TF32 semantic to the LLVM APFloat class
by extending usage to MLIR.
https://reviews.llvm.org/D151923
More information on the TF32 type can be found here:
https://blogs.nvidia.com/blog/2020/05/14/tensorfloat-32-precision-format/
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D153705
Alex Langford [Wed, 5 Jul 2023 18:18:23 +0000 (11:18 -0700)]
[lldb][NFCI] Minor cleanups to StructuredData::GetObjectForDotSeparatedPath
This accomplishes a few minor things:
- Removed unnecessary uses of `this->`
- Removed an unnecessary std::string allocation.
- Removed some nesting to improve readability using early returns where
it makes sense.
- Replaced `strtoul` with `llvm::to_integer` which avoids another
std::string allocation.
- Removed braces from single statement conditions, removed
else-after-returns.
Differential Revision: https://reviews.llvm.org/D154534
Alex Langford [Mon, 3 Jul 2023 19:55:29 +0000 (12:55 -0700)]
[lldb][NFCI] Remove use of ConstString from OptionValue
Summary: No need to create a ConstString, `GetName` already returns a StringRef.
Reviewers: JDevlieghere, mib, jasonmolenda
Subscribers:
Differential Revision: https://reviews.llvm.org/D154386
zhijian [Thu, 6 Jul 2023 15:47:08 +0000 (11:47 -0400)]
[AIX][XCOFF] print out the traceback info
Summary:
Adding a new option -traceback-table to print out the traceback info of xcoff ojbect file.
Reviewers: James Henderson, Fangrui Song, Stephen Peckham, Xing Xue
Differential Revision: https://reviews.llvm.org/D89049
Joseph Huber [Thu, 6 Jul 2023 15:38:18 +0000 (10:38 -0500)]
[Libomptarget] Fix tests after deleting the next-gen plugins
The next-gen plugins didn't correctly configure tests and were never
actually being run. Since deleting the old plugin we stopped getting
`libomptarget` tests. This patch fixes the issue and allows the targets
to be built
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D154619
Doru Bercea [Thu, 22 Jun 2023 22:25:05 +0000 (18:25 -0400)]
Enable dynamic-sized VLAs for data sharing in OpenMP offloaded target regions.
Review: https://reviews.llvm.org/D153883
Craig Topper [Thu, 6 Jul 2023 14:53:31 +0000 (07:53 -0700)]
[RISCV] Use ClangBuiltin in IntrinsicsRISCV.td to map some scalar crypto builtins to IR intrinsic.
This is the way most targets do it for a simple mapping.
We can't do this for all builtins due to type overloading of the IR intrinsics.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D154567
Nikita Popov [Thu, 29 Jun 2023 08:04:46 +0000 (10:04 +0200)]
[CaptureTracking] Don't consider comparison of inbounds GEP with nonnull non-capturing
This is required to bring CaptureTracking in line with the new
semantics from D154051, as gep inbounds p, 0 is now always non-poison.
There are many ways in which the inbounds special case could be
preserved: If the index is known non-zero, or there is an inbounds
chain down to an identified object, etc. However, I have opted to
drop the special case entirely, as it appears to be low value:
In cases where we can determine such things (e.g. the affected test
cases) we would end up removing the compare via isGEPKnownNonNull()
logic anyway.
Differential Revision: https://reviews.llvm.org/D154054
David Spickett [Thu, 6 Jul 2023 08:49:33 +0000 (08:49 +0000)]
[libcxx] Only add -GR- option to MSVC or clang-cl builds
Previously we added both `-GR-` and `-fno-rtti` if RTTI was disabled.
When building with clang 16.x, that caused this error in part of the build:
```
clang-16: error: argument unused during compilation: '-G R-' [-Werror,-Wunused-command-line-argument]
```
I think the strange message is because clang is seeing `R-` as the argument
to `-G`, which is a valid clang option.
`-GR-` is an alternate syntax for the `/GR-` option for MSVC
(the dash means disable RTTI):
https://learn.microsoft.com/en-us/cpp/build/reference/gr-enable-run-time-type-information?view=msvc-170
This error is sort of fixed by
cd18efb61d759405956dbd30e4b5f2720d8e1783
but not intentionally. Also, we'd have to wait for 17.x to benefit from that.
The proper fix here is to only add `-GR-` if we are building with MSVC
or the MSVC-like clang-cl, and add `-fno-rtti` if not.
Reviewed By: #libc, simon_tatham, michaelplatings, ldionne
Differential Revision: https://reviews.llvm.org/D154582
Leandro Lupori [Tue, 4 Jul 2023 15:50:32 +0000 (15:50 +0000)]
[flang] Force the use of intrinsic builtins in type_info
This ensures that the __Fortran_builtins module is always used
as an intrinsic module by __Fortran_type_info, which avoids issues
when, for instance, the intrinsic modules dir is present in the
include paths.
Fixes https://github.com/llvm/llvm-project/issues/63592
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D154452
Simon Pilgrim [Thu, 6 Jul 2023 14:35:52 +0000 (15:35 +0100)]
[X86] isTargetShuffleEquivalent - ensure the reference operands are vector types
Fixes #63700
Craig Topper [Thu, 6 Jul 2023 14:37:19 +0000 (07:37 -0700)]
[RISCV] Use 'long' in sha512 builtin tests. NFC
This matches the data type of the intrinsics. This case be seen
from the removal of sext and trunc instructions from the IR.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D154577
songruiwang [Thu, 6 Jul 2023 14:34:10 +0000 (22:34 +0800)]
[analyzer] Fix false negative when pass implicit cast nil to nonnull
We should look through implicit casts before determining the type of the arguments, and only allow explicit cast to _Nonnull to suppress warning
```
void foo(NSString *_Nonnull);
foo((NSString * _Nonnull)nil); // no-warning
id obj = nil;
foo(obj); // should warning here (implicit cast id to NSString *_Nonnull)
```
Reviewed By: xazax.hun, steakhal
Differential Revision: https://reviews.llvm.org/D154221
Sergei Barannikov [Mon, 3 Jul 2023 04:06:33 +0000 (07:06 +0300)]
[Mips] Replace OperandMatchResultTy with ParseStatus (NFC)
ParseStatus is slightly more convenient to use due to implicit
conversion from bool, which allows to do something like:
```
return Error(L, "msg");
```
when with MatchOperandResultTy it had to be:
```
Error(L, "msg");
return MatchOperand_ParseFail;
```
It also has more appropriate name since parse* methods are not only for
parsing operands.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D154319
David Tenty [Wed, 29 Mar 2023 13:25:37 +0000 (09:25 -0400)]
[clang][CodeGenCXX] Improve handling of itanium ABI member function alignment requirements
The itanium ABI for certain platforms requires a minimum alignments for
member function pointers to reserve certain bits for distinguishing
virtual and non-virtual functions.
Our implementation of this however depends on the alignment of the
function involved, which may however not reflect the true alignment of
function pointers on certain targets for which the alignment is
independent of the function (e.g. AIX). Worse, the 2-byte alignment
we use may be less than the ABI minimum for the target, and in the case
we are using explicit sections will result in invalid codegen.
This patch attempts to correct this situation by considering the target
alignment of function pointers as part of making the decision about
whether we need to adjust the function alignment to conform to the ABI.
Targets which do not provide the function ptr alignment information
will return a value of 1 when queried and will conservatively retain
the old alignment.
Differential Revision: https://reviews.llvm.org/D147184
Konrad Kleine [Thu, 6 Jul 2023 12:05:02 +0000 (14:05 +0200)]
[lld] respect LLVM_EXTERNAL_LIT
Consider a setup without a system-wide installation of lit.
Instead you pass the path to lit like this:
```
cmake ...
-DLLVM_EXTERNAL_LIT=<PATH_TO_LIT_BINARY> ...
```
Then you will run into this error:
```
ninja: error: unknown target 'check-lld'
```
I have a buildbot builder that fails with this message. Here's the
passage that triggers this error:
https://github.com/llvm/llvm-zorg/blob/
d3bfd5ccbceb542098c350e4d071ceceac6854cb/zorg/buildbot/builders/annotated/standalone-build.sh#L194-L239
By using `LLVM_EXTERNAL_LIT` instead of `LLVM_LIT` we fix this problem.
See
[here](https://llvm.org/docs/GettingStarted.html#stand-alone-builds) for
a description:
> Both the LLVM_ROOT and LLVM_EXTERNAL_LIT options are required to do stand-alone builds for all sub-projects. Additional required options for each sub-project can be found in the table below.
Differential Revision: https://reviews.llvm.org/D154599
Jens Massberg [Thu, 6 Jul 2023 08:31:57 +0000 (10:31 +0200)]
Add missing semantic highlighing for concepts.
Differential Revision: https://reviews.llvm.org/D154580
Matt Arsenault [Sat, 1 Jul 2023 12:34:02 +0000 (08:34 -0400)]
AMDGPU: Make SIFixVGPRCopies preserve everything
All this does is add uses of reserved registers, which
aren't tracked by anything. Saves a loop info computation.
Matt Arsenault [Mon, 3 Jul 2023 14:38:04 +0000 (10:38 -0400)]
AMDGPU: Fold out sign bit ops on frexp_exp
The sign bit has no impact on the exponent, so strip these away. Saves
on the source modifier encoding cost. I left the GlobalISel handling
until there's a resolution to issue #62628.
We should do this in instcombine too, but legalization should be
introducing more frexps than it currently is where this would occur.
Paul Walker [Mon, 3 Jul 2023 14:00:15 +0000 (15:00 +0100)]
[SVE] Add isel for 32-bit add/sub(cntp()) -> incp/decp.
Patterns already exist for 64-bit that I've simply copied and
converted to include the necessary truncation.
Differential Revision: https://reviews.llvm.org/D154350
Matthias Springer [Thu, 6 Jul 2023 14:20:30 +0000 (16:20 +0200)]
[mlir][linalg][transform] Add verifier to MaskedVectorizeOp
Verify that the correct number of `scalable_sizes` was provided.
Differential Revision: https://reviews.llvm.org/D154600
Florian Hahn [Thu, 6 Jul 2023 14:23:16 +0000 (15:23 +0100)]
[LV] Add test case for incorrect shift truncation.
Test for https://github.com/llvm/llvm-project/issues/47927