Peter Collingbourne [Tue, 27 Oct 2020 19:10:08 +0000 (12:10 -0700)]
AArch64: Switch to x20 as the shadow base register for outlined HWASan checks.
From a code size perspective it turns out to be better to use a
callee-saved register to pass the shadow base. For non-leaf functions
it avoids the need to reload the shadow base into x9 after each
function call, at the cost of an additional stack slot to save the
caller's x20. But with x9 there is also a stack size cost, either
as a result of copying x9 to a callee-saved register across calls or
by spilling it to stack, so for the non-leaf functions the change to
stack usage is largely neutral.
It is also code size (and stack size) neutral for many leaf functions.
Although they now need to save/restore x20 this can typically be
combined via LDP/STP into the x30 save/restore. In the case where
the function needs callee-saved registers or stack spills we end up
needing, on average, 8 more bytes of stack and 1 more instruction
but given the improvements to other functions this seems like the
right tradeoff.
Unfortunately we cannot change the register for the v1 (non short
granules) check because the runtime assumes that the shadow base
register is stored in x9, so the v1 check still uses x9.
Aside from that there is no change to the ABI because the choice
of shadow base register is a contract between the caller and the
outlined check function, both of which are compiler generated. We do
need to rename the v2 check functions though because the functions
are deduplicated based on their names, not on their contents, and we
need to make sure that when object files from old and new compilers
are linked together we don't end up with a function that uses x9
calling an outlined check that uses x20 or vice versa.
With this change code size of /system/lib64/*.so in an Android build
with HWASan goes from
200066976 bytes to
194085912 bytes, or a 3%
decrease.
Differential Revision: https://reviews.llvm.org/D90422
Nikita Popov [Fri, 30 Oct 2020 19:26:42 +0000 (20:26 +0100)]
[PhaseOrdering] Add test for PR39282 (NFC)
While the actually incorrect transform happens in LoopUnroll, it
is based on noalias metadata inserted by the inliner, and
ultimately manifests in GVN. Add a phase ordering test that checks
this even if our representation of noalias metadata changes in
the future.
Mircea Trofin [Thu, 29 Oct 2020 00:44:13 +0000 (17:44 -0700)]
[FileCheck] Report missing prefixes when more than one is provided.
If more than a prefix is provided - e.g. --check-prefixes=CHECK,FOO - we
don't report if (say) FOO is never used. This may lead to a gap in our
test coverage.
This patch introduces a new option, --allow-unused-prefixes. It
currently is set to true, keeping today's behavior. After we explicitly
set it in tests where this behavior was actually intentional, we will
switch it to false by default.
Differential Revision: https://reviews.llvm.org/D90281
LLVM GN Syncbot [Fri, 30 Oct 2020 19:18:17 +0000 (19:18 +0000)]
[gn build] Port
ac49500cd04
Joseph Tremoulet [Fri, 30 Oct 2020 19:13:26 +0000 (15:13 -0400)]
[lldb] Report old modules from ModuleList::ReplaceEquivalent
This allows the Target to update its module list when loading a shared
module replaces an equivalent one.
A testcase is added which hits this codepath -- without the fix, the
target reports libbreakpad.so twice in its module list.
Reviewed By: jingham
Differential Revision: https://reviews.llvm.org/D89157
Joseph Tremoulet [Fri, 30 Oct 2020 19:12:10 +0000 (15:12 -0400)]
[lldb] GetSharedModule: Collect old modules in SmallVector
The various GetSharedModule methods have an optional out parameter for
the old module when a file has changed or been replaced, which the
Target uses to keep its module list current/correct. We've been using
a single ModuleSP to track "the" old module, and this change switches
to using a SmallVector of ModuleSP, which has a couple benefits:
- There are multiple codepaths which may discover an old module, and
this centralizes the code for how to handle multiples in one place,
in the Target code. With the single ModuleSP, each place that may
discover an old module is responsible for how it handles multiples,
and the current code is inconsistent (some code paths drop the first
old module, others drop the second).
- The API will be more natural for identifying old modules in routines
that work on sets, like ModuleList::ReplaceEquivalent (which I plan
on updating to report old module(s) in a subsequent change to fix a
bug).
I'm not convinced we can ever actually run into the case that multiple
old modules are found in the same GetOrCreateModule call, but I think
this change makes sense regardless, in light of the above.
When an old module is reported, Target::GetOrCreateModule calls
m_images.ReplaceModule, which doesn't allow multiple "old" modules; the
new code calls ReplaceModule for the first "old" module, and for any
subsequent old modules it logs the event and calls m_images.Remove.
Reviewed By: jingham
Differential Revision: https://reviews.llvm.org/D89156
Anna Thomas [Fri, 30 Oct 2020 16:48:18 +0000 (12:48 -0400)]
[CFG] Replace hardcoded max BBs explored as CL option. NFC.
This option was hardcoded to 32. Changing this as a CL option since we
have seen some cases downstream where increasing this limit allows us to
disprove reachability.
Reviewed-By: jdoerfert
Differential Revision: https://reviews.llvm.org/D90487
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 18:08:19 +0000 (14:08 -0400)]
Reapply "FileManager: Improve the FileEntryRef API and customize its OptionalStorage"
This reverts commit
940d0a310dca31ae97080b068cef92eadfee6367,
effectively reapplying
84e8257937ec6a332aa0b688f4dce57016516ffd, after
working around the compile errors on the bots that I wasn't seeing
locally. I removed the `constexpr` from `OptionalStorage<FileEntryRef>`
that I had cargo-culted from the generic version, since `FileEntryRef`
isn't relevant in `constexpr` contexts anyway.
The original commit message follows:
Make a few changes to the `FileEntryRef` API in preparation for
propagating it enough to remove `FileEntry::getName()`.
- Allow `FileEntryRef` to degrade implicitly to `const FileEntry*`. This
allows functions currently returning `const FileEntry *` to be updated
to return `FileEntryRef` without requiring all callers to be updated
in the same patch. This helps avoid both (a) massive patches where
many fields and locals are updated simultaneously and (b) noisy
incremental patches where the first patch adds `getFileEntry()` at
call sites and the second patch removes it. (Once `FileEntryRef` is
everywhere, we should remove this API.)
- Change `operator==` to compare the underlying `FileEntry*`, ignoring
any difference in the spelling of the filename. There were 0 users of
the existing function because it's not useful. In case comparing the
exact named reference becomes important, add/test `isSameRef`.
- Add `==` comparisons between `FileEntryRef` and `const FileEntry *`
(compares the `FileEntry*`).
- Customize `OptionalStorage<FileEntryRef>` to be pointer-sized. Add
a private constructor that initializes with `nullptr` and specialize
`OptionalStorage` to use it. This unblocks updating fields in
size-sensitive data structures that currently use `const FileEntry *`.
- Add `OptionalFileEntryRefDegradesToFileEntryPtr`, a wrapper around
`Optional<FileEntryRef>` that degrades to `const FileEntry*`. This
facilitates future incremental patches, like the same operator on
`FileEntryRef`. (Once `FileEntryRef` is everywhere, we should remove
this class.)
- Remove the unncessary `const` from the by-value return of
`FileEntryRef::getName`.
- Delete the unused function `FileEntry::isOpenForTests`.
Note that there are still `FileEntry` APIs that aren't wrapped and I
plan to deal with these separately / incrementally, as they are needed.
Differential Revision: https://reviews.llvm.org/D89834
ergawy [Fri, 30 Oct 2020 18:36:19 +0000 (14:36 -0400)]
[MLIR][SPIRV] Start module combiner.
This commit adds a new library that merges/combines a number of spv
modules into a combined one. The library has a single entry point:
combine(...).
To combine a number of MLIR spv modules, we move all the module-level ops
from all the input modules into one big combined module. To that end, the
combination process can proceed in 2 phases:
(1) resolving conflicts between pairs of ops from different modules
(2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)
This patch implements only the first phase.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D90477
Scott Linder [Fri, 30 Oct 2020 18:37:28 +0000 (18:37 +0000)]
[AMDGPU] Refactor and extend elf-header-flags-mach tests
* Factor out common elements of the input YAML document and use sed to
macro replace the run line specific elements.
* Add checks for the common elements which depend on the ELF class.
* Use non-numeric suffix for temporary files to avoid merge conflicts.
* Sort tests by GFX# ascending.
* Group ELF and YAML tests by GFX#.
Reviewed By: t-tye
Differential Revision: https://reviews.llvm.org/D90245
Louis Dionne [Fri, 30 Oct 2020 18:55:37 +0000 (14:55 -0400)]
[libc++] Fix tests failing with Clang after removing GCC warnings
Dmitry Vyukov [Fri, 30 Oct 2020 18:42:48 +0000 (19:42 +0100)]
tsan: add Go race detector support for macOS/ARM64
Add Go race detector support for macOS/ARM64. The Go counterpart is https://golang.org/cl/266373 .
Author: cherry (Cherry Zhang)
Reviewed-in: https://reviews.llvm.org/D90435
LLVM GN Syncbot [Fri, 30 Oct 2020 18:08:01 +0000 (18:08 +0000)]
[gn build] Port
940d0a310dc
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 18:06:15 +0000 (14:06 -0400)]
Revert "FileManager: Improve the FileEntryRef API and customize its OptionalStorage" and follow-ups
This reverts commit
5530fb586f30da9dcb434f6be39198dbf016b866.
This reverts commit
010238a296e61cbf6f4d7f4383e26cf00c4e4992.
This reverts commit
84e8257937ec6a332aa0b688f4dce57016516ffd.
Having trouble getting the bots compiling. Will try again later.
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 18:04:48 +0000 (14:04 -0400)]
Speculative fix for bots after
84e8257937ec6a332aa0b688f4dce57016516ffd, v2
Looks like some bots don't like the defaulted default constructor, try
being explicit.
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 17:58:00 +0000 (13:58 -0400)]
Speculative fix for bots after
84e8257937ec6a332aa0b688f4dce57016516ffd
I'm not seeing an error locally, but many bots are having a problem with
the call to `hasOptionalValue`. Try to fix it.
LLVM GN Syncbot [Fri, 30 Oct 2020 17:54:57 +0000 (17:54 +0000)]
[gn build] Port
84e8257937e
Nico Weber [Fri, 30 Oct 2020 17:48:44 +0000 (13:48 -0400)]
[gn build] port
e58660750e76
Made necessary by
c479e0c99459e4, which requires std::timespec
to exist, which it only does in c++17 and later.
Craig Topper [Fri, 30 Oct 2020 17:25:44 +0000 (10:25 -0700)]
[RISCV] Don't use DCI.CombineTo to replace a single result. NFCI
Just return the new node, which is the standard practice.
I also noticed what appeared to be an unnecessary attempt at
creating an ANY_EXTEND where the type should already be correct.
I replace with an assert to verify the type.
Differential Revision: https://reviews.llvm.org/D90444
Zequan Wu [Wed, 28 Oct 2020 18:23:56 +0000 (11:23 -0700)]
[lldb][NFC] Refactor getUUID functionality
Differential Revision: https://reviews.llvm.org/D90325
Ronald Wampler [Mon, 28 Sep 2020 21:07:44 +0000 (17:07 -0400)]
[Support] PR42623: Avoid setting the delete-on-close bit if a TempFile doesn't reside on a local drive
On Windows, after commit
881ba104656c40098d4bc90c52613c08136f0fe1, tools
using TempFile would error with "bad file descriptor" when writing the
file on a network drive. It appears that setting the delete-on-close bit via
SetFileInformationByHandle/FileDispositionInfo prevented it from
accessing the file on network drives, and although using
FILE_DISPOSITION_INFO seems to work, it causes other troubles.
Differential Revision: https://reviews.llvm.org/D81803
Duncan P. N. Exon Smith [Tue, 20 Oct 2020 03:36:26 +0000 (23:36 -0400)]
FileManager: Improve the FileEntryRef API and customize its OptionalStorage
Make a few changes to the `FileEntryRef` API in preparation for
propagating it enough to remove `FileEntry::getName()`.
- Allow `FileEntryRef` to degrade implicitly to `const FileEntry*`. This
allows functions currently returning `const FileEntry *` to be updated
to return `FileEntryRef` without requiring all callers to be updated
in the same patch. This helps avoid both (a) massive patches where
many fields and locals are updated simultaneously and (b) noisy
incremental patches where the first patch adds `getFileEntry()` at
call sites and the second patch removes it. (Once `FileEntryRef` is
everywhere, we should remove this API.)
- Change `operator==` to compare the underlying `FileEntry*`, ignoring
any difference in the spelling of the filename. There were 0 users of
the existing function because it's not useful. In case comparing the
exact named reference becomes important, add/test `isSameRef`.
- Add `==` comparisons between `FileEntryRef` and `const FileEntry *`
(compares the `FileEntry*`).
- Customize `OptionalStorage<FileEntryRef>` to be pointer-sized. Add
a private constructor that initializes with `nullptr` and specialize
`OptionalStorage` to use it. This unblocks updating fields in
size-sensitive data structures that currently use `const FileEntry *`.
- Add `OptionalFileEntryRefDegradesToFileEntryPtr`, a wrapper around
`Optional<FileEntryRef>` that degrades to `const FileEntry*`. This
facilitates future incremental patches, like the same operator on
`FileEntryRef`. (Once `FileEntryRef` is everywhere, we should remove
this class.)
- Remove the unncessary `const` from the by-value return of
`FileEntryRef::getName`.
- Delete the unused function `FileEntry::isOpenForTests`.
Note that there are still `FileEntry` APIs that aren't wrapped and I
plan to deal with these separately / incrementally, as they are needed.
Differential Revision: https://reviews.llvm.org/D89834
Richard Smith [Fri, 30 Oct 2020 02:01:19 +0000 (19:01 -0700)]
PR47861: Expand dangling reference warning to look through copy
construction, and to assume that assignment operators return *this.
Sam Clegg [Fri, 30 Oct 2020 03:37:16 +0000 (20:37 -0700)]
[lld][WebAssembly] Give better warnings on bad relocation sites
Differential Revision: https://reviews.llvm.org/D90443
Arthur Eubanks [Thu, 29 Oct 2020 22:43:31 +0000 (15:43 -0700)]
[NFC] Clean up PassBuilder
Make DebugLogging a member variable so that users of PassBuilder don't
need to pass it around so much.
Move call to TargetMachine::registerPassBuilderCallbacks() within
PassBuilder so users don't need to remember to call it.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D90437
Arthur Eubanks [Wed, 30 Sep 2020 19:11:46 +0000 (12:11 -0700)]
Use uint64_t for branch weights instead of uint32_t
CallInst::updateProfWeight() creates branch_weights with i64 instead of i32.
To be more consistent everywhere and remove lots of casts from uint64_t
to uint32_t, use i64 for branch_weights.
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D88609
Andrzej Warzynski [Fri, 30 Oct 2020 15:57:42 +0000 (15:57 +0000)]
[clang][driver] Rename DriverOption as NoXarchOption (NFC)
As discussed in [1], ClangFlags::DriverOption is currently only used to
mark options that should not be forwarded to other tools via `-Xarch`
options. This patch renames this flag accordingly and updates the
corresponding driver diagnostic.
A comment in ToolChain::TranslateXarchArgs is also updated to reflect
the change. The original comment referred to isDriverOption(), which is
no longer available.
[1] http://lists.llvm.org/pipermail/cfe-dev/2020-October/066953.html
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D89799
Louis Dionne [Fri, 30 Oct 2020 16:50:58 +0000 (12:50 -0400)]
[libc++] Add -Wno-sized-deallocation to avoid spurious GCC warnings
GCC tries to be nice and tell us that we probably want to also implement
sized deallocation functions when we override the normal ones. However,
we know what we're doing in the test suite and don't want to override
them.
Pedro Tammela [Fri, 30 Oct 2020 16:50:07 +0000 (16:50 +0000)]
[NFC][Reg2Mem] modernize loops iterators
This patch updates the Reg2Mem loops to use more modern iterators.
Differential Revision: https://reviews.llvm.org/D90122
Pedro Tammela [Fri, 30 Oct 2020 16:34:01 +0000 (16:34 +0000)]
[NFC][LoopSimplify] modernize for loops over LoopInfo
This patch modifies two for loops to use the range based syntax.
Since they are equivalent, this patch is tagged NFC.
Differential Revision: https://reviews.llvm.org/D90069
Louis Dionne [Fri, 30 Oct 2020 15:19:07 +0000 (11:19 -0400)]
[libc++] NFC: Fix several GCC warnings in the test suite
- Several -Wshadow warnings
- Several places where we did not initialize our base class explicitly
- Unused variable warnings
- Some tautological comparisons
- Some places where we'd pass null arguments to functions expecting
non-null (in unevaluated contexts)
- Add a few pragmas to turn off spurious warnings
- Fix warnings about declarations that don't declare anything
- Properly disable deprecation warnings in ext/ tests (the pragmas we
were using didn't work on GCC)
- Disable include_as_c.sh.cpp because GCC complains about C++ flags
when compiling as C. I couldn't find a way to fix this one properly,
so I'm disabling the test. This isn't great, but at least we'll be
able to enable warnings in the whole test suite with GCC.
Daniel Kiss [Fri, 30 Oct 2020 16:42:23 +0000 (17:42 +0100)]
[libunwind] Support DW_CFA_remember/restore_state without heap allocation.
This patch just reorganises the code to make possible to use alloca
instead of malloc. This makes possible to use `.cfi_remember_state`/`.cfi_restore_state` on
platforms without heap allocation.
Also it will be safe to backtrace/unwind faults related to the allocator behind malloc.
`_LIBUNWIND_REMEMBER_HEAP_ALLOC ` option reenables the heap usage for `.cfi_remember_state`/`.cfi_restore_state`.
Define _LIBUNWIND_REMEMBER_STACK_ALLOC to force stack allocation.
Reviewed By: #libunwind, mstorsjo
Differential Revision: https://reviews.llvm.org/D85005
Sanjay Patel [Fri, 30 Oct 2020 16:05:01 +0000 (12:05 -0400)]
[x86] add cost overrides for mul with overflow
I'm assuming the standard size integer instructions for this end up as something like:
mulq %rsi
seto %al
And the 'mul' generally has reciprocal throughput of 1 on typical implementations
(higher latency, but that's not handled here).
The default costs may end up much higher than that, and that's what we see in the test diffs.
Vector types are left as a 'TODO'.
Differential Revision: https://reviews.llvm.org/D90431
Amy Huang [Tue, 27 Oct 2020 00:11:45 +0000 (17:11 -0700)]
[CodeView] Encode signed int values correctly when emitting S_CONSTANTs
Differential Revision: https://reviews.llvm.org/D90199
Simon Pilgrim [Fri, 30 Oct 2020 16:22:55 +0000 (16:22 +0000)]
[CodeGen][X86] Remove unused check-prefix in constrained fma tests
Simon Pilgrim [Fri, 30 Oct 2020 16:18:44 +0000 (16:18 +0000)]
[CodeGen][X86] Remove unused check-prefix in movdir tests
Jonas Devlieghere [Fri, 30 Oct 2020 16:17:10 +0000 (09:17 -0700)]
[lldb] Ignore binary data in crashlog
Skip the instruction stream section in the crashlog section.
Differential revision: https://reviews.llvm.org/D90414
Simon Pilgrim [Fri, 30 Oct 2020 16:13:14 +0000 (16:13 +0000)]
[CodeGen][X86] Cleanup + fix unused check-prefixes in bmi tests
Simon Pilgrim [Fri, 30 Oct 2020 16:12:15 +0000 (16:12 +0000)]
[CodeGen][X86] Tidyup CHECKs on bitscan tests
Simon Pilgrim [Fri, 30 Oct 2020 16:07:30 +0000 (16:07 +0000)]
[CodeGen][X86] Remove unused check-prefix in bitscan tests
Simon Pilgrim [Fri, 30 Oct 2020 16:04:20 +0000 (16:04 +0000)]
[CodeGen][X86] Remove unused check-prefix in bswap tests
Simon Pilgrim [Fri, 30 Oct 2020 16:01:33 +0000 (16:01 +0000)]
[CodeGen][X86] Cleanup + remove unused check-prefixes in avx union tests
Simon Pilgrim [Fri, 30 Oct 2020 15:56:16 +0000 (15:56 +0000)]
[CodeGen][X86] Remove unused check-prefix in amx inline asm tests
Pavel Labath [Fri, 30 Oct 2020 15:38:23 +0000 (16:38 +0100)]
Fix an embarrasing use-after-free from
a895a446bcde
Jan Kratochvil [Fri, 30 Oct 2020 15:43:45 +0000 (16:43 +0100)]
[nfc] [lldb] Align `user_id_t` format to the current `DIERef` format
Current user_id_t format is:
63{isDebugTypes} 62..32{dwo ||
7fffffff}
31..0 {die_offset}
while current DIERef format is (I have made up the bit positions but the
field widths do match):
63{m_section==isDebugTypes} 62{m_dwo_num_valid} 61..32{m_dwo_num}
31..0 {m_die_offset}
Proposing to change user_id_t to:
63{isDebugTypes} 62{dwo_is_valid} 61..32{dwo; 0 if !valid}
31..0 {die_offset}
There is no benefit of having 31-bits wide dwo_num in user_id_t when it
gets converted to 30-bits width in DIERef.
This patch is for future DWZ patchset which extends the dwo_is_valid bit
into a 2-bit field (normal, DWO, DWZ, DWZcommon) so that both user_id_t
and DIERef can be changed then the same way.
It would be best to somehow unify user_id_t and DIERef but I do not plan
to do that. user_id_t should probably remain a number for the Python API
compatibility while there still needs to be some class with all the
methods to access it.
SymbolFileDWARF::GetDwpSymbolFile() and SymbolFileDWARF::GetDIE use
0x3fffffff for DWP but that does not clash:
formerly:
31bits32..62:0x7fffffff = normal unit / not any DWO
31bits32..62:0x3fffffff = DWP
31bits32..62:others = DWO unit number
after this patch:
bit62=0 30bits32..61:any = normal unit / not any DWO
bit62=1 30bits32..61:0x3fffffff = DWP
bit62=1 30bits32..61:others = DWO unit number
Differential Revision: https://reviews.llvm.org/D90413
Simon Moll [Fri, 30 Oct 2020 15:44:13 +0000 (16:44 +0100)]
[VE][NFC] move scalar tests to Scalar/
Restructure lit tests to follow downstream
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D90468
Keith Smiley [Fri, 30 Oct 2020 15:27:50 +0000 (08:27 -0700)]
[llvm-cov][NFC] Remove unused prefixes from FileCheck usage
This is to enable `--allow-unused-duplicates=false`. These prefixes
appear to be outdated and intentionally unused.
Reviewed By: vsk
Differential Revision: https://reviews.llvm.org/D90423
Michael Liao [Fri, 30 Oct 2020 14:55:04 +0000 (10:55 -0400)]
[gvn] PRE needs to skip convergent intrinsics/calls.
- As convergent intrinsics/calls could only be moved to
control-equivalent blocks, or more precisely the same divergent
branch, PRE needs to skip them.
Differential Revision: https://reviews.llvm.org/D90391
Evgeniy Brevnov [Thu, 29 Oct 2020 07:27:54 +0000 (14:27 +0700)]
[DSE] Improve partial overlap detection
Currently isOverwrite returns OW_MaybePartial even for accesss known not to overlap. This is not a big problem for legacy implementation (since isPartialOverwrite follows isOverwrite and clarifies the result). Contrary SSA based version does a lot of work to later find out that accesses don't overlap. Besides negative impact on compile time we quickly reach MemorySSAPartialStoreLimit and miss optimization opportunities.
Note: In fact, I think it would be cleaner implementation if isOverwrite returned fully clarified result in the first place whithout need to call isPartialOverwrite. This can be done as a follow up. What do you think?
Reviewed By: fhahn, asbirlea
Differential Revision: https://reviews.llvm.org/D90371
Simon Pilgrim [Fri, 30 Oct 2020 15:18:01 +0000 (15:18 +0000)]
[SLP][X86] Extend target coverage for PR47629
As suggested on D90445, add tests for various SSE/AVX levels and more complex gep pointer offsets
Simon Pilgrim [Fri, 30 Oct 2020 15:05:23 +0000 (15:05 +0000)]
Use cast<> instead of dyn_cast<> as we dereference the pointers immediately. NFCI.
Fix clang static analyzer warnings - we're better off relying on cast<> asserting on failure rather than a null dereference crash.
Simon Moll [Fri, 30 Oct 2020 15:14:42 +0000 (16:14 +0100)]
[VE][NFC] Split up lowering init
Split up the monolithic VETargetLowering ctor into three initialization phases:
1. initRegisterClasses()
2. initSPUActions()
3. // TODO initVPUActions()
Reviewed By: kaz7
Differential Revision: https://reviews.llvm.org/D90463
Matt Arsenault [Sat, 17 Oct 2020 00:33:02 +0000 (20:33 -0400)]
AMDGPU: Fix missing writelane cases to skip with exec=0
Cullen Rhodes [Thu, 29 Oct 2020 11:04:35 +0000 (11:04 +0000)]
[clang][aarch64] Address various fixed-length SVE vector operations
This patch adds tests and support for operations on SVE vectors created
by the 'arm_sve_vector_bits' attribute, described by the Arm C Language
Extensions (ACLE, version 00bet6, section 3.7.3.3) for SVE [1].
This covers the following:
* VLSTs support the same forms of element-wise initialization as GNU
vectors.
* VLSTs support the same built-in C and C++ operators as GNU vectors.
* Conditional and binary expressions containing GNU and SVE vectors
(fixed or sizeless) are invalid since the ambiguity around the result
type affects the ABI.
No functional changes were required to support vector initialization and
operators. The functional changes are to address unsupported conditional and
binary expressions.
[1] https://developer.arm.com/documentation/100987/latest
Reviewed By: fpetrogalli
Differential Revision: https://reviews.llvm.org/D88233
Mehdi Amini [Fri, 30 Oct 2020 15:09:09 +0000 (15:09 +0000)]
Revert "[MLIR][SPIRV] Start module combiner"
This reverts commit
316593ce839f05af936e705182747743e4638f3c.
Build is broken with:
TestModuleCombiner.cpp:(.text._ZN12_GLOBAL__N_122TestModuleCombinerPass14runOnOperationEv+0x195): undefined reference to `mlir::spirv::combine(llvm::MutableArrayRef<mlir::spirv::ModuleOp>, mlir::OpBuilder&, llvm::function_ref<void (mlir::spirv::ModuleOp, llvm::StringRef, llvm::StringRef)>)'
David Green [Fri, 30 Oct 2020 15:06:49 +0000 (15:06 +0000)]
[ARM] Update target triple in tests. NFC
Florian Hahn [Fri, 30 Oct 2020 14:45:08 +0000 (14:45 +0000)]
[VPlan] Use isa<> instead getVPRecipeID in getFirstNonPhi (NFC).
As per the comment in VPRecipeBase, clients should not rely on
getVPRecipeID, as it may change in the future. It should only be used in
classof implementations. Use isa instead in getFirstNonPhi.
Simon Pilgrim [Fri, 30 Oct 2020 14:54:52 +0000 (14:54 +0000)]
[SCEV] SCEVExpander::InsertNoopCastOfTo - reduce scope of pointer type. NFCI.
By reducing the scope of the dyn_cast<PointerType> we can make this a cast<PointerType> and avoid clang static analyzer null deference warnings.
Frederik Gossen [Fri, 30 Oct 2020 14:41:37 +0000 (14:41 +0000)]
[MLIR] Use `llvm::is_one_of` in walk templates
Differential Revision: https://reviews.llvm.org/D90449
serge-sans-paille [Mon, 26 Oct 2020 08:09:25 +0000 (09:09 +0100)]
[lit] Ship and bundle license for lit package
lit is bundled independently from LLVM in at least one location
(https://pypi.org/project/lit/), it's easier to state its license locally.
Differential Revision: https://reviews.llvm.org/D90136
serge-sans-paille [Tue, 27 Oct 2020 09:59:42 +0000 (10:59 +0100)]
[stack-clash] Fix probing of dynamic alloca
- Perform the probing in the correct direction.
Related to https://github.com/rust-lang/rust/pull/77885#issuecomment-
711062924
- The first touch on a dynamic alloca cannot use a mov because it clobbers
existing space. Use a xor 0 instead
Differential Revision: https://reviews.llvm.org/D90216
Simon Pilgrim [Fri, 30 Oct 2020 14:27:50 +0000 (14:27 +0000)]
Use cast<> instead of dyn_cast<> as we dereference the pointer immediately. NFCI.
Fix clang static analyzer warning - we know that the arg should be ConstantInt and we're better off relying on cast<> asserting on failure rather than a null dereference crash.
Simon Pilgrim [Fri, 30 Oct 2020 12:05:39 +0000 (12:05 +0000)]
BitcodeReader::popValue - pass SmallVectorImpl<> as const reference. NFCI.
Fixes cppcheck warning.
Melanie Blower [Fri, 30 Oct 2020 14:29:37 +0000 (07:29 -0700)]
[clang] add fexperimental-strict-floating-point to test cases that fail on arm and aarch not sure this will work due to commit rG13bfd89c4962
Pavel Labath [Fri, 30 Oct 2020 14:18:11 +0000 (15:18 +0100)]
[lldb/DWARF] Fix dwo flavour of TestTypeGetModule
SymbolFileDWARF::GetTypes was not handling dwo correctly. The fix is
simple -- adding a GetNonSkeletonUnit call -- but I've snuck in a small
refactor as well.
Marco Antognini [Thu, 29 Oct 2020 10:30:11 +0000 (10:30 +0000)]
Address ABI issues introduced with CXCursor_CXXAddrspaceCastExpr
Revert values in CXCursorKind as they were before
CXCursor_CXXAddrspaceCastExpr was introduced in
a6a237f2046a ([OpenCL]
Added addrspace_cast operator in C++ mode., 2020-05-18).
Insert CXCursor_CXXAddrspaceCastExpr after the last expression in
CXCursorKind using the next available value.
Reviewed By: akyrtzi, svenvh
Differential Revision: https://reviews.llvm.org/D90385
Roman Lebedev [Fri, 30 Oct 2020 12:34:11 +0000 (15:34 +0300)]
[NFCI][SCEV] getPtrToIntExpr(): use SCEVRewriteVisitor<> for ptrtoint cast sinking
This is functionally-identical to the previous implementation,
just using a generic interface to do that instead of hand-rolled one,
with caching as a bonus. Thought the sinking is still recursive..
Note that SCEVRewriteVisitor<>'s default implementations
don't preserve NoWrap flags on Add/Mul (but does on AddRec!),
but here we know we can preserve them,
so `visitAddExpr()`/`visitMulExpr()` are specialized.
Florian Hahn [Fri, 30 Oct 2020 13:48:28 +0000 (13:48 +0000)]
[TTI] Add VecPred argument to getCmpSelInstrCost.
On some targets, like AArch64, vector selects can be efficiently lowered
if the vector condition is a compare with a supported predicate.
This patch adds a new argument to getCmpSelInstrCost, to indicate the
predicate of the feeding select condition. Note that it is not
sufficient to use the context instruction when querying the cost of a
vector select starting from a scalar one, because the condition of the
vector select could be composed of compares with different predicates.
This change greatly improves modeling the costs of certain
compare/select patterns on AArch64.
I am also planning on putting up patches to make use of the new argument in
SLPVectorizer & LV.
Reviewed By: dmgreen, RKSimon
Differential Revision: https://reviews.llvm.org/D90070
Erich Keane [Fri, 16 Oct 2020 16:09:09 +0000 (09:09 -0700)]
PR47372: Fix Lambda invoker calling conventions
As mentioned in the defect, the lambda static invoker does not follow
the calling convention of the lambda itself, which seems wrong. This
patch ensures that the calling convention of operator() is passed onto
the invoker and conversion-operator type.
This is accomplished by extracting the calling-convention determination
code out into a separate function in order to better reflect the 'thiscall'
work, as well as somewhat better support the future implementation of
https://devblogs.microsoft.com/oldnewthing/
20150220-00/?p=44623
For any target (basically just win32) that has a different free and
static function calling convention, this generates BOTH alternatives.
This required some work to get the Windows mangler to work correctly for
this, as well as some tie-breaking for the unary operators.
Differential Revision: https://reviews.llvm.org/D89559
ergawy [Fri, 30 Oct 2020 13:18:29 +0000 (09:18 -0400)]
[MLIR][SPIRV] Start module combiner
This commit adds a new library that merges/combines a number of spv
modules into a combined one. The library has a single entry point:
combine(...).
To combine a number of MLIR spv modules, we move all the module-level ops
from all the input modules into one big combined module. To that end, the
combination process can proceed in 2 phases:
(1) resolving conflicts between pairs of ops from different modules
(2) deduplicate equivalent ops/sub-ops in the merged module. (TODO)
This patch implements only the first phase.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D90022
David Sherwood [Tue, 27 Oct 2020 13:59:29 +0000 (13:59 +0000)]
[SVE] Add fatal error for unnamed SVE variadic arguments
We don't currently support passing unnamed variadic SVE arguments
so I've added a fatal error if we hit such cases to prevent any
silent ABI issues in future.
Differential Revision: https://reviews.llvm.org/D90230
David Green [Fri, 30 Oct 2020 13:34:27 +0000 (13:34 +0000)]
[ARM] Match MVE vqdmulh
This adds ISel matching for a form of VQDMULH. There are several ir
patterns that we could match to that instruction, this one is for:
min(ashr(mul(sext(a), sext(b)), 7), 127)
Which is what llvm will optimize to once it has removed the max that
usually makes up the min/max saturate pattern, as in this case the
compare will always be false. The additional complication to match i32
patterns (which extend into an i64) is that the min will be a
vselect/setcc, as vmin is not supported for i64 vectors. Tablegen
patterns have also been updated to attempt to reuse the MVE_TwoOpPattern
patterns.
Differential Revision: https://reviews.llvm.org/D90096
Pavel Labath [Fri, 30 Oct 2020 13:24:21 +0000 (14:24 +0100)]
[lldb/test] Remove a double debugserver launch in TestGdbRemoteGPacket
Debug server is already launched by prep_debug_monitor_and_inferior. The
second seems to have been benign so far, but after
8cc49bec2 this test
started failing frequently on GreenDragon, and this is the only unusual
thing about it.
Pavel Labath [Thu, 29 Oct 2020 13:25:24 +0000 (14:25 +0100)]
[lldb/test] Simplify/generalize YAMLModuleTester
The class only supports a single DWARF unit (needed for my new test), and it
reimplements chunks of object and symbol file classes. We can just make it use
the real thing, save some LOC and get the full feature set.
Differential Revision: https://reviews.llvm.org/D90393
Louis Dionne [Thu, 29 Oct 2020 20:02:21 +0000 (16:02 -0400)]
[libc++] Add a new concept of ConfigAction, and use it in the DSL
This will allow adding bare compiler flags through the new
configuration DSL. Previously, this would have required adding
a Lit feature for each such flag.
Differential Revision: https://reviews.llvm.org/D90429
Georgii Rymar [Thu, 29 Oct 2020 13:04:45 +0000 (16:04 +0300)]
[yaml2obj] - Make `Section::Link` field to be `Optional<>`.
`Link` is not an optional field currently.
Because of this it is not convenient to write macros.
This makes it optional and fixes corresponding test cases.
Differential revision: https://reviews.llvm.org/D90390
Melanie Blower [Wed, 28 Oct 2020 16:23:21 +0000 (09:23 -0700)]
[clang][FPEnv] Diagnose Strict FP pragmas if target does not support StrictFP
Reviewers: sepavloff, kpn, aaron.ballman
Differential Revision: https://reviews.llvm.org/D90316
Eugene Zhulenev [Fri, 30 Oct 2020 12:19:42 +0000 (05:19 -0700)]
[mlir] Implement lowering to LLVM of async.execute ops with token dependencies
Add support for lowering `async.execute` operations with token dependencies
Example:
```
%dep = ... : !async.token
%token = async.execute[%dep] {
...
}
```
Token dependencies lowered to `async.await` operations inside the outline coroutine body.
Reviewed By: herhut, mehdi_amini, ftynse
Differential Revision: https://reviews.llvm.org/D89958
Stephen Kelly [Sun, 21 Jun 2020 12:31:27 +0000 (13:31 +0100)]
[AST] Fix traversal over CXXConstructExpr in Syntactic mode
Summary:
Skip over elidable nodes, and ensure that intermediate
CXXFunctionalCastExpr nodes are also skipped if they are semantic.
Reviewers: klimek, ymandel
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D82278
David Truby [Mon, 26 Oct 2020 14:45:11 +0000 (14:45 +0000)]
[Aarch64] Fix assumption that Windows implies x86
When compiling for Windows on Arm the amd64 debug interfce from the Visual
Studio SDK is used as the cmake currently only distinguishes between x86 and
amd64 by checking the pointer size. Instead we can get the target
architecture for the compilier and check that to distinguish between
architectures.
Simon Pilgrim [Fri, 30 Oct 2020 11:59:21 +0000 (11:59 +0000)]
Revert rG22c383763456 "[RISCV] Remove include of RISCVRegisterInfo.h from RISCVBaseInfo.h"
This reverts commit
22c38376345670c1883963e5e1cccd597a15b3a5.
This is causing a build failure with MSVC - reported on D90322
Andrzej Warzynski [Fri, 30 Oct 2020 11:27:04 +0000 (11:27 +0000)]
[Flang] Fix build failures (NFC)
Some changes introduced in https://reviews.llvm.org/D88655 cause compiler
warnings. Since in Flang warnings are treated as errors (`-Werror` is on by
default), these are in practice compiler errors (verified with clang-10 and
clang-11, gcc-10). This patches fixes these warning/failures.
Warning/error 1:
```
llvm-project/flang/lib/Semantics/check-omp-structure.cpp:107:3: error:
unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
```
Warning/error 2:
```
llvm-project/flang/lib/Semantics/check-directive-structure.h:39:9: error: field
'currentDirective_' will be initialized after field 'upperCaseDirName_'
[-Werror,-Wreorder-ctor]
```
Failing buildbot:
* http://lab.llvm.org:8011/#/builders/33/builds/386
alex-t [Wed, 28 Oct 2020 16:01:02 +0000 (19:01 +0300)]
[AMDGPU] SILowerControlFlow::removeMBBifRedundant. Refactoring plus fix for the null MBB pointer in MF->splice
Detailed description: This change addresses the refactoring adviced by foad. It also contain the fix for the case when getNextNode is null if the successor block is the last in MachineFunction.
Reviewed By: foad
Differential Revision: https://reviews.llvm.org/D90314
Simon Pilgrim [Fri, 30 Oct 2020 11:36:27 +0000 (11:36 +0000)]
[clangd] Fix MSVC implicit capture build failure.
MSVC builds were failing because the constexpr wasn't couldn't be captured by the lamdba.
Fix an implicit double to float truncation warning as well.
Simon Pilgrim [Thu, 29 Oct 2020 17:43:24 +0000 (17:43 +0000)]
[SROA] Pass Twine by const reference. NFCI.
Fixes clang-tidy warnings.
Nathan James [Fri, 30 Oct 2020 10:57:25 +0000 (10:57 +0000)]
[ADT][NFC] Silence some misc-unconventional-assign-operator warnings
Max Kazantsev [Fri, 30 Oct 2020 10:37:03 +0000 (17:37 +0700)]
[NFC] Simplify code in IndVars
David Green [Fri, 30 Oct 2020 10:20:59 +0000 (10:20 +0000)]
[ARM] Additional MVE VQDMULH tests. NFC
Nathan James [Fri, 30 Oct 2020 10:07:39 +0000 (10:07 +0000)]
[ADT] Add methods to SmallString for efficient concatenation
A common pattern when using SmallString is to repeatedly call append to build a larger string.
The issue here is the optimizer can't see through this and often has to check there is enough space in the storage for each string you try to append.
This results in lots of conditional branches and potentially multiple calls to grow needing to be emitted if the buffer wasn't large enough.
By taking an initializer_list of StringRefs, SmallString can preallocate the storage it needs for all of the StringRefs which only need to grow one time at most, then use a fast path of copying all the strings into its storage knowing there is guaranteed to be enough capacity.
By using StringRefs, this also means you can append different string like types in one go as they will all be implicitly converted to a StringRef.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D90386
Tres Popp [Thu, 29 Oct 2020 16:13:26 +0000 (17:13 +0100)]
[mlir] Add lowering for IsBroadcastable to Std dialect.
Differential Revision: https://reviews.llvm.org/D90407
Florian Hahn [Fri, 30 Oct 2020 09:32:43 +0000 (09:32 +0000)]
[DSE] Remove noop stores after killing stores for a MemoryDef.
Currently we fail to eliminate some noop stores if there is a kill-able
store between the starting def and the load. This is because we
eliminate noop stores first.
In practice it seems like eliminating noop stores after the main
elimination for a def covers slightly more cases.
This patch improves the number of stores slightly in 2 cases for X86 -O3
-flto
Same hash: 235 (filtered out)
Remaining: 2
Metric: dse.NumRedundantStores
Program base patch diff
test-suite...ce/Benchmarks/PAQ8p/paq8p.test 2.00 3.00 50.0%
test-suite...006/453.povray/453.povray.test 18.00 21.00 16.7%
There might be other phase ordering issues, but it appears that they do
not show up in the test-suite/SPEC2000/SPEC2006. We can always tune the
ordering later.
Partly fixes PR47887.
Reviewed By: asbirlea, zoecarver
Differential Revision: https://reviews.llvm.org/D89650
Louis Dionne [Wed, 21 Oct 2020 23:14:48 +0000 (16:14 -0700)]
[compiler-rt] Don't include libc++ headers from the source tree in MSAN
We shouldn't be including the libc++ headers from the source tree directly, since those headers are not configured (i.e. they don't use the __config_site) header like they should, which could mean up to ABI differences
Reviewed By: vitalybuka, phosek, ldionne
Differential Revision: https://reviews.llvm.org/D89915
Tres Popp [Thu, 29 Oct 2020 14:32:26 +0000 (15:32 +0100)]
[mlir] Add shape.is_broadcastable.
This op returns a boolean value indicating whether 2 ops are
broadcastable or not. This follows the same logic as the other ops with
broadcast in their names in the shape dialect.
Concretely, shape.is_broadcastable returning true implies that
shape.broadcast will not give an error, and shape.cstr_broadcastable
will not result in an assertion failure. Similarly, false implies an
error or assertion failure.
Dmitry Vyukov [Fri, 30 Oct 2020 08:17:46 +0000 (09:17 +0100)]
[sanitizer] Use __atomic_load/store() built-ins for generic 32-bit targets
Simplifies the code and fixes the build on SPARC.
See discussion in: http://lists.llvm.org/pipermail/llvm-dev/2020-October/145937.html
Author: glaubitz (John Paul Adrian Glaubitz)
Reviewed-in: https://reviews.llvm.org/D89940
Roman Lebedev [Fri, 30 Oct 2020 06:12:49 +0000 (09:12 +0300)]
[SCEV] SCEVPtrToIntExpr simplifications
If we've got an SCEVPtrToIntExpr(op), where op is not an SCEVUnknown,
we want to sink the SCEVPtrToIntExpr into an operand,
so that the operation is performed on integers,
and eventually we end up with just an `SCEVPtrToIntExpr(SCEVUnknown)`.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D89692
Roman Lebedev [Fri, 30 Oct 2020 06:12:17 +0000 (09:12 +0300)]
[SCEV] Introduce SCEVPtrToIntExpr (PR46786)
And use it to model LLVM IR's `ptrtoint` cast.
This is essentially an alternative to D88806, but with no chance for
all the problems it caused due to having the cast as implicit there.
(see rG7ee6c402474a2f5fd21c403e7529f97f6362fdb3)
As we've established by now, there are at least two reasons why we want this:
* It will allow SCEV to actually model the `ptrtoint` casts
and their operands, instead of treating them as `SCEVUnknown`
* It should help with initial problem of PR46786 - this should eventually allow us
to not loose pointer-ness of an expression in more cases
As discussed in [[ https://bugs.llvm.org/show_bug.cgi?id=46786 | PR46786 ]], in principle,
we could just extend `SCEVUnknown` with a `is ptrtoint` cast, because `ScalarEvolution::getPtrToIntExpr()`
should sink the cast as far down into the expression as possible,
so in the end we should always end up with `SCEVPtrToIntExpr` of `SCEVUnknown`.
But i think that it isn't the best solution, because it doesn't really matter
from memory consumption side - there probably won't be *that* many `SCEVPtrToIntExpr`s
for it to matter, and it allows for much better discoverability.
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D89456
Michael Roe [Fri, 30 Oct 2020 07:57:22 +0000 (10:57 +0300)]
[mips] Implement add.ps, mul.ps and sub.ps
Differential revision: https://reviews.llvm.org/D90321
Vitaly Buka [Fri, 30 Oct 2020 07:36:50 +0000 (00:36 -0700)]
[NFC] Fix "ambiguous overload for ‘operator=’"
From D89768
River Riddle [Fri, 30 Oct 2020 07:30:59 +0000 (00:30 -0700)]
[mlir][ASM] Refactor how attribute/type aliases are specified.
Previously they were separated into "instance" and "kind" aliases, and also required that the dialect know ahead of time all of the instances that would have a corresponding alias. This approach was very clunky and not ergonomic to interact with. The new approach is to provide the dialect with an instance of an attribute/type to provide an alias for, fully replacing the original split approach.
Differential Revision: https://reviews.llvm.org/D89354
Vitaly Buka [Fri, 30 Oct 2020 07:36:50 +0000 (00:36 -0700)]
[NFC] Fix "ambiguous overload for ‘operator=’"