Xiang1 Zhang [Tue, 27 Jul 2021 00:15:43 +0000 (08:15 +0800)]
[X86] Fix lowering to illegal type in LowerINSERT_VECTOR_ELT
River Riddle [Tue, 27 Jul 2021 23:58:41 +0000 (23:58 +0000)]
[PDL] Mark PatternOp as SingleBlock
This provides access to the SingleBlock accessor methods, e.g. getBody().
River Riddle [Tue, 27 Jul 2021 23:58:28 +0000 (23:58 +0000)]
[PDL] Fix the builders for OperationOp and PatternOp
Greg Clayton [Mon, 12 Jul 2021 17:03:46 +0000 (10:03 -0700)]
Create synthetic symbol names on demand to improve memory consumption and startup times.
This is a resubmission of https://reviews.llvm.org/
D105160 after fixing testing issues.
This fix was created after profiling the target creation of a large C/C++/ObjC application that contained almost 4,000,000 redacted symbol names. The symbol table parsing code was creating names for each of these synthetic symbols and adding them to the name indexes. The code was also adding the object file basename to the end of the symbol name which doesn't allow symbols from different shared libraries to share the names in the constant string pool.
Prior to this fix this was creating 180MB of "___lldb_unnamed_symbol" symbol names and was taking a long time to generate each name, add them to the string pool and then add each of these names to the name index.
This patch fixes the issue by:
not adding a name to synthetic symbols at creation time, and allows name to be dynamically generated when accessed
doesn't add synthetic symbol names to the name indexes, but catches this special case as name lookup time. Users won't typically set breakpoints or lookup these synthetic names, but support was added to do the lookup in case it does happen
removes the object file baseanme from the generated names to allow the names to be shared in the constant string pool
Prior to this fix the startup times for a large application was:
12.5 seconds (cold file caches)
8.5 seconds (warm file caches)
After this fix:
9.7 seconds (cold file caches)
5.7 seconds (warm file caches)
The names of the symbols are auto generated by appending the symbol's UserID to the end of the "___lldb_unnamed_symbol" string and is only done when the name is requested from a synthetic symbol if it has no name.
Differential Revision: https://reviews.llvm.org/
D106837
Krzysztof Parzyszek [Tue, 27 Jul 2021 22:18:10 +0000 (17:18 -0500)]
[Hexagon] Fix resetting dead registers in DBG_VALUE_LISTs
This fixes https://llvm.org/PR51229.
Fangrui Song [Tue, 27 Jul 2021 23:34:32 +0000 (16:34 -0700)]
Revert "[ELF] --gc-sections: allow GC on reserved sections in a group"
clang may place dynamic initializations for explicitly specialized class
template static data members in comdat.
Such in-comdat SHT_INIT_ARRAY was an abuse but we have to work around it for a while.
LLVM GN Syncbot [Tue, 27 Jul 2021 23:10:20 +0000 (23:10 +0000)]
[gn build] Port
8a48e6dda9f7
Johannes Doerfert [Tue, 27 Jul 2021 23:06:33 +0000 (18:06 -0500)]
Revert "[Attributor] Disable simplification AAs if a callback is present"
This reverts commit
cbb709e25124dc38ee593882051fc88c987fe591 as it
breaks the tests, which was not supposed to happen. Investigating now.
Johannes Doerfert [Tue, 27 Jul 2021 22:30:53 +0000 (17:30 -0500)]
[Attributor] Verify `checkForAllUses` return value properly
Also do not emit more than one remark after Heap2Stack failed.
Johannes Doerfert [Tue, 27 Jul 2021 17:54:04 +0000 (12:54 -0500)]
[OpenMP] Improve alignment handling in the new device runtime
Johannes Doerfert [Tue, 27 Jul 2021 18:44:21 +0000 (13:44 -0500)]
[Attributor] Disable simplification AAs if a callback is present
AAValueSimplify, AAValueConstantRange, and AAPotentialValues all look at
the IR by default. If queried for a IR position which has a
simplification callback we should either look at the callback return, or
give up. We do the latter for now.
zoecarver [Tue, 13 Jul 2021 18:06:10 +0000 (11:06 -0700)]
[libcxx][ranges] Add `counted_iterator`.
Differential Revision: https://reviews.llvm.org/
D106205
zoecarver [Tue, 27 Jul 2021 22:46:10 +0000 (15:46 -0700)]
[libcxx][nfc] Delete `cpp20_input_iterator`'s default constructor.
This will make it conform only to the minimum requirements for an `input_iterator`.
Leonard Chan [Fri, 9 Jul 2021 22:13:04 +0000 (15:13 -0700)]
[compiler-rt][hwasan][Fuchsia] Do not emit FindDynamicShadowStart for Fuchsia
This function is unused because fuchsia does not support a dynamic shadow.
Differential Revision: https://reviews.llvm.org/
D105735
James Y Knight [Tue, 27 Jul 2021 22:29:25 +0000 (18:29 -0400)]
Fix test/Transforms/LoopVectorize/AArch64/strict-fadd-vf1.ll.
It was writing to the source directory (which may not be writeable),
rather than using %t.
Fixes: a5dd6c6cf935 ("[LoopVectorize] Don't interleave scalar ordered reductions for inner loops")
Amilendra Kodithuwakku [Tue, 27 Jul 2021 21:29:25 +0000 (22:29 +0100)]
[lld][ELF] remove empty SyntheticSections from inputSections
Change removeUnusedSyntheticSections() to actually remove empty
SyntheticSections in inputSections.
In addition to doing what removeUnusedSyntheticSections() was meant
to do, this will also make the shuffle-sections tests, which shuffles
inputSections, less sensitive to empty Synthetic Sections that
will not appear in the final image.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/
D106427
Change-Id: I589eaf596472161a4395fb658aea0fad73318088
Nico Weber [Tue, 27 Jul 2021 22:23:28 +0000 (18:23 -0400)]
[gn build] manually port
71909de37495
Joseph Huber [Tue, 27 Jul 2021 19:00:09 +0000 (15:00 -0400)]
[Libomptarget] Revert new variable sharing to use the old method
The new method of sharing variables introduces a `__kmpc_alloc_shared` call
that cannot be removed in the middle end because of its non-constant argument
and unconnected free. This patch reverts this to the old method that used a
static amount of shared memory for sharing variables.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/
D106905
Jinsong Ji [Tue, 27 Jul 2021 22:10:33 +0000 (22:10 +0000)]
[AIX] Update fetch_and_add type
It turns out that the AIX kernel is defining int instead of unsigned int for fetch_and_add.
Legacy XL also defines this to be signed.
https://www.ibm.com/docs/en/aix/7.2?topic=f-fetch-add-kernel-services
So update the type for compat.
Reviewed By: hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/
D106920
Mircea Trofin [Tue, 27 Jul 2021 22:09:36 +0000 (15:09 -0700)]
[MLGO] fix silly LLVM_DEBUG misuse
Joachim Protze [Tue, 27 Jul 2021 22:08:32 +0000 (00:08 +0200)]
[OpenMP][Tests] Fix test compatibility
gcc and clang disagree in how the event handle needs to be handled.
According to OpenMP LC, gcc is right. Will open clang bug report
Mircea Trofin [Tue, 27 Jul 2021 22:03:47 +0000 (15:03 -0700)]
[NFC][MLGO] Debug messages for what inline advisor is selected
We already have an indication (error) if the desired inline advisor
cannot be enabled, but we don't have a positive indication. Added
LLVM_DEBUG messages for the latter.
Joachim Protze [Wed, 2 Jun 2021 15:39:22 +0000 (17:39 +0200)]
[OpenMP] Fix deadlock for detachable task with child tasks
This patch fixes https://bugs.llvm.org/show_bug.cgi?id=49066.
For detachable tasks, the assumption breaks that the proxy task cannot have
remaining child tasks when the proxy completes.
In stead of increment/decrement the incomplete task count, a high-order bit
is flipped to mark and wait for the incomplete proxy task.
Differential Revision: https://reviews.llvm.org/
D101082
Alfonso Gregory [Tue, 27 Jul 2021 21:33:06 +0000 (21:33 +0000)]
[libc] Fix strtok_r crash when src and *saveptr are both nullptr
While working and testing my refactoring of multiple string functions in libc, I came across a bug that needs to be addressed in a patch on its own: src is checked for nullptr and assigned to *saveptr if it is nullptr. However, saveptr is initially nullptr when it comes to reentry. This could cause a problem if both saveptr and src are null; we need to do the check first and return nullptr if both are nullptr.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/
D106885
Alex Langford [Tue, 27 Jul 2021 21:43:40 +0000 (14:43 -0700)]
[lldb][NFC] Fix incorrect log and comment
Likely copy & paste issue that was overlooked years ago
Jose M Monsalve Diaz [Tue, 27 Jul 2021 21:20:47 +0000 (17:20 -0400)]
[OpenMP] Creating the `omp_target_num_teams` and `omp_target_thread_limit` attributes to outlined functions
The device runtime contains several calls to __kmpc_get_hardware_num_threads_in_block
and __kmpc_get_hardware_num_blocks. If the thread_limit and the num_teams are constant,
these calls can be folded to the constant value.
In commit
D106033 we have the optimization phase. This commit adds the attributes to
the outlined function for the grid size. the two attributes are `omp_target_num_teams` and
`omp_target_thread_limit`. These values are added as long as they are constant.
Two functions are created `getNumThreadsExprForTargetDirective` and
`getNumTeamsExprForTargetDirective`. The original functions `emitNumTeamsForTargetDirective`
and `emitNumThreadsForTargetDirective` identify the expresion and emit the code.
However, for the Device version of the outlined function, we cannot emit anything.
Therefore, this is a first attempt to separate emision of code from deduction of the
values.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/
D106298
Jianzhou Zhao [Tue, 27 Jul 2021 18:54:55 +0000 (18:54 +0000)]
[dfsan][NFC] Describe how origin trace tracking works
Reviewed By: gbalats
Differential Revision: https://reviews.llvm.org/
D106903
Siva Chandra Reddy [Mon, 26 Jul 2021 16:47:07 +0000 (16:47 +0000)]
[libc] Fix x86_64 fenv implementation for windows
All fenv functions are also enabled for windows. Since two tests,
enabled_exceptions_test and feholdexcept_test are still failing on
windows, they have been disabled.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/
D106808
Nemanja Ivanovic [Tue, 27 Jul 2021 20:47:44 +0000 (15:47 -0500)]
[PowerPC] Turn deprecated altivec prefetch instrs to nops on AIX
The dst/dstt/dstst/dststt instructions are nop's on all PowerPC
cores that AIX supports. The AIX assembler also does not accept
these mnemonics. Turn them into nop's on AIX (similar to dstall).
Sanjay Patel [Tue, 27 Jul 2021 20:42:51 +0000 (16:42 -0400)]
[x86] update stale code comment; NFC
The transform was generalized with:
1ce05ad619a5
Sanjay Patel [Tue, 27 Jul 2021 19:41:24 +0000 (15:41 -0400)]
[x86] add more tests for cmov and lea; NFC
River Riddle [Tue, 27 Jul 2021 20:27:37 +0000 (20:27 +0000)]
[mlir] Add a FailureOr copy constructor from a FailureOr of a convertible type.
River Riddle [Tue, 27 Jul 2021 20:27:24 +0000 (20:27 +0000)]
[PDL] Remove RewriteEndOp and mark RewriteOp as NoTerminator
RewriteEndOp was a fake terminator operation that is no longer needed now that blocks are not required to have terminators.
Differential Revision: https://reviews.llvm.org/
D106911
Hedin Garca [Tue, 27 Jul 2021 17:14:18 +0000 (17:14 +0000)]
[libc] Enable MPFR library for math functions test
Included more math functions to Windows's entrypoints
and made a cmake option (-DLLVM_LIBC_MPFR_INSTALL_PATH)
where the user can specify the install path where the MPFR
library was built so it can be linked. The try_compile was
moved to LLVMLibCCheckMPFR.cmake, so the variable that is
set after this process can retain its value in other files
of the same parent file. A direct reason for this is for
LIBC_TESTS_CAN_USE_MPFR to be true when the user specifies
MPFR's path and retain its value even after leaving the file.
Reviewed By: sivachandra
Differential Revision: https://reviews.llvm.org/
D106894
Jim Ingham [Tue, 27 Jul 2021 20:36:21 +0000 (13:36 -0700)]
Add a test for top-level expressions using "expr --top-level".
This was broken for a while even though the Python version
continued to work. This adds a test so it doesn't regress.
Jim Ingham [Tue, 27 Jul 2021 20:33:49 +0000 (13:33 -0700)]
When calculating the "currently selected thread" in
Process::HandleStateChangedEvent, we check whether a thread stopped
for eStopReasonSignal is stopped for a signal that's currently set to
"no-stop". If it is, then we don't set that thread as the currently
selected thread.
But that only happens in the part of the algorithm that's handling the
case where the previously selected thread has no stop reason. Since we
want to keep on a thread as long as it is doing something interesting,
we always prefer the current thread. That's almost right, but we
forgot to check whether the previously selected thread stopped with an
eStopReasonSignal for a "no-stop" signal. If it did, then we shouldn't
select it.
This patch adds that check. I can't figure out a good way to test
this. This is the sort of thing that Ismail's scripted process plugin
will make easy once it is a real boy. But figuring out how to do this
in a real process is not trivial.
Differential Revision: https://reviews.llvm.org/
D106712
Jim Ingham [Fri, 23 Jul 2021 00:51:02 +0000 (17:51 -0700)]
Fix "break delete --disabled" with no arguments.
The code that figured out which breakpoints to delete was supposed
to set the result status if it found breakpoints, and then the code
that actually deleted them checked that the result's status was set.
The code for "break delete --disabled" failed to set the status if
no "protected" breakpoints were provided. This was a confusing way
to implement this, so I reworked it with early returns so it was less
error prone, and added a test case for the no arguments case.
Differential Revision: https://reviews.llvm.org/
D106623
Mark de Wever [Sun, 25 Jul 2021 07:18:53 +0000 (09:18 +0200)]
[libc++] Disable incomplete library features.
Adds a new CMake option to disable the usage of incomplete headers.
These incomplete headers are not guaranteed to be ABI stable. This
option is intended to be used by vendors so they can avoid their users
from code that's not ready for production usage.
The option is enabled by default.
Differential Revision: https://reviews.llvm.org/
D106763
Jacques Pienaar [Tue, 27 Jul 2021 20:32:09 +0000 (13:32 -0700)]
[mlir][bzl] Fix typo
Jinsong Ji [Tue, 27 Jul 2021 20:18:48 +0000 (20:18 +0000)]
[libclang] Check LLVM_HAVE_LINK_VERSION_SCRIPT
There are some platform that might not have version script support,
don't try to use version script on those.
Reviewed By: MaskRay, hubert.reinterpretcast
Differential Revision: https://reviews.llvm.org/
D106914
Peter Steinfeld [Tue, 27 Jul 2021 17:40:34 +0000 (10:40 -0700)]
[flang] Disallow BOZ literal constants as output list items
According to C7109, "A boz-literal-constant shall appear only as a
data-stmt-constant in a DATA statement, or where explicitly allowed in
16.9 as an actual argument of an intrinsic procedure." This change
enforces that constraint for output list items.
I also added a general interface to determine if an expression is a BOZ
literal constant and changed all of the places I could find where it
could be used.
I also added a test.
This change stemmed from the following issue --
https://gitlab-master.nvidia.com/fortran/f18-stage/issues/108
Differential Revision: https://reviews.llvm.org/
D106893
Matt Arsenault [Mon, 26 Jul 2021 22:10:28 +0000 (18:10 -0400)]
AMDGPU/GlobalISel: Fix selecting G_SEXTLOAD/G_ZEXTLOAD pre-gfx9
The patterns for the m0 glue patterns were failing to import.
Matt Arsenault [Tue, 27 Jul 2021 17:06:38 +0000 (13:06 -0400)]
AMDGPU/GlobalISel: Fix wrong addrspace in test MMOs
Matt Arsenault [Tue, 27 Jul 2021 14:57:29 +0000 (10:57 -0400)]
AMDGPU/GlobalISel: Add a few tests for unaligned truncating stores
Florian Mayer [Tue, 27 Jul 2021 09:39:33 +0000 (10:39 +0100)]
[hwasan] Fix stack safety test for old PM.
With the old PM, the stub for __hwasan_generate_tag is still generated
in the IR, but never called.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/
D106858
Fanbo Meng [Tue, 27 Jul 2021 16:46:04 +0000 (12:46 -0400)]
[z/OS] Make MinGlobalAlign consistent with SystemZ
Remove overriding MinGlobalAlign to 0 for z/OS target to be consistent with SystemZ.
Reviewed By: abhina.sreeskantharajan
Differential Revision: https://reviews.llvm.org/
D106890
Nico Weber [Tue, 27 Jul 2021 19:24:38 +0000 (15:24 -0400)]
[lld/mac] Fix sub-library.s on Windows after
8e8701abca3d4f0
The endswith() check for the framework name fails when joining
with the native path separator. Always use the posix separator as fix.
Nancy Wang [Tue, 27 Jul 2021 19:19:27 +0000 (15:19 -0400)]
[SystemZ][z/OS][libcxx]: Disable align_val_t test cases on z/OS
align_val_t is not supported on z/OS, it causes failure on z/OS. similar to https://reviews.llvm.org/rGd0fe294729a2ac45625ed45a5619c8405a14db49 , we will need to disable those test cases on z/OS platform.
Differential Revision: https://reviews.llvm.org/
D106810
Benjamin Kramer [Tue, 27 Jul 2021 19:21:55 +0000 (21:21 +0200)]
Remove unused include that's also a layering violation. NFC.
Amara Emerson [Tue, 27 Jul 2021 19:16:06 +0000 (12:16 -0700)]
Add test update for
a11d9a1f480f which disables fallbacks.
Amara Emerson [Tue, 27 Jul 2021 19:00:44 +0000 (12:00 -0700)]
[AArch64][GlobalISel] Fix constraining LDXPX intrinsic selection.
Causes a fallback because of lack of regclasses on vregs, unless its without
asserts, where we end up crashing later in codegen.
Enna1 [Tue, 27 Jul 2021 18:53:47 +0000 (11:53 -0700)]
[ASAN] NFC: Remove redundant variable
`StackAlignment` has only one use: `StackAlignment = std::max(StackAlignment, AI.getAlignment());` So it is redundant.
Reviewed By: vitalybuka, MTC
Differential Revision: https://reviews.llvm.org/
D106741
Jianzhou Zhao [Tue, 27 Jul 2021 17:44:22 +0000 (17:44 +0000)]
[dfsan][NFC] Update API interfaces
Reviewed By: gbalats
Differential Revision: https://reviews.llvm.org/
D106895
LLVM GN Syncbot [Tue, 27 Jul 2021 18:41:55 +0000 (18:41 +0000)]
[gn build] Port
02077da7e7a8
Nico Weber [Tue, 27 Jul 2021 18:38:36 +0000 (14:38 -0400)]
[lld/mac] Fix application-extension.s failure after
8e8701abca3d4
The test accidentally tested something else that makes lld fail
with a different (correct-looking) error that wasn't the one the
test tries to test for. (The test case before this change makes
ld64 hang in an infinite loop.)
Adam Nemet [Fri, 23 Jul 2021 22:02:44 +0000 (15:02 -0700)]
[Matrix] Fix shape for factored transpose
The shape of the input is C x R.
Differential Revision: https://reviews.llvm.org/
D106722
Adam Nemet [Fri, 23 Jul 2021 19:27:25 +0000 (12:27 -0700)]
[Matrix] RAUW should only replace an instruction in ShapeMap if supportsShapeInfo
As an instruction is replaced in optimizeTransposes RAUW will replace it in
the ShapeMap (ShapeMap is ValueMap so that uses are updated). In
finalizeLowering however we skip updating uses if they are in the ShapeMap
since they will be lowered separately at which point we pick up the lowered
operands.
In the testcase what happened was that since we replaced the doubled-transpose
with the shuffle, it ended up in the ShapeMap. As we lowered the
columnwise-load the use in the shuffle was not updated. Then as we removed
the original columnwise-load we changed that to an undef. I.e. we ended up
with:
```
%shuf = shufflevector <8 x double> undef, <8 x double> poison, <6 x i32>
^^^^^
<i32 0, i32 1, i32 2, i32 4, i32 5, i32 6>
```
Besides the fix itself, I have fortified this last bit. As we change uses to
undef when removing instruction we track the undefed instruction to make sure
we eventually remove those too. This would have caught the issue at compile
time.
Differential Revision: https://reviews.llvm.org/
D106714
Alexey Zhikhartsev [Tue, 27 Jul 2021 18:26:49 +0000 (14:26 -0400)]
Add jump-threading optimization for deterministic finite automata
The current JumpThreading pass does not jump thread loops since it can
result in irreducible control flow that harms other optimizations. This
prevents switch statements inside a loop from being optimized to use
unconditional branches.
This code pattern occurs in the core_state_transition function of
Coremark. The state machine can be implemented manually with goto
statements resulting in a large runtime improvement, and this transform
makes the switch implementation match the goto version in performance.
This patch specifically targets switch statements inside a loop that
have the opportunity to be threaded. Once it identifies an opportunity,
it creates new paths that branch directly to the correct code block.
For example, the left CFG could be transformed to the right CFG:
```
sw.bb sw.bb
/ | \ / | \
case1 case2 case3 case1 case2 case3
\ | / / | \
latch.bb latch.2 latch.3 latch.1
br sw.bb / | \
sw.bb.2 sw.bb.3 sw.bb.1
br case2 br case3 br case1
```
Co-author: Justin Kreiner @jkreiner
Co-author: Ehsan Amiri @amehsan
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D99205
Nico Weber [Tue, 27 Jul 2021 00:39:24 +0000 (20:39 -0400)]
[lld/mac] When loading reexports, look for basename in -F / -L first
Matches ld64 (cf Options::findIndirectDylib()), and fixes PR51218.
Differential Revision: https://reviews.llvm.org/
D106842
Louis Dionne [Tue, 15 Jun 2021 22:47:38 +0000 (18:47 -0400)]
[runtimes] Always build libc++, libc++abi and libunwind with -fPIC
Building the libraries with -fPIC ensures that we can link an executable
against the static libraries with -fPIE. Furthermore, there is apparently
basically no downside to building the libraries with position independent
code, since modern toolchains are sufficiently clever.
This commit enforces that we always build the runtime libraries with -fPIC.
This is another take on
D104327, which instead makes the decision of whether
to build with -fPIC or not to the build script that drives the runtimes'
build.
Fixes http://llvm.org/PR43604.
Differential Revision: https://reviews.llvm.org/
D104328
Louis Dionne [Thu, 15 Jul 2021 22:06:18 +0000 (18:06 -0400)]
[libc++] CI: Run -std=c++03 on Clang ToT
Differential Revision: https://reviews.llvm.org/
D106104
Craig Topper [Tue, 27 Jul 2021 16:48:18 +0000 (09:48 -0700)]
[RISCV] Select vector shl by 1 to a vector add.
A vector add may be faster than a vector shift.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/
D106689
Melanie Blower [Tue, 27 Jul 2021 17:51:31 +0000 (13:51 -0400)]
[clang][fpenv][patch] Change clang option -ffp-model=precise to select ffp-contract=on
Change the ffp-model=precise to enables -ffp-contract=on (previously
-ffp-model=precise enabled -ffp-contract=fast). This is a follow-up
to Andy Kaylor's comments in the llvm-dev discussion "Floating Point
semantic modes". From the same email thread, I put Andy's distillation
of floating point options and floating point modes into UsersManual.rst
Also fixes bugs.llvm.org/show_bug.cgi?id=50222
I had to revert this a few times because of failures on the x86-64
buildbot but I think we finally have that fixed by LNT/
79f2b03c51.
Reviewed By: rjmccall, andrew.kaylor
Differential Revision: https://reviews.llvm.org/D74436
David Green [Tue, 27 Jul 2021 17:48:58 +0000 (18:48 +0100)]
[AArch64] Update and expand min-max cost model test. NFC
This expands the cost model test for min/max to many more types,
including floating point minnum/maxnum and minimum/maximum, and FP16
with and without fullfp16. The old llc run lines are removed, as those
are better tested by CodeGen tests.
Andy Kaylor [Tue, 27 Jul 2021 17:09:30 +0000 (10:09 -0700)]
Enabling the copy-constant-to-alloca optimization in more instances
Patch by Mohammad Fawaz
This patch allows lifetime calls to be ignored (and later erased) if we
know that the copy-constant-to-alloca optimization is going to happen.
The case that is missed is when the global variable is in a different address
space than the alloca (as shown in the example added to the lit test.)
This used to work before https://github.com/llvm/llvm-project/commit/
6da31fa4a61d68af21dfa1e144e726ed6d77903e
Differential Revision: https://reviews.llvm.org/
D106573
David Sherwood [Fri, 23 Jul 2021 09:52:53 +0000 (10:52 +0100)]
[LoopVectorize] Don't interleave scalar ordered reductions for inner loops
Consider the following loop:
void foo(float *dst, float *src, int N) {
for (int i = 0; i < N; i++) {
dst[i] = 0.0;
for (int j = 0; j < N; j++) {
dst[i] += src[(i * N) + j];
}
}
}
When we are not building with -Ofast we may attempt to vectorise the
inner loop using ordered reductions instead. In addition we also try
to select an appropriate interleave count for the inner loop. However,
when choosing a VF=1 the inner loop will be scalar and there is existing
code in selectInterleaveCount that limits the interleave count to 2
for reductions due to concerns about increasing the critical path.
For ordered reductions this problem is even worse due to the additional
data dependency, and so I've added code to simply disable interleaving
for scalar ordered reductions for now.
Test added here:
Transforms/LoopVectorize/AArch64/strict-fadd-vf1.ll
Differential Revision: https://reviews.llvm.org/
D106646
Anna Thomas [Tue, 27 Jul 2021 16:34:12 +0000 (12:34 -0400)]
Update reduction test. Remove standalone test file
Based on post commit review comments at
68ffed12b.
Eugene Zhulenev [Tue, 27 Jul 2021 16:17:31 +0000 (09:17 -0700)]
[mlir] Math: add algebraic simplification patterns to math transforms
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/
D106822
Matt Arsenault [Wed, 21 Jul 2021 20:50:49 +0000 (16:50 -0400)]
AMDGPU: Update tests for lower i1 change
I forgot to squash the test updates for
b32d3d9e81cdd9275d19cd2a396c461edc9e7189
Stella Laurenzo [Thu, 22 Jul 2021 19:57:41 +0000 (19:57 +0000)]
Re-engineer MLIR python build support.
* Implements all of the discussed features:
- Links against common CAPI libraries that are self contained.
- Stops using the 'python/' directory at the root for everything, opening the namespace up for multiple projects to embed the MLIR python API.
- Separates declaration of sources (py and C++) needed to build the extension from building, allowing external projects to build custom assemblies from core parts of the API.
- Makes the core python API relocatable (i.e. it could be embedded as something like 'npcomp.ir', 'npcomp.dialects', etc). Still a bit more to do to make it truly isolated but the main structural reset is done.
- When building statically, installed python packages are completely self contained, suitable for direct setup and upload to PyPi, et al.
- Lets external projects assemble their own CAPI common runtime library that all extensions use. No more possibilities for TypeID issues.
- Begins modularizing the API so that external projects that just include a piece pay only for what they use.
* I also rolled in a re-organization of the native libraries that matches how I was packaging these out of tree and is a better layering (i.e. all libraries go into a nested _mlir_libs package). There is some further cleanup that I resisted since it would have required source changes that I'd rather do in a followup once everything stabilizes.
* Note that I made a somewhat odd choice in choosing to recompile all extensions for each project they are included into (as opposed to compiling once and just linking). While not leveraged yet, this will let us set definitions controlling the namespacing of the extensions so that they can be made to not conflict across projects (with preprocessor definitions).
* This will be a relatively substantial breaking change for downstreams. I will handle the npcomp migration and will coordinate with the circt folks before landing. We should stage this and make sure it isn't causing problems before landing.
* Fixed a couple of absolute imports that were causing issues.
Differential Revision: https://reviews.llvm.org/
D106520
Aart Bik [Tue, 27 Jul 2021 00:14:30 +0000 (17:14 -0700)]
[mlir][sparse] fixed bug in verification
The order of testing in two sparse tensor ops was incorrect,
which could cause an invalid cast (crashing the compiler instead
of reporting the error). This revision fixes that bug.
Reviewed By: gussmith23
Differential Revision: https://reviews.llvm.org/
D106841
Matt Arsenault [Tue, 9 Mar 2021 21:48:49 +0000 (16:48 -0500)]
AMDGPU: Treat IMPLICIT_DEF like a constant lanemask source
This is partially a workaround. SILowerI1Copies does not understand
unstructured loops. This would result in inserting instructions to
merge a mask register in the same block where it was defined in an
unstructured loop.
Thomas Lively [Tue, 27 Jul 2021 15:41:29 +0000 (08:41 -0700)]
[WebAssembly] Codegen for extmul SIMD instructions
Replace the clang builtins and LLVM intrinsics for the SIMD extmul instructions
with normal codegen patterns.
Differential Revision: https://reviews.llvm.org/
D106724
Riccardo Mori [Tue, 27 Jul 2021 15:28:09 +0000 (17:28 +0200)]
Update isl to
isl-0.24-69-g54aac5ac
This is needed for having the functions isl_{set,map}_n_basic_{set,map}
exported to the C++ interface.
Some tests have been modified to reflect the isl changes.
Anastasia Stulova [Tue, 27 Jul 2021 15:27:36 +0000 (16:27 +0100)]
[OpenCL] NULL redefined as nullptr in C++ mode.
Redefines NULL as nullptr instead of ((void*)0)
in C++ for OpenCL.
Such internal representation of NULL provides
compatibility with C++11 and later language
standards.
Patch by Topotuna (Justas Janickas)!
Differential Revision: https://reviews.llvm.org/
D105987
Hans Wennborg [Tue, 27 Jul 2021 15:22:01 +0000 (17:22 +0200)]
Revert "[clang][pp] adds '#pragma include_instead'"
> `#pragma clang include_instead(<header>)` is a pragma that can be used
> by system headers (and only system headers) to indicate to a tool that
> the file containing said pragma is an implementation-detail header and
> should not be directly included by user code.
>
> The library alternative is very messy code that can be seen in the first
> diff of
D106124, and we'd rather avoid that with something more
> universal.
>
> This patch takes the first step by warning a user when they include a
> detail header in their code, and suggests alternative headers that the
> user should include instead. Future work will involve adding a fixit to
> automate the process, as well as cleaning up modules diagnostics to not
> suggest said detail headers. Other tools, such as clangd can also take
> advantage of this pragma to add the correct user headers.
>
> Differential Revision: https://reviews.llvm.org/
D106394
This caused compiler crashes in Chromium builds involving PCH and an include
directive with macro expansion, when Token::getLiteralData() returned null. See
the code review for details.
This reverts commit
e8a64e5491260714c79dab65d1aa73245931d314.
Anirudh Prasad [Tue, 27 Jul 2021 15:26:00 +0000 (11:26 -0400)]
[SystemZ][z/OS] Initial code to generate assembly files on z/OS
- This patch consists of the bare basic code needed in order to generate some assembly for the z/OS target.
- Only the .text and the .bss sections are added for now.
- The relevant MCSectionGOFF/Symbol interfaces have been added. This enables us to print out the GOFF machine code sections.
- This patch enables us to add simple lit tests wherever possible, and contribute to the testing coverage for the z/OS target
- Further improvements and additions will be made in future patches.
Reviewed By: tmatheson
Differential Revision: https://reviews.llvm.org/
D106380
Anna Thomas [Tue, 27 Jul 2021 13:48:13 +0000 (09:48 -0400)]
Strip undef implying attributes when moving calls
When hoisting/moving calls to locations, we strip unknown metadata. Such calls are usually marked `speculatable`, i.e. they are guaranteed to not cause undefined behaviour when run anywhere. So, we should strip attributes that can cause immediate undefined behaviour if those attributes are not valid in the context where the call is moved to.
This patch introduces such an API and uses it in relevant passes. See
updated tests.
Fix for PR50744.
Reviewed By: nikic, jdoerfert, lebedev.ri
Differential Revision: https://reviews.llvm.org/
D104641
Tres Popp [Tue, 27 Jul 2021 14:49:15 +0000 (16:49 +0200)]
Revert "[X86][AVX] Add getBROADCAST_LOAD helper function. NFCI."
This reverts commit
1cfecf4fc4278afb0005923f6dff595cd372da5c.
This commit broke LLVM code generated through XLA by removing a
conditional on Ld->getExtensionType() == ISD::NON_EXTLOAD
This is not a perfect revert. The new function is left as other uses of
it exist now.
Tres Popp [Tue, 27 Jul 2021 14:47:52 +0000 (16:47 +0200)]
Revert "Revert "[X86][AVX] Add getBROADCAST_LOAD helper function. NFCI.""
This reverts commit
d7bbb1230a94cb239aa4a8cb896c45571444675d.
There were follow up uses of a deleted method and I didn't run the
tests. Undo the revert, so I can do it properly.
Tres Popp [Tue, 27 Jul 2021 14:21:10 +0000 (16:21 +0200)]
Revert "[X86][AVX] Add getBROADCAST_LOAD helper function. NFCI."
This reverts commit
1cfecf4fc4278afb0005923f6dff595cd372da5c.
This commit broke LLVM code generated through XLA by removing a
conditional on Ld->getExtensionType() == ISD::NON_EXTLOAD
Marek Kurdej [Tue, 27 Jul 2021 14:16:21 +0000 (16:16 +0200)]
[libc++] [c++2b] [P2166] Prohibit string and string_view construction from nullptr.
* https://wg21.link/P2166
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/
D106801
David Spickett [Wed, 31 Mar 2021 13:57:35 +0000 (14:57 +0100)]
[lldb][AArch64] Add memory tag writing to lldb
This adds memory tag writing to Process and the
GDB remote code. Supporting work for the
"memory tag write" command. (to follow)
Process WriteMemoryTags is similair to ReadMemoryTags.
It will pack the tags then call DoWriteMemoryTags.
That function will send the QMemTags packet to the gdb-remote.
The QMemTags packet follows the GDB specification in:
https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html#General-Query-Packets
Note that lldb-server will be treating partial writes as
complete failures. So lldb doesn't need to handle the partial
write case in any special way.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/
D105181
Jeremy Morse [Tue, 27 Jul 2021 13:58:49 +0000 (14:58 +0100)]
[DebugInfo][InstrRef] Correctly update DBG_PHIs during instr scheduling
Avoid several crashes when DBG_INSTR_REF and DBG_PHI instructions are fed
to the instruction scheduler. DBG_INSTR_REFs should be treated like
DBG_LABELs, and just ignored for the purpose of scheduling [0].
DBG_PHIs however behave much more like DBG_VALUEs: they refer to register
operands, and if some register defs get shuffled around during instruction
scheduling, there's a risk that the debug instr will refer to the wrong
value. There's already a facility for updating DBG_VALUEs to reflect this;
add DBG_PHI to the list of instructions that it will update.
[0] Suboptimal, but it's what instr scheduling does right now.
Differential Revision: https://reviews.llvm.org/
D106663
Vassil Vassilev [Tue, 27 Jul 2021 10:02:13 +0000 (10:02 +0000)]
[clang-repl] Build and install clang-repl by default.
We have the basic infrastructure in place. We can recover from simple errors
(recovering from errors in template instantiations is not yet supported). It
looks like we are in a reasonably functional state for llvm13.
Differential revision: https://reviews.llvm.org/
D106813
Louis Dionne [Tue, 27 Jul 2021 14:01:32 +0000 (10:01 -0400)]
[libc++] NFC: Try to trigger Docker image rebuild on CI nodes
Tres Popp [Tue, 27 Jul 2021 13:43:04 +0000 (15:43 +0200)]
Handle unused variable when assertions are disabled
Anna Thomas [Tue, 27 Jul 2021 01:39:18 +0000 (21:39 -0400)]
[IVDescriptors] Fix bug in checkOrderedReduction
The Exit instruction passed in for checking if it's an ordered reduction need not be
an FPAdd operation. We need to bail out at that point instead of
assuming it is an FPAdd (and hence has two operands). See added testcase.
It crashes without the patch because the Exit instruction is a phi with
exactly one operand.
This latent bug was exposed by
95346ba which added support for
multi-exit loops for vectorization.
Reviewed-By: kmclaughlin
Differential Revision: https://reviews.llvm.org/
D106843
Chris Jackson [Tue, 27 Jul 2021 12:59:34 +0000 (13:59 +0100)]
[DebugInfo][LoopStrengthReduction] SCEV-based salvaging for LSR
This reapplies commit
76f3ffb2b285998f02639db8fd42fb0de8a540d0 that was
reverted due to buildbot failures.
- Update lit tests with REQUIRES condition.
- Abandon salvage attempt if SCEVUnknown::getValue() returns nullptr.
Differential Revision: https://reviews.llvm.org/
D105207
Kadir Cetinkaya [Sun, 25 Jul 2021 18:38:00 +0000 (20:38 +0200)]
Revert "Revert "[clangd] Adjust compile flags to contain only the requested file as input""
This reverts commit
04e21fbc44c145d5599ef8db9aaf66b159107f33.
Kadir Cetinkaya [Mon, 26 Jul 2021 09:20:47 +0000 (11:20 +0200)]
Revert "Revert "[clangd] Canonicalize compile flags before applying edits""
Set driver mode before parsing arglist.
Depends on
D106789.
Differential Revision: https://reviews.llvm.org/
D106794
Kadir Cetinkaya [Mon, 26 Jul 2021 12:09:36 +0000 (14:09 +0200)]
[clang][Driver] Expose driver mode detection logic
Also use it in other places that performed it on their own.
Differential Revision: https://reviews.llvm.org/
D106789
Jeremy Morse [Tue, 27 Jul 2021 12:15:42 +0000 (13:15 +0100)]
[DebugInfo][InstrRef] Handle llvm.frameaddress intrinsics gracefully
When working out which instruction defines a value, the
instruction-referencing variable location code has a few special cases for
physical registers:
* Arguments are never defined by instructions,
* Constant physical registers always read the same value, are never def'd
This patch adds a third case for the llvm.frameaddress intrinsics: you can
read the framepointer in any block if you so choose, and use it as a
variable location, as shown in the added test.
This rather violates one of the assumptions behind instruction referencing,
that LLVM-ir shouldn't be able to read from an arbitrary register at some
arbitrary point in the program. The solution for now is to just emit a
DBG_PHI that reads the register value: this works, but if we wanted to do
something clever with DBG_PHIs in the future then this would probably get
in the way. As it stands, this patch avoids a crash.
Differential Revision: https://reviews.llvm.org/
D106659
Chris Jackson [Tue, 27 Jul 2021 12:34:20 +0000 (13:34 +0100)]
[DebugInfo][LoopStrengthReduction] SCEV-based salvaging for LSR
This reverts commit
76f3ffb2b285998f02639db8fd42fb0de8a540d0 because
of a failure on sanitixer-X86-64-linux-autoconf.
Sam McCall [Fri, 9 Jul 2021 08:26:44 +0000 (10:26 +0200)]
[clangd] Add platform triple (host & target) to version info
Useful in logs to understand issues around some platforms we don't have much
experience with (e.g. m1, mingw)
Differential Revision: https://reviews.llvm.org/
D105681
Andrzej Warzynski [Wed, 21 Jul 2021 08:53:01 +0000 (09:53 +0100)]
[flang][driver] Make `flang` ignore `-Mfree/-Mfixed`
`-Mfixed` is not supported by the new driver and hence
`flang`, the bash wrapper script, forwards it to the host compiler.
The forwarded options are used by the host compiler when compiling the
unparsed files. As the unparsed source files are always in the free
form, forwarding `-Mfixed` is problematic.
With this patch, `-Mfixed` (and `-Mfree` for consistency) will be
ignored altogether. The user will only see a warning. This is not a
particularly sound approach, but `flang` is only a temporary solution
for us and this workaround is a fair compromise.
Differential Revision: https://reviews.llvm.org/
D106428
Sam McCall [Tue, 27 Jul 2021 11:52:32 +0000 (13:52 +0200)]
[clangd] Use function pointer instead of function_ref to avoid GCC 5 bug
With GCC <6 constructing a function_ref from a free function reference
leads to it referencing a temporary function pointer. If the lifetime of
that temporary is insufficient it can crash.
Fixes https://github.com/clangd/clangd/issues/800
Chris Jackson [Thu, 22 Jul 2021 08:27:46 +0000 (09:27 +0100)]
[DebugInfo][LoopStrengthReduction] SCEV-based salvaging for LSR
This patch extends salvaging of debuginfo in the Loop Strength Reduction
(LSR) pass by translating Scalar Evaluations (SCEV) into DIExpressions.
The method is as follows:
- Cache dbg.value intrinsics that are salvageable.
- Obtain a loop Induction Variable (IV) from ScalarExpressionExpander or
the loop header.
- Translate the IV SCEV into an expression that recovers the current
loop iteration count. Combine this with the dbg.value's location
op SCEV to create a DIExpression that salvages the value.
Review by: jmorse
Differential Revision: https://reviews.llvm.org/
D105207
Raphael Isemann [Tue, 27 Jul 2021 11:58:48 +0000 (13:58 +0200)]
[lldb] Wait in TestGuiBasicDebug for the interface to open before quitting the welcome screen
Speculative fix for the failing lldb-aarch64-ubuntu bot.
Vignesh Balasubramanian [Tue, 27 Jul 2021 10:47:07 +0000 (16:17 +0530)]
Convert the error to warning for enabling OMPD in non-Linux platform
OMPD is enabled by default on Linux machines and disabled on others.
However, if explicitly enabled it throws an error and exit while configuring.
It is mentioned in Bug: https://bugs.llvm.org/show_bug.cgi?id=51121
This patch, instead of throwing error, disables OMPD support with a warning message,
so configuration can continue.
Reviewed By: @protze.joachim
Differential Revision: https://reviews.llvm.org/
D106682