Juneyoung Lee [Sat, 29 Feb 2020 04:10:31 +0000 (13:10 +0900)]
[ValueTracking] A value is never undef or poison if it must raise UB
Summary:
This patch helps isGuaranteedNotToBeUndefOrPoison return true if the value
makes the program always undefined.
According to value tracking functions' comments, it is not still in consensus
whether a poison value can be bitwise or not, so conservatively only the case with
i1 is considered.
Reviewers: spatel, lebedev.ri, reames, nlopes, regehr
Reviewed By: nlopes
Subscribers: uenoku, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75396
Juneyoung Lee [Sat, 29 Feb 2020 05:58:07 +0000 (14:58 +0900)]
[GVN] Fold equivalent freeze instructions
Summary:
This patch defines two freeze instructions to have the same value number if they are equivalent.
This is allowed because GVN replaces all uses of a duplicated instruction with another.
If it partially rewrites use, it is not allowed. e.g)
```
a = freeze(x)
b = freeze(x)
use(a)
use(a)
use(b)
=>
use(a)
use(b) // This is not allowed!
use(b)
```
Reviewers: fhahn, reames, spatel, efriedma
Reviewed By: fhahn
Subscribers: lebedev.ri, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75398
Craig Topper [Sat, 29 Feb 2020 06:45:05 +0000 (22:45 -0800)]
[X86] Tighten up the SDTypeProfile for X86ISD::CVTNE2PS2BF16. NFCI
Reid Kleckner [Sat, 29 Feb 2020 18:23:54 +0000 (10:23 -0800)]
Avoid including FileSystem.h from MemoryBuffer.h
Lots of headers pass around MemoryBuffer objects, but very few open
them. Let those that do include FileSystem.h.
Saves ~250 includes of Chrono.h & FileSystem.h:
$ diff -u thedeps-before.txt thedeps-after.txt | grep '^[-+] ' | sort | uniq -c | sort -nr
254 - ../llvm/include/llvm/Support/FileSystem.h
253 - ../llvm/include/llvm/Support/Chrono.h
237 - ../llvm/include/llvm/Support/NativeFormatting.h
237 - ../llvm/include/llvm/Support/FormatProviders.h
192 - ../llvm/include/llvm/ADT/StringSwitch.h
190 - ../llvm/include/llvm/Support/FormatVariadicDetails.h
...
This requires duplicating the file_t typedef, which is unfortunate. I
sunk the choice of mapping mode down into the cpp file using variable
template specializations instead of class members in headers.
Stephen Neuendorffer [Sat, 29 Feb 2020 19:51:04 +0000 (11:51 -0800)]
Revert "[MLIR] Move from using target_link_libraries to LINK_LIBS for llvm libraries."
This reverts commit
7a6c68977114b91097d693e9cfcb636631f61f91.
This breaks the build with cmake 3.13.4, but succeeds with cmake 3.15.3
Stephen Neuendorffer [Sat, 29 Feb 2020 19:50:45 +0000 (11:50 -0800)]
Revert "[MLIR] Remove redundant library dependencies"
This reverts commit
c4c8fbde649af8359cbfcbb5cef90fbe195c16fc.
Stephen Neuendorffer [Sat, 29 Feb 2020 19:50:31 +0000 (11:50 -0800)]
Revert "[MLIR] Move from add_dependencies() to DEPENDS"
This reverts commit
31e07d716a083b85df226c31f6ba72bc477f58fc.
Simon Pilgrim [Sat, 29 Feb 2020 19:24:21 +0000 (19:24 +0000)]
Fix Wdocumentation warning - use tparam for template parameters. NFC.
Simon Pilgrim [Sat, 29 Feb 2020 19:22:40 +0000 (19:22 +0000)]
[MachineInst] Remove dead code. NFCI.
The MachineFunction MF value is not used any more and is always null.
Simon Pilgrim [Sat, 29 Feb 2020 19:11:00 +0000 (19:11 +0000)]
Make argument const to silence cppcheck warning. NFCI.
Stephen Neuendorffer [Sat, 29 Feb 2020 19:08:19 +0000 (11:08 -0800)]
Revert "[MLIR] Add support for libMLIR.so"
This reverts commit
e17d9c11d49ab42ec19620679e981bb6147a2856.
It breaks the build.
Stephen Neuendorffer [Sat, 29 Feb 2020 19:06:50 +0000 (11:06 -0800)]
Revert "[MLIR] Fixes for BUILD_SHARED_LIBS=on"
This reverts commit
777e97cc1a8c1fe44245bdcb4fd9386ae2b3cc9d.
Petr Hosek [Thu, 6 Feb 2020 23:24:07 +0000 (15:24 -0800)]
[CMake] Link against ZLIB::ZLIB
This is the imported target that find_package(ZLIB) defines.
Differential Revision: https://reviews.llvm.org/D74176
Petr Hosek [Thu, 6 Feb 2020 03:07:43 +0000 (19:07 -0800)]
[CMake] Use PUBLIC link mode for static libraries
Using INTERFACE prevents the use of imported libraries as we've done
in 00b3d49 because these aren't linked against the target, they're
only made part of the interface. This doesn't affect the output since
static libraries aren't being linked into, but it enables the use of
imported libraries.
Differential Revision: https://reviews.llvm.org/D74106
Simon Pilgrim [Sat, 29 Feb 2020 18:56:53 +0000 (18:56 +0000)]
[X86][F16C] Remove cvtph2ps intrinsics and use generic half2float conversion (PR37554)
This removes everything but int_x86_avx512_mask_vcvtph2ps_512 which provides the SAE variant, but even this can use the fpext generic if the rounding control is the default.
Differential Revision: https://reviews.llvm.org/D75162
Stephen Neuendorffer [Thu, 27 Feb 2020 22:53:12 +0000 (14:53 -0800)]
[MLIR] Fixes for BUILD_SHARED_LIBS=on
Differential Revision: https://reviews.llvm.org/D75308
Valentin Churavy [Sun, 9 Feb 2020 03:27:54 +0000 (19:27 -0800)]
[MLIR] Add support for libMLIR.so
Putting this up mainly for discussion on
how this should be done. I am interested in MLIR from
the Julia side and we currently have a strong preference
to dynamically linking against the LLVM shared library,
and would like to have a MLIR shared library.
This patch adds a new cmake function add_mlir_library()
which accumulates a list of targets to be compiled into
libMLIR.so. Note that not all libraries make sense to
be compiled into libMLIR.so. In particular, we want
to avoid libraries which primarily exist to support
certain tools (such as mlir-opt and mlir-cpu-runner).
Note that the resulting libMLIR.so depends on LLVM, but
does not contain any LLVM components. As a result, it
is necessary to link with libLLVM.so to avoid linkage
errors. So, libMLIR.so requires LLVM_BUILD_LLVM_DYLIB=on
FYI, Currently it appears that LLVM_LINK_LLVM_DYLIB is broken
because mlir-tblgen is linked against libLLVM.so and
and independent LLVM components.
Previous version of this patch broke depencies on TableGen
targets. This appears to be because it compiled all
libraries to OBJECT libraries (probably because cmake
is generating different target names). Avoiding object
libraries results in correct dependencies.
(updated by Stephen Neuendorffer)
Differential Revision: https://reviews.llvm.org/D73130
Stephen Neuendorffer [Thu, 20 Feb 2020 18:48:51 +0000 (10:48 -0800)]
[MLIR] Move from add_dependencies() to DEPENDS
add_llvm_library and add_llvm_executable may need to create new targets with
appropriate dependencies. As a result, it is not sufficient in some
configurations (namely LLVM_BUILD_LLVM_DYLIB=on) to only call
add_dependencies(). Instead, the explicit TableGen dependencies must
be passed to add_llvm_library() or add_llvm_executable() using the DEPENDS
keyword.
Differential Revision: https://reviews.llvm.org/D74930
Stephen Neuendorffer [Thu, 20 Feb 2020 06:56:38 +0000 (22:56 -0800)]
[MLIR] Remove redundant library dependencies
In cmake, it is redundant to have a target list under target_link_libraries()
and add_dependency(). This patch removes the redundant dependency from
add_dependency().
Differential Revision: https://reviews.llvm.org/D74929
Stephen Neuendorffer [Tue, 18 Feb 2020 23:07:35 +0000 (15:07 -0800)]
[MLIR] Move from using target_link_libraries to LINK_LIBS for llvm libraries.
When compiling libLLVM.so, add_llvm_library() manipulates the link libraries
being used. This means that when using add_llvm_library(), we need to pass
the list of libraries to be linked (using the LINK_LIBS keyword) instead of
using the standard target_link_libraries call. This is preparation for
properly dealing with creating libMLIR.so as well.
Differential Revision: https://reviews.llvm.org/D74864
Mehdi Amini [Sat, 29 Feb 2020 06:04:38 +0000 (06:04 +0000)]
Ensure that multi-threading is disabled when enabling IRPrinting with module scope
This is avoid the user to shoot themselves in the foot and encounter
strange crashes that are confusing until one run with TSAN.
Differential Revision: https://reviews.llvm.org/D75399
Fangrui Song [Sat, 29 Feb 2020 16:25:22 +0000 (08:25 -0800)]
[MC] Add MCStreamer::emitInt{8,16,32,64}
Similar to AsmPrinter::emitInt{8,16,32,64}.
Aaron Puchert [Sat, 29 Feb 2020 13:22:41 +0000 (14:22 +0100)]
Remove unused parameter from CXXRecordDecl::forallBases [NFC]
Summary:
Apparently all users of the function were fine with short-circuiting
and none cared to override the default argument.
Reviewers: aaron.ballman, rsmith
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75319
Sanjay Patel [Fri, 28 Feb 2020 22:49:22 +0000 (17:49 -0500)]
[PassManager] add tests for vector pass enabling; NFC
Stefan Gränitz [Sat, 29 Feb 2020 11:52:19 +0000 (11:52 +0000)]
[ExecutionEngine] Add JITSymbolFlags::fromSummary(GlobalValueSummary*)
Summary: A function that creates JITSymbolFlags from a GlobalValueSummary. Similar functions exist: fromGlobalValue(), fromObjectSymbol()
Reviewers: lhames
Reviewed By: lhames
Subscribers: hiraditya, steven_wu, dexonsmith, arphaman, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75082
Stefanos Baziotis [Sat, 29 Feb 2020 09:53:11 +0000 (11:53 +0200)]
First test commit - empty
Georgii Rymar [Fri, 14 Feb 2020 09:47:52 +0000 (12:47 +0300)]
[llvm-readobj] - Report warnings instead of errors for broken relocations.
This is a follow-up for https://reviews.llvm.org/D74545.
It adds test cases for each incorrect case returned in `getRelocationTarget`.
Differential revision: https://reviews.llvm.org/D74595
Benjamin Kramer [Sat, 29 Feb 2020 08:50:23 +0000 (09:50 +0100)]
ArrayRef'ize restoreCalleeSavedRegisters. NFCI.
restoreCalleeSavedRegisters can mutate the contents of the
CalleeSavedInfos, so use a MutableArrayRef.
Siva Chandra Reddy [Thu, 27 Feb 2020 22:30:24 +0000 (14:30 -0800)]
[libc] Add ability to generate enum types/values to HdrGen.
A target to generate the std C threads.h file has been added. This
utilizes the new feature added in this change.
Reviewers: phosek
Differential Revision: https://reviews.llvm.org/D75379
Shengchen Kan [Fri, 28 Feb 2020 14:27:53 +0000 (22:27 +0800)]
[X86] Move the function getOrCreateBoundaryAlignFragment
MCObjectStreamer is more suitable to create fragments than
X86AsmBackend, for example, the function getOrCreateDataFragment is
defined in MCObjectStreamer.
Differential Revision: https://reviews.llvm.org/D75351
Shengchen Kan [Fri, 28 Feb 2020 13:09:30 +0000 (21:09 +0800)]
[X86] Disable the NOP padding for branches when bundle is enabled
When bundle is enabled, data fragment itself has a space to emit NOP
to bundle-align instructions. The behaviour makes it impossible for
us to determine whether the macro fusion really happen when emitting
instructions. In addition, boundary-align fragment is also used to
emit NOPs to align instructions, currently using them together sometimes
makes code crazy.
Differential Revision: https://reviews.llvm.org/D75346
Fangrui Song [Sat, 29 Feb 2020 01:22:29 +0000 (17:22 -0800)]
[ELF][PPC32] Fix canonical PLTs when the order does not match the PLT order
Reviewed By: Bdragon28
Differential Revision: https://reviews.llvm.org/D75394
Fangrui Song [Sat, 29 Feb 2020 05:26:36 +0000 (21:26 -0800)]
[ELF] Delete two unneeded `referenced = true` after D65584
Greg Clayton [Sat, 29 Feb 2020 05:19:05 +0000 (21:19 -0800)]
Revert "Fix GSYM tests to run the yaml files and fix test failures on some machines."
This reverts commit
d334ce0b5acb945d6202d0ab6a17bdca530f50c1.
Michael Liao [Fri, 28 Feb 2020 05:01:08 +0000 (00:01 -0500)]
[cmake] Fix LLVM_USE_SPLIT_DWARF
Summary:
- Add `-gsplit-dwarf` as an option instead of a definition.
- Only add that option on compilers supporting dwarf splitting, such as clang
and gcc.
Reviewers: echristo, pcc
Subscribers: mgorny, aprantl, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75328
Vedant Kumar [Sat, 29 Feb 2020 02:59:56 +0000 (18:59 -0800)]
Disable instrprof-merging.cpp on powerpc64 (D69471 follow up)
An execution count goes missing for a constructor, this needs
investigation:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/45132/
```
/home/buildbots/ppc64be-clang-test/clang-ppc64be/llvm/compiler-rt/test/profile/instrprof-merging.cpp:28:16:
error: V1: expected string not found in input
A() {} // V1: [[@LINE]]{{ *}}|{{ *}}1
<stdin>:28:32: note: possible intended match here
28| | A() {} // V1: [[@LINE]]{{ *}}|{{ *}}1
```
Vedant Kumar [Sat, 29 Feb 2020 02:27:04 +0000 (18:27 -0800)]
Add cast to appease clang-armv7-linux-build-cache (D69471 followup)
http://lab.llvm.org:8011/builders/clang-armv7-linux-build-cache/builds/27075
error: non-constant-expression cannot be narrowed from type 'uint64_t'
(aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in
initializer list [-Wc++11-narrowing]
return {MappingBuf, getDataSize<FuncRecordTy, Endian>(Record)};
Vedant Kumar [Mon, 21 Oct 2019 18:48:38 +0000 (11:48 -0700)]
Reland: [Coverage] Revise format to reduce binary size
Try again with an up-to-date version of D69471 (
99317124 was a stale
revision).
---
Revise the coverage mapping format to reduce binary size by:
1. Naming function records and marking them `linkonce_odr`, and
2. Compressing filenames.
This shrinks the size of llc's coverage segment by 82% (334MB -> 62MB)
and speeds up end-to-end single-threaded report generation by 10%. For
reference the compressed name data in llc is 81MB (__llvm_prf_names).
Rationale for changes to the format:
- With the current format, most coverage function records are discarded.
E.g., more than 97% of the records in llc are *duplicate* placeholders
for functions visible-but-not-used in TUs. Placeholders *are* used to
show under-covered functions, but duplicate placeholders waste space.
- We reached general consensus about giving (1) a try at the 2017 code
coverage BoF [1]. The thinking was that using `linkonce_odr` to merge
duplicates is simpler than alternatives like teaching build systems
about a coverage-aware database/module/etc on the side.
- Revising the format is expensive due to the backwards compatibility
requirement, so we might as well compress filenames while we're at it.
This shrinks the encoded filenames in llc by 86% (12MB -> 1.6MB).
See CoverageMappingFormat.rst for the details on what exactly has
changed.
Fixes PR34533 [2], hopefully.
[1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118428.html
[2] https://bugs.llvm.org/show_bug.cgi?id=34533
Differential Revision: https://reviews.llvm.org/D69471
Vedant Kumar [Sat, 29 Feb 2020 02:03:15 +0000 (18:03 -0800)]
Revert "[Coverage] Revise format to reduce binary size"
This reverts commit
99317124e1c772e9a9de41a0cd56e1db049b4ea4. This is
still busted on Windows:
http://lab.llvm.org:8011/builders/lld-x86_64-win7/builds/40873
The llvm-cov tests report 'error: Could not load coverage information'.
Vedant Kumar [Sat, 29 Feb 2020 01:46:54 +0000 (17:46 -0800)]
[compiler-rt/test] Relax a test so we can debug it on sanitizer-x86_64-linux-android
This test is failing with a core dump on /just/ this bot, and I'd like
to find out why.
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/27979/
Vedant Kumar [Mon, 21 Oct 2019 18:48:38 +0000 (11:48 -0700)]
[Coverage] Revise format to reduce binary size
Revise the coverage mapping format to reduce binary size by:
1. Naming function records and marking them `linkonce_odr`, and
2. Compressing filenames.
This shrinks the size of llc's coverage segment by 82% (334MB -> 62MB)
and speeds up end-to-end single-threaded report generation by 10%. For
reference the compressed name data in llc is 81MB (__llvm_prf_names).
Rationale for changes to the format:
- With the current format, most coverage function records are discarded.
E.g., more than 97% of the records in llc are *duplicate* placeholders
for functions visible-but-not-used in TUs. Placeholders *are* used to
show under-covered functions, but duplicate placeholders waste space.
- We reached general consensus about giving (1) a try at the 2017 code
coverage BoF [1]. The thinking was that using `linkonce_odr` to merge
duplicates is simpler than alternatives like teaching build systems
about a coverage-aware database/module/etc on the side.
- Revising the format is expensive due to the backwards compatibility
requirement, so we might as well compress filenames while we're at it.
This shrinks the encoded filenames in llc by 86% (12MB -> 1.6MB).
See CoverageMappingFormat.rst for the details on what exactly has
changed.
Fixes PR34533 [2], hopefully.
[1] http://lists.llvm.org/pipermail/llvm-dev/2017-October/118428.html
[2] https://bugs.llvm.org/show_bug.cgi?id=34533
Differential Revision: https://reviews.llvm.org/D69471
Reid Kleckner [Sat, 29 Feb 2020 01:21:50 +0000 (17:21 -0800)]
Try to fix WindowsManifest CMake logic on Windows
CMake is complaining about the "^" regex if the prefixes are empty
strings.
Greg Clayton [Fri, 28 Feb 2020 23:25:47 +0000 (15:25 -0800)]
Fix GSYM tests to run the yaml files and fix test failures on some machines.
Summary: YAML files were not being run during lit testing as there was no lit.local.cfg file. Once this was fixed, some buildbots would fail due to a StringRef that pointed to a std::string inside of a temporary llvm::Triple object. These issues are fixed here by making a local triple object that stays around long enough so the StringRef points to valid data.
Reviewers: aprantl, thakis, MaskRay, aadsm, wallace
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75390
Craig Topper [Fri, 28 Feb 2020 23:42:47 +0000 (15:42 -0800)]
[X86] Remove isel patterns from broadcast of loadi32.
We already combine non extending loads with broadcasts in DAG
combine. All these patterns are picking up is the aligned extload
special case. But the only lit test we have that exercsises it is
using v8i1 load that datalayout is reporting align 8 for. That
seems generous. So without a realistic test case I don't think
there is much value in these patterns.
Vedant Kumar [Sat, 29 Feb 2020 00:20:54 +0000 (16:20 -0800)]
[compiler-rt/test] Use FileCheck -allow-empty instead of count 0
Hope this fixes:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/27977/steps/run%20lit%20tests%20%5Bi686%2Ffugu-userdebug%2FN2G48C%5D/logs/stdio
```
: 'RUN: at line 8'; UBSAN_OPTIONS=suppressions=/var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_i686/test/ubsan/Standalone-i386/TestCases/Misc/Output/nullability.c.tmp.supp /var/lib/buildbot/sanitizer-buildbot6/sanitizer-x86_64-linux-android/build/compiler_rt_build_android_i686/test/ubsan/Standalone-i386/TestCases/Misc/Output/nullability.c.tmp 2>&1 | count 0
--
Exit Code: 1
Command Output (stderr):
--
Expected 0 lines, got 2.
```
Not sure what this would be printing though, a sanitizer initialization message?
Francis Visoiu Mistrih [Fri, 28 Feb 2020 23:49:28 +0000 (15:49 -0800)]
[LTO][Legacy] Add explicit dependency on BinaryFormat
This fixes some windows bots.
Matt Morehouse [Fri, 28 Feb 2020 23:49:37 +0000 (15:49 -0800)]
[DFSan] Add __dfsan_cmp_callback.
Summary:
When -dfsan-event-callbacks is specified, insert a call to
__dfsan_cmp_callback on every CMP instruction.
Reviewers: vitalybuka, pcc, kcc
Reviewed By: kcc
Subscribers: hiraditya, #sanitizers, eugenis, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D75389
Erik Pilkington [Fri, 28 Feb 2020 23:24:23 +0000 (15:24 -0800)]
[Sema] Fix an assert when objc_externally_retained was applied to an unprototyped function
rdar://
58893199
Matt Morehouse [Fri, 28 Feb 2020 23:48:03 +0000 (15:48 -0800)]
[DFSan] Add __dfsan_mem_transfer_callback.
Summary:
When -dfsan-event-callbacks is specified, insert a call to
__dfsan_mem_transfer_callback on every memcpy and memmove.
Reviewers: vitalybuka, kcc, pcc
Reviewed By: kcc
Subscribers: eugenis, hiraditya, #sanitizers, llvm-commits
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D75386
Volodymyr Sapsai [Thu, 27 Feb 2020 23:51:24 +0000 (15:51 -0800)]
[modules] Allow frameworks to have only a private module without a public one.
Support only preferred spelling 'Modules/module.private.modulemap' and
not the deprecated 'module_private.map'.
rdar://problem/
57715533
Reviewed By: bruno
Differential Revision: https://reviews.llvm.org/D75311
Jay Foad [Fri, 28 Feb 2020 23:20:45 +0000 (23:20 +0000)]
[AMDGPU] Fix scheduling model for V_MULLIT_F32
This was incorrectly marked as a half rate 64-bit instruction by D45073.
Craig Topper [Fri, 28 Feb 2020 08:35:52 +0000 (00:35 -0800)]
[X86] Canonicalize (bitcast (vbroadcast_load)) so that the cast and vbroadcast_load are both integer or fp.
Helps a little with some isel pattern matching. Especially on
32-bit targets where we sometimes use f64 loads.
Craig Topper [Fri, 28 Feb 2020 05:32:49 +0000 (21:32 -0800)]
[X86] Remove stale FIXME form test. NFC.
Craig Topper [Fri, 28 Feb 2020 05:29:52 +0000 (21:29 -0800)]
[X86] Cleanup a comment around bitcasting X86ISD::VBROADCAST_LOAD and add an assert to make sure memory VT size doesn't change.
Michael Spencer [Fri, 28 Feb 2020 22:39:49 +0000 (14:39 -0800)]
[llvm][Support][modulemap] Exclude WindowsSupport.h from the LLVM_Util module
rG01f9abbb50b1 moved WindowsSupport.h to include/llvm/Support/Windows/
This is a problem because the modulemap include all of the Support and
ADT directories, thus any use of any header in Support or ADT would
cause the compiler to try to build WindowsSupport.h, which only works
on Windows.
Fix this by explicitly excluding WindowsSupport.h from the LLVM_Util
module.
Vedant Kumar [Fri, 28 Feb 2020 22:09:14 +0000 (14:09 -0800)]
[ubsan] Add support for -fsanitize=nullability-* suppressions
rdar://
59402904
Vedant Kumar [Thu, 27 Feb 2020 17:58:24 +0000 (09:58 -0800)]
[entry values] ARM: Add a describeLoadedValue override (PR45025)
As a narrow stopgap for the assertion failure described in PR45025, add
a describeLoadedValue override to ARMBaseInstrInfo and use it to detect
copies in which the forwarding reg is a super/sub reg of the copy
destination. For the moment this is unsupported.
Several follow ups are possible:
1) Handle VORRq. At the moment, we do not, because isCopyInstrImpl
returns early when !MI.isMoveReg().
2) In the case where forwarding reg is a super-reg of the copy
destination, we should be able to describe the forwarding reg as a
subreg within the copy destination. I'm not 100% sure about this, but
it looks like that's what's done in AArch64InstrInfo.
3) In the case where the forwarding reg is a sub-reg of the copy
destination, maybe we could describe the forwarding reg using the
copy destinaion and a DW_OP_LLVM_fragment (I guess this should be
possible after D75036).
https://bugs.llvm.org/show_bug.cgi?id=45025
rdar://
59772698
Differential Revision: https://reviews.llvm.org/D75273
Matt Morehouse [Fri, 28 Feb 2020 22:25:45 +0000 (14:25 -0800)]
[DFSan] Add __dfsan_load_callback.
Summary:
When -dfsan-event-callbacks is specified, insert a call to
__dfsan_load_callback() on every load.
Reviewers: vitalybuka, pcc, kcc
Reviewed By: vitalybuka, kcc
Subscribers: hiraditya, #sanitizers, llvm-commits, eugenis, kcc
Tags: #sanitizers, #llvm
Differential Revision: https://reviews.llvm.org/D75363
Reid Kleckner [Thu, 27 Feb 2020 21:11:17 +0000 (13:11 -0800)]
[ADT] Allow K to be incomplete during DenseMap<K*, V> instantiation
DenseMap requires two sentinel values for keys: empty and tombstone
values. To avoid undefined behavior, LLVM aligns the two sentinel
pointers to alignof(T). This requires T to be complete, which is
needlessly restrictive.
Instead, assume that DenseMap pointer keys have a maximum alignment of
4096, and use the same sentinel values for all pointer keys. The new
sentinels are:
empty: static_cast<uintptr_t>(-1) << 12
tombstone: static_cast<uintptr_t>(-2) << 12
These correspond to the addresses of -4096 and -8192. Hopefully, such a
key is never inserted into a DenseMap.
I encountered this while looking at making clang's SourceManager not
require FileManager.h, but it has several maps keyed on classes defined
in FileManager.h. FileManager depends on various LLVM FS headers, which
cumulatively take ~200ms to parse, and are generally not needed.
Reviewed By: hans
Differential Revision: https://reviews.llvm.org/D75301
Jordan Rupprecht [Fri, 28 Feb 2020 22:11:21 +0000 (14:11 -0800)]
[NFC] Fix minor python issues.
* llvm-gisel-cov.py: extra `)` after print
* chunk-print-before-all.py: py2-only print method
Stephen Neuendorffer [Fri, 28 Feb 2020 22:13:30 +0000 (14:13 -0800)]
Revert "[MLIR] Move from using target_link_libraries to LINK_LIBS for llvm libraries."
This reverts commit
2f265e35285127de376afc2243e3b5d0c5842cc2.
Stephen Neuendorffer [Fri, 28 Feb 2020 22:04:58 +0000 (14:04 -0800)]
Revert "[MLIR] Remove redundant library dependencies"
This reverts commit
e1cb15c8f92215585105fc00d6eab80860dbc68d.
Jay Foad [Mon, 7 Oct 2019 14:33:59 +0000 (15:33 +0100)]
[AMDGPU] Remove dubious logic in bidirectional list scheduler
Summary:
pickNodeBidirectional tried to compare the best top candidate and the
best bottom candidate by examining TopCand.Reason and BotCand.Reason.
This is unsound because, after calling pickNodeFromQueue, Cand.Reason
does not reflect the most important reason why Cand was chosen. Rather
it reflects the most recent reason why it beat some other potential
candidate, which could have been for some low priority tie breaker
reason.
I have seen this cause problems where TopCand is a good candidate, but
because TopCand.Reason is ORDER (which is very low priority) it is
repeatedly ignored in favour of a mediocre BotCand. This is not how
bidirectional scheduling is supposed to work.
To fix this I changed the code to always compare TopCand and BotCand
directly, like the generic implementation of pickNodeBidirectional does.
This removes some uncommented AMDGPU-specific logic; if this logic turns
out to be important then perhaps it could be moved into an override of
tryCandidate instead.
Graphics shader benchmarking on gfx10 shows a lot more positive than
negative effects from this change.
Reviewers: arsenm, tstellar, rampitec, kzhuravl, vpykhtin, dstuttard, tpr, atrick, MatzeB
Subscribers: jvesely, wdng, nhaehnle, yaxunl, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68338
Alexey Lapshin [Thu, 27 Feb 2020 10:21:58 +0000 (13:21 +0300)]
[LLD] Report errors occurred while parsing debug info as warnings.
Summary:
Extracted from D74773. Currently, errors happened while parsing
debug info are reported as errors. DebugInfoDWARF library treats such
errors as "Recoverable errors". This patch makes debug info errors
to be reported as warnings, to support DebugInfoDWARF approach.
Reviewers: ruiu, grimar, MaskRay, jhenderson, espindola
Reviewed By: MaskRay, jhenderson
Subscribers: emaste, aprantl, arichardson, arphaman, llvm-commits
Tags: #llvm, #debug-info, #lld
Differential Revision: https://reviews.llvm.org/D75234
Francis Visoiu Mistrih [Wed, 19 Feb 2020 01:13:47 +0000 (17:13 -0800)]
[LTO][Legacy] Add new API to query Mach-O CPU (sub)type
Tools working with object files on Darwin (e.g. lipo) may need to know
properties like the CPU type and subtype of a bitcode file. The logic of
converting a triple to a Mach-O CPU_(SUB_)TYPE should be provided by
LLVM instead of relying on tools to re-implement it.
Differential Revision: https://reviews.llvm.org/D75067
Tim Shen [Tue, 25 Feb 2020 23:48:23 +0000 (15:48 -0800)]
[MLIR] Add vector support for fpexp and fptrunc.
Differential Revision: https://reviews.llvm.org/D75150
Tim Shen [Sat, 22 Feb 2020 02:13:56 +0000 (18:13 -0800)]
[MLIR] Add llvm.mlir.cast op for semantic preserving cast between dialect types.
Summary: See discussion here: https://llvm.discourse.group/t/rfc-dialect-type-cast-op/538/11
Reviewers: ftynse
Subscribers: bixia, sanjoy.google, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits
Differential Revision: https://reviews.llvm.org/D75141
Tim Shen [Tue, 25 Feb 2020 21:31:56 +0000 (13:31 -0800)]
[MLIR] Add LLVMConversionTarget as a customization point. NFC.
This is in preparation for the next patch D75141. The purpose is to
provide a single place where LLVM dialect registers its ops as
legal/illegal.
Reviewers: ftynse, mravishankar, herhut
Subscribers: jholewinski, bixia, sanjoy.google, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits
Differential Revision: https://reviews.llvm.org/D75140
Krzysztof Parzyszek [Fri, 28 Feb 2020 19:50:16 +0000 (13:50 -0600)]
[Hexagon] Map dcfetch intrinsic to Y2_dcfetchbo, not Y2_dcfetch
Stephen Neuendorffer [Fri, 28 Feb 2020 20:16:51 +0000 (12:16 -0800)]
Revert "[MLIR] Move from add_dependencies() to DEPENDS"
This reverts commit
8a2b86b2c20a50f4a32931ae311b8e2457e591eb.
Stephen Neuendorffer [Fri, 28 Feb 2020 20:16:10 +0000 (12:16 -0800)]
Revert "[MLIR] Add support for libMLIR.so"
This reverts commit
1246e867164b06fc3f0de6bfaaa0922d99cb5ce9.
Stephen Neuendorffer [Fri, 28 Feb 2020 20:15:45 +0000 (12:15 -0800)]
Revert "[MLIR] Fixes for BUILD_SHARED_LIBS=on"
This reverts commit
c767dc9394b4cca26c3eb40f1270092594e539c2.
cchen [Fri, 28 Feb 2020 19:37:14 +0000 (14:37 -0500)]
[OpenMP5.0] Allow pointer arithmetic in motion/map clause, by Chi Chun
Chen
Summary:
Base declaration in pointer arithmetic expression is determined by
binary search with type information. Take "int *a, *b; *(a+*b)" as an
example, we determine the base by checking the type of LHS and RHS. In
this case the type of LHS is "int *", the type of RHS is "int",
therefore, we know that we need to visit LHS in order to find base
declaration.
Reviewers: ABataev, jdoerfert
Reviewed By: ABataev
Subscribers: guansong, cfe-commits, sandoval, dreachem
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75077
Stephen Neuendorffer [Thu, 27 Feb 2020 22:53:12 +0000 (14:53 -0800)]
[MLIR] Fixes for BUILD_SHARED_LIBS=on
Differential Revision: https://reviews.llvm.org/D75308
Valentin Churavy [Sun, 9 Feb 2020 03:27:54 +0000 (19:27 -0800)]
[MLIR] Add support for libMLIR.so
Putting this up mainly for discussion on
how this should be done. I am interested in MLIR from
the Julia side and we currently have a strong preference
to dynamically linking against the LLVM shared library,
and would like to have a MLIR shared library.
This patch adds a new cmake function add_mlir_library()
which accumulates a list of targets to be compiled into
libMLIR.so. Note that not all libraries make sense to
be compiled into libMLIR.so. In particular, we want
to avoid libraries which primarily exist to support
certain tools (such as mlir-opt and mlir-cpu-runner).
Note that the resulting libMLIR.so depends on LLVM, but
does not contain any LLVM components. As a result, it
is necessary to link with libLLVM.so to avoid linkage
errors. So, libMLIR.so requires LLVM_BUILD_LLVM_DYLIB=on
FYI, Currently it appears that LLVM_LINK_LLVM_DYLIB is broken
because mlir-tblgen is linked against libLLVM.so and
and independent LLVM components
(updated by Stephen Neuendorffer)
Differential Revision: https://reviews.llvm.org/D73130
Stephen Neuendorffer [Thu, 20 Feb 2020 18:48:51 +0000 (10:48 -0800)]
[MLIR] Move from add_dependencies() to DEPENDS
add_llvm_library and add_llvm_executable may need to create new targets with
appropriate dependencies. As a result, it is not sufficient in some
configurations (namely LLVM_BUILD_LLVM_DYLIB=on) to only call
add_dependencies(). Instead, the explicit TableGen dependencies must
be passed to add_llvm_library() or add_llvm_executable() using the DEPENDS
keyword.
Differential Revision: https://reviews.llvm.org/D74930
Stephen Neuendorffer [Thu, 20 Feb 2020 06:56:38 +0000 (22:56 -0800)]
[MLIR] Remove redundant library dependencies
In cmake, it is redundant to have a target list under target_link_libraries()
and add_dependency(). This patch removes the redundant dependency from
add_dependency().
Differential Revision: https://reviews.llvm.org/D74929
Stephen Neuendorffer [Tue, 18 Feb 2020 23:07:35 +0000 (15:07 -0800)]
[MLIR] Move from using target_link_libraries to LINK_LIBS for llvm libraries.
When compiling libLLVM.so, add_llvm_library() manipulates the link libraries
being used. This means that when using add_llvm_library(), we need to pass
the list of libraries to be linked (using the LINK_LIBS keyword) instead of
using the standard target_link_libraries call. This is preparation for
properly dealing with creating libMLIR.so as well.
Differential Revision: https://reviews.llvm.org/D74864
Stephen Neuendorffer [Thu, 27 Feb 2020 17:47:37 +0000 (09:47 -0800)]
[MLIR] Refactor library initialization of JitRunner.
Previously, lib/Support/JitRunner.cpp was essentially a complete application,
performing all library initialization, along with dealing with command line
arguments and actually running passes. This differs significantly from
mlir-opt and required a dependency on InitAllDialects.h. This dependency
is significant, since it requires a dependency on all of the resulting
libraries.
This patch refactors the code so that tools are responsible for library
initialization, including registering all dialects, prior to calling
JitRunnerMain. This places the concern about what dialect to support
with the end application, enabling more extensibility at the cost of
a small amount of code duplication between tools. It also fixes
BUILD_SHARED_LIBS=on.
Differential Revision: https://reviews.llvm.org/D75272
Stephen Neuendorffer [Thu, 27 Feb 2020 00:31:14 +0000 (16:31 -0800)]
[MLIR] Refactor library handling for conversions.
Collect a list of conversion libraries in cmake, so we don't have to
list these explicitly in most binaries.
Differential Revision: https://reviews.llvm.org/D75222
Stephen Neuendorffer [Wed, 26 Feb 2020 19:50:03 +0000 (11:50 -0800)]
[MLIR] Refactor handling of dialect libraries
Instead of creating extra libraries we don't really need, collect a
list of all dialects and use that instead.
Differential Revision: https://reviews.llvm.org/D75221
Jacques Pienaar [Fri, 28 Feb 2020 18:59:34 +0000 (10:59 -0800)]
[mlir] Fix typo
Benjamin Kramer [Thu, 27 Feb 2020 12:24:27 +0000 (13:24 +0100)]
Add a pass that specializes parallel loops for easier unrolling and vectorization
This matches loops with a affine.min upper bound, limiting the trip
count to a constant, and rewrites them into two loops, one with constant
upper bound and one with variable upper bound. The assumption is that
the constant upper bound loop will be unrolled and vectorized, which is
preferable if this is the hot path.
Differential Revision: https://reviews.llvm.org/D75240
Yitzhak Mandelbaum [Fri, 28 Feb 2020 17:45:19 +0000 (12:45 -0500)]
[AST Matchers] Fix bug in 'optionally' matcher wherein all previous bindings are cleared when all inner matchers fail.
Summary: The implementation of 'optionally' doesn't preserve bindings when none of the submatchers succeed. This patch adds a regression test for that behavior and fixes it.
Reviewers: aaron.ballman, sbenza
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75365
David Green [Fri, 28 Feb 2020 18:31:45 +0000 (18:31 +0000)]
[DAGCombine] Fix alias analysis for unaligned accesses
The alias analysis in DAG Combine looks at the BaseAlign, the Offset and
the Size of two accesses, and determines if they are known to access
different parts of memory by the fact that they are different offsets
from inside that "alignment window". It does not seem to account for
accesses that are not a multiple of the size, and may overflow from one
alignment window into another.
For example in the test case we have a 19byte memset that is splits into
a 16 byte neon store and an unaligned 4 byte store with a 15 byte
offset. This 15byte offset (with a base align of 8) wraps around to the
next alignment windows. When compared to an access that is a 16byte
offset (of the same 4byte size and 8byte basealign), the two accesses
are said not to alias.
I've fixed this here by just ensuring that the offsets are a multiple of
the size, ensuring that they don't overlap by wrapping. Fixes PR45035,
which was exposed by the UseAA changes in the arm backend.
Differential Revision: https://reviews.llvm.org/D75238
Austin Kerbow [Fri, 28 Feb 2020 18:08:59 +0000 (10:08 -0800)]
[VectorCombine] Fix assert on compare extract index
Extract index could be a differnet integral type.
Differential Revision: https://reviews.llvm.org/D75327
Eric Fiselier [Fri, 28 Feb 2020 18:35:47 +0000 (13:35 -0500)]
[libc++] update GCC cherry-pick to build 4.8.5
Valery N Dmitriev [Thu, 27 Feb 2020 20:50:08 +0000 (12:50 -0800)]
[SLP][NFC] Assert that tree entry operands completed when scheduler looks for dependencies.
This change adds an assertion to prevent tricky bug related to recursive
approach of building vectorization tree. For loop below takes number of
operands directly from tree entry rather than from scalars.
If the entry at this moment turns out incomplete (i.e. not all operands set)
then not all the dependencies will be seen by the scheduler.
This can lead to failed scheduling (and thus failed vectorization)
for perfectly vectorizable tree.
Here is code example which is likely to fire the assertion:
for (i : VL0->getNumOperands()) {
...
TE->setOperand(i, Operands);
buildTree_rec(Operands, Depth + 1,...);
}
Correct way is two steps process: first set all operands to a tree entry
and then recursively process each operand.
Differential Revision: https://reviews.llvm.org/D75296
Alexey Bataev [Fri, 28 Feb 2020 18:18:32 +0000 (13:18 -0500)]
[SLP]Update test checks, NFC.
Craig Topper [Fri, 28 Feb 2020 17:58:42 +0000 (09:58 -0800)]
[X86] Recognize CVTPH2PS from STRICT_FP_EXTEND
This should avoid scalarizing the cvtph2ps intrinsics with D75162
Differential Revision: https://reviews.llvm.org/D75304
Sam Clegg [Fri, 28 Feb 2020 01:32:22 +0000 (17:32 -0800)]
[lld][WebAssembly] Handle mixed strong and weak undefined symbols
When there are both strong and weak references to an undefined
symbol ensure that the strong reference prevails in the output symbol
generating the correct error.
Test case copied from lld/test/ELF/weak-and-strong-undef.s
Differential Revision: https://reviews.llvm.org/D75322
Hiroshi Yamauchi [Fri, 28 Feb 2020 17:43:32 +0000 (09:43 -0800)]
Devirtualize a call on alloca without waiting for post inline cleanup and next DevirtSCCRepeatedPass iteration.
This aims to fix a missed inlining case.
If there's a virtual call in the callee on an alloca (stack allocated object) in
the caller, and the callee is inlined into the caller, the post-inline cleanup
would devirtualize the virtual call, but if the next iteration of
DevirtSCCRepeatedPass doesn't happen (under the new pass manager), which is
based on a heuristic to determine whether to reiterate, we may miss inlining the
devirtualized call.
This enables inlining in clang/test/CodeGenCXX/member-function-pointer-calls.cpp.
This is a second commit after a revert
https://reviews.llvm.org/rG4569b3a86f8a4b1b8ad28fe2321f936f9d7ffd43 and a fix
https://reviews.llvm.org/rG41e06ae7ba91.
Differential Revision: https://reviews.llvm.org/D69591
Hiroshi Yamauchi [Thu, 27 Feb 2020 21:59:59 +0000 (13:59 -0800)]
[CallPromotionUtils] Add missing promotion legality check to tryPromoteCall.
Summary: This fixes the crash that led to the revert of D69591.
Reviewers: davidxl
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75307
Valery N Dmitriev [Thu, 27 Feb 2020 18:57:06 +0000 (10:57 -0800)]
[SLP][NFC] Delete some unreachable code.
This patch deletes some dead code out of SLP vectorizer.
Couple of changes taken out of D57059 to slightly lighten it
plus one more similar case fixed.
Differential Revision: https://reviews.llvm.org/D75276
Christopher Tetreault [Fri, 28 Feb 2020 16:36:27 +0000 (08:36 -0800)]
Revert "[NFC][ARM] Update test"
Summary:
There exists no corresponding code change for this commit, and this
commit causes downstream breakages.
This reverts commit
2db5547c016dbbd6acac3f3175937324f0095226.
Reviewers: samparker
Subscribers: kristof.beyls, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75358
aartbik [Fri, 28 Feb 2020 00:43:49 +0000 (16:43 -0800)]
[mlir] [VectorOps] Add vector.broadcast to EDSC
Reviewers: nicolasvasilache, andydavis1
Reviewed By: nicolasvasilache
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75320
Simon Pilgrim [Fri, 28 Feb 2020 16:54:45 +0000 (16:54 +0000)]
[AVX512] Add strict-fp cvtph2ps constrained tests
As suggested on D75162
Simon Pilgrim [Fri, 28 Feb 2020 16:18:32 +0000 (16:18 +0000)]
[F16C] Add strict-fp constrained tests
As suggested on D75162
Jacques Pienaar [Fri, 28 Feb 2020 16:37:09 +0000 (08:37 -0800)]
[mlir] Add reifyReturnShape to shaped type OpInterface
This call results in inserting operations that compute the return shape
dynamically for the operation.
Teresa Johnson [Thu, 6 Feb 2020 21:28:41 +0000 (13:28 -0800)]
[Inliner] Inlining should honor nobuiltin attributes
Summary:
Final patch in series to fix inlining between functions with different
nobuiltin attributes/options, which was specifically an issue in LTO.
See discussion on D61634 for background.
The prior patch in this series (D67923) enabled per-Function TLI
construction that identified the nobuiltin attributes.
Here I have allowed inlining to proceed if the callee's nobuiltins are a
subset of the caller's nobuiltins, but not in the reverse case, which
should be conservatively correct. This is controlled by a new option,
-inline-caller-superset-nobuiltin, which is enabled by default.
Reviewers: hfinkel, gchatelet, chandlerc, davidxl
Subscribers: arsenm, jvesely, nhaehnle, mehdi_amini, eraman, hiraditya, haicheng, dexonsmith, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74162