Thomas Lively [Sat, 5 Mar 2022 00:07:16 +0000 (16:07 -0800)]
[WebAssembly] Check bulk-memory when adjusting lang opts
We previously had logic to disable pthreads, set the ThreadModel to Single, and
disable thread-safe statics when the atomics target features is disabled, since
that means that the resulting program will not be used in a threaded context.
Similarly check for the presence of the bulk-memory feature, since that is also
necessary to produce multithreaded programs.
Differential Revision: https://reviews.llvm.org/D121014
Zequan Wu [Thu, 3 Mar 2022 19:59:57 +0000 (11:59 -0800)]
[clang-format] fix namepsace format when the name is macro expansion
Originally filed at crbug.com/1184570.
When the name of a namespace is a macro that takes arguments,
- It fixed the indentation.
- It fixed the namepsace end comments.
Differential Revision: https://reviews.llvm.org/D120931
Andrew Browne [Fri, 4 Mar 2022 23:45:55 +0000 (15:45 -0800)]
[Docs] List __has_feature(dataflow_sanitizer) in LanguageExtensions docs.
Kevin Athey [Fri, 4 Mar 2022 22:08:36 +0000 (14:08 -0800)]
[MSAN] extend ioctl interceptor to support BLKSSZGET
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D120693
River Riddle [Thu, 3 Mar 2022 01:54:32 +0000 (17:54 -0800)]
[mlir][Pass] Add support for an InterfacePass and pass filtering based on OperationName
This commit adds a new hook Pass `bool canScheduleOn(RegisteredOperationName)` that
indicates if the given pass can be scheduled on operations of the given type. This makes it
easier to define constraints on generic passes without a) adding conditional checks to
the beginning of the `runOnOperation`, or b) defining a new pass type that forwards
from `runOnOperation` (after checking the invariants) to a new hook. This new hook is
used to implement an `InterfacePass` pass class, that represents a generic pass that
runs on operations of the given interface type.
The PassManager will also verify that passes added to a pass manager can actually be
scheduled on that pass manager, meaning that we will properly error when an Interface
is scheduled on an operation that doesn't actually implement that interface.
Differential Revision: https://reviews.llvm.org/D120791
Jorge Gorbe Moya [Fri, 4 Mar 2022 22:02:20 +0000 (14:02 -0800)]
Revert "[ELF] Parallelize initializeLocalSymbols"
This reverts commit
09602d3b47ec83abb2c26efa5a199c13b72c7abf.
Med Ismail Bennani [Fri, 4 Mar 2022 22:21:56 +0000 (14:21 -0800)]
[lldb/Test] Disable test_scripted_process_and_scripted_thread on Windows
This disables TestScriptedProcess.test_scripted_process_and_scripted_thread
on Windows since the inferior binary a linked to a dylib that doesn't
build on Windows.
This should fix https://lab.llvm.org/buildbot/#/builders/83/builds/16100
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Martin Storsjö [Fri, 21 Jan 2022 23:21:31 +0000 (23:21 +0000)]
[libcxx] Fix the ctype `is` (pointer version) function for Windows
Previously, this test snippet would report incorrect information:
F::mask m;
std::wstring in(L"\u00DA"); // LATIN CAPITAL LETTER U WITH ACUTE
f.is(in.data(), in.data() + 1, &m);
// m & F::lower would be set
The single-character version of the `is` function wasn't
affected by this issue though.
Define `_LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA` for Windows,
as the `alpha` / `_ALPHA` constant is a mask consisting of
multiple bits set, which avoids setting `alpha` whenver any
of the bits is set, in the `do_is` implementation.
On Windows, with the "C" locale, wchars are classified according
to their Unicode interpretation, just as in the en_US.UTF-8 locale on
all platforms.
Due to the differing classification of some characters, the
`scan_is` and `scan_not` tests are quite annoying to fix, thus just
ifdef out some of the tests for the "C" locale there - the code gets
tested with the more standard en_US.UTF-8 locale anyway.
Differential Revision: https://reviews.llvm.org/D120796
Arthur O'Dwyer [Thu, 24 Feb 2022 01:08:28 +0000 (20:08 -0500)]
[libc++] [LWG3656] Update the return type of std::bit_width.
Fixes LWG3656, "Inconsistent bit operations returning a count".
https://cplusplus.github.io/LWG/issue3656
The fix has been approved for C++23 and left to vendors' discretion
in C++20 (but it sounds like everyone's on the same page that
of course it should be DR'ed back to C++20 too).
Differential Revision: https://reviews.llvm.org/D120444
Aart Bik [Fri, 4 Mar 2022 21:26:56 +0000 (13:26 -0800)]
[mlir][sparse] fix mlir-window build breakage
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D121022
Tanya Lattner [Fri, 4 Mar 2022 22:27:07 +0000 (14:27 -0800)]
Update references to the mailing list to reference Discourse. Also update references to LLVM Bugzilla as we have moved to GitHub issues.
Reviewed By: lattner
Differential Revision: https://reviews.llvm.org/D120833
Mogball [Fri, 4 Mar 2022 22:25:18 +0000 (22:25 +0000)]
[mlir] RegionBranchOpInterface should be verifyWithRegions
Roman Lebedev [Fri, 4 Mar 2022 22:08:11 +0000 (01:08 +0300)]
Revert "Reland [SROA] Maintain shadow/backing alloca when some slices are noncapturnig read-only calls to allow alloca partitioning/promotion"
There seems to be one more uncaught problem, SROA may now end up trying
to re-re-repromote the just-promoted shadow alloca, and do that endlessly.
This reverts commit
adc0984d81f570ecc38ea23e7f556b95c7831e4c.
Mogball [Fri, 4 Mar 2022 21:59:14 +0000 (21:59 +0000)]
[mlir][ods] Save the Enum info in EnumAttr
Mogball [Fri, 4 Mar 2022 21:58:17 +0000 (21:58 +0000)]
[mlir] NFC fix missing dependency on Async
Saleem Abdulrasool [Fri, 4 Mar 2022 21:50:54 +0000 (21:50 +0000)]
ObjectFile: add a case for `EM_RISCV`
This adds the jump slot mapping for RISCV. This enables lldb to attach to a
remote debug server. Although this doesn't enable debugging RISCV targets, it
is sufficient to attach, which is a slight improvement.
Tested with DebugServer2:
~~~
(lldb) gdb-remote localhost:1234
(lldb) Process 71438 stopped
* thread #1, name = 'reduced', stop reason = signal SIGTRAP
frame #0: 0x0000003ff7fe1b20
error: Process 71438 is currently being debugged, kill the process before connecting.
(lldb) register read
general:
x0 = 0x0000003ff7fe1b20
x1 = 0x0000002ae00d3a50
x2 = 0x0000003ffffff3e0
x3 = 0x0000002ae01566e0
x4 = 0x0000003fe567c7b0
x5 = 0x0000000000001000
x6 = 0x0000002ae00604ec
x7 = 0x00000000000003ff
x8 = 0x0000003fffc22db0
x9 = 0x0000000000000000
x10 = 0x0000000000000000
x11 = 0x0000002ae603b1c0
x12 = 0x0000002ae6039350
x13 = 0x0000000000000000
x14 = 0x0000002ae6039350
x15 = 0x0000002ae6039350
x16 = 0x73642f74756f3d5f
x17 = 0x00000000000000dd
x18 = 0x0000002ae6038f08
x19 = 0x0000002ae603b1c0
x20 = 0x0000002b0f3d3f40
x21 = 0x0000003ff0b212d0
x22 = 0x0000002b0f3a2740
x23 = 0x0000002b0f3de3a0
x24 = 0x0000002b0f3d3f40
x25 = 0x0000002ad6929850
x26 = 0x0000000000000000
x27 = 0x0000002ad69297c0
x28 = 0x0000003fe578b364
x29 = 0x000000000000002f
x30 = 0x0000000000000000
x31 = 0x0000002ae602401a
pc = 0x0000003ff7fe1b20
ft0 = 0
ft1 = 0
ft2 = 0
ft3 = 0
ft4 = 0
ft5 = 0
ft6 = 0
ft7 = 0
fs0 = 0
fs1 = 0
fa0 = 0
fa1 = 0
fa2 = 0
fa3 = 0
fa4 = 0
fa5 = 0
fa6 = 0
fa7 = 9.
10304232197721e-313
fs2 = 0
fs3 = 1.
35805727667792e-312
fs4 = 1.
35589259164679e-312
fs5 = 1.
35805727659887e-312
fs6 = 9.
10304232355822e-313
fs7 = 0
fs8 = 9.
10304233027751e-313
fs9 = 0
fs10 = 9.
10304232948701e-313
fs11 = 1.
35588724164707e-312
ft8 = 0
ft9 = 9.
1372158616833e-313
ft10 = 9.
13720376537528e-313
ft11 = 1.
356808717416e-312
3 registers were unavailable.
(lldb) disassemble
error: Failed to disassemble memory at 0x3ff7fe1b2
~~~
Stella Laurenzo [Fri, 4 Mar 2022 20:08:04 +0000 (12:08 -0800)]
Reapply "[cmake] Prefix gtest and gtest_main with "llvm_"."
This reverts commit
7cdda6b8ce49ae3c90c068cff4dc355bba5d77f2.
Differential Revision: https://reviews.llvm.org/D121020
Med Ismail Bennani [Fri, 4 Mar 2022 21:36:36 +0000 (13:36 -0800)]
revert "[lldb/Host] Fix crash in FileSystem::IsLocal"
This reverts commit
2dc6e906b09deb092c15a726c06d0ecbeec1eb18 following
changes introduced in
59eb70527741594fe3c92d0a1b6704ed45111437.
Med Ismail Bennani [Fri, 4 Mar 2022 19:22:32 +0000 (11:22 -0800)]
[lldb/Plugins] Add ability to load modules to Scripted Processes
This patch introduces a new way to load modules programatically with
Scripted Processes. To do so, the scripted process blueprint holds a
list of dictionary describing the modules to load, which their path or
uuid, load address and eventually a slide offset.
LLDB will fetch that list after launching the ScriptedProcess, and
iterate over each entry to create the module that will be loaded in the
Scripted Process' target.
The patch also refactors the StackCoreScriptedProcess test to stop
inside the `libbaz` module and make sure it's loaded correctly and that
we can fetch some variables from it.
rdar://
74520238
Differential Revision: https://reviews.llvm.org/D120969
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Tue, 1 Mar 2022 01:37:28 +0000 (17:37 -0800)]
[lldb/Plugin] Use static ScriptedInterface::ErrorWithMessage function (NFC)
This patch replaces the calls to ErrorWithMessage using the GetInterface
message by a call to the static method directly.
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Med Ismail Bennani [Sat, 26 Feb 2022 04:50:05 +0000 (20:50 -0800)]
[lldb/test] Re-enable TestEvents.py on Darwin and fix crashes
This patch re-enables TestEvents.py on Darwin and fixes some crashes
that were happening due to an undefined method.
I ran it 100 times locally with the following command and it passed
every the time:
```
for i in {1..100}; do print $i/100; ./bin/lldb-dotest -p TestEvents.py 2>&1 | rg PASSED; if [ "$?" -eq "1" ]; then break; fi; done
```
Let's see if it still fails non-deterministically on the bots and
eventually also re-enable it on linux.
rdar://
37037235
Differential Revision: https://reviews.llvm.org/D120607
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Yaxun (Sam) Liu [Fri, 4 Mar 2022 21:27:53 +0000 (16:27 -0500)]
Fix test failure in openmp-offload.c
Update active offload kind of actions for OpenMP programs.
The change is expected as of
e5eb365069cce7bb642421d53a1d3964f8d5bdb7.
Richard Howell [Fri, 4 Mar 2022 21:24:37 +0000 (13:24 -0800)]
[llvm] add -r functionality to llvm-bitcode-strip
This diff adds functionality to the llvm-bitcode-strip tool for
stripping of LLVM bitcode sections.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D120669
Augie Fackler [Fri, 11 Feb 2022 20:07:48 +0000 (15:07 -0500)]
OpenMP: add allocsize(0) attribute to __kmpc_alloc_shared
This is the second step in obviating two columns about allocation
functions in MemoryBuiltins.cpp.
Differential Revision: https://reviews.llvm.org/D119583
Roman Lebedev [Thu, 24 Feb 2022 12:24:36 +0000 (15:24 +0300)]
Reland [SROA] Maintain shadow/backing alloca when some slices are noncapturnig read-only calls to allow alloca partitioning/promotion
This is inspired by the original variant of D109749 by Graham Hunter,
but is a more general version.
Roughly, instead of promoting the alloca, we call it
a shadow/backing alloca, go through all it's slices,
clone(!) instructions that operated on it,
but make them operate on the cloned alloca,
and promote cloned alloca instead.
This keeps the shadow/backing alloca, and all the original instructions
around, which results in said shadow/backing alloca being
a perfect mirror/representation of the promoted alloca's content,
so calls that take the alloca as arguments (non-capturingly!)
can be supported.
For now, we require that the calls also don't modify the alloca's content,
but that is only to simplify the initial implementation,
and that will be supported in a follow-up.
Overall, this leads to *smaller* codesize:
https://llvm-compile-time-tracker.com/compare.php?from=
a8b4f5bbab62091835205f3d648902432a4a5b58&to=
aeae054055b125b011c1122f82c86457e159436f&stat=size-total
and is roughly neutral compile-time wise:
https://llvm-compile-time-tracker.com/compare.php?from=
a8b4f5bbab62091835205f3d648902432a4a5b58&to=
aeae054055b125b011c1122f82c86457e159436f&stat=instructions
This relands commit
703240c71fd640af7490069e8149d32d78d14da1,
that was reverted by commit
7405581f7ca3ba54be8a04c394a96fe6d980f073,
because the assertion `isa<LoadInst>(OrigInstr)` didn't hold in practice,
as the newly added test `@select_of_ptrs` shows:
If the pointers into alloca are used by select's/PHI's, then even if
we manage to fracture the alloca, some sub-alloca's will likely remain.
And if there are any non-capturing calls, then we will also decide to
keep the original backing alloca around, and we suddenly ~doubled
the alloca size, and the amount of memory traffic.
I'm not sure if this is a problem or we could live with it,
but let's leave that for later...
Reviewed By: djtodoro
Differential Revision: https://reviews.llvm.org/D113520
Roman Lebedev [Fri, 4 Mar 2022 20:46:27 +0000 (23:46 +0300)]
[NFC][SROA] Add test w/ select and non-capturing call
Zequan Wu [Fri, 4 Mar 2022 03:22:30 +0000 (19:22 -0800)]
[LLDB] Flush stream at the end of PrintCommandOutput
On Windows, lldb doesn't print any error message until exit. This fixes it.
Differential Revision: https://reviews.llvm.org/D120961
Augie Fackler [Wed, 26 Jan 2022 04:50:22 +0000 (23:50 -0500)]
getAllocAlignment: respect allocalign attribute if present
As with allocsize(), we prefer the table data to attributes.
Differential Revision: https://reviews.llvm.org/D118263
Augie Fackler [Fri, 21 Jan 2022 17:07:53 +0000 (12:07 -0500)]
BuildLibCalls: add allocalign attributes for memalign and aligned_alloc
This gets us close to being able to remove a column from the table in
MemoryBuiltins.cpp.
Differential Revision: https://reviews.llvm.org/D117923
Augie Fackler [Fri, 21 Jan 2022 16:22:09 +0000 (11:22 -0500)]
Attributes: add a new allocalign attribute
This will let us start moving away from hard-coded attributes in
MemoryBuiltins.cpp and put the knowledge about various attribute
functions in the compilers that emit those calls where it probably
belongs.
Differential Revision: https://reviews.llvm.org/D117921
Yaxun (Sam) Liu [Thu, 3 Mar 2022 14:01:46 +0000 (09:01 -0500)]
[CUDA][HIP] Fix offloading kind for linking C++ programs
When both CUDA or HIP programs and C++ programs are passed
to clang driver without -c, C++ programs are treated as CUDA
or HIP program, which is incorrect.
This is because action builder sets the offloading kind of input
job actions to the linking action to be the union of offloading
kind of the input job actions, i.e. if there is one HIP or CUDA
input to the linker, then all the input to the linker is marked
as HIP or CUDA.
To fix this issue, the offload action builder tracks the originating
input argument of each host action, which allows it to determine
the active offload kind of each host action. Then the offload
kind of each input action to the linker can be determined
individually.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D120911
Shafik Yaghmour [Fri, 4 Mar 2022 20:50:25 +0000 (12:50 -0800)]
[LLDB] Remove cases of using namespace std
We had using namespace std; sprinkled around several source files and tests.
Differential Revision: https://reviews.llvm.org/D120966
Yaxun (Sam) Liu [Wed, 2 Mar 2022 14:09:16 +0000 (09:09 -0500)]
[HIP] Fix job action offloading kind for mixed HIP/C++ compilation
When both HIP and C++ programs are input files to clang
with -c, clang treats C++ programs as HIP programs,
which is incorrect.
This is due to action builder does not set correct
offloading kind for job actions for C++ programs.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D120910
Mogball [Fri, 4 Mar 2022 20:23:24 +0000 (20:23 +0000)]
[mlir] Region/BranchOpInterface: Allow implicit type conversions along control-flow edges
RegionBranchOpInterface and BranchOpInterface are allowed to make implicit type conversions along control-flow edges. In effect, this adds an interface method, `areTypesCompatible`, to both interfaces, which should return whether the types of corresponding successor operands and block arguments are compatible. Users of the interfaces, here on forth, must be aware that types may mismatch, although current users (in MLIR core), are not affected by this change. By default, type equality is used.
`async.execute` already has unequal types along control-flow edges (`!async.value<f32>` vs. `f32`), but it opted out of calling `RegionBranchOpInterface::verifyTypes` in its verifier. That method has now been removed and `RegionBranchOpInterface` will verify types along control edges by default in its verifier.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D120790
Paul Robinson [Thu, 17 Feb 2022 18:36:17 +0000 (10:36 -0800)]
[RGT] DistroTest: Separate environment-specific test functions
This allows using GTEST_SKIP() to identify un-executed tests.
Found by the Rotten Green Tests project.
Matthias Springer [Fri, 4 Mar 2022 20:11:21 +0000 (05:11 +0900)]
[mlir][bufferize] Add BufferizationState initializers
Such initializer functions can be enqueued in `BufferizationOptions`. They can be used to set up dialect-specific bufferization state.
Differential Revision: https://reviews.llvm.org/D120985
Tue Ly [Fri, 4 Mar 2022 15:00:10 +0000 (10:00 -0500)]
[libc] Fix small bugs in aarch64/FEnvImpl.h and simplify feclearexcept_test.
Fix small bugs in aarch64/EFnvImpl.h and simplify feclearexcept_test.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D120997
Richard [Thu, 3 Feb 2022 03:53:53 +0000 (20:53 -0700)]
[tooling] Explain how to create a compilation database on Windows [NFC]
Differential Revision: https://reviews.llvm.org/D120947
wren romano [Thu, 3 Mar 2022 19:41:23 +0000 (11:41 -0800)]
[mlir][sparse] Rename add{Pointer,Index} to append{Pointer,Index}
This clarifies that these methods only work in append mode, not for general insertions. This is a prospective change towards https://github.com/llvm/llvm-project/issues/51652 which also performs random-access insertions, so we want to avoid confusion.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D120929
Jez Ng [Fri, 4 Mar 2022 19:20:53 +0000 (14:20 -0500)]
[lld-macho][nfc] Use %X in mapfile test
LLD (and ld64) emits uppercase hex addresses in the mapfile. The
map-file.s test passes right now because the addresses we emit happen
not to include any alphabets, but that can easily change.
I noticed this while dealing with
https://github.com/llvm/llvm-project/issues/54184.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D120941
Jez Ng [Fri, 4 Mar 2022 19:20:49 +0000 (14:20 -0500)]
[lld-macho][nfc] Rename some tests for consistency
Now all the tests that cover symbol resolution / precedence have
"resolution" in their filename.
I also added a couple of extra comments.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D120938
Benjamin Kramer [Fri, 4 Mar 2022 19:18:00 +0000 (20:18 +0100)]
[bazel] Port
76ec69a911c6
Snehasish Kumar [Thu, 3 Mar 2022 01:28:09 +0000 (17:28 -0800)]
[memprof] Filter out callstack frames which cannot be symbolized.
This patch filters out callstack frames which can't be symbolized or if
the frames belong to the runtime. Symbolization may not be possible if
debug information is unavailable or if the addresses are from a shared
library. For now we only support optimization of the main binary which
is statically linked to the compiler runtime.
Differential Revision: https://reviews.llvm.org/D120860
Tue Ly [Fri, 4 Mar 2022 03:58:51 +0000 (22:58 -0500)]
[libc] Remove the redundant header FPUtil/FEnvUtils.h
Remove the redundant header FPUtil/FEnvUtils.h, use FPUtil/FEnvImpl.h header instead.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/D120965
Jakub Chlanda [Fri, 4 Mar 2022 19:05:00 +0000 (11:05 -0800)]
[NVPTX] Correctly set regs for neg, abs intrinsics
This patch fixes a bug introduced in D117887.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D120991
Johannes Doerfert [Fri, 4 Mar 2022 18:16:29 +0000 (13:16 -0500)]
[OpenMP][FIX] Ensure custom state machine works
The custom state machine had a check for surplus threads that filtered
the main thread if the kernel was executed by a single warp only. We
now first check for the main thread, then for surplus threads, avoiding
to filter the former out.
Fixes #54214.
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D121011
Roman Lebedev [Fri, 4 Mar 2022 18:47:54 +0000 (21:47 +0300)]
Revert "[SROA] Maintain shadow/backing alloca when some slices are noncapturnig read-only calls to allow alloca partitioning/promotion"
Bots are reporting that the assertion about only expecting loads is wrong.
This reverts commit
703240c71fd640af7490069e8149d32d78d14da1.
Ellis Hoag [Thu, 3 Mar 2022 22:59:51 +0000 (14:59 -0800)]
[InstrProf][NFC] Fix warning by removing typecast
This fixes a warning about comparing mismatched types. Since `mmap()` already returns a `void *` use that as the pointer type for comparison.
Reviewed By: kyulee, zequanwu
Differential Revision: https://reviews.llvm.org/D120945
Siva Chandra Reddy [Sat, 26 Feb 2022 01:18:19 +0000 (01:18 +0000)]
[libc][NFC] Add a platform independent thread support library.
The idea is that, other parts of the libc which require thread/lock
support will be able to use this platform independent setup.
With this change, only the linux implementation of a mutex type has been
moved to the new library. Because of this, there is some duplication
between the new library and src/threads/linux. A follow up change will
move all of src/threads/linux to the new library. The duplication should
be eliminated with that move.
Reviewed By: lntue
Differential Revision: https://reviews.llvm.org/D120795
Arthur O'Dwyer [Thu, 3 Mar 2022 20:42:26 +0000 (15:42 -0500)]
[libc++] Mark __wrap_iter's private constructors as explicit.
This is slightly more user-visible than D119894, because the user is
expected to touch `__wrap_iter` directly. But the affected ctors are
non-public, so the user was never expected to be actually calling them.
And I didn't intentionally omit this from D119894; I just didn't
think of it.
Differential Revision: https://reviews.llvm.org/D120937
Tue Ly [Fri, 4 Mar 2022 18:15:17 +0000 (13:15 -0500)]
[libc][Obvious] Add build folder to .gitignore.
Joseph Huber [Fri, 4 Mar 2022 17:07:57 +0000 (12:07 -0500)]
[Libomptarget] Work around bug in initialization of libomptarget
Libomptarget uses some shared variables to track certain internal stated
in the runtime. This causes problems when we have code that contains no
OpenMP kernels. These variables are normally initialized upon kernel
entry, but if there are no kernels we will see no initialization.
Currently we load the runtime into each source file when not running in
LTO mode, so these variables will be erroneously considered undefined or
dead and removed, causing miscompiles. This patch temporarily works
around the most obvious case, but others still exhibit this problem. We
will need to fix this more soundly later.
Fixes #54208.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D121007
Roman Lebedev [Thu, 24 Feb 2022 12:24:36 +0000 (15:24 +0300)]
[SROA] Maintain shadow/backing alloca when some slices are noncapturnig read-only calls to allow alloca partitioning/promotion
This is inspired by the original variant of D109749 by Graham Hunter,
but is a more general version.
Roughly, instead of promoting the alloca, we call it
a shadow/backing alloca, go through all it's slices,
clone(!) instructions that operated on it,
but make them operate on the cloned alloca,
and promote cloned alloca instead.
This keeps the shadow/backing alloca, and all the original instructions
around, which results in said shadow/backing alloca being
a perfect mirror/representation of the promoted alloca's content,
so calls that take the alloca as arguments (non-capturingly!)
can be supported.
For now, we require that the calls also don't modify the alloca's content,
but that is only to simplify the initial implementation,
and that will be supported in a follow-up.
Overall, this leads to *smaller* codesize:
https://llvm-compile-time-tracker.com/compare.php?from=
a8b4f5bbab62091835205f3d648902432a4a5b58&to=
aeae054055b125b011c1122f82c86457e159436f&stat=size-total
and is roughly neutral compile-time wise:
https://llvm-compile-time-tracker.com/compare.php?from=
a8b4f5bbab62091835205f3d648902432a4a5b58&to=
aeae054055b125b011c1122f82c86457e159436f&stat=instructions
Reviewed By: djtodoro
Differential Revision: https://reviews.llvm.org/D113520
Arthur O'Dwyer [Mon, 14 Feb 2022 21:03:01 +0000 (16:03 -0500)]
[clang] [concepts] Check constrained-auto return types for void-returning functions
Fixes #49188.
Differential Revision: https://reviews.llvm.org/D119184
Arthur O'Dwyer [Thu, 17 Feb 2022 16:59:00 +0000 (11:59 -0500)]
[clang] [NFC] Add `const` to a parameter that's not modified.
Reviewed as part of D119184.
Simon Pilgrim [Fri, 4 Mar 2022 17:41:28 +0000 (17:41 +0000)]
[X86] getTargetVShiftNode - peek through any zext node
If the shift amount has been zero-extended, peek through as this might help us further canonicalize the shift amount.
Fixes regression mentioned in rG147cfcbef1255ba2b4875b76708dab1a685085f5
Colin Cross [Fri, 4 Mar 2022 06:17:15 +0000 (22:17 -0800)]
Pass through more LIBCXX_* variables to libfuzzer's custom lib++
Pass LIBCXX_HAS_PTHREAD_LIB, LIBCXX_HAS_RT_LIB and LIBCXXABI_HAS_PTHREAD_LIB
through to the custom lib++ builds so that libfuzzer doesn't end up with a .deplibs section that
links against those libraries when the variables are set to false.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D120946
Siva Chandra Reddy [Thu, 3 Mar 2022 10:25:35 +0000 (10:25 +0000)]
[libc] Make the errno macro resolve to the thread local variable directly.
With modern architectures having a thread pointer and language supporting
thread locals, there is no reason to use a function intermediary to access
the thread local errno value.
The entrypoint corresponding to errno has been replaced with an object
library as there is no formal entrypoint for errno anymore.
Reviewed By: jeffbailey, michaelrj
Differential Revision: https://reviews.llvm.org/D120920
LLVM GN Syncbot [Fri, 4 Mar 2022 17:22:23 +0000 (17:22 +0000)]
[gn build] Port
c88deef0a721
LLVM GN Syncbot [Fri, 4 Mar 2022 17:22:23 +0000 (17:22 +0000)]
[gn build] Port
7ee97c24efab
Yitzhak Mandelbaum [Thu, 3 Mar 2022 11:58:57 +0000 (11:58 +0000)]
[clang][dataflow] Add `MatchSwitch` utility library.
Adds `MatchSwitch`, a library for simplifying implementation of transfer
functions. `MatchSwitch` supports constructing a "switch" statement, where each
case of the switch is defined by an AST matcher. The cases are considered in
order, like pattern matching in functional languages.
Differential Revision: https://reviews.llvm.org/D120900
Krzysztof Drewniak [Thu, 3 Mar 2022 22:52:27 +0000 (22:52 +0000)]
[MLIR][AMDGPU] Fix typo and add comment to SerializeToHsaco
Reviewed By: bondhugula
Differential Revision: https://reviews.llvm.org/D120943
Yitzhak Mandelbaum [Thu, 3 Mar 2022 03:34:44 +0000 (03:34 +0000)]
[clang][dataflow] Add a lattice to track source locations.
This patch adds a simpe lattice used to collect source loctions. An intended application is to track errors found in code during an analysis.
Differential Revision: https://reviews.llvm.org/D120890
William S. Moses [Thu, 3 Mar 2022 19:04:14 +0000 (14:04 -0500)]
[MLIR][SCF] Allow combining subsequent if statements that yield & negated condition
This patch extends the existing if combining canonicalization to also handle the case where a value returned by the first if is used within the body of the second if.
This patch also extends if combining to support if's whose conditions are logical negations of each other.
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D120924
Jeremy Morse [Fri, 4 Mar 2022 16:39:22 +0000 (16:39 +0000)]
[DebugInfo][InstrRef] Accept register-reads after isel in any block
When lowering LLVM-IR to instruction referencing stuff, if a value is
defined by a COPY, we try and follow the register definitions back to where
the value was defined, and build an instruction reference to that
instruction. In a few scenarios (such as arguments), this isn't possible.
I added some assertions to catch cases that weren't explicitly whitelisted.
Over the course of a few months, several more scenarios have cropped up,
the lastest is the llvm.read_register intrinsic, which lets LLVM-IR read an
arbitary register at any point. In the face of this, there's little point
in validating whether debug-info reads a register in an expected scenario.
Thus: this patch just deletes those assertions, and adds a regression test
to check that something is done with the llvm.read_register intrinsic.
Fixes #54190
Differential Revision: https://reviews.llvm.org/D121001
William S. Moses [Wed, 2 Mar 2022 20:13:07 +0000 (15:13 -0500)]
[MLIR][MemRef] Ensure alloca_scope is inlined with no allocating ops
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D120841
Simon Pilgrim [Fri, 4 Mar 2022 16:47:20 +0000 (16:47 +0000)]
[X86] LowerShiftByScalarVariable - find splat patterns with getSplatSourceVector instead of getSplatValue
This completes the removal of uses of SelectionDAG::getSplatValue started in D119090 - by avoiding extracting the splatted element we make it a lot easier to zero-extend the bottom 64-bits of the shift amount and fixes issues we had on 32-bit targets where i64 isn't legal.
I've removed the old version of getTargetVShiftNode that took the scalar shift amount argument and LowerRotate can finally efficiently handle vXi16 rotates-by-scalar (using the same code as general funnel-shifts).
The only regression we see is in the X86-AVX2 PR52719 test case in vector-shift-ashr-256.ll - this is now hitting the same problem as the X86-AVX1 case (failure to simplify a multi-use X86ISD::VBROADCAST_LOAD) which I intend to address in a follow up patch.
Hans Wennborg [Fri, 4 Mar 2022 16:25:48 +0000 (17:25 +0100)]
Revert "[AArch64] Async unwind - function prologues"
It caused builds to assert with:
(StackSize == 0 && "We already have the CFA offset!"),
function generateCompactUnwindEncoding, file AArch64AsmBackend.cpp, line 624.
when targeting iOS. See comment on the code review for reproducer.
> This patch rearranges emission of CFI instructions, so the resulting
> DWARF and `.eh_frame` information is precise at every instruction.
>
> The current state is that the unwind info is emitted only after the
> function prologue. This is fine for synchronous (e.g. C++) exceptions,
> but the information is generally incorrect when the program counter is
> at an instruction in the prologue or the epilogue, for example:
>
> ```
> stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
> mov x29, sp
> .cfi_def_cfa w29, 16
> ...
> ```
>
> after the `stp` is executed the (initial) rule for the CFA still says
> the CFA is in the `sp`, even though it's already offset by 16 bytes
>
> A correct unwind info could look like:
> ```
> stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
> .cfi_def_cfa_offset 16
> mov x29, sp
> .cfi_def_cfa w29, 16
> ...
> ```
>
> Having this information precise up to an instruction is useful for
> sampling profilers that would like to get a stack backtrace. The end
> goal (towards this patch is just a step) is to have fully working
> `-fasynchronous-unwind-tables`.
>
> Reviewed By: danielkiss, MaskRay
>
> Differential Revision: https://reviews.llvm.org/D111411
This reverts commit
32e8b550e5439c7e4aafa73894faffd5f25d0d05.
zhongyunde [Fri, 4 Mar 2022 14:44:14 +0000 (22:44 +0800)]
[AArch64] Use simd mov to materialize big fp constants
mov w8, #
1325400064 + fmov s0, w8 ==> movi v0.2s, 0x4f, lsl 24
Fix https://github.com/llvm/llvm-project/issues/53651
Reviewed By: dmgreen, fhahn
Differential Revision: https://reviews.llvm.org/D120452
Richard Howell [Fri, 4 Mar 2022 16:30:32 +0000 (08:30 -0800)]
[llvm] fix bitcode-strip.test on windows
Remove the executable name from the test match as this will have
a `.exe` suffix on windows.
Reviewed By: drodriguez
Differential Revision: https://reviews.llvm.org/D121000
Michel Weber [Fri, 4 Mar 2022 15:04:37 +0000 (15:04 +0000)]
[MLIR][Presburger] skip IntegerPolyhedrons with LocalIds in coalesce
This patch makes coalesce skip the comparison of all pairs of IntegerPolyhedrons with LocalIds rather than crash. The heuristics to handle these cases will be upstreamed later on.
Reviewed By: arjunp
Differential Revision: https://reviews.llvm.org/D120995
Richard Howell [Fri, 4 Mar 2022 16:00:21 +0000 (08:00 -0800)]
[llvm] add -o flag to llvm-bitcode-strip
Add the -o flag to specify an output path for llvm-bitcode-strip.
This matches the interface to the Xcode bitcode_strip tool.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D120731
William S. Moses [Thu, 3 Mar 2022 17:31:48 +0000 (12:31 -0500)]
[MLIR][LLVM] Fold extractvalue to ignore insertvalue at distinct index
We can simplify an extractvalue of an insertvalue to extract out of the base of the insertvalue, if the insert and extract are at distinct and non-prefix'd indices
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D120915
Louis Dionne [Fri, 4 Mar 2022 15:59:03 +0000 (10:59 -0500)]
[runtimes] Trigger CI jobs when only the runtimes/ subdirectory is touched
Balazs Benics [Fri, 4 Mar 2022 15:45:20 +0000 (16:45 +0100)]
[clang-tidy][NFC] Document bugprone-narrowing-conversions check alias
Augie Fackler [Fri, 14 Jan 2022 19:38:44 +0000 (14:38 -0500)]
InstructionCombining: avoid eliding mismatched alloc/free pairs
Prior to this change LLVM would happily elide a call to any allocation
function and a call to any free function operating on the same unused
pointer. This can cause problems in some obscure cases, for example if
the body of operator::new can be inlined but the body of
operator::delete can't, as in this example from jyknight:
#include <stdlib.h>
#include <stdio.h>
int allocs = 0;
void *operator new(size_t n) {
allocs++;
void *mem = malloc(n);
if (!mem) abort();
return mem;
}
__attribute__((noinline)) void operator delete(void *mem) noexcept {
allocs--;
free(mem);
}
void deleteit(int*i) { delete i; }
int main() {
int*i = new int;
deleteit(i);
if (allocs != 0)
printf("MEMORY LEAK! allocs: %d\n", allocs);
}
This patch addresses the issue by introducing the concept of an
allocator function family and uses it to make sure that alloc/free
function pairs are only removed if they're in the same family.
Differential Revision: https://reviews.llvm.org/D117356
Karl Meakin [Wed, 16 Feb 2022 17:07:05 +0000 (17:07 +0000)]
Extend `performANDCSELCombine` to `performANDORCSELCombine`
Differential Revision: https://reviews.llvm.org/D120422
Nikita Popov [Fri, 4 Mar 2022 14:10:51 +0000 (15:10 +0100)]
[CoroFrame] Remove unused insertSpills() return value (NFC)
Simon Pilgrim [Fri, 4 Mar 2022 13:14:24 +0000 (13:14 +0000)]
[X86] SimplifyDemandedVectorElts - adjust X86ISD::ANDNP demanded elts based off constant masks
Similar to what we already do in combineAndnp, if either operand is a constant then we can improve the demanded elts/bits.
David Spickett [Fri, 4 Mar 2022 13:33:55 +0000 (13:33 +0000)]
Revert "[WebAssembly] Update WebAssemblyAsmTypeCheck for table.get"
This reverts commit
6b2482f6f4729a76776a48ac3b4a3fcd401a880e due to
test failures on AArch64 bots:
https://lab.llvm.org/buildbot/#/builders/183/builds/3684
Andrzej Warzynski [Fri, 4 Mar 2022 11:31:29 +0000 (11:31 +0000)]
[flang] Fix standalone builds
In
dd875dd88bf7f39ad56d8402bdc49ffeb51b4ab8 I added a missing MLIR
dependency in Flang. However, that particular CMake target is not
exported as something available to standalone builds. In this patch is
switch to `MLIRIR` instead, which depends on
`MLIRBuiltinAttributeInterfacesIncGen` - the missing dependency added
previously.
Differential Revision: https://reviews.llvm.org/D120986
Jay Foad [Fri, 4 Mar 2022 12:45:09 +0000 (12:45 +0000)]
[AMDGPU] Extra test cases in hard-clauses.mir
Add some cases where different kinds of instruction might be
combined in the same hard clause.
Jay Foad [Fri, 4 Mar 2022 12:45:38 +0000 (12:45 +0000)]
[AMDGPU] Regenerate checks in hard-clauses.mir
Nathan Sidwell [Thu, 3 Mar 2022 11:44:16 +0000 (03:44 -0800)]
[demangler] Make OutputBuffer non-copyable
In addressing the buffer ownership API, I discovered a rogue member
function that returned by value rather than by reference. It clearly
intended to return by reference, but because the copy ctor wasn't
deleted this wasn't caught.
It is not necessary to make this a move-only type, although that would
be an alternative.
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D120901
Aaron Ballman [Fri, 4 Mar 2022 12:21:04 +0000 (07:21 -0500)]
Revert "[analyzer] Done some changes to detect Uninitialized read by the char array manipulation functions"
This reverts commit
9c300c18a4eaf79eb7044744bbdb705764579220.
This broke the sphinx bot and seems like an unintentional commit.
4vtomat [Fri, 4 Mar 2022 04:09:00 +0000 (20:09 -0800)]
[NFC] Divide tests into smaller files
This commit divides the large test files(over 30k lines) under clang/test/CodeGen/RISCV including:
rvv-intrinsics/vloxseg.c
rvv-intrinsics/vluxseg.c
rvv-intrinsics-overloaded/vloxseg.c
rvv-intrinsics-overloaded/vluxseg.c
into "non-masked" version and "masked" version which can reduce the test cases by 50% in a single file.
Differential Revision: https://reviews.llvm.org/D120967
Jay Foad [Thu, 3 Mar 2022 15:35:40 +0000 (15:35 +0000)]
[AMDGPU] Tweak predicates for image_bvh_intersect_ray instructions
Don't override SubtargetPredicate since that is already set in the
base classes for the appropriate subtarget like MIMG_gfx10. Use
OtherPredicates instead for consistency with the way we handle
features like HasImageInsts and HasExtendedImageInsts. NFC.
Differential Revision: https://reviews.llvm.org/D120909
nokotan [Fri, 4 Mar 2022 12:01:25 +0000 (13:01 +0100)]
[WebAssembly] Update WebAssemblyAsmTypeCheck for table.get
This patch is aimed to resolve [[ https://github.com/llvm/llvm-project/issues/53789 | GitHub Issue #53789 ]].
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D120229
Paul Walker [Thu, 24 Feb 2022 18:40:23 +0000 (18:40 +0000)]
[DAGCombine] Prevent illegal ISD::SPLAT_VECTOR operations post legalisation.
When triggered during operation legalisation the affected combine
generates a splat_vector that when custom lowered for SVE fixed
length code generation, results in the original precombine sequence
and thus we enter a legalisation/combine hang.
NOTE: The patch contains no tests because I observed this issue
only when combined with other work that might never become public.
The current way AArch64 lowers ISD::SPLAT_VECTOR meant a specific
test was not possible so I'm hoping the DAGCombiner fix can be seen
as obvious. The AArch64ISelLowering change is requirted to maintain
existing code quality.
Differential Revision: https://reviews.llvm.org/D120735
Florian Hahn [Fri, 4 Mar 2022 11:37:00 +0000 (11:37 +0000)]
[Driver] Split up huge arm-cortex-cpus.c test.
This test file has grown to the point where it takes a huge amount of
time to run. At the moment, this test seems to consistently time out
when running in the pre-commit checks in Phabricator with a 10 minute
timeout. For example see
https://reviews.llvm.org/harbormaster/unit/view/2832724/
While splitting up the test file is not ideal, it is even more
undesirable to have huge test files that time out in common settings.
This patch splits up the test file roughly in the middle.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D120876
Florian Hahn [Fri, 4 Mar 2022 11:24:12 +0000 (11:24 +0000)]
[Driver] Split up huge aarch64-cpus.c test.
This test file has grown to the point where it takes a huge amount of
time to run. At the moment, this test seems to consistently time out
when running in the pre-commit checks in Phabricator with a 10 minute
timeout. For example see
https://reviews.llvm.org/harbormaster/unit/view/2832723/
While splitting up the test file is not ideal, it is even more
undesirable to have huge test files that time out in common settings.
This patch splits up the test file roughly in the middle.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D120875
David Green [Fri, 4 Mar 2022 11:12:26 +0000 (11:12 +0000)]
[AArch64] Turn UZP1 with undef operand into truncate
This turns upz1(x, undef) to concat(truncate(x), undef), as the truncate
is simpler and can often be optimized away, and it helps some of the
insert-subvector tests optimize more cleanly.
Differential Revision: https://reviews.llvm.org/D120879
Nikita Popov [Fri, 4 Mar 2022 11:08:41 +0000 (12:08 +0100)]
[Attributor] Remove function pointer type check (NFCI)
This check is not relevant for correctness, it can only avoid
walking some recursive uses if the cast is to a non-function
pointer type. As this distinction will no longer be possible
with opaque pointers and all users will have to be walked
anyway, I'm dropping the check in advance.
Florian Hahn [Fri, 4 Mar 2022 11:07:42 +0000 (11:07 +0000)]
[IVDescriptor] Use DT to check order of Previous, OtherPrev.
Previous and OhterPrev may not be in the same block. Use DT::dominates
instead of local comesBefore. DT::dominates is already used earlier to
check the order of Previous and SinkCandidate.
Fixes https://github.com/llvm/llvm-project/issues/54195
Nikita Popov [Fri, 25 Feb 2022 16:36:29 +0000 (17:36 +0100)]
Reapply [MergeICmps] Don't require GEP
Recommit without changes over
53abe3ff66a54117308352d379837c7d3229f8d6,
which addressed the cause of the reported crash.
-----
With opaque pointers, the zero-offset load will generally not use
a GEP. Allow a direct load without GEP, which is treated the same
way as a zero-offset GEP.
David Sherwood [Mon, 28 Feb 2022 17:04:55 +0000 (17:04 +0000)]
[AArch64] Fix the TuneExynosM4 entry in lib/Target/AArch64/AArch64.td
A bug was introduced in
5ea35791e6642f6160819c930f79b0f57ad0e907 that
gave the wrong name and description for TuneExynosM4. This patch fixes
that and changes it back to m3.
Differential Revision: https://reviews.llvm.org/D120665
Nikita Popov [Fri, 4 Mar 2022 10:13:40 +0000 (11:13 +0100)]
[MergeICmp] Make instruction move robust against empty block (NFCI)
Use the overload that support moving into an empty block. I don't
think that this situation can occur right now, but it can happen
with the change from
e7fb1c15cb85d748c1c4fdd5a2eb5613ec7bef1d,
and the test is derived from the issue reported there.
Sander de Smalen [Thu, 3 Mar 2022 14:09:26 +0000 (14:09 +0000)]
[AArch64] Improve access to fixed-width object when stack has SVE.
When the stack has SVE objects, fixed-width objects are often better accessed
from the SP, instead of the FP, because part/all of the fixed-width offset
can be folded into the (non-scalable) addressing mode, where otherwise an
ADDVL would be required.
Reviewed By: david-arm
Differential Revision: https://reviews.llvm.org/D120738
Sander de Smalen [Tue, 1 Mar 2022 17:00:04 +0000 (17:00 +0000)]
[AArch64] NFC: Add test for access to fixed-width stack object when stack has SVE.
In this case, the access would benefit from being accessed from the SP, as that
would avoid the redundant ADDVL, since most of the offset can currently be
folded into the addressing mode.
Nikita Popov [Fri, 4 Mar 2022 09:30:50 +0000 (10:30 +0100)]
[Bitcode] Move x86_intrcc upgrade to bitcode reader
This upgrade requires access the legacy pointer element type, so
it needs to happen inside the bitcode reader.