OSDN Git Service
Luo, Yuanke [Thu, 31 Dec 2020 05:47:42 +0000 (13:47 +0800)]
[X86] Fix tile register spill issue.
The tile register spill need 2 instructions.
%46:gr64_nosp = MOV64ri 64
TILESTORED %stack.2, 1, killed %46:gr64_nosp, 0, $noreg, %43:tile
The first instruction load the stride to a GPR, and the second
instruction store tile register to stack slot. The optimization of merge
spill instruction is done after register allocation. And spill tile
register need create a new virtual register to for stride, so we can't
hoist tile spill instruction in postOptimization() of register
allocation. We can't hoist TILESTORED alone and we can't hoist the 2
instuctions together because MOV64ri will clobber some GPR. This patch
is to disble the spill merge for any spill which need 2 instructions.
Differential Revision: https://reviews.llvm.org/D93898
Haojian Wu [Mon, 11 Jan 2021 08:55:24 +0000 (09:55 +0100)]
[clangd] Add metrics for go-to-implementation.
Differential Revision: https://reviews.llvm.org/D94393
David Green [Mon, 11 Jan 2021 09:24:28 +0000 (09:24 +0000)]
[ARM] Add debug messages for the load store optimizer. NFC
David Sherwood [Wed, 25 Nov 2020 15:55:43 +0000 (15:55 +0000)]
[NFC][InstructionCost] Change LoopVectorizationCostModel::getInstructionCost to return InstructionCost
This patch is part of a series of patches that migrate integer
instruction costs to use InstructionCost. In the function
selectVectorizationFactor I have simply asserted that the cost
is valid and extracted the value as is. In future we expect
to encounter invalid costs, but we should filter out those
vectorization factors that lead to such invalid costs.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Differential Revision: https://reviews.llvm.org/D92178
Jan Svoboda [Fri, 8 Jan 2021 10:05:16 +0000 (11:05 +0100)]
Reapply "[clang][cli] Port DiagnosticOpts to new option parsing system"
This reverts commit
8e3e148c
This commit fixes two issues with the original patch:
* The sanitizer build bot reported an uninitialized value. This was caused by normalizeStringIntegral not returning None on failure.
* Some build bots complained about inaccessible keypaths. To mitigate that, "this->" was added back to the keypath to restore the previous behavior.
David Sherwood [Thu, 7 Jan 2021 15:02:50 +0000 (15:02 +0000)]
[NFC] Remove min/max functions from InstructionCost
Removed the InstructionCost::min/max functions because it's
fine to use std::min/max instead.
Differential Revision: https://reviews.llvm.org/D94301
David Green [Mon, 11 Jan 2021 08:59:28 +0000 (08:59 +0000)]
[ARM] Update trunc costs
We did not have specific costs for larger than legal truncates that were
not otherwise cheap (where they were next to stores, for example). As
MVE does not have a dedicated instruction for them (and we do not use
loads/stores yet), they should be expensive as they get expanded to a
series of lane moves.
Differential Revision: https://reviews.llvm.org/D94260
Rafał Jelonek [Mon, 11 Jan 2021 08:43:30 +0000 (09:43 +0100)]
[clang-format] Find main include after block ended with #pragma hdrstop
Find main include in first include block not ended with #pragma hdrstop
Reviewed By: curdeius
Differential Revision: https://reviews.llvm.org/D94217
Rafał Jelonek [Mon, 11 Jan 2021 08:34:01 +0000 (09:34 +0100)]
[clang-format] turn on formatting after "clang-format on" while sorting includes
Formatting is not active after "clang-format on" due to merging lines while formatting is off. Also, use trimmed line. Behaviour with LF is different than with CRLF.
Reviewed By: curdeius, MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D94206
David Green [Mon, 11 Jan 2021 08:35:16 +0000 (08:35 +0000)]
[ARM] Additional trunc cost tests. NFC
Rafał Jelonek [Mon, 11 Jan 2021 08:28:41 +0000 (09:28 +0100)]
[clang-format] Skip UTF8 Byte Order Mark while sorting includes
If file contain BOM then first instruction (include or clang-format off) is ignored
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D94201
Zi Xuan Wu [Mon, 11 Jan 2021 08:18:01 +0000 (16:18 +0800)]
[CSKY] Add visibility macro to fix link error
Add LLVM_EXTERNAL_VISIBILITY macro to fix link error of
https://reviews.llvm.org/D88466#
2476378
Adrian Kuegel [Fri, 8 Jan 2021 14:37:06 +0000 (15:37 +0100)]
Remove redundant casts.
Differential Revision: https://reviews.llvm.org/D94305
Craig Topper [Mon, 11 Jan 2021 06:35:51 +0000 (22:35 -0800)]
[RISCV] Clear isCodeGenOnly flag on VMSGE(U) pseudo instructions. Remove InstAliases that duplicate the asm strings in the pseudos.
The Pseudo class sets isCodeGenOnly=1 which causes the asm strings
in the pseudos to be ignored. I think this is why the aliases are
needed at all.
Reviewed By: frasercrmck
Differential Revision: https://reviews.llvm.org/D94024
Lang Hames [Mon, 11 Jan 2021 07:30:09 +0000 (18:30 +1100)]
[JITLink] Rename PostAllocationPasses to PreFixupPasses.
PreFixupPasses better reflects when these passes will run.
A future patch will (re)introduce a PostAllocationPasses list that will run
after allocation, but before JITLinkContext::notifyResolved is called to notify
the rest of the JIT about the resolved symbol addresses.
Hsiangkai Wang [Fri, 8 Jan 2021 13:07:05 +0000 (21:07 +0800)]
[NFC][AsmPrinter] Make comments for spill/reload more precise.
The size of spill/reload may be unknown for scalable vector types.
When the size is unknown, print it as "Unknown-size" instead of a very
large number.
Differential Revision: https://reviews.llvm.org/D94299
ergawy [Mon, 11 Jan 2021 06:37:34 +0000 (07:37 +0100)]
[MLIR][SPIRV] Add (de-)serialization support for SpecConstantOpeation.
This commit adds support for (de-)serializing SpecConstantOpeation. One
thing worth noting is that during deserialization, we assign a fake ID to
enclosed ops inside SpecConstantOpeation. We need to do this in order
for deserialization logic to properly update ID to value map and to
later reference the created value from the sibling 'spv::YieldOp'.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D93591
Fangrui Song [Mon, 11 Jan 2021 06:22:07 +0000 (22:22 -0800)]
CGDebugInfo: Delete unneeded UnwrapTypeForDebugInfo
Tested with stage 2 -DCMAKE_BUILD_TYPE=Debug clang, byte identical.
Fangrui Song [Mon, 11 Jan 2021 06:09:47 +0000 (22:09 -0800)]
CGDebugInfo: Delete redundant test
Chris Lattner [Mon, 11 Jan 2021 02:32:57 +0000 (18:32 -0800)]
[IR Parser] Fix a crash handling zero width integer attributes.
llvm::APInt cannot hold zero bit values, therefore we shouldn't try
to form them.
Differential Revision: https://reviews.llvm.org/D94384
Esme-Yi [Mon, 11 Jan 2021 03:52:16 +0000 (03:52 +0000)]
[PowerPC] Add variants of 64-bit vector types for vec_sel.
Summary: This patch added variants of vec_sel and fixed bugzilla 46770.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D94162
Serguei Katkov [Tue, 22 Dec 2020 09:40:50 +0000 (16:40 +0700)]
[LoopUnroll] Fix a crash
Loop peeling as a last step triggers loop simplification and this
can change the loop structure. As a result all cashed values like
latch branch becomes invalid.
Patch re-structure the code to take into account the possible
changes caused by peeling.
Reviewers: dmgreen, Meinersbur, etiotto, fhahn, efriedma, bmahjour
Reviewed By: Meinersbur, fhahn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D93686
Craig Topper [Mon, 11 Jan 2021 02:01:23 +0000 (18:01 -0800)]
[RISCV] Convert most of the information about RVV Pseudos into bits in TSFlags.
This patch moves all but the BaseInstr to bits in TSFlags.
For the index fields, we can just use a bit to indicate their presence.
The locations of the operands are well defined.
This reduces the llc binary by about 32K on my build. It also
removes the binary search of the table from the custom inserter.
Instead we just check that the SEW op is present.
Reviewed By: rogfer01
Differential Revision: https://reviews.llvm.org/D94375
QingShan Zhang [Mon, 11 Jan 2021 02:25:53 +0000 (02:25 +0000)]
[DAGCombine] Remove the check for unsafe-fp-math when we are checking the AFN
We are checking the unsafe-fp-math for sqrt but not for fpow, which behaves inconsistent.
As the direction is to remove this global option, we need to remove the unsafe-fp-math
check for sqrt and update the test with afn fast-math flags.
Reviewed By: Spatel
Differential Revision: https://reviews.llvm.org/D93891
Nico Weber [Mon, 11 Jan 2021 01:22:53 +0000 (20:22 -0500)]
Revert "[X86][SSE] Fold unpack(hop(),hop()) -> permute(hop())"
This reverts commit
80dee7965dffdfb866afa9d74f3a4a97453708b2.
Makes clang sometimes hang forever. See
https://bugs.chromium.org/p/chromium/issues/detail?id=
1164786#c6 for a
stand-alone repro.
Philip Reames [Sun, 10 Jan 2021 23:57:25 +0000 (15:57 -0800)]
[LoopDeletion] Break backedge of outermost loops when known not taken
This is a resubmit of
dd6bb367 (which was reverted due to stage2 build failures in
7c63aac), with the additional restriction added to the transform to only consider outer most loops.
As shown in the added test case, ensuring LCSSA is up to date when deleting an inner loop is tricky as we may actually need to remove blocks from any outer loops, thus changing the exit block set. For the moment, just avoid transforming this case. I plan to return to this case in a follow up patch and see if we can do better.
Original commit message follows...
The basic idea is that if SCEV can prove the backedge isn't taken, we can go ahead and get rid of the backedge (and thus the loop) while leaving the rest of the control in place. This nicely handles cases with dispatch between multiple exits and internal side effects.
Differential Revision: https://reviews.llvm.org/D93906
Fangrui Song [Sun, 10 Jan 2021 23:03:40 +0000 (15:03 -0800)]
CGDebugInfo: Delete unused DIFile* parameter
Kazu Hirata [Sun, 10 Jan 2021 22:32:02 +0000 (14:32 -0800)]
[StringExtras] Add a helper class for comma-separated lists
This patch introduces a helper class SubsequentDelim to simplify loops
that generate a comma-separated lists.
For example, consider the following loop, taken from
llvm/lib/CodeGen/MachineBasicBlock.cpp:
for (auto I = pred_begin(), E = pred_end(); I != E; ++I) {
if (I != pred_begin())
OS << ", ";
OS << printMBBReference(**I);
}
The new class allows us to rewrite the loop as:
SubsequentDelim SD;
for (auto I = pred_begin(), E = pred_end(); I != E; ++I)
OS << SD << printMBBReference(**I);
where SD evaluates to the empty string for the first time and ", " for
subsequent iterations.
Unlike interleaveComma, defined in llvm/include/llvm/ADT/STLExtras.h,
SubsequentDelim can accommodate a wider variety of loops, including:
- those that conditionally skip certain items,
- those that need iterators to call getSuccProbability(I), and
- those that iterate over integer ranges.
As an example, this patch cleans up MachineBasicBlock::print.
Differential Revision: https://reviews.llvm.org/D94377
Shilei Tian [Sun, 10 Jan 2021 21:46:09 +0000 (16:46 -0500)]
[OpenMP] Not set OPENMP_STANDALONE_BUILD=ON when building OpenMP along with LLVM
For now, `*_STANDALONE_BUILD` is set to ON even if they're built along
with LLVM because of issues mentioned in the comments. This can cause some issues.
For example, if we build OpenMP along with LLVM, we'd like to copy those OpenMP
headers to `<prefix>/lib/clang/<version>/include` such that `clang` can find
those headers without using `-I <prefix>/include` because those headers will be
copied to `<prefix>/include` if it is built standalone.
In this patch, we fixed the dependence issue in OpenMP such that it can be built
correctly even with `OPENMP_STANDALONE_BUILD=OFF`. The issue is in the call to
`add_lit_testsuite`, where `clang` and `clang-resource-headers` are passed as
`DEPENDS`. Since we're building OpenMP along with LLVM, `clang` is set by CMake
to be the C/C++ compiler, therefore these two dependences are no longer needed,
where caused the dependence issue.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D93738
Shilei Tian [Sun, 10 Jan 2021 21:45:39 +0000 (16:45 -0500)]
[LLVM] Added OpenMP to `LLVM_ALL_RUNTIMES`
This patch added `openmp` to `LLVM_ALL_RUNTIMES` so that when the CMake argument `LLVM_ENABLE_RUNTIMES=all`, OpenMP can also be built.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D94369
Roman Lebedev [Sun, 10 Jan 2021 13:25:15 +0000 (16:25 +0300)]
[NFCI][SimplifyCFG] Prefer to add Insert edges before Delete edges into DomTreeUpdater, if reasonable
This has a measurable impact on the number of DomTree recalculations.
While this doesn't handle all the cases,
it deals with the most obvious ones.
Pavel Labath [Fri, 8 Jan 2021 19:37:09 +0000 (20:37 +0100)]
[lldb] Fix some bugs in the Pipe class and add tests
- s/createUniqueFile/createUniquePath -- we don't want to create the file,
just the file name
- s/data()/str().c_str()/ -- paths given to system apis must be
null-terminated
Philip Reames [Sun, 10 Jan 2021 20:42:08 +0000 (12:42 -0800)]
[Tests] Precommit tests from to simplify rebase
Philip Reames [Sun, 10 Jan 2021 20:26:24 +0000 (12:26 -0800)]
Precommit tests requested for D93725
Fangrui Song [Sun, 10 Jan 2021 20:24:49 +0000 (12:24 -0800)]
[test] Improve CodeGenCXX/difile_entry.cpp
The test added in D87147 did not actually test PR47391.
Use an absolute path to test the canonicalization.
Philip Reames [Sun, 10 Jan 2021 20:23:22 +0000 (12:23 -0800)]
[Tests] Auto update a vectorizer test to simplify future diff
Sanjay Patel [Sun, 10 Jan 2021 18:15:04 +0000 (13:15 -0500)]
[SLP] fix typo in assert
This snuck into
0aa75fb12faa , but I didn't catch it locally.
Sanjay Patel [Sun, 10 Jan 2021 17:31:05 +0000 (12:31 -0500)]
[SLP] put verifyFunction call behind EXPENSIVE_CHECKS
A severe compile-time slowdown from this call is noted in:
https://llvm.org/PR48689
My naive fix was to put it under LLVM_DEBUG (
267ff79 ),
but that's not limiting in the way we want.
This is a quick fix (or we could just remove the call completely
and rely on some later pass to discover potentially wrong IR?).
A bigger/better fix would be to improve/limit verifyFunction()
as noted in:
https://llvm.org/PR47712
Differential Revision: https://reviews.llvm.org/D94328
Kazu Hirata [Sun, 10 Jan 2021 17:24:56 +0000 (09:24 -0800)]
[llvm] Ensure newlines at the end of files (NFC)
This patch eliminates pesky "No newline at end of file" messages from
git diff.
Kazu Hirata [Sun, 10 Jan 2021 17:24:54 +0000 (09:24 -0800)]
[MemorySSA] Remove unused dominatesUse (NFC)
The function was introduced without a use on Feb 2, 2016 in commit
e1100f533f0a48f55e80e1152b06f5deab5f9b30.
Kazu Hirata [Sun, 10 Jan 2021 17:24:53 +0000 (09:24 -0800)]
[CodeGen, DebugInfo] Use llvm::find_if (NFC)
Nikita Popov [Sun, 10 Jan 2021 16:07:14 +0000 (17:07 +0100)]
[ConstantFold] Fold fptoi.sat intrinsics
The APFloat::convertToInteger() API already implements the desired
saturation semantics.
Nikita Popov [Sun, 10 Jan 2021 16:08:11 +0000 (17:08 +0100)]
[ConstantFold] Add tests for fptoi.sat (NFC)
Florian Hahn [Sun, 10 Jan 2021 14:41:13 +0000 (14:41 +0000)]
[STLExtras] Use return type from operator* of the wrapped iter.
Currently make_early_inc_range cannot be used with iterators with
operator* implementations that do not return a reference.
Most notably in the LLVM codebase, this means the User iterator ranges
cannot be used with make_early_inc_range, which slightly simplifies
iterating over ranges while elements are removed.
Instead of directly using BaseT::reference as return type of operator*,
this patch uses decltype to get the actual return type of the operator*
implementation in WrappedIteratorT.
This patch also updates a few places to use make use of
make_early_inc_range.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D93992
Nico Weber [Sun, 10 Jan 2021 14:35:00 +0000 (09:35 -0500)]
[lld/mac] llvm style fix: no else after return
Nicolas Vasilache [Sun, 10 Jan 2021 14:01:54 +0000 (14:01 +0000)]
[mlir] NFC - Drop spurious assertion on symbols during `promoteComposedSymbolsAsDims`
This assertion is an old remnant from earlier days when only affine functions existed.
It is not the place of affine map composition to check whether orthogonal considerations
on what is allowed to be a symbol under the AffineScope trait.
Juneyoung Lee [Sun, 10 Jan 2021 08:22:54 +0000 (17:22 +0900)]
[CodeGen] Update transformations to use poison for shufflevector/insertelem's initial vector elem
This patch is a part of D93817 and makes transformations in CodeGen use poison for shufflevector/insertelem's initial vector element.
The change in CodeGenPrepare.cpp is fine because the mask of shufflevector should be always zero.
It doesn't touch the second element (which is poison).
The change in InterleavedAccessPass.cpp is also fine becauses the mask is of the form <a, a+m, a+2m, .., a+km> where a+km is smaller than
the size of the first vector operand.
This is guaranteed by the caller of replaceBinOpShuffles, which is lowerInterleavedLoad.
It calls isDeInterleaveMask and isDeInterleaveMaskOfFactor to check the mask is the desirable form.
isDeInterleaveMask has the check that a+km is smaller than the vector size.
To check my understanding, I added an assertion & added a test to show that this optimization doesn't fire in such case.
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D94056
Fangrui Song [Sun, 10 Jan 2021 07:56:55 +0000 (23:56 -0800)]
[test] Improve weakref & weak_import tests
Craig Topper [Sun, 10 Jan 2021 03:56:57 +0000 (19:56 -0800)]
[RISCV] Change ConstraintMask in RISCVII enum to be shifted left. NFC
This makes the mask align with the position of the bits in TSFlags
which is a little more logical.
I might be adding more fields to TSFlags and some might be single
bits where just ANDing with mask to test the bit would make sense.
While there rename TargetFlags in validateInstruction to reflect
that it's just the constraint bits.
Craig Topper [Sun, 10 Jan 2021 02:00:05 +0000 (18:00 -0800)]
[RISCV] Use uint16_t instead of unsigned for opcodes in the RVV pseudo instruction table.
We currently have about 7000 opcodes in the RISCVGenInstrInfo.inc
enum. We can use uint16_t to store these values. We would need to
grow by nearly 9x before we run out of space so this should last
for a little while.
This reduces the llc binary by 32K.
Nico Weber [Sun, 10 Jan 2021 02:17:59 +0000 (21:17 -0500)]
[lld/mac] remove redundant null check
This is already checked two lines up. No behavior change.
Sriraman Tallam [Sun, 10 Jan 2021 01:40:38 +0000 (17:40 -0800)]
Recommit D91678 after fixing the test breakage.
This adds a new test checking llvm-symbolizer with an object built with basic block sections.
Build a object with -fbasic-block-sections and reorder the basic blocks to be
non-contiguous. Then check if llvm-symbolizer correctly reports the symbolized
addresses. Included the source to build the object with command lines.
Differential Revision: https://reviews.llvm.org/D91678
Fangrui Song [Sun, 10 Jan 2021 00:31:55 +0000 (16:31 -0800)]
[CodeGenModule] Drop dso_local on function declarations for ELF -fno-pic -fno-direct-access-external-data
ELF -fno-pic sets dso_local on a function declaration to allow direct accesses
when taking its address (similar to a data symbol). The emitted code follows the
traditional GCC/Clang -fno-pic behavior: an absolute relocation is produced.
If the function is not defined in the executable, a canonical PLT entry will be
needed at link time. This is similar to a copy relocation and is incompatible
with (-Bsymbolic or --dynamic-list linked shared objects / protected symbols in
a shared object).
This patch gives -fno-pic code a way to avoid such a canonical PLT entry.
The FIXME was about a generalization for -fpie -mpie-copy-relocations (now -fpie
-fdirect-access-external-data). While we could set dso_local to avoid GOT when
taking the address of a function declaration (there is an ignorable difference
about R_386_PC32 vs R_386_PLT32 on i386), it likely does not provide any benefit
and can just cause trouble, so we don't make the generalization.
Fraser Cormack [Sat, 9 Jan 2021 19:21:23 +0000 (19:21 +0000)]
[RISCV] Add scalable vector icmp ISel patterns
Original patch by @rogfer01.
The RVV integer comparison instructions are defined in such a way that
many LLVM operations are defined by using the "opposite" comparison
instruction and swapping the operands. This is done in this patch in
most cases, except for the mappings where the immediate range must be
adjusted to accomodate:
va < i --> vmsle{u}.vi vd, va, i-1, vm
va >= i --> vmsgt{u}.vi vd, va, i-1, vm
That is left for future optimization; this patch supports all operations
but in the case of the missing mappings the immediate will be moved to
a scalar register first.
Since there are so many condition codes and operand cases to check, it
was decided to reduce the test burden by only testing the "vscale x 8"
vector types.
Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D94168
Fraser Cormack [Sat, 9 Jan 2021 17:12:22 +0000 (17:12 +0000)]
[SelectionDAG] Teach isConstOrConstSplat about ISD::SPLAT_VECTOR
This improves llvm::isConstOrConstSplat by allowing it to analyze
ISD::SPLAT_VECTOR nodes, in order to allow more constant-folding of
operations using scalable vector types.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D94168
Lewuathe [Sat, 9 Jan 2021 20:43:43 +0000 (20:43 +0000)]
[mlir] Enhance mlir-opt show-dialects test case
mlir-opt supports many more test cases. All available dialects supported by latest mlir-opt should be coverted in the test case.
Reviewed By: aartbik, stephenneuendorffer, mehdi_amini
Differential Revision: https://reviews.llvm.org/D93821
Shoaib Meenai [Sat, 9 Jan 2021 19:57:09 +0000 (11:57 -0800)]
[clang] Add llvm-strip to test dependencies
CodeGen/thinlto_embed_bitcode.ll relies on it.
Mircea Trofin [Fri, 8 Jan 2021 20:21:29 +0000 (12:21 -0800)]
[NFC] Disallow unused prefixes in CodeGen/X86 tests.
Also fixed remaining tests that featured unused prefixes.
Differential Revision: https://reviews.llvm.org/D94330
Aart Bik [Sat, 9 Jan 2021 00:25:37 +0000 (16:25 -0800)]
[mlir][vector] modified scatter/gather syntax, pass_thru mandatory
This change makes the scatter/gather syntax more consistent with
the syntax of all the other memory operations in the Vector dialect
(order of types, use of [] for index, etc.). This will make the MLIR
code easier to read. In addition, the pass_thru parameter of the
gather has been made mandatory (there is very little benefit in
using the implicit "undefined" values).
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D94352
Florian Hahn [Sat, 9 Jan 2021 17:02:58 +0000 (17:02 +0000)]
[SimplifyCFG] Keep !dgb metadata of moved instruction, if they match.
Currently SimplifyCFG drops the debug locations of 'bonus' instructions.
Such instructions are moved before the first branch. The reason for the
current behavior is that this could lead to surprising debug stepping,
if the block that's folded is dead.
In case the first branch and the instructions to be folded have the same
debug location, this shouldn't be an issue and we can keep the debug
location.
Reviewed By: vsk
Differential Revision: https://reviews.llvm.org/D93662
Nico Weber [Sat, 9 Jan 2021 19:03:52 +0000 (14:03 -0500)]
[gn build] Make an explicit `use_lld = true` on mac use lld.darwinnew
use_lld defaults to true on non-mac if clang_base_path is set (i.e.
the host compiler is a locally-built clang). On mac, the lld Mach-O
port used to be unusable, but ld64.lld.darwinnew is close to usable.
When explicitly setting `use_lld = true` in a GN build on a mac host,
check-lld passes, two check-clang tests fail, and a handful check-llvm
tests fail (the latter all due to -flat_namespace not yet being implemented).
Shilei Tian [Sat, 9 Jan 2021 18:00:50 +0000 (13:00 -0500)]
[OpenMP] Remove copy constructor of `RTLInfoTy`
Multiple `RTLInfoTy` objects are stored in a list `AllRTLs`. Since
`RTLInfoTy` contains a `std::mutex`, it is by default not a copyable object.
In order to support `AllRTLs.push_back(...)` which is currently used, a customized
copy constructor is provided. Every time we need to add a new data member into
`RTLInfoTy`, we should keep in mind not forgetting to add corresponding assignment
in the copy constructor. In fact, the only use of the copy constructor is to push
the object into the list, we can of course write it in a way that first emplace
a new object back, and then use the reference to the last element. In this way we
don't need the copy constructor anymore. If the element is invalid, we just need
to pop it, and that's what this patch does.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D94361
Jez Ng [Sat, 9 Jan 2021 16:58:19 +0000 (11:58 -0500)]
[lld-macho] Remove unnecessary llvm:: namespace prefixes
Kazu Hirata [Sat, 9 Jan 2021 17:24:59 +0000 (09:24 -0800)]
[llvm] Drop unnecessary make_range (NFC)
Kazu Hirata [Sat, 9 Jan 2021 17:24:58 +0000 (09:24 -0800)]
[Transforms] Use llvm::find_if (NFC)
Kazu Hirata [Sat, 9 Jan 2021 17:24:56 +0000 (09:24 -0800)]
[SCEV] Remove unused getOrInsertCanonicalInductionVariable (NFC)
The last use was removed on Mar 22, 2012 in commit
f47d0af5515bee47dfd000363740fe347bb6cd18.
Fraser Cormack [Wed, 6 Jan 2021 08:07:41 +0000 (08:07 +0000)]
[SelectionDAG] Extend immAll(Ones|Zeros)V to handle ISD::SPLAT_VECTOR
The TableGen immAllOnesV and immAllZerosV helpers implicitly wrapped the
ISD::isBuildVectorAll(Ones|Zeros) helper functions. This was inhibiting
their use for targets such as RISC-V which use ISD::SPLAT_VECTOR. In
particular, RISC-V had to define its own 'vnot' fragment.
In order to extend the scope of these nodes to include support for
ISD::SPLAT_VECTOR, two new ISD predicate functions have been introduced:
ISD::isConstantSplatVectorAll(Ones|Zeros). These effectively supersede
the older "isBuildVector" predicates, which are now simple wrappers for
the new functions. They pass a defaulted boolean toggle which preserves
the old behaviour. It is hoped that in time all call-sites can be ported
to the "isConstantSplatVector" functions.
While the use of ISD::isBuildVectorAll(Ones|Zeros) has not changed, the
behaviour of the TableGen immAll(Ones|Zeros)V **has**. To test the new
functionality, the custom RISC-V TableGen fragment has been removed and
replaced with the built-in 'vnot'. To test their use as pattern-roots, two
splat patterns have been updated accordingly.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D94223
Shilei Tian [Sat, 9 Jan 2021 16:58:37 +0000 (11:58 -0500)]
[OpenMP] Added the support for cache line size 256 for A64FX
Fugaku supercomputer is built with the Fujitsu A64FX microprocessor, whose cache line is 256. In current libomp, we only have cache line size 128 for PPC64 and otherwise 64. This patch added the support of cache line 256 for A64FX. It's worth noting that although A64FX is a variant of AArch64, this property is not shared. As a result, in light of UCX source code (https://github.com/openucx/ucx/blob/
392443ab92626412605dee1572056f79c897c6c3/src/ucs/arch/aarch64/cpu.c#L17), we can only determine by checking whether the CPU is FUJITSU A64FX.
Reviewed By: jdoerfert, Hahnfeld
Differential Revision: https://reviews.llvm.org/D93169
Roger Ferrer Ibanez [Sat, 9 Jan 2021 16:49:05 +0000 (16:49 +0000)]
[RISCV] Do not grow the stack a second time when we need to realign the stack
This is a first change needed to fix a crash in which the emergency
spill splot ends being out of reach. This happens when we run the
register scavenger after we have eliminated the frame indexes. The fix
for the actual crash will come in a later change.
This change removes an extra stack size increase we do in
RISCVFrameLowering::determineFrameLayout.
We don't have to change the size of the stack here as
PEI::calculateFrameObjectOffsets is already doing this with the right
size accounting the extra alignment.
Differential Revision: https://reviews.llvm.org/D89237
Florian Hahn [Sat, 9 Jan 2021 16:34:15 +0000 (16:34 +0000)]
[VPlan] Keep start value of VPWidenPHIRecipe as VPValue.
Similar to D92129, update VPWidenPHIRecipe to manage the start value as
VPValue. This allows adjusting the start value as a VPlan transform,
which will be used in a follow-up patch to support reductions during
epilogue vectorization.
Reviewed By: gilr
Differential Revision: https://reviews.llvm.org/D93975
Mikhail Maltsev [Sat, 9 Jan 2021 14:13:18 +0000 (14:13 +0000)]
[clang][Sema] Compare SourceLocations directly [NFCI]
The ordered comparison operators are defined for the SourceLocation
class, so SourceLocation objects can be compared directly. There is no
need to extract the internal representation for comparison.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D94231
Lei Zhang [Sat, 9 Jan 2021 13:04:49 +0000 (08:04 -0500)]
[mlir][spirv] Replace SPIRVOpLowering with OpConversionPattern
The dialect conversion framework was enhanced to handle type
conversion automatically. OpConversionPattern already contains
a pointer to the TypeConverter. There is no need to duplicate it
in a separate subclass. This removes the only reason for a
SPIRVOpLowering subclass. It adapts to use core infrastructure
and simplifies the code.
Also added a utility function to OpConversionPattern for getting
TypeConverter as a certain subclass.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D94080
Heejin Ahn [Sun, 27 Dec 2020 10:52:43 +0000 (02:52 -0800)]
[WebAssembly] Remove unreachable EH pads
This removes unreachable EH pads in LateEHPrepare. This is not for
optimization but for preparation for CFGStackify. In CFGStackify, we
determine where to place `try` marker by computing the nearest common
dominator of all predecessors of an EH pad, but when an EH pad does not
have a predecessor, it becomes tricky. We can insert an empty dummy BB
before the EH pad and place the `try` there, but removing unreachable EH
pads is simpler.
This moves an existing exception label test from eh-label.mir to
exception.mir and adds a new test there.
This also adds some comments to existing methods.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94044
Fraser Cormack [Sat, 9 Jan 2021 10:29:50 +0000 (10:29 +0000)]
[RISCV] Add tests for scalable constant-folding (NFC)
Thomas Preud'homme [Thu, 20 Aug 2020 19:41:43 +0000 (20:41 +0100)]
[Test][FileCheck] Fix use of undef var
The test related to directives with prefix NUMEXPR-CONSTRAINT-NOMATCH
refers to the numeric variable UNSI which is defined by a directive with
prefix CHECK not enabled on the lit command-line. Rather than adding the
prefix CHECK to the lit command-line, this commit defined variable UNSI
in a new NUMEXPR-CONSTRAINT-NOMATCH prefixed directive. The directive
needs to contain more than just the variable otherwise the error message
from FileCheck is about the wrong line being matched.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D93346
Heejin Ahn [Sun, 27 Dec 2020 09:10:53 +0000 (01:10 -0800)]
[WebAssembly] Update InstPrinter support for EH
- Updates InstPrinter to handle `catch_all`.
- Makes `rethrow` condition an early exit from the function to make the
rest simpler.
- Unify label and catch counters. They don't need to be counted
separately and this will help `delegate` instruction later.
- Removes `LastSeenEHInst` field. This was first introduced to handle
when there are more than one `catch` blocks per `try`, but this was
not implemented correctly and not being used at the moment anyway.
- Reenables all tests in cfg-stackify-eh.ll that don't deal with unwind
destination mismatches, which will be handled in a later CL.
Reviewed By: dschuff, tlively, aardappel
Differential Revision: https://reviews.llvm.org/D94043
Eugene Zhulenev [Fri, 8 Jan 2021 23:23:59 +0000 (15:23 -0800)]
[mlir] AsyncRuntime: use LLVM ThreadPool to run async tasks
Revert https://reviews.llvm.org/D92368 after the dynamic library unloading was fixed in https://reviews.llvm.org/D94312
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D94346
Heejin Ahn [Sat, 26 Dec 2020 04:23:33 +0000 (20:23 -0800)]
[WebAssembly] Remove exnref and br_on_exn
This removes `exnref` type and `br_on_exn` instruction. This is
effectively NFC because most uses of these were already removed in the
previous CLs.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94041
Heejin Ahn [Sat, 26 Dec 2020 10:27:44 +0000 (02:27 -0800)]
[WebAssembly] Update basic EH instructions for the new spec
This implements basic instructions for the new spec.
- Adds new versions of instructions: `catch`, `catch_all`, and `rethrow`
- Adds support for instruction selection for the new instructions
- `catch` needs a custom routine for the same reason `throw` needs one,
to encode `__cpp_exception` tag symbol.
- Updates `WebAssembly::isCatch` utility function to include `catch_all`
and Change code that compares an instruction's opcode with `catch` to
use that function.
- LateEHPrepare
- Previously in LateEHPrepare we added `catch` instruction to both
`catchpad`s (for user catches) and `cleanuppad`s (for destructors).
In the new version `catch` is generated from `llvm.catch` intrinsic
in instruction selection phase, so we only need to add `catch_all`
to the beginning of cleanup pads.
- `catch` is generated from instruction selection, but we need to
hoist the `catch` instruction to the beginning of every EH pad,
because `catch` can be in the middle of the EH pad or even in a
split BB from it after various code transformations.
- Removes `addExceptionExtraction` function, which was used to
generate `br_on_exn` before.
- CFGStackfiy: Deletes `fixUnwindMismatches` function. Running this
function on the new instruction causes crashes, and the new version
will be added in a later CL, whose contents will be completely
different. So deleting the whole function will make the diff easier to
read.
- Reenables all disabled tests in exception.ll and eh-lsda.ll and a
single basic test in cfg-stackify-eh.ll.
- Updates existing tests to use the new assembly format. And deletes
`br_on_exn` instructions from the tests and FileCheck lines.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94040
Fangrui Song [Sat, 9 Jan 2021 08:46:02 +0000 (00:46 -0800)]
Fix CodeGenCXX/difile_entry.cpp on Windows
Fangrui Song [Sat, 9 Jan 2021 08:32:02 +0000 (00:32 -0800)]
Make -fno-pic respect -fno-direct-access-external-data
D92633 added -f[no-]direct-access-external-data to supersede -m[no-]pie-copy-relocations.
(The option works for -fpie but is a no-op for -fno-pic and -fpic.)
This patch makes -fno-pic -fno-direct-access-external-data drop dso_local from
global variable declarations. This usually causes the backend to emit a GOT
indirection for external data access. With a GOT relocation, the subsequent
-no-pie link will not have copy relocation even if the data symbol turns out to
be defined by a shared object.
Differential Revision: https://reviews.llvm.org/D92714
Fangrui Song [Sat, 9 Jan 2021 08:29:09 +0000 (00:29 -0800)]
Add -f[no-]direct-access-external-data to supersede -mpie-copy-relocations
GCC r218397 "x86-64: Optimize access to globals in PIE with copy reloc" made
-fpie code emit R_X86_64_PC32 to reference external data symbols by default.
Clang adopted -mpie-copy-relocations D19996 as a flexible alternative.
The name -mpie-copy-relocations can be improved [1] and does not capture the
idea that this option can apply to -fno-pic and -fpic [2], so this patch
introduces -f[no-]direct-access-external-data and makes -mpie-copy-relocations
their aliases for compatibility.
[1]
For
```
extern int var;
int get() { return var; }
```
if var is defined in another translation unit in the link unit, there is no copy
relocation.
[2]
-fno-pic -fno-direct-access-external-data is useful to avoid copy relocations.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65888
If a shared object is linked with -Bsymbolic or --dynamic-list and exports a
data symbol, normally the data symbol cannot be accessed by -fno-pic code
(because by default an absolute relocation is produced which will lead to a copy
relocation). -fno-direct-access-external-data can prevent copy relocations.
-fpic -fdirect-access-external-data can avoid GOT indirection. This is like the
undefined counterpart of -fno-semantic-interposition. However, the user should
define var in another translation unit and link with -Bsymbolic or
--dynamic-list, otherwise the linker will error in a -shared link. Generally
the user has better tools for their goal but I want to mention that this
combination is valid.
On COFF, the behavior is like always -fdirect-access-external-data.
`__declspec(dllimport)` is needed to enable indirect access.
There is currently no plan to affect non-ELF behaviors or -fpic behaviors.
-fno-pic -fno-direct-access-external-data will be implemented in the subsequent patch.
GCC feature request https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98112
Reviewed By: tmsriram
Differential Revision: https://reviews.llvm.org/D92633
Heejin Ahn [Sat, 26 Dec 2020 02:38:59 +0000 (18:38 -0800)]
[WebAssembly] Update WasmEHPrepare for the new spec
Clang generates `wasm.get.exception` and `wasm.get.ehselector`
intrinsics, which respectively return a caught exception value (a
pointer to some C++ exception struct) and a selector (an integer value
that tells which C++ `catch` clause the current exception matches, or
does not match any).
WasmEHPrepare is a pass that does some IR-level preparation before
instruction selection. Previously one of things we did in this pass was
to convert `wasm.get.exception` intrinsic calls to
`wasm.extract.exception` intrinsics. Their semantics were the same
except `wasm.extract.exception` did not have a token argument. We
maintained these two separate intrinsics with the same semantics because
instruction selection couldn't handle token arguments. This
`wasm.extract.exception` intrinsic was later converted to
`extract_exception` instruction in instruction selection, which was a
pseudo instruction to implement `br_on_exn`. Because `br_on_exn` pushed
an extracted value onto the value stack after the `end` instruction of a
`block`, but LLVM does not have a way of modeling that kind of behavior,
so this pseudo instruction was used to pull an extracted value out of
thin air, like this:
```
block $l0
...
br_on_exn $cpp_exception $l0
...
end
extract_exception ;; pushes values onto the stack
```
In the new spec, we don't need this pseudo instruction anymore because
`catch` itself returns a value and we don't have `br_on_exn` anymore. In
the spec `catch` returns multiple values (like `br_on_exn`), but here we
assume it only returns a single i32, which is sufficient to support C++.
So this renames `wasm.get.exception` intrinsic to `wasm.catch`. Because
this CL does not yet contain instruction selection for `wasm.catch`
intrinsic, all `RUN` lines in exception.ll, eh-lsda.ll, and
cfg-stackify-eh.ll, and a single `RUN` line in wasm-eh.cpp (which is an
end-to-end test from C++ source to assembly) fail. So this CL
temporarily disables those `RUN` lines, and for those test files without
any valid remaining `RUN` lines, adds a dummy `RUN` line to make them
pass. These tests will be reenabled in later CLs.
Reviewed By: dschuff, tlively
Differential Revision: https://reviews.llvm.org/D94039
Fangrui Song [Sat, 9 Jan 2021 07:28:22 +0000 (23:28 -0800)]
[IR] Delete unused ReplaceLast in DebugLoc::appendInlineAt
Not used after r304488
Sriraman Tallam [Sat, 9 Jan 2021 06:33:53 +0000 (22:33 -0800)]
Revert "This adds a new test checking llvm-symbolizer with an object built with basic block sections."
This reverts commit
1816de08232673e97ec41287ad3f6494bceaec43.
This breaks on ppc64 and windows although x86-registered-target is
mentioned. I will re-commit after fixing.
Sriraman Tallam [Sat, 9 Jan 2021 05:52:34 +0000 (21:52 -0800)]
This adds a new test checking llvm-symbolizer with an object built with basic block sections.
Build a object with -fbasic-block-sections and reorder the basic blocks to be
non-contiguous. Then check if llvm-symbolizer correctly reports the symbolized
addresses. Included the source to build the object with command lines.
Differential Revision: https://reviews.llvm.org/D91678
Umesh Kalappa [Sat, 9 Jan 2021 05:41:13 +0000 (21:41 -0800)]
PR47391: Canonicalize DIFiles
Like @aprantl suggested, modify to use the canonicalized DIFile, if we
don't know the loc info and filename for the compiler generated
functions for example static initialization functions.
Reviewed By: dblaikie, aprantl
Differential Revision: https://reviews.llvm.org/D87147
Jonas Devlieghere [Sat, 9 Jan 2021 02:57:36 +0000 (18:57 -0800)]
[DWARFLinker] Link against BinaryFormat
Jonas Devlieghere [Sat, 9 Jan 2021 02:53:08 +0000 (18:53 -0800)]
[debugserver] Various plist changes
- Remove unused plists that were referenced (but unused) by Xcode.
- Move all debugserver plists unders tools/debugserver/resources.
- Add the ability to distinguish between com.apple.security.cs.debugger
and com.apple.private.cs.debugger.
rdar://
66082043
Differential revision: https://reviews.llvm.org/D94320
Jonas Devlieghere [Fri, 8 Jan 2021 19:35:46 +0000 (11:35 -0800)]
[DWARFLinker] Print the unsupport DWARF form as part of the warning
Kazu Hirata [Sat, 9 Jan 2021 02:39:57 +0000 (18:39 -0800)]
[SCEV] Remove unused getExactExistingExpansion (NFC)
The last use was removed on Sep 4, 2018 in commit
2cbba5633753552a984572c8b9a5997e5c96496d.
Kazu Hirata [Sat, 9 Jan 2021 02:39:55 +0000 (18:39 -0800)]
[Tablegen] Use llvm::find_if (NFC)
Kazu Hirata [Sat, 9 Jan 2021 02:39:53 +0000 (18:39 -0800)]
[Target, Transforms] Use *Set::contains (NFC)
Ben Shi [Sat, 9 Jan 2021 02:37:21 +0000 (10:37 +0800)]
[RISCV] Optimize multiplication with constant
1. Break MUL with specific constant to a SLLI and an ADD/SUB on riscv32
with the M extension.
2. Break MUL with specific constant to two SLLI and an ADD/SUB, if the
constant needs a pair of LUI/ADDI to construct.
Reviewed by: craig.topper
Differential Revision: https://reviews.llvm.org/D93619
Nathan James [Sat, 9 Jan 2021 02:32:23 +0000 (02:32 +0000)]
[clangd][NFC] Remove unnecessary copy in CodeComplete
All tests still pass with ASAN so fairly confident no use-after-free going on here.
Craig Topper [Sat, 9 Jan 2021 01:47:12 +0000 (17:47 -0800)]
[X86] Remove IntrArgMemOnly from ldmxcsr intrinsic.
Since we're leaving this as ReadWrite with the "write" reflecting
the update to MXCSR, we shouldn't say it only writes arg memory.
Hopefully this fixes the issue reported in post-commit in D93571.
Tony [Sat, 19 Dec 2020 02:05:11 +0000 (02:05 +0000)]
[AMDGPU] Add volatile support to SIMemoryLegalizer
Treat a non-atomic volatile load and store as a relaxed atomic at
system scope for the address spaces accessed. This will ensure all
relevant caches will be bypassed.
A volatile atomic is not changed and still only bypasses caches upto
the level specified by the SyncScope operand.
Differential Revision: https://reviews.llvm.org/D94214
Richard Smith [Sat, 9 Jan 2021 00:41:31 +0000 (16:41 -0800)]
Never call a destroying operator delete when cleaning up from an
exception thrown during construction in a new-expression.
Instead, when performing deallocation function lookup for a
new-expression, ignore all destroying operator delete candidates, and
fall back to global operator delete if there is no member operator
delete other than a destroying operator delete.
Use of destroying operator delete only makes sense when there is an
object to destroy, which there isn't in this case. The language wording
doesn't cover this case; this oversight has been reported to WG21, with
the approach in this patch as the proposed fix.
Michael Jones [Sat, 9 Jan 2021 00:35:00 +0000 (00:35 +0000)]
[libc][NFC] add includes for internal headers to all libc functions
this will make sure that all of the functions are using the correct
prototypes. Explained much better in the comments of this diff:
https://reviews.llvm.org/D94195
Michael Jones [Wed, 23 Dec 2020 18:46:09 +0000 (18:46 +0000)]
[libc] Switch to use a macro which does not insert a section for every libc function.
Summary:
The new macro also inserts the C alias for the C++ implementations
without needing an objcopy based post processing step. The CMake
rules have been updated to reflect this. More CMake cleanup can be
taken up in future rounds and appropriate TODOs have been added for them.
Reviewers: mcgrathr, sivachandra
Subscribers: