Alex Zinenko [Mon, 15 Feb 2021 09:52:19 +0000 (10:52 +0100)]
[mlir] silence unused-function warnings in table-generated code
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D96695
Vedant Kumar [Wed, 17 Feb 2021 18:20:40 +0000 (10:20 -0800)]
Revert "[SampleFDO] Reapply: Refactor SampleProfile.cpp"
Revert "[SampleFDO] Add missing #includes to unbreak modules build after D96455"
This reverts commit
c73cbf218a289029cc0b54183c3cf79454ecc76f.
Revert "[SampleFDO] Fix MSVC "namespace uses itself" warning (NFC)"
This reverts commit
a23e6b321ca623b83252f8b1e06a2ad4fc441f89.
Revert "[SampleFDO] Reapply: Refactor SampleProfile.cpp"
This reverts commit
6fd5ccff72eeaffcb3b3ba2696282015aab755bc.
Still seeing link failures when building llc (or other tools), due to
the new SampleProfileLoaderBaseImpl.h containing definitions that get
duplicated across multiple TU's.
```
duplicate symbol 'llvm::SampleProfileLoaderBaseImpl::findEquivalenceClasses(llvm::Function&)' in:
tools/llc/CMakeFiles/llc.dir/llc.cpp.o
lib/libLLVMInstCombine.a(InstCombineVectorOps.cpp.o)
duplicate symbol 'llvm::SampleProfileLoaderBaseImpl::buildEdges(llvm::Function&)' in:
tools/llc/CMakeFiles/llc.dir/llc.cpp.o
lib/libLLVMInstCombine.a(InstCombineVectorOps.cpp.o)
duplicate symbol 'llvm::SampleProfileLoaderBaseImpl::computeDominanceAndLoopInfo(llvm::Function&)' in:
tools/llc/CMakeFiles/llc.dir/llc.cpp.o
lib/libLLVMInstCombine.a(InstCombineVectorOps.cpp.o)
duplicate symbol 'llvm::SampleProfileLoaderBaseImpl::getFunctionLoc(llvm::Function&)' in:
tools/llc/CMakeFiles/llc.dir/llc.cpp.o
lib/libLLVMInstCombine.a(InstCombineVectorOps.cpp.o)
duplicate symbol 'llvm::SampleProfileLoaderBaseImpl::getBlockWeight(llvm::BasicBlock const*)' in:
tools/llc/CMakeFiles/llc.dir/llc.cpp.o
lib/libLLVMInstCombine.a(InstCombineVectorOps.cpp.o)
duplicate symbol 'llvm::SampleProfileLoaderBaseImpl::printBlockWeight(llvm::raw_ostream&, llvm::BasicBlock const*) const' in:
tools/llc/CMakeFiles/llc.dir/llc.cpp.o
lib/libLLVMInstCombine.a(InstCombineVectorOps.cpp.o)
duplicate symbol 'llvm::SampleProfileLoaderBaseImpl::printBlockEquivalence(llvm::raw_ostream&, llvm::BasicBlock const*)' in:
tools/llc/CMakeFiles/llc.dir/llc.cpp.o
lib/libLLVMInstCombine.a(InstCombineVectorOps.cpp.o)
duplicate symbol 'llvm::SampleProfileLoaderBaseImpl::printEdgeWeight(llvm::raw_ostream&, std::__1::pair<llvm::BasicBlock const*, llvm::BasicBlock const*>)' in:
tools/llc/CMakeFiles/llc.dir/llc.cpp.o
lib/libLLVMInstCombine.a(InstCombineVectorOps.cpp.o)
```
Heejin Ahn [Wed, 17 Feb 2021 13:27:19 +0000 (05:27 -0800)]
[WebAssembly] Change catch_all's opcode
We decided to change `catch_all`'s opcode from 0x05, which is the same
as `else`, to 0x19, to avoid some complicated handling in the tools.
See: https://github.com/WebAssembly/exception-handling/issues/147
Reviewed By: sbc100
Differential Revision: https://reviews.llvm.org/D96863
Craig Topper [Wed, 17 Feb 2021 06:58:14 +0000 (22:58 -0800)]
[RISCV] Merge the handlers for masked and unmasked segment loads/stores.
A lot of the code for the masked and unmasked is the same. This
patch adds a boolean to handle the differences so we can share
the code.
Differential Revision: https://reviews.llvm.org/D96841
Craig Topper [Wed, 17 Feb 2021 03:46:44 +0000 (19:46 -0800)]
[RISCV] Merge the vsetvli and vsetvlimax intrinsic selection
These have very similar code just with a different number of
operands and handling for vsetivl.
Differential Revision: https://reviews.llvm.org/D96834
Eugene Zhulenev [Wed, 17 Feb 2021 16:34:33 +0000 (08:34 -0800)]
[mlir] Add fma operation to std dialect
Will remove `vector.fma` operation in the followup CLs.
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D96801
Dmitry Vyukov [Wed, 17 Feb 2021 16:43:16 +0000 (17:43 +0100)]
tsan: fix mmap_lots test
If tsan runtime will try to allocate something during exit handling,
the allocation will fail because there is no VA whatsoever.
It's observed to fail with the following error in some cases:
failed to allocate 0x1000 (4096) bytes of DTLS_NextBlock.
So terminate the process immediately.
Reviewed-in: https://reviews.llvm.org/D96874
Vedant Kumar [Wed, 17 Feb 2021 18:01:09 +0000 (10:01 -0800)]
[SampleFDO] Add missing #includes to unbreak modules build after D96455
Bot: http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/28999
```
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h:124:19: error: missing '#include "llvm/Analysis/PostDominators.h"'; 'PostDominatorTree' must be declared before it is used
std::unique_ptr<PostDominatorTree> PDT;
^
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/Analysis/PostDominators.h:28:7: note: declaration here is not visible
class PostDominatorTree : public PostDomTreeBase<BasicBlock> {
^
While building module 'LLVM_Transforms' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/Transforms/CFGuard/CFGuard.cpp:15:
In file included from <module-includes>:191:
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h:125:19: error: missing '#include "llvm/Analysis/LoopInfo.h"'; 'LoopInfo' must be declared before it is used
std::unique_ptr<LoopInfo> LI;
^
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/Analysis/LoopInfo.h:1079:7: note: declaration here is not visible
class LoopInfo : public LoopInfoBase<BasicBlock, Loop> {
^
While building module 'LLVM_Transforms' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/Transforms/CFGuard/CFGuard.cpp:15:
In file included from <module-includes>:191:
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/Transforms/Utils/SampleProfileLoaderBaseImpl.h:149:3: error: missing '#include "llvm/Analysis/OptimizationRemarkEmitter.h"'; 'OptimizationRemarkEmitter' must be declared before it is used
OptimizationRemarkEmitter *ORE = nullptr;
^
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/Analysis/OptimizationRemarkEmitter.h:33:7: note: declaration here is not visible
class OptimizationRemarkEmitter {
^
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/Transforms/CFGuard/CFGuard.cpp:15:10: fatal error: could not build module 'LLVM_Transforms'
```
Jonas Devlieghere [Wed, 17 Feb 2021 17:30:07 +0000 (09:30 -0800)]
[lldb] Improve error message for modules with dots or dashes
LLDB does not like to import Python files with dashes or dots in their
name. While the former are technically allowed, it is discouraged. Dots
are allowed for subpackages but not in module names. This patch improves
the user experience by printing a useful error.
Before this patch:
error: module importing failed: SyntaxError('invalid syntax',
('<string>', 1, 11, 'import foo-bar\n'))
After this patch:
error: module importing failed: Python discourages dashes in module
names: foo-bar
rdar://
74263511
[1] https://www.python.org/dev/peps/pep-0008/#package-and-module-names
Differential revision: https://reviews.llvm.org/D96833
Martin Storsjö [Sun, 1 Nov 2020 21:39:03 +0000 (23:39 +0200)]
[libcxx] Implement is_absolute properly for windows
Differential Revision: https://reviews.llvm.org/D91177
Marianne Mailhot-Sarrasin [Wed, 17 Feb 2021 17:14:03 +0000 (12:14 -0500)]
[Pipeliner] Fixed optimization remarks and debug dumps Initiation
Interval value
The II value was incremented before exiting the loop, and therefor when
used in the optimization remarks and debug dumps it did not reflect the
initiation interval actually used in Schedule.
Differential Revision: https://reviews.llvm.org/D95692
William S. Moses [Mon, 1 Feb 2021 23:16:17 +0000 (18:16 -0500)]
[SROA] Propagate correct TBAA/TBAA Struct offsets
SROA does not correctly account for offsets in TBAA/TBAA struct metadata.
This patch creates functionality for generating new MD with the corresponding
offset and updates SROA to use this functionality.
Differential Revision: https://reviews.llvm.org/D95826
David Green [Wed, 17 Feb 2021 16:56:28 +0000 (16:56 +0000)]
[NPM][LTO] Update buildLTODefaultPipeline to be more in-line with the old pass manager
The NPM LTO pipeline has a lot of fixme's and missing passes, causing a
lot of regressions after the switch in c70737b. Notably unrolling and
vectorization were both disabled, but many other passes are missing
compared to the old pass manager. This attempt to enable the most
obvious missing passes like the unroller, vectorization and other loop
passes, fixing the existing FIXME comments.
Differential Revision: https://reviews.llvm.org/D96780
Ta-Wei Tu [Wed, 17 Feb 2021 16:55:03 +0000 (00:55 +0800)]
[NFC] Refactor LoopInterchange into a loop-nest pass
This is the preliminary patch of converting `LoopInterchange` pass to a loop-nest pass and has no intended functional change.
Changes that are not loop-nest related are split to D96650.
Reviewed By: Whitney
Differential Revision: https://reviews.llvm.org/D96644
Nico Weber [Wed, 17 Feb 2021 16:52:24 +0000 (11:52 -0500)]
fix comment typo to cycle bots
Sjoerd Meijer [Wed, 17 Feb 2021 15:32:04 +0000 (15:32 +0000)]
[LSR] Add a flag that overrides the target's preferred addressing mode
This adds a new flag -lsr-preferred-addressing-mode to override the target's
preferred addressing mode. It replaces flag -lsr-backedge-indexing, which is
equivalent to preindexed addressing that is one of the options that
-lsr-preferred-addressing-mode accepts.
Differential Revision: https://reviews.llvm.org/D96855
Nico Weber [Wed, 17 Feb 2021 16:49:23 +0000 (11:49 -0500)]
fix comment typo to cycle bots
Louis Dionne [Wed, 17 Feb 2021 16:19:37 +0000 (11:19 -0500)]
[libc++] Allow retries in a few more flaky tests
Sanjay Patel [Wed, 17 Feb 2021 15:16:12 +0000 (10:16 -0500)]
[InstCombine] fold fcmp-of-copysign idiom
As discussed in:
https://llvm.org/PR49179
...this pattern shows up in library code.
There are several potential generalizations as noted,
but we need to be careful that we get FP special-values
right, and it's not clear how much variation we should
expect to see from this exact idiom.
Sanjay Patel [Wed, 17 Feb 2021 14:20:04 +0000 (09:20 -0500)]
[InstCombine] add tests for fcmp-of-copysign; NFC
https://llvm.org/PR49179
Nico Weber [Wed, 17 Feb 2021 15:03:02 +0000 (10:03 -0500)]
build: Add LLVM_WINSYSROOT to make setting /winsysroot easy on Win
Also add a script for sysroot management. For now, it can only create
fake sysroots that just symlink to local folders. This is useful for
testing.
Differential Revision: https://reviews.llvm.org/D96868
Hanhan Wang [Wed, 17 Feb 2021 14:55:10 +0000 (06:55 -0800)]
[mlir][StandardToSPIRV] Add support for lowering trunci to SPIR-V to i1 types.
Add a pattern to converting some value to a boolean. spirv.S/UConvert does not
work on i1 types. Thus, the pattern is lowered to cmpi + select.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D96851
Raphael Isemann [Wed, 17 Feb 2021 15:11:33 +0000 (16:11 +0100)]
[lldb][NFC] Delete deleted const char* overloads of SetValueFromString
This came up during the review of D96817 because those deleted overloads force
the caller to explicitly create a StringRef when passing a string literal.
It seems they were added as some kind of help while migrating the code base to
StringRef in D24847, but I don't think they have any use these days and make
these functions awkward to use.
This patch just removes all the deleted overloads.
Reviewed By: tatyana-krasnukha
Differential Revision: https://reviews.llvm.org/D96861
Jonny Farley [Tue, 16 Feb 2021 16:34:35 +0000 (16:34 +0000)]
[Fuzzer][Test] Use %python substitution for trace-malloc-unbalanced.test
This test was found to fail for some of our downstream builds, on
computers where python was not on the default $PATH. Therefore
add a %python substitution to use sys.executable, based on similar
solutions for python calls in tests elsewhere in LLVM.
Differential Revision: https://reviews.llvm.org/D96799
Sidharth Baveja [Wed, 17 Feb 2021 14:54:57 +0000 (14:54 +0000)]
[PowerPC][AIX] Enable Shrinkwrapping on 32 and 64 bit AIX.
Summary:
Currently Shrinkwrap is not enabled on AIX.
This patch enables shrink wrap on 32 and 64 bit AIX, and 64 bit ELF.
Reviewed By: sfertile, nemanjai
Differential Revision: https://reviews.llvm.org/D95094
Haojian Wu [Wed, 17 Feb 2021 14:40:12 +0000 (15:40 +0100)]
[clangd] IndexedFiles should include Fils from RefSlab and RelationSlab.
This looks like an oversight.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D96845
Haojian Wu [Wed, 17 Feb 2021 07:39:52 +0000 (08:39 +0100)]
[clangd] Pass file when possible to resolve URI.
Some URI scheme needs the hint path to do a correct resolution, we pass
one of the open files as hint path.
This is not perfect, and it might not work for opening files across
project, but it would fix a bug with our internal scheme.
in the long run, removing URIs from all the index internals is a more proper fix.
Differential Revision: https://reviews.llvm.org/D96844
Sean Fertile [Wed, 17 Feb 2021 14:22:43 +0000 (09:22 -0500)]
[PowerPC] Handle FP physical register in inline asm constraint.
Do not defer to the base class when the register constraint is a
physical fpr. The base class will select SPILLTOVSRRC as the register
class and register allocation will fail on subtargets without VSX
registers.
Differential Revision: https://reviews.llvm.org/D91629
David Green [Wed, 17 Feb 2021 14:21:09 +0000 (14:21 +0000)]
[ARM] Add MVE abs costs
Similar to min/max, this increases the accuracy of abs intrinsics costs
under MVE.
Sven van Haastregt [Wed, 17 Feb 2021 14:17:43 +0000 (14:17 +0000)]
[OpenCL] Support enum and typedef args in TableGen BIFs
Add enum and typedef argument support to `-fdeclare-opencl-builtins`,
which was the last major missing feature.
Adding the remaining missing builtins is left as future work.
Differential Revision: https://reviews.llvm.org/D96051
Piotr Sobczak [Wed, 17 Feb 2021 09:56:29 +0000 (10:56 +0100)]
[AMDGPU] Add implicit vcc_lo on S_CBRANCH_VCCNZ in wave32
* Update skip-if-dead.ll with tests for wave32.
* Fix the crash in verifier in one newly enabled test by adding
missing fixImplicitOperands in branch insertion code.
```
*** Bad machine code: Using an undefined physical register ***
- function: test_kill_divergent_loop
- basic block: %bb.2 bb (0xad96308)
- instruction: S_CBRANCH_VCCNZ %bb.1, implicit $vcc_lo
- operand 1: implicit $vcc_lo
LLVM ERROR: Found 1 machine code errors.
```
* Simplify "cbranch_kill" to not use interp instructions.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D96793
Sanne Wouda [Mon, 8 Feb 2021 16:13:28 +0000 (16:13 +0000)]
Use LoopRotate PrepareForLTO stage in NPM
The PrepareForLTO stage of LoopRotate tries to avoid unrolling loops
with calls that might be inlined later. See D94232 where this was
introduced.
We didn't catch all occurances of the LoopRotatePass in the New Pass
Manager, so the original regression in astar returned with the pass
manager switch.
Weiwei Li [Wed, 17 Feb 2021 14:00:28 +0000 (09:00 -0500)]
[mlir][spirv] Add spv.GLSL.FrexpStruct
co-authored-by: Alan Liu <alanliu.yf@gmail.com>
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D96527
David Green [Wed, 17 Feb 2021 13:54:17 +0000 (13:54 +0000)]
[ARM] MVE abs intrinsic costs. NFC
Martin Storsjö [Tue, 3 Nov 2020 21:52:32 +0000 (23:52 +0200)]
[libcxx] Implement parsing of root_name for paths on windows
Differential Revision: https://reviews.llvm.org/D91176
Jan Svoboda [Mon, 1 Feb 2021 11:33:23 +0000 (12:33 +0100)]
[clang][cli] Documentation of CompilerInvocation parsing/generation
This patch documents command line parsing in `-cc1`, `CompilerInvocation` and the marshalling infrastructure for command line options.
Reviewed By: Bigcheese
Differential Revision: https://reviews.llvm.org/D95790
Andrew Savonichev [Wed, 3 Feb 2021 15:07:18 +0000 (18:07 +0300)]
[NFC] Use the same type for bit fields in MCSchedClassDesc
Otherwise they are not allocated as a single bit field and take 4
bytes instead of 2.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D95954
luxufan [Wed, 17 Feb 2021 12:15:21 +0000 (20:15 +0800)]
[RISCV] Simplify BP initialisation
We can re-use copyPhysReg rather than writing a specialised copy.
Differential Revision: https://reviews.llvm.org/D95227
Simon Pilgrim [Wed, 17 Feb 2021 12:17:08 +0000 (12:17 +0000)]
[DAG] Pull out getTruncatedUSUBSAT helper from foldSubToUSubSat. NFCI.
This will simplify an incoming generic implementation of D25987.
I'll rebase D96703 shortly to support this.
Simon Pilgrim [Wed, 17 Feb 2021 11:41:41 +0000 (11:41 +0000)]
[DAG] Fold shuffle(bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle(c,d))) (REAPPLIED)
Fold shuffle(bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle(c,d))) -> bop(shuffle(x,y),shuffle(z,w)),bop(shuffle(a,b),shuffle(c,d))
Attempt to fold from a shuffle of a pair of binops to a binop of shuffles, as long as one/both of the binop sources are also shuffles that can be merged with the outer shuffle. This should guarantee that we remove one binop without introducing any additional shuffles.
Technically there's potential for a merged shuffle's lowering to be poorer than the original shuffle, but it could also be better, and I'm not seeing any regressions as long as we keep the 'don't merge splats' rule already present in MergeInnerShuffle.
This expands and generalizes an existing X86 combine and attempts to merge either of each binop's sources (with an on-the-fly commutation of the shuffle mask) - we couldn't do that in the x86 version as it had to stay in a form that DAGCombine's MergeInnerShuffle would still recognise.
Fixes issue raised by @saugustine in rG5aa8f4c0843a where we were failing to replace null shuffle operands from MergeInnerShuffle to UNDEFs.
Differential Revision: https://reviews.llvm.org/D96345
Jay Foad [Wed, 17 Feb 2021 09:44:05 +0000 (09:44 +0000)]
[AMDGPU] Rename simplifyI24 to simplifyMul24
Also simplify one of its call sites. NFC.
David Zarzycki [Tue, 16 Feb 2021 17:00:00 +0000 (12:00 -0500)]
[lit] Add "early_tests" config option
With enough cores, the slowest tests can significantly change the total testing time if they happen to run late. With this change, a test suite can improve performance (for high-end systems) by listing just a few of the slowest tests up front.
Reviewed By: jdenny, jhenderson
Differential Revision: https://reviews.llvm.org/D96594
Piotr Sobczak [Wed, 10 Feb 2021 16:21:15 +0000 (17:21 +0100)]
[AMDGPU] Fix a miscompile with S_ADD/S_SUB
The helper function isBoolSGPR is too aggressive when determining
when a v_cndmask can be skipped on a boolean value because the
function does not check the operands of and/or/xor.
This can be problematic for the Add/Sub combines that can leave
bits set even for inactive lanes leading to wrong results.
Fix this by inspecting the operands of and/or/xor recursively.
Differential Revision: https://reviews.llvm.org/D86878
Fraser Cormack [Mon, 15 Feb 2021 16:38:25 +0000 (16:38 +0000)]
[RISCV] Add support for fixed vector vselect
This patch adds support for fixed-length vector vselect. It does so by
lowering them to a custom unmasked VSELECT_VL node with a vector length
operand.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D96768
Simon Pilgrim [Wed, 17 Feb 2021 10:56:46 +0000 (10:56 +0000)]
[X86][SSE] Add testcase for bug reported in D96345
Failure to handle binop(shuffle(x,undef),shuffle(a,b))
Benjamin Kramer [Tue, 16 Feb 2021 18:08:34 +0000 (19:08 +0100)]
[mlir][Shape] Generalize cstr_broadcastable folding for n-ary broadcasts
This is still fairly tricky code, but I tried to untangle it a bit.
Differential Revision: https://reviews.llvm.org/D96800
Thomas Preud'homme [Fri, 15 Jan 2021 12:47:32 +0000 (12:47 +0000)]
Add lit config for dir with standalone tests
Some test systems do not use lit for test discovery but only for its
substitution and test selection because they use another way of managing
test collections, e.g. CTest. This forces those tests to be invoked with
lit --no-indirectly-run-check. When a mix of lit version is in use, it
requires to detect the availability of that option.
This commit provides a new config option standalone_tests to signal a
directory made of tests meant to run as standalone. When this option is
set, lit skips test discovery and the indirectly run check. It also adds
the missing documentation for --no-indirectly-run-check.
Reviewed By: jdenny
Differential Revision: https://reviews.llvm.org/D94766
Alex Richardson [Wed, 17 Feb 2021 10:36:41 +0000 (10:36 +0000)]
[sanitizers] Define SANITIZER_INTERCEPTOR_HOOKS on FreeBSD
This fixes the weak_hooks.cpp test on FreeBSD. Since this feature appears
to be supported on almost all platforms, it might also make sense to turn
it into an opt-out list instead of being opt-in.
Reviewed By: krytarowski
Differential Revision: https://reviews.llvm.org/D96255
Stephen Kelly [Tue, 29 Dec 2020 13:44:05 +0000 (13:44 +0000)]
[clang-tidy] Simplify const params check
Differential Revision: https://reviews.llvm.org/D96141
Stephen Kelly [Sun, 3 Jan 2021 17:05:17 +0000 (17:05 +0000)]
[clang-tidy] Simplify inefficient algorithm check
The normalization of matchers means that this now works in all language
modes.
Differential Revision: https://reviews.llvm.org/D96140
Stephen Kelly [Tue, 29 Dec 2020 13:44:18 +0000 (13:44 +0000)]
[clang-tidy] Simplify delete null ptr check
Because it no longer relies on finding implicit casts, this check now
works on templates which are not instantiated in the translation unit.
Differential Revision: https://reviews.llvm.org/D96138
Sjoerd Meijer [Wed, 17 Feb 2021 10:00:05 +0000 (10:00 +0000)]
Follow up of rGdea4a63e6359, which committed a slightly different version than
intended.
Igor Kudrin [Fri, 12 Feb 2021 13:41:39 +0000 (20:41 +0700)]
[Driver] Support -gdwarf64 for assembly files
The option was added in D90507 for C/C++ source files. This patch adds
support for assembly files.
Differential Revision: https://reviews.llvm.org/D96783
Igor Kudrin [Fri, 12 Feb 2021 07:28:22 +0000 (14:28 +0700)]
[DebugInfo] Keep the DWARF64 flag in the module metadata
This allows the option to affect the LTO output. Module::Max helps to
generate debug info for all modules in the same format.
Differential Revision: https://reviews.llvm.org/D96597
Sam McCall [Mon, 15 Feb 2021 09:41:38 +0000 (10:41 +0100)]
[clangd] Bind outgoing calls through LSPBinder too. NFC
The redundancy around work-done-progress is annoying but ok for now.
There's a weirdness with context lifetimes around outgoing method calls, which
I've preserved to keep this NFC. We should probably fix it though.
Differential Revision: https://reviews.llvm.org/D96717
Sjoerd Meijer [Tue, 16 Feb 2021 13:14:59 +0000 (13:14 +0000)]
[LSR] Cleanup of getPreferredAddresingMode. NFC.
This is a follow up D96600 and cleans up most calls to
getPreferredAddresingMode. I.e., we really don't need to query the same things
again and again, but get the preferred addressing mode once for each loop. So
this should be a lot friendlier for compile times, especially if we start
implementing getPreferredAddresingMode.
Differential Revision: https://reviews.llvm.org/D96772
Sam McCall [Tue, 16 Feb 2021 16:58:34 +0000 (17:58 +0100)]
[ADT] Add SFINAE guards to unique_function constructor.
We can't construct a working unique_function from an object that's not callable
with the right types, so don't allow deduction to succeed.
This avoids some ambiguous conversion cases, e.g. allowing to overload
on different unique_function types, and to conversion operators to
unique_function.
std::function and the any_invocable proposal have these.
This was added to llvm::function_ref in D88901 and followups
Differential Revision: https://reviews.llvm.org/D96794
Benjamin Kramer [Tue, 16 Feb 2021 17:29:19 +0000 (18:29 +0100)]
[mlir][Shape] Mark BroadcastOp as not having side effects
This allows it to be dead code eliminated when unused.
Differential Revision: https://reviews.llvm.org/D96797
Anton Zabaznov [Fri, 12 Feb 2021 12:53:02 +0000 (15:53 +0300)]
[OpenCL] Create VoidPtrTy with generic AS in C++ for OpenCL mode
This change affects 'SemaOpenCLCXX/newdelete.cl' test,
thus the patch contains adjustments in types validation of
operators new and delete
Reviewed By: Anastasia
Differential Revision: https://reviews.llvm.org/D96178
Sjoerd Meijer [Tue, 16 Feb 2021 14:43:44 +0000 (14:43 +0000)]
[MachineSink] Add a loop sink limit
To make sure compile-times don't regress, add an option to restrict the number
of instructions considered for sinking as alias analysis can be expensive and
for the same reason also skip large blocks.
Differential Revision: https://reviews.llvm.org/D96485
Joachim Protze [Wed, 17 Feb 2021 08:14:23 +0000 (09:14 +0100)]
[sanitizers] Pass CMAKE_C_FLAGS into TSan buildgo script
When compiling with ccache, compiler commands get split into smaller steps
and clang's default -Wunused-command-line-argument complains about unused
include directory arguments. In combination -Werror, compilation aborts.
This patch passes the CMAKE_C_FLAGS into the build script. Configuring with
-DCMAKE_C_FLAGS=-Wno-unused-command-line-argument allows successful testing.
Differential Revision: https://reviews.llvm.org/D96762
Balázs Kéri [Tue, 16 Feb 2021 14:52:44 +0000 (15:52 +0100)]
[clang][Frontend] Fix a crash in DiagnosticRenderer.
Displaying the problem range could crash if the begin and end of a
range is in different files or macros. After the change such range
is displayed only as the beginning location.
There is a bug for this problem:
https://bugs.llvm.org/show_bug.cgi?id=46540
Reviewed By: steakhal
Differential Revision: https://reviews.llvm.org/D95860
Kazu Hirata [Wed, 17 Feb 2021 07:46:21 +0000 (23:46 -0800)]
[OpenMP] Fix a warning on an unused variable
Cassie Jones [Wed, 17 Feb 2021 07:38:53 +0000 (02:38 -0500)]
[vim] Highlight most common MIR syntax not in LLVM IR
This adds highlighting for MIR instruction opcodes, physical registers,
and MIR types.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D95553
Cassie Jones [Wed, 17 Feb 2021 07:38:08 +0000 (02:38 -0500)]
[vim] Add initial syntax definition for .mir files
This initial definition handles the yaml container and the embedding of
the inner IRs. As a stopgap, this reuses the LLVM IR syntax highlighting
for the MIR function bodies--even though it's not technically correct,
it produces decent highlighting for a first pass.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D95552
Dmitry Vyukov [Mon, 15 Feb 2021 10:25:48 +0000 (11:25 +0100)]
tsan: don't leave unmapped hole in non-app memory
If an app mmaps lots of memory, a user mmap may end up
in the tsan region for traces. Shadow for this range
overlaps with shadow for other user regions.
This causes havok: from false positives to crashes.
Don't leave unmapped holes in the traces region.
Reviewed-in: https://reviews.llvm.org/D96697
Yang Fan [Wed, 17 Feb 2021 07:26:07 +0000 (15:26 +0800)]
[SampleFDO] Fix MSVC "namespace uses itself" warning (NFC)
MSVC warning:
```
SampleProfileLoaderBaseImpl.h(41): warning C4515: 'llvm': namespace uses itself
```
Kazu Hirata [Wed, 17 Feb 2021 07:23:08 +0000 (23:23 -0800)]
[CodeGen] Use range-based for loops (NFC)
Kazu Hirata [Wed, 17 Feb 2021 07:23:07 +0000 (23:23 -0800)]
[llvm] Fix header guards (NFC)
Identified with llvm-header-guard.
Kazu Hirata [Wed, 17 Feb 2021 07:23:05 +0000 (23:23 -0800)]
[SCEV] Use ListSeparator (NFC)
Mikael Holmen [Tue, 16 Feb 2021 14:16:41 +0000 (15:16 +0100)]
[lld] Silence compiler warnings by removing always true/false comparisons
type is an uint8_t so
type >= 0
is always true and
type < 0
is always false.
Mircea Trofin [Fri, 12 Feb 2021 06:17:59 +0000 (22:17 -0800)]
[mlgo] Fetch models from path / URL
Allow custom location for pre-trained models used when AOT-compiling
policies.
Differential Revision: https://reviews.llvm.org/D96796
Hsiangkai Wang [Fri, 8 Jan 2021 06:42:59 +0000 (14:42 +0800)]
[RISCV] Spilling for RISC-V V extension. (2nd version)
Differential Revision: https://reviews.llvm.org/D95148
Hsiangkai Wang [Fri, 8 Jan 2021 02:18:26 +0000 (10:18 +0800)]
[RISCV] Frame handling for RISC-V V extension.
This patch proposes how to deal with RISC-V vector frame objects. The
layout of RISC-V vector frame will look like
|---------------------------------|
| scalar callee-saved registers |
|---------------------------------|
| scalar local variables |
|---------------------------------|
| scalar outgoing arguments |
|---------------------------------|
| RVV local variables && |
| RVV outgoing arguments |
|---------------------------------| <- end of frame (sp)
If there is realignment or variable length array in the stack, we will use
frame pointer to access fixed objects and stack pointer to access
non-fixed objects.
|---------------------------------| <- frame pointer (fp)
| scalar callee-saved registers |
|---------------------------------|
| scalar local variables |
|---------------------------------|
| ///// realignment ///// |
|---------------------------------|
| scalar outgoing arguments |
|---------------------------------|
| RVV local variables && |
| RVV outgoing arguments |
|---------------------------------| <- end of frame (sp)
If there are both realignment and variable length array in the stack, we
will use frame pointer to access fixed objects and base pointer to access
non-fixed objects.
|---------------------------------| <- frame pointer (fp)
| scalar callee-saved registers |
|---------------------------------|
| scalar local variables |
|---------------------------------|
| ///// realignment ///// |
|---------------------------------| <- base pointer (bp)
| RVV local variables && |
| RVV outgoing arguments |
|---------------------------------|
| /////////////////////////////// |
| variable length array |
| /////////////////////////////// |
|---------------------------------| <- end of frame (sp)
| scalar outgoing arguments |
|---------------------------------|
In this version, we do not save the addresses of RVV objects in the
stack. We access them directly through the polynomial expression
(a x VLENB + b). We do not reserve frame pointer when there is any RVV
object in the stack. So, we also access the scalar frame objects through the
polynomial expression (a x VLENB + b) if the access across RVV stack
area.
Differential Revision: https://reviews.llvm.org/D94465
Douglas Yung [Wed, 17 Feb 2021 05:54:10 +0000 (21:54 -0800)]
Fix gcc build after
de3a485d9 due to a gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598
This should fix gcc based builders such as http://lab.llvm.org:8011/#/builders/76/builds/1683
Valentin Clement [Wed, 17 Feb 2021 02:52:26 +0000 (21:52 -0500)]
[flang][fir][NFC] Move ComplexType to TableGen type definition
This patch is a follow up of D96422 and move ComplexType to
TableGen.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D96575
Valentin Clement [Wed, 17 Feb 2021 02:26:55 +0000 (21:26 -0500)]
[flang][fir][NFC] Move BoxProcType to TableGen type definition
This patch is a follow up of D96422 and move BoxProcType to TableGen.
Reviewed By: schweitz, mehdi_amini
Differential Revision: https://reviews.llvm.org/D96514
Valentin Clement [Wed, 17 Feb 2021 02:15:06 +0000 (21:15 -0500)]
[flang][fir][NFC] Move CharacterType and BoxCharType to TableGen type definition
This patch is a follow up of D96422 and move CharacterType and BoxCharType to
TableGen.
Reviewed By: schweitz
Differential Revision: https://reviews.llvm.org/D96446
Alexander Shaposhnikov [Thu, 11 Feb 2021 21:46:49 +0000 (13:46 -0800)]
[llvm-libtool] Emit warnings for files without symbols
1. Emit warnings for files without symbols.
2. Add -no_warning_for_no_symbols.
Test plan: make check-all
Differential revision: https://reviews.llvm.org/D95843
Tony Tye [Tue, 16 Feb 2021 03:22:34 +0000 (03:22 +0000)]
[AMDGPU] Correct rmw atomics s_waitcnt generation
The AMD GPU SIMemoryLegalizer was using the ordering address space
rather than the instruction address space when determining the
s_waitcnt to generate to ensure that a read-modify-write atomic has
completed. This resulted in additional unnecessary counters being
waited on.
Differential Revision: https://reviews.llvm.org/D96743
LLVM GN Syncbot [Wed, 17 Feb 2021 00:53:56 +0000 (00:53 +0000)]
[gn build] Port
6fd5ccff72ee
Rong Xu [Tue, 16 Feb 2021 22:44:09 +0000 (14:44 -0800)]
[SampleFDO] Reapply: Refactor SampleProfile.cpp
Reapply patch after fixing buildbot failure.
Refactor SampleProfile.cpp to use the core code in CodeGen.
The main changes are:
(1) Move SampleProfileLoaderBaseImpl class to a header file.
(2) Split SampleCoverageTracker to a head file and a cpp file.
(3) Move the common codes (common options and callsiteIsHot())
to the common cpp file.
Differential Revision: https://reviews.llvm.org/D96455
Sriraman Tallam [Tue, 16 Feb 2021 23:26:41 +0000 (15:26 -0800)]
Basic block sections should enable function sections implicitly.
Basic block sections enables function sections implicitly, this is not needed
and is inefficient with "=list" option.
We had basic block sections enable function sections implicitly in clang. This
is particularly inefficient with "=list" option as it places functions that do
not have any basic block sections in separate sections. This causes unnecessary
object file overhead for large applications.
This patch disables this implicit behavior. It only creates function sections
for those functions that require basic block sections.
Further, there was an inconistent behavior with llc as llc was not turning on
function sections by default. This patch makes llc and clang consistent and
tests are added to check the new behavior.
This is the first of two patches and this adds functionality in LLVM to
create a new section for the entry block if function sections is not
enabled.
Differential Revision: https://reviews.llvm.org/D93876
Stella Laurenzo [Tue, 16 Feb 2021 21:53:42 +0000 (13:53 -0800)]
[mlir][python] Add python binding for AffineMapAttribute.
Differential Revision: https://reviews.llvm.org/D96815
Alexey Bataev [Thu, 11 Feb 2021 13:10:54 +0000 (05:10 -0800)]
[OPENMP50]Allow overlapping mapping in target constructs.
OpenMP 5.0 removed a lot of restriction for overlapped mapped items
comparing to OpenMP 4.5. Patch restricts the checks for overlapped data
mappings only for OpenMP 4.5 and less and reorders mapping of the
arguments so, that present and alloc mappings are processed first and
then all others.
Differential Revision: https://reviews.llvm.org/D86119
Peter Steinfeld [Fri, 12 Feb 2021 21:28:58 +0000 (13:28 -0800)]
[flang] Detect circularly defined procedures
It's possible to define a procedure that has a procedure dummy argument which
names the procedure that contains it. This was causing the compiler to fall
into an infinite loop when characterizing a call to the procedure.
Following a suggestion from Peter, I fixed this be maintaining a set of
procedure symbols that had already been seen while characterizing a procedure.
This required passing a new parameter to the functions that characterized a
Procedure, a DummyArgument, and a DummyProcedure.
I also added several tests that will crash the compiler without this change.
Differential Revision: https://reviews.llvm.org/D96631
Petr Hosek [Fri, 12 Feb 2021 22:26:31 +0000 (14:26 -0800)]
[lld][ELF] Support for zero flag section groups
This change introduces support for zero flag ELF section groups to lld.
lld already supports COMDAT sections, which in ELF are a special type of
ELF section groups. These are generally useful to enable linker GC where
you want a group of sections to always travel together, that is to be
either retained or discarded as a whole, but without the COMDAT
semantics. Other ELF linkers already support zero flag ELF section
groups and this change helps us reach feature parity.
Differential Revision: https://reviews.llvm.org/D96636
Yang Fan [Tue, 16 Feb 2021 21:09:26 +0000 (16:09 -0500)]
[C++20] [P1825] More implicit moves
Implement all of P1825R0:
- implicitly movable entity can be an rvalue reference to non-volatile
automatic object.
- operand of throw-expression can be a function or catch-clause parameter
(support for function parameter has already been implemented).
- in the first overload resolution, the selected function no need to be
a constructor.
- in the first overload resolution, the first parameter of the selected
function no need to be an rvalue reference to the object's type.
This patch also removes the diagnostic `-Wreturn-std-move-in-c++11`.
Differential Revision: https://reviews.llvm.org/D88220
Petr Hosek [Mon, 1 Feb 2021 06:42:35 +0000 (22:42 -0800)]
[MC][ELF] Support for zero flag section groups
This change introduces support for zero flag ELF section groups to LLVM.
LLVM already supports COMDAT sections, which in ELF are a special type
of ELF section groups. These are generally useful to enable linker GC
where you want a group of sections to always travel together, that is to
be either retained or discarded as a whole, but without the COMDAT
semantics. Other ELF assemblers already support zero flag ELF section
groups and this change helps us reach feature parity.
Differential Revision: https://reviews.llvm.org/D95851
LLVM GN Syncbot [Tue, 16 Feb 2021 22:13:03 +0000 (22:13 +0000)]
[gn build] Port
c761fe77bdca
Mehdi Amini [Tue, 16 Feb 2021 22:10:51 +0000 (22:10 +0000)]
Revert "[SampleFDO][NFC] Refactor SampleProfile.cpp"
This reverts commit
310b35304cdf5a230c042904655583c5532d3e91.
The build is broken with -DBUILD_SHARED_LIBS=ON :
lib/ProfileData/CMakeFiles/LLVMProfileData.dir/SampleProfileLoaderBaseUtil.cpp.o: In function `llvm::sampleprofutil::callsiteIsHot(llvm::sampleprof::FunctionSamples const*, llvm::ProfileSummaryInfo*, bool)':
SampleProfileLoaderBaseUtil.cpp:(.text._ZN4llvm14sampleprofutil13callsiteIsHotEPKNS_10sampleprof15FunctionSamplesEPNS_18ProfileSummaryInfoEb+0x1a): undefined reference to `llvm::ProfileSummaryInfo::isColdCount(unsigned long) const'
SampleProfileLoaderBaseUtil.cpp:(.text._ZN4llvm14sampleprofutil13callsiteIsHotEPKNS_10sampleprof15FunctionSamplesEPNS_18ProfileSummaryInfoEb+0x28): undefined reference to `llvm::ProfileSummaryInfo::isHotCount(unsigned long) const'
...
David Blaikie [Tue, 16 Feb 2021 21:45:25 +0000 (13:45 -0800)]
Effectively revert
ba2aa5f49ebb since the object isn't destroyed polymorphically
MaheshRavishankar [Tue, 16 Feb 2021 21:15:55 +0000 (13:15 -0800)]
[mlir][Linalg] Add utility method to reshape ops to express output shape in terms of input shape.
Resolving the dim of outputs of a tensor_reshape op in terms of its
input shape allows the op to be eliminated when its used only in its
dims. The init_tensor -> tensor_reshape canonicalization can be
simplified to use the dims of the output of the tensor_reshape which
gets canonicalized away later making the tensor_reshape dead.
Differential Revision: https://reviews.llvm.org/D96635
Simonas Kazlauskas [Tue, 16 Feb 2021 21:35:32 +0000 (13:35 -0800)]
[llvm-dwp] Join dwo paths correctly when DWOPath is absolute
When the `DWOPath` is absolute, we want to use `DWOPath` as is, without prepending any other
components to the path. The `sys::path::append` does not join, but rather unconditionally appends
the paths, so something like `sys::path::append("/tmp", "/tmp/banana")` will result in
`/tmp/tmp/banana` rather than the desired `/tmp/banana`.
This then causes `llvm-dwp` to fail in a following situation:
```
$ clang -gsplit-dwarf /tmp/banana/test.c -c -o /tmp/outdir/foo.o
$ clang outdir/foo.o -o outdir/hm
$ llvm-dwarfdump outdir/hm | grep -C2 foo.dwo
DW_AT_comp_dir ("/tmp")
DW_AT_GNU_pubnames (true)
DW_AT_GNU_dwo_name ("/tmp/outdir/foo.dwo")
DW_AT_GNU_dwo_id (0xde4d396f3bf0e257)
DW_AT_low_pc (0x0000000000401100)
$ strace -o trace llvm-dwp -e outdir/hm -o outdir/hm.dwp
error: No such file or directory
$ cat trace | grep foo.dwo
openat(AT_FDCWD, "/tmp/tmp/outdir/foo.dwo", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
```
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D96678
David Blaikie [Tue, 16 Feb 2021 21:13:21 +0000 (13:13 -0800)]
Fix -Wnon-virtual-dtor by making the ctor protected
Johannes Doerfert [Sun, 14 Feb 2021 18:25:56 +0000 (12:25 -0600)]
[OpenMP][FIX] Avoid use of stack allocations in asynchronous calls
As reported by Guilherme Valarini [0], we used to pass stack allocations
to calls that can nowadays be asynchronous. This is arguably a problem
and it will inevitably result in UB. To remedy the situation we
allocate the locations as part of the AsyncInfoTy object. The lifetime
of that object matches what we need for now. If the synchronization is
not tied to the AsyncInfoTy object anymore we might need to have a
different buffer construct in global space.
This should be back-ported to LLVM 12 but needs slight modifications as
it is based on refactoring patches we do not need to backport.
[0] https://lists.llvm.org/pipermail/openmp-dev/2021-February/003867.html
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D96667
Johannes Doerfert [Wed, 10 Feb 2021 17:06:00 +0000 (11:06 -0600)]
[OpenMP] Unify omptarget API and usage wrt. `__tgt_async_info`
This patch unifies our libomptarget API in two ways:
- always pass a `__tgt_async_info` object, the Queue member decides if
it is in use or not.
- (almost) always synchronize in the interface layer and not in the
omptarget layer.
A side effect is that we now put all constructor and static initializer
kernels in a stream too, if the device utilizes `__tgt_async_info`.
The patch contains a TODO which can be addressed as we add support for
asynchronous malloc and free in the plugin API. This is the only
`synchronizeAsyncInfo` left in the omptarget layer.
Site note: On a V100 system the GridMini performance for small sizes
more than doubled.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D96379
Johannes Doerfert [Wed, 10 Feb 2021 17:06:00 +0000 (11:06 -0600)]
[OpenMP] Move synchronization into `__tgt_async_info`
The AsyncInfo should be passed everywhere and it should offer a way to
ensure synchronization, given a libomptarget Device.
This replaces D96431.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D96438
Johannes Doerfert [Wed, 10 Feb 2021 16:57:24 +0000 (10:57 -0600)]
[OpenMP][NFC] Unify `target` API with other by passing a `__tgt_async_info` pointer
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D96430
Johannes Doerfert [Wed, 10 Feb 2021 16:50:09 +0000 (10:50 -0600)]
[OpenMP][NFC] Pass a DeviceTy, not the device number to `target`
This unifies the API of `target` relative to `targetUpdateData` and
such.
Reviewed By: tianshilei1992, grokos
Differential Revision: https://reviews.llvm.org/D96429