James Nagurne [Fri, 17 Jan 2020 23:16:34 +0000 (15:16 -0800)]
[CMake] Prefer multi-target variables over generic target variables in runtimes build
Runtimes variables in a multi-target environment are defined like:
RUNTIMES_target_VARIABLE_NAME
RUNTIMES_target+multi_VARIABLE_NAME
In my case, I have a downstream runtimes cache that does the following:
set(RUNTIMES_${target}+except_LIBCXXABI_ENABLE_EXCEPTIONS ON CACHE BOOL "")
set(RUNTIMES_${target}_LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
I found that I was always getting the 'target' variable value (OFF) in
my 'target+except' build, which was unexpected. This behavior was
caused by the loop in llvm/runtimes/CMakeLists.txt that runs through all
variable names, adding '-DVARIABLE_NAME=' options to the subsequent
external project's cmake command.
The issue is that the loop does a single pass, such that if the 'target'
value appears in the cache after the 'target+except' value, the 'target'
value will take precedence. I suggest in my change here that the more
specific 'target+except' value should take precedence always, without
relying on CMake cache ordering.
Differential Revision: https://reviews.llvm.org/D71570
Patch By: JamesNagurne
Peter Collingbourne [Fri, 17 Jan 2020 02:10:03 +0000 (18:10 -0800)]
hwasan: Remove dead code. NFCI.
Differential Revision: https://reviews.llvm.org/D72896
Petr Hosek [Fri, 4 Oct 2019 20:29:56 +0000 (13:29 -0700)]
[profile] Support counter relocation at runtime
This is an alternative to the continous mode that was implemented in
D68351. This mode relies on padding and the ability to mmap a file over
the existing mapping which is generally only available on POSIX systems
and isn't suitable for other platforms.
This change instead introduces the ability to relocate counters at
runtime using a level of indirection. On every counter access, we add a
bias to the counter address. This bias is stored in a symbol that's
provided by the profile runtime and is initially set to zero, meaning no
relocation. The runtime can mmap the profile into memory at abitrary
location, and set bias to the offset between the original and the new
counter location, at which point every subsequent counter access will be
to the new location, which allows updating profile directly akin to the
continous mode.
The advantage of this implementation is that doesn't require any special
OS support. The disadvantage is the extra overhead due to additional
instructions required for each counter access (overhead both in terms of
binary size and performance) plus duplication of counters (i.e. one copy
in the binary itself and another copy that's mmapped).
Differential Revision: https://reviews.llvm.org/D69740
Sergej Jaskiewicz [Fri, 17 Jan 2020 22:28:51 +0000 (01:28 +0300)]
[CMake] Use LinuxRemoteTI instead of LinuxLocalTI in CrossWinToARMLinux cmake cache
Summary: Depends on D72847
Reviewers: vvereschaka, aorlov, andreil99
Reviewed By: vvereschaka
Subscribers: mgorny, kristof.beyls, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72850
Sergej Jaskiewicz [Fri, 17 Jan 2020 22:26:58 +0000 (01:26 +0300)]
[libcxx] Introduce LinuxRemoteTI for remote testing
Summary:
This patch adds a new target info object called LinuxRemoteTI.
Unlike LinuxLocalTI, which asks the host system about various things
like available locales, distribution name etc. which don't make sense
if we're testing on a remote board, LinuxRemoteTI uses SSHExecutor
to get information from the target system.
Reviewers: jroelofs, ldionne, bcraig, EricWF, danalbert, mclow.lists
Reviewed By: jroelofs
Subscribers: christof, dexonsmith, libcxx-commits
Tags: #libc
Differential Revision: https://reviews.llvm.org/D72847
Jonas Devlieghere [Fri, 17 Jan 2020 22:17:00 +0000 (14:17 -0800)]
[lldb/Docs] Fix formatting for the variable formatting page
Nicolas Vasilache [Fri, 17 Jan 2020 19:26:50 +0000 (14:26 -0500)]
[mlir][Linalg] Extend linalg vectorization to MatmulOp
Summary:
This is a simple extension to allow vectorization to work not only on GenericLinalgOp
but more generally across named ops too.
For now, this still only vectorizes matmul-like ops but is a step towards more
generic vectorization of Linalg ops.
Reviewers: ftynse
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72942
Eric Fiselier [Fri, 17 Jan 2020 21:53:47 +0000 (16:53 -0500)]
[libc++] Optimize / partially inline basic_string copy constructor
Splits copy constructor up inlining short initialization, outlining long
initialization into __init_long() which is the externally instantiated slow
path initialization.
Subsequently changing the copy ctor to be inlined (not externally instantiated)
provides significant speed ups for short string initialization.
Generated code given:
void StringCopyCtor(void* mem, const std::string& s) {
std::string*p = new(mem) std::string{s};
}
asm:
cmp byte ptr [rsi + 23], 0
js .LBB0_2
mov rax, qword ptr [rsi + 16]
mov qword ptr [rdi + 16], rax
movups xmm0, xmmword ptr [rsi]
movups xmmword ptr [rdi], xmm0
ret
.LBB0_2:
jmp std::basic_string::__init_long # TAILCALL
Benchmark:
BM_StringCopy_Empty 5.19ns ± 6% 1.50ns ± 8% -71.02% (p=0.000 n=10+10)
BM_StringCopy_Small 5.14ns ± 8% 1.53ns ± 7% -70.17% (p=0.000 n=10+10)
BM_StringCopy_Large 18.9ns ± 0% 19.3ns ± 0% +1.92% (p=0.000 n=10+10)
BM_StringCopy_Huge 309ns ± 1% 316ns ± 5% ~ (p=0.633 n=8+10)
Patch from Martijn Vels (mvels@google.com)
Reviewed as D72160.
Peter Collingbourne [Fri, 17 Jan 2020 17:49:40 +0000 (09:49 -0800)]
hwasan: Move .note.hwasan.globals note to hwasan.module_ctor comdat.
As of D70146 lld GCs comdats as a group and no longer considers notes in
comdats to be GC roots, so we need to move the note to a comdat with a GC root
section (.init_array) in order to prevent lld from discarding the note.
Differential Revision: https://reviews.llvm.org/D72936
Sanjay Patel [Fri, 17 Jan 2020 21:26:24 +0000 (16:26 -0500)]
[InstSimplify] add test for select of vector constants; NFC
Sanjay Patel [Fri, 17 Jan 2020 16:57:50 +0000 (11:57 -0500)]
[InstSimplify] add test for select of FP constants; NFC
aartbik [Fri, 17 Jan 2020 21:11:56 +0000 (13:11 -0800)]
[mlir] [VectorOps] Rename Utils.h into VectorUtils.h
Summary:
First step towards the consolidation
of a lot of vector related utilities
that are now all over the place
(or even duplicated).
Reviewers: nicolasvasilache, andydavis1
Reviewed By: nicolasvasilache, andydavis1
Subscribers: merge_guards_bot, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72955
Adrian Prantl [Fri, 17 Jan 2020 21:34:46 +0000 (13:34 -0800)]
Pass length of string in Go binding of CreateCompileUnit
Ian Levesque [Fri, 17 Jan 2020 21:24:27 +0000 (13:24 -0800)]
[xray] Allow instrumenting only function entry and/or only function exit
Extend -fxray-instrumentation-bundle to split function-entry and
function-exit into two separate options, so that it is possible to
instrument only function entry or only function exit. For use cases
that only care about one or the other this will save significant overhead
and code size.
Differential Revision: https://reviews.llvm.org/D72890
Ian Levesque [Fri, 17 Jan 2020 21:24:16 +0000 (13:24 -0800)]
[clang][xray] Add -fxray-ignore-loops option
XRay allows tuning by minimum function size, but also always instruments
functions with loops in them. If the minimum function size is set to a
large value the loop instrumention ends up causing most functions to be
instrumented anyway. This adds a new flag, -fxray-ignore-loops, to disable
the loop detection logic.
Differential Revision: https://reviews.llvm.org/D72873
Ian Levesque [Fri, 17 Jan 2020 21:24:07 +0000 (13:24 -0800)]
[xray] Add xray-ignore-loops option
XRay allows tuning by minimum function size, but also always instruments
functions with loops in them. If the minimum function size is set to a
large value the loop instrumention ends up causing most functions to be
instrumented anyway. This adds a new flag, xray-ignore-loops, to disable
the loop detection logic.
Differential Revision: https://reviews.llvm.org/D72659
Eric Astor [Fri, 17 Jan 2020 20:15:53 +0000 (15:15 -0500)]
[ms] [llvm-ml] Add placeholder for llvm-ml, based on llvm-mc
Summary:
As discussed on the mailing list, I plan to introduce an ml-compatible MASM assembler as part of providing more of the Windows build tools. This will be similar to llvm-mc, but with different command-line parameters.
This placeholder is purely a stripped-down version of llvm-mc; we'll eventually add support for the Microsoft-style command-line flags, and back it with a MASM parser.
Reviewers: rnk, thakis
Reviewed By: thakis
Subscribers: merge_guards_bot, mgorny, jfb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72679
Vedant Kumar [Fri, 17 Jan 2020 21:06:17 +0000 (13:06 -0800)]
debugserver: Pass -arch flags to mig invocation as needed
Specify -isysroot and any necessary -arch flags in the `mig` invocation
when CMAKE_OSX_ARCHITECTURES is set (needed for the bridgeOS build).
Fangrui Song [Fri, 17 Jan 2020 19:50:00 +0000 (11:50 -0800)]
[ELF] Allow R_PLT_PC (R_PC) to a hidden undefined weak symbol
This essentially reverts
b841e119d77ed0502e3a2e710f26a899bef28b3c.
Such code construct can be used in the following way:
// glibc/stdlib/exit.c
// clang -fuse-ld=lld => succeeded
// clang -fuse-ld=lld -fpie -pie => relocation R_PLT_PC cannot refer to absolute symbol
__attribute__((weak, visibility("hidden"))) extern void __call_tls_dtors();
void __run_exit_handlers() {
if (__call_tls_dtors)
__call_tls_dtors();
}
Since we allow R_PLT_PC in -no-pie mode, it makes sense to allow it in
-pie mode as well.
Reviewed By: pcc
Differential Revision: https://reviews.llvm.org/D72943
Adrian Prantl [Tue, 14 Jan 2020 21:37:04 +0000 (13:37 -0800)]
Move the sysroot attribute from DIModule to DICompileUnit
[this re-applies
c0176916a4824812d25a5a22c4ff7c95857b0cd6
with the correct commit message and phabricator link]
This addresses point 1 of PR44213.
https://bugs.llvm.org/show_bug.cgi?id=44213
The DW_AT_LLVM_sysroot attribute is used for Clang module debug info,
to allow LLDB to import a Clang module from source. Currently it is
part of each DW_TAG_module, however, it is the same for all modules in
a compile unit. It is more efficient and less ambiguous to store it
once in the DW_TAG_compile_unit.
This should have no effect on DWARF consumers other than LLDB.
Differential Revision: https://reviews.llvm.org/D71732
Adrian Prantl [Fri, 17 Jan 2020 20:52:36 +0000 (12:52 -0800)]
Revert "Rename DW_AT_LLVM_isysroot to DW_AT_LLVM_sysroot"
This reverts commit
12e479475a896f664fb721f98c2d6805185ac352.
I accidentally landed this patch with the wrong commit message ...
Adrian Prantl [Fri, 17 Jan 2020 20:52:25 +0000 (12:52 -0800)]
Revert "Attempt to fix Go syntax error"
This reverts commit
c0176916a4824812d25a5a22c4ff7c95857b0cd6.
Adrian Prantl [Fri, 17 Jan 2020 20:37:15 +0000 (12:37 -0800)]
Attempt to fix Go syntax error
Frank Laub [Fri, 17 Jan 2020 20:09:53 +0000 (21:09 +0100)]
[MLIR] LLVM dialect: Add llvm.atomicrmw
Summary:
This op is the counterpart to LLVM's atomicrmw instruction. Note that
volatile and syncscope attributes are not yet supported.
This will be useful for upcoming parallel versions of `affine.for` and generally
for reduction-like semantics.
Differential Revision: https://reviews.llvm.org/D72741
Eric Schweitz [Fri, 17 Jan 2020 20:07:58 +0000 (21:07 +0100)]
[Flang][mlir] add a band-aid to support the creation of mutually recursive types when lowering to LLVM IR
Summary:
This is a temporary implementation to support Flang. The LLVM-IR parser
will need to be extended in some way to support recursive types. The
exact approach here is still a work-in-progress.
Unfortunately, this won't pass roundtrip testing yet. Adding a comment
to the test file as a reminder.
Differential Revision: https://reviews.llvm.org/D72542
Marco Vanotti [Fri, 17 Jan 2020 01:20:20 +0000 (17:20 -0800)]
[libFuzzer] Allow discarding output in ExecuteCommand in Fuchsia.
Summary:
This commit modifies the way `ExecuteCommand` works in fuchsia by adding
special logic to handle `/dev/null`.
The FuzzerCommand interface does not have a way to "discard" the output,
so other parts of the code just set the output file to `getDevNull()`.
The problem is that fuchsia does not have a named file that is
equivalent to `/dev/null`, so opening that file just fails.
This commit detects whether the specified output file is `getDevNull`,
and if that's the case, it will not copy the file descriptor for stdout
in the spawned process.
NOTE that modifying `FuzzerCommand` to add a "discardOutput" function
involves a significant refactor of all the other platforms, as they all
rely on the `toString()` method of `FuzzerCommand`.
This allows libfuzzer in fuchsia to run with `fork=1`, as the merge
process (`FuzzerMerge.cpp`) invoked `ExecuteCommand` with `/dev/null` as the
output.
Reviewers: aarongreen, phosek
Reviewed By: aarongreen
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D72894
Eli Friedman [Fri, 17 Jan 2020 20:13:49 +0000 (12:13 -0800)]
Revert "[SVE] Pass Scalable argument to VectorType::get in Bitcode Reader"
This reverts commit
5df53a22592729e631c4030f38c599b9f37095b7.
Caused test failures.
Lei Zhang [Fri, 17 Jan 2020 19:53:51 +0000 (14:53 -0500)]
[mlir][spirv] Explicitly construct ArrayRef from static array
Again for pleasing GCC 5.
Christopher Tetreault [Fri, 17 Jan 2020 19:32:52 +0000 (11:32 -0800)]
[SVE] Pass Scalable argument to VectorType::get in Bitcode Reader
Summary:
* Pass the Scalability test to VectorType::get in order to be
able to deserialize bitcode that contains scalable vector operations
Change-Id: I37fe5b1c0c237a9153130deefdc1a6d595c7f12e
Reviewers: efriedma, pcc, sdesmalen, apazos, huihuiz, chrisj
Reviewed By: sdesmalen
Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72792
Alexey Bataev [Fri, 17 Jan 2020 19:05:40 +0000 (14:05 -0500)]
[OPENMP]Improve debug locations in OpenMP regions.
Emit more precise debug locations for the OpenMP outlined regions.
Mike Lambert [Fri, 17 Jan 2020 19:13:28 +0000 (13:13 -0600)]
[Hexagon] Use itinerary for assembler HVX resource checking
Alina Sbirlea [Fri, 17 Jan 2020 19:08:33 +0000 (11:08 -0800)]
Update clang test.
Adrian Prantl [Fri, 17 Jan 2020 18:58:33 +0000 (10:58 -0800)]
Update testcase for LLVM IR change (sysroot)
Davide Italiano [Fri, 17 Jan 2020 18:57:35 +0000 (10:57 -0800)]
[TestQuoting] Use the fully qualified path for remote platforms.
Patch by Jason Molenda, fixes a test failure on arm64 devices.
Alina Sbirlea [Wed, 15 Jan 2020 22:30:21 +0000 (14:30 -0800)]
[UnitTests] Add invalidate methods.
Alina Sbirlea [Wed, 15 Jan 2020 22:07:58 +0000 (14:07 -0800)]
[LazyCallGraph] Add invalidate method.
Summary: Add invalidate method in LazyCallGraph.
Reviewers: chandlerc, silvas
Subscribers: hiraditya, sanjoy.google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72817
Alina Sbirlea [Wed, 15 Jan 2020 22:05:56 +0000 (14:05 -0800)]
[CallGraph] Add invalidate method.
Summary: Add invalidate method in CallGraph.
Reviewers: Eugene.Zelenko, chandlerc
Subscribers: hiraditya, sanjoy.google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72816
Alina Sbirlea [Wed, 15 Jan 2020 22:02:33 +0000 (14:02 -0800)]
[BrachProbablityInfo] Add invalidate method.
Summary: Add invalidate method for BrachProbablityInfo.
Reviewers: Eugene.Zelenko, chandlerc
Subscribers: hiraditya, sanjoy.google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72815
Stanislav Mekhanoshin [Thu, 16 Jan 2020 20:43:22 +0000 (12:43 -0800)]
[AMDGPU] allow multi-dword flat scratch access since GFX9
This is supported starting with GFX9.
Differential Revision: https://reviews.llvm.org/D72865
Lei Zhang [Fri, 17 Jan 2020 18:44:37 +0000 (13:44 -0500)]
[mlir][spirv] Explicitly construct ArrayRef from array
Hopefully this pleases GCC 5.
Krzysztof Parzyszek [Fri, 17 Jan 2020 18:32:28 +0000 (12:32 -0600)]
[Hexagon] Move testcase from
c1873631d0a8f2acc to proper location
Alina Sbirlea [Wed, 15 Jan 2020 22:10:37 +0000 (14:10 -0800)]
[GlobalsModRef] Add invalidate method
Summary: Add invalidate method to GlobalsAA.
Reviewers: tejohnson, chandlerc
Subscribers: hiraditya, sanjoy.google, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72818
Fangrui Song [Fri, 17 Jan 2020 18:30:54 +0000 (10:30 -0800)]
[InterfaceStubs][test] Add -triple to clang/test/InterfaceStubs/externstatic.c to make it robust
llvm-nm on Linux prints 0 line while llvm-nm on macOS prints 1 line.
Brian Cain [Fri, 17 Jan 2020 18:18:59 +0000 (12:18 -0600)]
[Hexagon] Refactor HexagonShuffle
The check() in HexagonShuffle has been decomposed into smaller steps.
No functionality change is intended with this commit.
River Riddle [Fri, 17 Jan 2020 07:56:34 +0000 (23:56 -0800)]
[mlir] Replace AbstractOperation::classof with a ClassID instance.
Summary: This field is currently not used by anything, and using a ClassID instance provides better support for more efficient classof.
Reviewers: mehdi_amini, nicolasvasilache
Reviewed By: mehdi_amini
Subscribers: merge_guards_bot, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72822
Fangrui Song [Fri, 17 Jan 2020 18:13:09 +0000 (10:13 -0800)]
[test] Fix test/ELF/lto/thinlto-obj-path.ll after D52810
Sanne Wouda [Fri, 13 Dec 2019 14:45:46 +0000 (14:45 +0000)]
[clang] Set function attributes on SEH filter functions correctly.
Summary:
When compiling with -munwind-tables, the SEH filter funclet needs the uwtable
function attribute, which gets automatically added if we use
SetInternalFunctionAttributes. The filter funclet is internal so this seems
appropriate.
Reviewers: rnk
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72786
Fangrui Song [Fri, 17 Jan 2020 18:04:00 +0000 (10:04 -0800)]
Reland "[llvm-nm] Don't report "no symbols" error for files that contain symbols"
Fangrui Song [Fri, 17 Jan 2020 18:00:17 +0000 (10:00 -0800)]
[test] Fix tests after D52810
Sam Clegg [Fri, 17 Jan 2020 17:55:18 +0000 (09:55 -0800)]
Revert "[llvm-nm] Don't report "no symbols" error for files that contain symbols"
This reverts commit
ab974161ba699534f3e30b1f4b036eec9c33053c.
This change broke several tests, and the pre-commit bot even warning
me that it would. Doh!
Francis Visoiu Mistrih [Fri, 17 Jan 2020 17:36:26 +0000 (09:36 -0800)]
[perf-training] Ignore ' (in-process)' prefix from -###
After D69825, the output of clang -### when running in process can be
prefixed by ' (in-process)'. Skip it.
Adrian Prantl [Tue, 14 Jan 2020 21:37:04 +0000 (13:37 -0800)]
Rename DW_AT_LLVM_isysroot to DW_AT_LLVM_sysroot
This is a purely cosmetic change that is NFC in terms of the binary
output. I bugs me that I called the attribute DW_AT_LLVM_isysroot
since the "i" is an artifact of GCC command line option syntax
(-isysroot is in the category of -i options) and doesn't carry any
useful information otherwise.
This attribute only appears in Clang module debug info.
Differential Revision: https://reviews.llvm.org/D71722
Lei Zhang [Fri, 17 Jan 2020 17:26:42 +0000 (12:26 -0500)]
[mlir][spirv] Explicitly set the size of static arrays
Sam Clegg [Mon, 13 Jan 2020 23:13:31 +0000 (15:13 -0800)]
[llvm-nm] Don't report "no symbols" error for files that contain symbols
Previously we were reporting this error if we were list no symbols
which is not the same thing as the file containing no symbols.
Also, always report the filename when printing errors.
This matches the GNU nm behaviour.
This a followup to https://reviews.llvm.org/D52810
Differential Revision: https://reviews.llvm.org/D72658
Drew Wock [Wed, 15 Jan 2020 17:51:42 +0000 (12:51 -0500)]
[SeparateConstOffsetFromGEP] Fix: sext(a) + sext(b) -> sext(a + b) matches add and sub instructions with one another
During the SeparateConstOffsetFromGEP pass, signed extensions are distributed
to the values that feed into them and then later recombined. The recombination
stage is somewhat problematic- it doesn't differ add and sub instructions
from another when matching the sext(a) +/- sext(b) -> sext(a +/- b) pattern
in some instances.
An example- the IR contains:
%unextendedA
%unextendedB
%subuAuB = unextendedA - unextendedB
%extA = extend A
%extB = extend B
%
addeAeB = extA + extB
The problematic optimization will transform that into:
%unextendedA
%unextendedB
%subuAuB = unextendedA - unextendedB
%extA = extend A
%extB = extend B
%
addeAeB = extend subuAuB ; Obviously not semantically equivalent to the IR input.
This patch fixes that.
Patch by Drew Wock <drew.wock@sas.com>
Differential Revision: https://reviews.llvm.org/D65967
Alex Zinenko [Fri, 17 Jan 2020 17:16:07 +0000 (18:16 +0100)]
[mlir] Generator converting LLVM intrinsics defs to MLIR ODS
Introduce a new generator for MLIR tablegen driver that consumes LLVM IR
intrinsic definitions and produces MLIR ODS definitions. This is useful to
bulk-generate MLIR operations equivalent to existing LLVM IR intrinsics, such
as additional arithmetic instructions or NVVM.
A test exercising the generation is also added. It reads the main LLVM
intrinsics file and produces ODS to make sure the TableGen model remains in
sync with what is used in LLVM.
Differential Revision: https://reviews.llvm.org/D72926
Yitzhak Mandelbaum [Mon, 6 Jan 2020 16:00:44 +0000 (11:00 -0500)]
[libTooling] Fix bug in Stencil handling of macro ranges
Summary: Currently, an attempt to rewrite source code inside a macro expansion succeeds, but results in empty text, rather than failing with an error. This patch restructures to the code to explicitly validate ranges before attempting to edit them.
Reviewers: gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72274
Nikita Popov [Wed, 15 Jan 2020 21:24:15 +0000 (22:24 +0100)]
[InstCombine] Fix worklist management in DSE (PR44552)
Fixes https://bugs.llvm.org/show_bug.cgi?id=44552. We need to make
sure that the store is reprocessed, because performing DSE may
expose more DSE opportunities.
There is a slight caveat here though: We need to make sure that we
add back the store the worklist first, because that means it will
be processed after the operands of the removed store have been
processed. This is a general bug in InstCombine worklist management
that I hope to address at some point, but for now it means we need
to do this manually rather than just returning the instruction as
changed.
Differential Revision: https://reviews.llvm.org/D72807
Andy Davis [Fri, 17 Jan 2020 17:06:57 +0000 (12:06 -0500)]
[VectorOps] Update vector transfer read op comments.
Summary: Update vector transfer read op comments.
Reviewers: nicolasvasilache, aartbik
Reviewed By: nicolasvasilache, aartbik
Subscribers: merge_guards_bot, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72731
Denis Khalikov [Fri, 17 Jan 2020 16:52:06 +0000 (11:52 -0500)]
[mlir][spirv] Add lowering from `loop.if` to `spv.selection`
When lowering `loop.if` to `spv.selection` we explicitly create
a selection header block before the control flow diverges and a
merge block where control flow subsequently converges.
Differential Revision: https://reviews.llvm.org/D72836
Alex Zinenko [Fri, 17 Jan 2020 17:01:05 +0000 (18:01 +0100)]
[mlir] Improve documentation in ModuleTranslation MLIR to LLVM IR
Several functions were missing documentation.
Nikita Popov [Thu, 16 Jan 2020 20:38:19 +0000 (21:38 +0100)]
[InstCombine] Fix worklist management in return combine
There are two related bugs here: First, we don't add the operand
we're replacing to the worklist, which means it may not get DCEd
(see test change). Second, usually this would just get picked up
in the next iteration, but we also do not report the instruction
as changed. This means that we do not get that extra instcombine
iteration, and more importantly, may break the pass pipeline, as
the function is not marked as changed.
Differential Revision: https://reviews.llvm.org/D72864
Nikita Popov [Thu, 16 Jan 2020 20:33:04 +0000 (21:33 +0100)]
[InstCombine] Split assume test in expensive and not; NFC
The IR difference in @icmp1 serves as a test for D72864.
Nikita Popov [Thu, 16 Jan 2020 20:03:09 +0000 (21:03 +0100)]
[InstCombine] Support disabling expensive combines in opt
Currently, there is no way to disable ExpensiveCombines when doing
a standalone opt -instcombine run, as that's the default, and the
opt option can currently only be used to force enable, not to force
disable. The only way to disable expensive combines is via -O1 or -O2,
but that of course also runs the rest of the kitchen sink...
This patch allows using opt -instcombine -expensive-combines=0 to
run InstCombine without ExpensiveCombines.
Differential Revision: https://reviews.llvm.org/D72861
Nikita Popov [Thu, 16 Jan 2020 20:02:48 +0000 (21:02 +0100)]
[InstCombine] Add test for -expensive-combines option; NFC
This shows that -expensive-combines=0 is ignored.
Lei Zhang [Fri, 17 Jan 2020 15:12:31 +0000 (10:12 -0500)]
[mlir][spirv] Add `const` qualifier for static arrays
This makes the local variable `implies` to have the correct
type to satisfy ArrayRef's constructor:
/*implicit*/ constexpr ArrayRef(const T (&Arr)[N])
Hopefully this should please GCC 5.
Differential Revision: https://reviews.llvm.org/D72924
Sam McCall [Fri, 17 Jan 2020 16:30:12 +0000 (17:30 +0100)]
[lldb] Try to fix writing outside temp dir from
4bafceced6a7641be7b090229c6ccef22cf55bff
David Spickett [Fri, 17 Jan 2020 14:45:56 +0000 (14:45 +0000)]
[AArch64] Make AArch64 specific assembly directives case insensitive
Differential Revision: https://reviews.llvm.org/D72923
Dmitri Gribenko [Fri, 17 Jan 2020 16:02:59 +0000 (17:02 +0100)]
Renamed traverseDecl to TraverseDecl in a test
RecursiveASTVisitor expects TraverseDecl to be implemented by
subclasses.
Gabor Horvath [Wed, 8 Jan 2020 01:48:49 +0000 (17:48 -0800)]
[DataFlow] Factor two worklist implementations out
Right now every dataflow algorithm uses its own worklist implementation.
This is a first step to reduce this duplication. Some upcoming
algorithms such as the lifetime analysis is going to use the factored
out implementations.
Differential Revision: https://reviews.llvm.org/D72380
Matt Arsenault [Thu, 16 Jan 2020 20:44:36 +0000 (15:44 -0500)]
AMDGPU: Don't assert on a16 images on targets without FeatureR128A16
Currently the lowering for i16 image coordinates asserts on gfx10. I'm
somewhat confused by this though. The feature is missing from the
gfx10 feature lists, but the a16 bit appears to be present in the
manual for MIMG instructions.
Simon Pilgrim [Fri, 17 Jan 2020 16:04:10 +0000 (16:04 +0000)]
Revert rGb6437b352db9 - "Fix gcc9 "moving a local object in a return statement prevents copy elision" Wpessimizing-move warnings."
Fix buildbots
Simon Pilgrim [Fri, 17 Jan 2020 16:03:21 +0000 (16:03 +0000)]
Revert rGff3fe145fe48 "Fix gcc9 "moving a local object in a return statement prevents copy elision" Wpessimizing-move warning."
Fix buildbots
Simon Pilgrim [Fri, 17 Jan 2020 15:50:53 +0000 (15:50 +0000)]
Fix gcc9 "moving a local object in a return statement prevents copy elision" Wpessimizing-move warning.
Simon Pilgrim [Fri, 17 Jan 2020 15:32:44 +0000 (15:32 +0000)]
Fix gcc9 "moving a local object in a return statement prevents copy elision" Wpessimizing-move warnings.
Sanjay Patel [Fri, 17 Jan 2020 15:20:25 +0000 (10:20 -0500)]
[x86] try harder to form 256-bit unpck*
This is another part of a problem noted in PR42024:
https://bugs.llvm.org/show_bug.cgi?id=42024
The AVX2 code may use awkward 256-bit shuffles vs. the AVX code that gets split
into the expected 128-bit unpack instructions. We have to be selective in
matching the types where we try to do this though. Otherwise, we can end up
with more instructions (in the case of v8x32/v4x64).
Differential Revision: https://reviews.llvm.org/D72575
Krzysztof Parzyszek [Fri, 17 Jan 2020 15:40:26 +0000 (09:40 -0600)]
[Hexagon] Improve HVX version checks
Krzysztof Parzyszek [Fri, 17 Jan 2020 15:17:38 +0000 (09:17 -0600)]
[Hexagon] Add prev65 subtarget feature
There was a change to trap1 instruction between v62 and v65. This
feature will allow the assembler/disassembler to handle different
variants depending on the CPU version.
Aaron Ballman [Fri, 17 Jan 2020 15:23:45 +0000 (10:23 -0500)]
Another speculative fix for the Windows bots.
Hopefully fixes: http://45.33.8.238/win/6040/step_4.txt
Aaron Ballman [Fri, 17 Jan 2020 14:49:32 +0000 (09:49 -0500)]
Fix a compile error to get bots back to green.
Fixes http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/13716
Nathan [Tue, 31 Dec 2019 09:57:16 +0000 (09:57 +0000)]
[clang-tidy] Disable Checks on If constexpr statements in template Instantiations for BugproneBranchClone and ReadabilityBracesAroundStatements
Summary: fixes [[ https://bugs.llvm.org/show_bug.cgi?id=32203 | readability-braces-around-statements broken for if constexpr]] and [[ https://bugs.llvm.org/show_bug.cgi?id=44229 | bugprone-branch-clone false positive with template functions and constexpr ]] by disabling the relevant checks on if constexpr statements while inside an instantiated template. This is due to how the else branch of an if constexpr statement is folded away to a null statement if the condition evaluates to false
Reviewers: alexfh, hokein, aaron.ballman, xazax.hun
Reviewed By: aaron.ballman, xazax.hun
Subscribers: rnkovacs, JonasToth, Jim, lebedev.ri, xazax.hun, cfe-commits
Tags: #clang-tools-extra, #clang
Differential Revision: https://reviews.llvm.org/D71980
Simon Pilgrim [Fri, 17 Jan 2020 13:23:53 +0000 (13:23 +0000)]
[X86] Split X87/SSE compare classes into WriteFCom + WriteFComX
Most X87 compare instructions write to the X87 status word, while the SSE (U)COMI compares write to rFLAGS. These are often handled very differently on CPUs (e.g. rFLAGS outputs typically involve a fpu2gpr transfer), and we shouldn't be grouping all these instructions behind a single class - so this patch splits off the SSE compares into a new WriteFComX class (and currently keeps the same behaviours). If there's a need to distinguish between X87 instructions more closely we can investigate that in the future, but as we don't handle any of the X87 side effects at the moment its unlikely to have any notable effect.
Simon Pilgrim [Fri, 17 Jan 2020 12:10:17 +0000 (12:10 +0000)]
[SelectionDAG] ComputeKnownBits - assert we're computing the 0'th (difference) result for the SUB/SUBC cases
Matches what we already do for the ADD/ADDC/ADDE case.
LLVM GN Syncbot [Fri, 17 Jan 2020 13:44:44 +0000 (13:44 +0000)]
[gn build] Port
42a0355816d
Logan Smith [Fri, 17 Jan 2020 13:43:20 +0000 (08:43 -0500)]
Add `bugprone-reserved-identifier`
This patch adds bugprone-reserved-identifier, which flags uses of __names _Like
::_this, which are reserved for the implementation. The check can optionally be
inverted, i.e. configured to flag any names that are _not_ reserved, which may
be useful for e.g. standard library implementors.
Sanjay Patel [Fri, 17 Jan 2020 13:31:16 +0000 (08:31 -0500)]
[IR] fix Constant::isElementWiseEqual() to allow for all undef elements compare
We could argue that match() should be more flexible here,
but I'm not sure what impact that would have on existing code.
Sanjay Patel [Fri, 17 Jan 2020 13:25:15 +0000 (08:25 -0500)]
[IR] add unit test for Constant::isElementWiseEqual() for undef corner case; NFC
Sam Parker [Fri, 17 Jan 2020 13:08:24 +0000 (13:08 +0000)]
[ARM][MVE] Tail Predicate IsSafeToRemove
Introduce a method to walk through use-def chains to decide whether
it's possible to remove a given instruction and its users. These
instructions are then stored in a set until the end of the transform
when they're erased. This is now used to perform checks on the
iteration count (LoopDec chain), element count (VCTP chain) and the
possibly redundant iteration count.
As well as being able to remove chains of instructions, we know also
check that the sub feeding the vctp is producing the expected value.
Differential Revision: https://reviews.llvm.org/D71837
Lei Zhang [Thu, 26 Dec 2019 17:15:26 +0000 (12:15 -0500)]
[mlir][spirv] Support implied extensions and capabilities
In SPIR-V, when a new version is introduced, it is possible some
existing extensions will be incorporated into it so that it becomes
implicitly declared if targeting the new version. This affects
conversion target specification because we need to take this into
account when allowing what extensions to use.
For a capability, it may also implies some other capabilities,
for example, the `Shader` capability implies `Matrix` the capability.
This should also be taken into consideration when preparing the
conversion target: when we specify an capability is allowed, all
its recursively implied capabilities are also allowed.
This commit adds utility functions to query implied extensions for
a given version and implied capabilities for a given capability
and updated SPIRVConversionTarget to use them.
This commit also fixes a bug in availability spec. When a symbol
(op or enum case) can be enabled by an extension, we should drop
it's minimal version requirement. Being enabled by an extension
naturally means the symbol can be used by *any* SPIR-V version
as long as the extension is supported. The grammar still encodes
the 'version' field for such cases, but it should be interpreted
as a different way: rather than meaning a minimal version
requirement, it says the symbol becomes core at that specific
version.
Differential Revision: https://reviews.llvm.org/D72765
Lei Zhang [Fri, 17 Jan 2020 12:39:45 +0000 (07:39 -0500)]
Revert "[mlir][ods] Support dialect specific content emission via hooks"
This reverts commit
397215cc309df1171a198b11cab3b241db9441db because
this feature needs more discussion.
Fedor Sergeev [Fri, 17 Jan 2020 12:38:54 +0000 (15:38 +0300)]
[BasicBlock] fix looping in getPostdominatingDeoptimizeCall
Blindly following unique-successors chain appeared to be a bad idea.
In a degenerate case when block jumps to itself that goes into endless loop.
Discovered this problem when playing with additional changes,
managed to reproduce it on existing LoopPredication code.
Fix by checking a "visited" set while iterating through unique successors.
Reviewed By: skatkov
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72908
Martin Probst [Fri, 17 Jan 2020 09:44:10 +0000 (10:44 +0100)]
clang-format: [JS] pragmas for tslint, tsc.
Summary:
tslint and tsc (the TypeScript compiler itself) use comment pragmas of
the style:
// tslint:disable-next-line:foo
// @ts-ignore
These must not be wrapped and must stay on their own line, in isolation.
For tslint, this required adding it to the pragma regexp. The comments
starting with `@` are already left alone, but this change adds test
coverage for them.
Reviewers: krasimir
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72907
Krasimir Georgiev [Fri, 17 Jan 2020 12:26:24 +0000 (13:26 +0100)]
clang-format: fix spacing in `operator const char*()`
Summary:
Revision
a75f8d98d7ac9e557b238a229a9a2647c71feed1 fixed spacing for operators,
but caused the const and non-const versions to diverge:
```
// With Style.PointerAlignment = FormatStyle::PAS_Left:
struct A {
operator char*() { return ""; }
operator const char *() const { return ""; }
};
```
The code was checking if the type specifier was directly preceded by `operator`.
However there could be comments and `const/volatile` in between.
Reviewers: mprobst
Reviewed By: mprobst
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72911
Miloš Stojanović [Thu, 16 Jan 2020 16:47:21 +0000 (17:47 +0100)]
[llvm-exegesis][mips] Add support for memory instructions
Implementing functions used to enable testing of memory instructions.
Differential Revision: https://reviews.llvm.org/D72858
Raphael Isemann [Fri, 17 Jan 2020 12:01:48 +0000 (13:01 +0100)]
[lldb] Remove out of order OperatingSystemPython::Terminate call in SystemInitializerFull
We already call it later in the method (which is in the right order as we Initialize it
at the of the constructor).
Raphael Isemann [Fri, 17 Jan 2020 11:31:15 +0000 (12:31 +0100)]
[lldb] Add missing terminate calls to Python/Lua subsystems
Cullen Rhodes [Wed, 8 Jan 2020 11:38:35 +0000 (11:38 +0000)]
[AArch64][SVE] Add break intrinsics
Summary:
Implements the following intrinsics:
* @llvm.aarch64.sve.brka
* @llvm.aarch64.sve.brka.z
* @llvm.aarch64.sve.brkb
* @llvm.aarch64.sve.brkb.z
* @llvm.aarch64.sve.brkn.z
* @llvm.aarch64.sve.brkpa.z
* @llvm.aarch64.sve.brkpb.z
Reviewers: sdesmalen, efriedma, dancgr, mgudim, cameron.mcinally, rengolin
Reviewed By: sdesmalen
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72393
Simon Pilgrim [Fri, 17 Jan 2020 11:37:58 +0000 (11:37 +0000)]
[SelectionDAG] Better ISD::ANY_EXTEND/ISD::ANY_EXTEND_VECTOR_INREG ComputeKnownBits support
Add DemandedElts handling to ISD::ANY_EXTEND and add missing ISD::ANY_EXTEND_VECTOR_INREG handling. Despite the lack of test changes this code IS being used - its just that the ANY_EXTEND ops are legalized later on (typically to ZERO_EXTEND equivalents) so we typically manage to combine later on.
Simon Pilgrim [Fri, 17 Jan 2020 11:21:23 +0000 (11:21 +0000)]
Fix Wparentheses warning. NFCI.
David Spickett [Tue, 14 Jan 2020 09:26:10 +0000 (09:26 +0000)]
[AsmParser] Make generic directives and aliases case insensitive.
GCC will accept any case for assembler directives.
For example ".abort" and ".ABORT" (even ".aBoRt")
are equivalent.
https://sourceware.org/binutils/docs/as/Pseudo-Ops.html#Pseudo-Ops
"The names are case insensitive for most targets,
and usually written in lower case."
Change llvm-mc to accept any case for generic directives
or aliases of those directives.
This for Bugzilla #39527.
Differential Revision: https://reviews.llvm.org/D72686