Denis Antrushin [Thu, 27 Aug 2020 14:20:25 +0000 (21:20 +0700)]
[Statepoint] Turn assert into check in foldPatchpoint.
Original D81646 had check for tied regs in foldPatchpoint().
Due to unfortunate miscommunication with review comments and
adressing some comments post commit, it turned into assertion.
We had an offline talk and agreed that with current implementation
this path is possible, so I'm changing it back to check.
Note that this is workaround until ussues described in PR46917 are
resolved.
Sam Parker [Fri, 28 Aug 2020 12:56:16 +0000 (13:56 +0100)]
[ARM][LowOverheadLoops] Liveouts and reductions
Remove the code that tried to look for reduction patterns, since the
vectorizer and isel can now produce predicated arithmetic instructios
within the loop body. This has required some reorganisation and fixes
around live-out and predication checks, as well as looking for cases
where an input/output is initialised to zero.
Differential Revision: https://reviews.llvm.org/D86613
Sam Parker [Fri, 28 Aug 2020 12:45:30 +0000 (13:45 +0100)]
[NFC][ARM] Add tail predication test
Benjamin Kramer [Fri, 28 Aug 2020 11:40:06 +0000 (13:40 +0200)]
[SCCP] Use bulk-remove API to bulk-remove attributes. NFCI.
Eduardo Caldas [Fri, 28 Aug 2020 09:23:13 +0000 (09:23 +0000)]
[SyntaxTree] Add coverage for declarators and init-declarators
Eduardo Caldas [Thu, 27 Aug 2020 15:37:04 +0000 (15:37 +0000)]
[SyntaxTree][NFC] Refactor function templates into functions taking base class
The refactored functions were
* `isReponsibleForCreatingDeclaration`
* `getQualifiedNameStart`
Differential Revision: https://reviews.llvm.org/D86719
Benjamin Kramer [Fri, 28 Aug 2020 10:55:42 +0000 (12:55 +0200)]
[FunctionAttrs] Bulk remove attributes. NFC.
Ties Stuij [Fri, 28 Aug 2020 08:31:11 +0000 (09:31 +0100)]
[AArch64][CodeGen] Restrict bfloat vector operations to what's actually supported
Previously in addTypeForNeon, we would set the operations for bfloat vectors
like other generic types. But as bfloat is a storage-only type a number of
operations shouldn't be set. This patch fixes that.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D85101
Alex Richardson [Fri, 28 Aug 2020 10:03:10 +0000 (11:03 +0100)]
[clang-format] Detect pointer qualifiers in cast expressions
When guessing whether a closing paren is then end of a cast expression also
skip over pointer qualifiers while looking for TT_PointerOrReference.
This prevents some address-of and dereference operators from being parsed
as a binary operator.
Before:
x = (foo *const) * v;
x = (foo *const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified _Nonnull) & v;
After:
x = (foo *const)*v;
x = (foo *const volatile restrict __attribute__((foo)) _Nonnull _Null_unspecified _Nonnull)&v;
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D86716
Alex Richardson [Fri, 28 Aug 2020 10:03:03 +0000 (11:03 +0100)]
[clang-format] Parse nullability attributes as a pointer qualifier
Before:
void f() { MACRO(A * _Nonnull a); }
void f() { MACRO(A * _Nullable a); }
void f() { MACRO(A * _Null_unspecified a); }
After:
void f() { MACRO(A *_Nonnull a); }
void f() { MACRO(A *_Nullable a); }
void f() { MACRO(A *_Null_unspecified a); }
Reviewed By: JakeMerdichAMD
Differential Revision: https://reviews.llvm.org/D86713
Alex Richardson [Fri, 28 Aug 2020 10:03:00 +0000 (11:03 +0100)]
[clang-format] Parse __attribute((foo)) as a pointer qualifier
Before: void f() { MACRO(A * __attribute((foo)) a); }
After: void f() { MACRO(A *__attribute((foo)) a); }
Also check that the __attribute__ alias is handled.
Reviewed By: MyDeveloperDay
Differential Revision: https://reviews.llvm.org/D86711
Alex Richardson [Fri, 28 Aug 2020 10:02:56 +0000 (11:02 +0100)]
[clang-format] Parse restrict as a pointer qualifier
Before: void f() { MACRO(A * restrict a); }
After: void f() { MACRO(A *restrict a); }
Also check that the __restrict and __restrict__ aliases are handled.
Reviewed By: JakeMerdichAMD
Differential Revision: https://reviews.llvm.org/D86710
Alex Richardson [Fri, 28 Aug 2020 10:02:51 +0000 (11:02 +0100)]
[clang-format] Parse volatile as a pointer qualifier
Before: void f() { MACRO(A * volatile a); }
After: void f() { MACRO(A *volatile a); }
Also check that the __volatile and __volatile__ aliases are handled.
Reviewed By: JakeMerdichAMD
Differential Revision: https://reviews.llvm.org/D86708
Florian Hahn [Fri, 28 Aug 2020 09:31:30 +0000 (10:31 +0100)]
[DSE,MemorySSA] Check if Current is valid for elimination first.
This changes getDomMemoryDef to check if a Current is a valid
candidate for elimination before checking for reads. Before the change,
we were spending a lot of compile-time in checking for read accesses for
Current that might not even be removable.
This patch flips the logic, so we skip Current if they cannot be
removed before checking all their uses. This is much more efficient in
practice.
It also adds a more aggressive limit for checking partially overlapping
stores. The main problem with overlapping stores is that we do not know
if they will lead to elimination until seeing all of them. This patch
limits adds a new limit for overlapping store candidates, which keeps
the number of modified overlapping stores roughly the same.
This is another substantial compile-time improvement (while also
increasing the number of stores eliminated). Geomean -O3 -0.67%,
ReleaseThinLTO -0.97%.
http://llvm-compile-time-tracker.com/compare.php?from=
0a929b6978a068af8ddb02d0d4714a2843dd8ba9&to=
2e630629b43f64b60b282e90f0d96082fde2dacc&stat=instructions
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D86487
Pavel Labath [Mon, 24 Aug 2020 12:20:09 +0000 (14:20 +0200)]
[lldb/Utility] Polish the Scalar class
This patch is mostly about removing the "Category" enum, which was
very useful when the Type enum contained a large number of types, but
now the two are completely identical.
It also removes some other artifacts like unused typedefs and macros.
Pavel Labath [Thu, 27 Aug 2020 13:30:12 +0000 (15:30 +0200)]
[lldb] Reduce intentation in SymbolFileDWARF::ParseVariableDIE
using early exits. NFC.
Ella Ma [Fri, 28 Aug 2020 09:37:55 +0000 (12:37 +0300)]
[doxygen] Fix bad doxygen results for BugReporterVisitors.h
`{@code xxxxx}` triggers a Doxygen bug. The bug may be matching the
close brace with the open brace of the namespace
declaration (`namespace clang {` or `namespace ento {`).
Differential Revision: https://reviews.llvm.org/D85105
Rainer Orth [Fri, 28 Aug 2020 09:40:34 +0000 (11:40 +0200)]
[cmake] Don't build with -O3 -fPIC on Solaris/sparcv9
Tests on Solaris/sparcv9 currently show about 250 failures when building
with gcc, most of them like the following:
FAIL: LLVM-Unit :: Support/./SupportTests/TaskQueueTest.UnOrderedFutures (4269 of 67884)
******************** TEST 'LLVM-Unit :: Support/./SupportTests/TaskQueueTest.UnOrderedFutures' FAILED ********************
Note: Google Test filter = TaskQueueTest.UnOrderedFutures
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from TaskQueueTest
[ RUN ] TaskQueueTest.UnOrderedFutures
0 SupportTests 0x0000000100753b20 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 32
1 SupportTests 0x0000000100752974 llvm::sys::RunSignalHandlers() + 68
2 SupportTests 0x0000000100752b18 SignalHandler(int) + 372
3 libc.so.1 0xffffffff7eedc800 __sighndlr + 12
4 libc.so.1 0xffffffff7eecf23c call_user_handler + 852
5 libc.so.1 0xffffffff7eecf594 sigacthandler + 84
6 SupportTests 0x00000001006f8cb8 std::thread::_State_impl<std::thread::_Invoker<std::tuple<llvm::ThreadPool::ThreadPool(llvm::ThreadPoolStrategy)::'lambda'()> > >::_M_run() + 512
7 libstdc++.so.6.0.28 0xfffffffc628117cc execute_native_thread_routine + 16
8 libc.so.1 0xffffffff7eedc6a0 _lwp_start + 0
Since it's effectively impossible to debug such a `SEGV` in a `Release`
build, I tried a `Debug` build instead, only to find that the failures had
gone away.
Further investigation revealed that most of the issue centers around
`llvm/lib/Support/ThreadPool.cpp`. That file is built with `-O3 -fPIC` in
a `Release` build. The failure vanishes if
- compiling without `-fPIC`
- compiling with `-O -fPIC`
- linking with GNU `ld` instead of Solaris `ld`
It has meanwhile been determined that `gcc` doesn't correctly heed some TLS
code sequences. To make things worse, Solaris `ld` doesn't properly
validate its assumptions against the input, generating wrong code.
`gld` like `gcc` is more liberal here and correctly deals with the code it
gets fed from `gcc`.
There's PR target/96607: GCC feeds SPARC/Solaris linker with unrecognized
TLS sequences <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96607> now.
An attempt to build with `-DLLVM_ENABLE_PIC=Off` initially failed since
neither `libRemarks.so` (D85626 <https://reviews.llvm.org/D85626>) nor
`LLVMPolly.so` (D85627 <https://reviews.llvm.org/D85627>) heed that option.
Even with that fixed, a few codegen failures remain.
Next I tried to build just `ThreadPool.cpp` with `-O -fPIC`. While that
fixed the vast majority of the failures, 16 `LLVM :: CodeGen/X86` failures
remained.
Given that that solution was both incomplete and fragile, I went for
building the whole tree with `-O -fPIC` for `Release` and `RelWithDebInfo`
builds.
As detailed in Bug 47304, 2-stage builds also show large numbers of
failures when building with `-O3` or `-O2`, which are likewise worked
around by building with `-O` until they are sufficiently analyzed and
fixed.
This way, all failures relative to a `Debug` build go away.
Tested on `sparcv9-sun-solaris2.11`.
Differential Revision: https://reviews.llvm.org/D85630
Florian Hahn [Fri, 28 Aug 2020 09:07:56 +0000 (10:07 +0100)]
[MemLoc] Support memcmp in MemoryLocation::getForArgument.
This patch adds support for memcmp in MemoryLocation::getForArgument.
memcmp reads from the first 2 arguments up to the number of bytes of the
third argument.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D86725
Florian Hahn [Thu, 27 Aug 2020 16:27:32 +0000 (17:27 +0100)]
[BasicAA] Add first libfunc tests with memcmp.
Florian Hahn [Thu, 27 Aug 2020 16:27:07 +0000 (17:27 +0100)]
[DSE,MemorySSA] Add memcmp test case.
Vitaly Buka [Fri, 28 Aug 2020 08:59:27 +0000 (01:59 -0700)]
[NFC][asan] Don't unwind stack before pool check
Hanhan Wang [Fri, 28 Aug 2020 08:53:59 +0000 (01:53 -0700)]
[mlir][Linalg] Enhance Linalg fusion on generic op and tensor_reshape op.
The tensor_reshape op was only fusible only if it is a collapsing case. Now we
propagate the op to all the operands so there is a further chance to fuse it
with generic op. The pre-conditions are:
1) The producer is not an indexed_generic op.
2) All the shapes of the operands are the same.
3) All the indexing maps are identity.
4) All the loops are parallel loops.
5) The producer has a single user.
It is possible to fuse the ops if the producer is an indexed_generic op. We
still can compute the original indices. E.g., if the reshape op collapses the d0
and d1, we can use DimOp to get the width of d1, and calculate the index
`d0 * width + d1`. Then replace all the uses with it. However, this pattern is
not implemented in the patch.
Reviewed By: mravishankar
Differential Revision: https://reviews.llvm.org/D86314
Florian Hahn [Fri, 28 Aug 2020 08:37:01 +0000 (09:37 +0100)]
[BuildLibCalls] Add argmemonly to more lib calls.
strspn, strncmp, strcspn, strcasecmp, strncasecmp, memcmp, memchr,
memrchr, memcpy, memmove, memcpy, mempcpy, strchr, strrchr, bcmp
should all only access memory through their arguments.
I broke out strcoll, strcasecmp, strncasecmp because the result
depends on the locale, which might get accessed through memory.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86724
Georgii Rymar [Thu, 27 Aug 2020 15:20:13 +0000 (18:20 +0300)]
[llvm-readobj] - Simplify the code that creates dumpers. NFCI.
We have a few helper functions like the following:
```
std::error_code create*Dumper(...)
```
In fact we do not need or want to use `std::error_code` and the code
can be simpler if we just return `std::unique_ptr<ObjDumper>`.
This patch does this change and refines the signature of `createDumper`
as well.
Differential revision: https://reviews.llvm.org/D86718
Georgii Rymar [Fri, 21 Aug 2020 14:08:25 +0000 (17:08 +0300)]
[llvm-readobj][test] - Test "Format" values.
This adds testing for the "Format" field printed with `--file-headers`.
llvm-readelf doesn't use them, so only llvm-readobj needs to be tested.
All possible values are defined and tested in `ELFObjectFile<ELFT>::getFileFormatName()`.
Here we test just a few arbitrary ones.
Differential revision: https://reviews.llvm.org/D86350
Georgii Rymar [Wed, 26 Aug 2020 14:48:23 +0000 (17:48 +0300)]
[unittests/Object] - Add testing for missing ELF formats.
This adds all missing format values that are defined in
ELFObjectFile<ELFT>::getFileFormatName().
Differential revision: https://reviews.llvm.org/D86625
Florian Hahn [Fri, 28 Aug 2020 07:40:40 +0000 (08:40 +0100)]
[llvm-reduce] Skip chunks that lead to broken modules.
Some reduction passes may create invalid IR. I am not aware of any use
case where we would like to proceed reducing invalid IR. Various utils
used here, including CloneModule, assume the module to clone is valid
and crash otherwise.
Ideally, no reduction pass would create invalid IR, but some currently
do. ReduceInstructions can be fixed relatively easily (D86210), but
others are harder. For example, ReduceBasicBlocks may remove result in
invalid PHI nodes.
For now, skip the chunks. If we get to the point where all reduction
passes result in valid IR, we may want to turn this into an assertion.
Reviewed By: lebedev.ri
Differential Revision: https://reviews.llvm.org/D86212
Martin Storsjö [Fri, 28 Aug 2020 06:23:57 +0000 (09:23 +0300)]
[ValueTracking] Remove a stray semicolon. NFC.
This silences warnings when built with GCC at least.
Martin Storsjö [Thu, 20 Aug 2020 07:38:17 +0000 (10:38 +0300)]
[MC] [Win64EH] Avoid producing malformed xdata records
If there's no unwinding opcodes, omit writing the xdata/pdata records.
Previously, this generated truncated xdata records, and llvm-readobj
would error out when trying to print them.
If writing of an xdata record is forced via the .seh_handlerdata
directive, skip it if there's no info to make a sensible unwind
info structure out of, and clearly error out if such info appeared
later in the process.
Differential Revision: https://reviews.llvm.org/D86527
LLVM GN Syncbot [Fri, 28 Aug 2020 05:56:49 +0000 (05:56 +0000)]
[gn build] Port
b1f4e5979b7
serge-sans-paille [Thu, 27 Aug 2020 15:31:54 +0000 (17:31 +0200)]
(Expensive) Check for Loop, SCC and Region pass return status
This generalizes the logic introduced in https://reviews.llvm.org/D80916 to
other passes.
It's needed by https://reviews.llvm.org/D86442 to assert passes correctly report
their status.
Differential Revision: https://reviews.llvm.org/D86589
Mehdi Amini [Fri, 28 Aug 2020 02:26:27 +0000 (02:26 +0000)]
Add a global flag to disable the global dialect registry "process wise"
This is intended to ease the transition for client with a lot of
dependencies. It'll be removed in the coming weeks.
Differential Revision: https://reviews.llvm.org/D86755
JF Bastien [Fri, 14 Aug 2020 21:05:57 +0000 (14:05 -0700)]
Add an unsigned shift base sanitizer
It's not undefined behavior for an unsigned left shift to overflow (i.e. to
shift bits out), but it has been the source of bugs and exploits in certain
codebases in the past. As we do in other parts of UBSan, this patch adds a
dynamic checker which acts beyond UBSan and checks other sources of errors. The
option is enabled as part of -fsanitize=integer.
The flag is named: -fsanitize=unsigned-shift-base
This matches shift-base and shift-exponent flags.
<rdar://problem/
46129047>
Differential Revision: https://reviews.llvm.org/D86000
Valentin Clement [Fri, 28 Aug 2020 02:32:29 +0000 (22:32 -0400)]
[flang][openacc] Fix gang-argument parsing and add validity tests for !$acc loop
This patch fix the prasing for the gang-arg values for the gang clause. It also adds
some clause validity tests for the loop construct.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D86584
Justin Cady [Fri, 28 Aug 2020 02:21:59 +0000 (19:21 -0700)]
[MSAN] Add fiber switching APIs
Add functions exposed via the MSAN interface to enable MSAN within
binaries that perform manual stack switching (e.g. through using fibers
or coroutines).
This functionality is analogous to the fiber APIs available for ASAN and TSAN.
Fixes google/sanitizers#1232
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D86471
Valentin Clement [Fri, 28 Aug 2020 02:13:29 +0000 (22:13 -0400)]
[flang][openacc] Add check for tile clause restriction
The tile clause in OpenACC 3.0 imposes some restriction. Element in the tile size list are either * or a
constant positive integer expression. If there are n tile sizes in the list, the loop construct must be immediately
followed by n tightly-nested loops.
This patch implement these restrictions and add some tests.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D86655
Kai Luo [Fri, 28 Aug 2020 01:56:12 +0000 (01:56 +0000)]
[PowerPC] PPCBoolRetToInt: Don't translate Constant's operands
When collecting `i1` values via `findAllDefs`, ignore Constant's
operands, since Constant's operands might not be `i1`.
Fixes https://bugs.llvm.org/show_bug.cgi?id=46923 which causes ICE
```
llvm-project/llvm/lib/IR/Constants.cpp:1924: static llvm::Constant *llvm::ConstantExpr::getZExt(llvm::Constant *, llvm::Type *, bool): Assertion `C->getType()->getScalarSizeInBits() < Ty->getScalarSizeInBits()&& "SrcTy must be smaller than DestTy for ZExt!"' failed.
```
Differential Revision: https://reviews.llvm.org/D85007
Alina Sbirlea [Thu, 27 Aug 2020 23:39:53 +0000 (16:39 -0700)]
[MemorySSA] Assert defining access is not a MemoryUse.
Harmen Stoppels [Fri, 28 Aug 2020 00:57:26 +0000 (17:57 -0700)]
Revert "Use find_library for ncurses"
The introduction of find_library for ncurses caused more issues than it solved problems. The current open issue is it makes the static build of LLVM fail. It is better to revert for now, and get back to it later.
Revert "[CMake] Fix an issue where get_system_libname creates an empty regex capture on windows"
This reverts commit
1ed1e16ab83f55d85c90ae43a05cbe08a00c20e0.
Revert "Fix msan build"
This reverts commit
34fe9613dda3c7d8665b609136a8c12deb122382.
Revert "[CMake] Always mark terminfo as unavailable on Windows"
This reverts commit
76bf26236f6fd453343666c3cd91de8f74ffd89d.
Revert "[CMake] Fix OCaml build failure because of absolute path in system libs"
This reverts commit
8e4acb82f71ad4effec8895b8fc957189ce95933.
Revert "[CMake] Don't look for terminfo libs when LLVM_ENABLE_TERMINFO=OFF"
This reverts commit
495f91fd33d492941c39424a32cf24bcfe192f35.
Revert "Use find_library for ncurses"
This reverts commit
a52173a3e56553d7b795bcf3cdadcf6433117107.
Differential revision: https://reviews.llvm.org/D86521
Jez Ng [Fri, 28 Aug 2020 00:43:19 +0000 (17:43 -0700)]
[lld-macho][NFC] Define isHidden() in LinkEditSection
Since it's always true
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86749
Jez Ng [Fri, 28 Aug 2020 00:43:16 +0000 (17:43 -0700)]
[lld-macho] Weak locals should be relaxed too
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86746
Jez Ng [Thu, 27 Aug 2020 22:59:48 +0000 (15:59 -0700)]
[lld-macho] Support GOT relocations to __dso_handle
Found such a relocation while testing some real world programs.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86642
Jez Ng [Thu, 27 Aug 2020 22:59:45 +0000 (15:59 -0700)]
[lld-macho] Implement GOT_LOAD relaxation
We can have GOT_LOAD relocations that reference `__dso_handle`.
However, our binding opcode encoder doesn't support binding to the DSOHandle
symbol. Instead of adding support for that, I decided it would be cleaner to
implement GOT_LOAD relaxation since `__dso_handle`'s location is always
statically known.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86641
Jez Ng [Thu, 27 Aug 2020 22:59:30 +0000 (15:59 -0700)]
[lld-macho] Emit binding opcodes for defined symbols that override weak dysyms
These opcodes tell dyld to coalesce the overridden weak dysyms to this
particular symbol definition.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86575
Jez Ng [Thu, 27 Aug 2020 22:59:15 +0000 (15:59 -0700)]
[lld-macho] Emit the right header flags for weak bindings/symbols
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86574
Jez Ng [Thu, 27 Aug 2020 22:54:42 +0000 (15:54 -0700)]
[lld-macho] Implement weak binding for branch relocations
Since there is no "weak lazy" lookup, function calls to weak symbols are
always non-lazily bound. We emit both regular non-lazy bindings as well
as weak bindings, in order that the weak bindings may overwrite the
non-lazy bindings if an appropriate symbol is found at runtime. However,
the bound addresses will still be written (non-lazily) into the
LazyPointerSection.
Reviewed By: #lld-macho, smeenai
Differential Revision: https://reviews.llvm.org/D86573
Jonas Devlieghere [Fri, 28 Aug 2020 00:20:50 +0000 (17:20 -0700)]
[lldb] Fix "no matching std::pair constructor" on Ubuntu 16.04 (NFC)
Fixes error: no matching constructor for initialization of
'std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'
with older toolchain (clang/libcxx) on Ubuntu 16.04. The issue is the
StringRef-to-std::string conversion.
Nathan James [Fri, 28 Aug 2020 00:06:46 +0000 (01:06 +0100)]
[clang-query][NFC] Silence a few lint warnings
Matt Arsenault [Thu, 27 Aug 2020 18:58:39 +0000 (14:58 -0400)]
GlobalISel: Implement computeNumSignBits for G_SEXT_INREG
Matt Arsenault [Thu, 27 Aug 2020 21:21:41 +0000 (17:21 -0400)]
AMDGPU/GlobalISel: Implement computeKnownBits for groupstaticsize
Matt Arsenault [Thu, 27 Aug 2020 21:17:50 +0000 (17:17 -0400)]
AMDGPU: Fix broken switch braces
Matt Arsenault [Thu, 27 Aug 2020 23:02:34 +0000 (19:02 -0400)]
Correctly revert "GlobalISel: Use & operator on KnownBits"
I mis-resolved the revert through moving the code to another function.
Matt Arsenault [Thu, 27 Aug 2020 22:41:02 +0000 (18:41 -0400)]
Revert "GlobalISel: Use & operator on KnownBits"
This reverts commit
e53b799779b079a70f600e5cad2ab7267d66b1b7.
Confusingly, this does not simply and the two sets of known bits, but
implements known bits for the and operator.
Dokyung Song [Wed, 5 Aug 2020 23:12:19 +0000 (23:12 +0000)]
Recommit "[libFuzzer] Fix arguments of InsertPartOf/CopyPartOf calls in CrossOver mutator."
The CrossOver mutator is meant to cross over two given buffers (referred to as
the first/second buffer henceforth). Previously InsertPartOf/CopyPartOf calls
used in the CrossOver mutator incorrectly inserted/copied part of the second
buffer into a "scratch buffer" (MutateInPlaceHere of the size
CurrentMaxMutationLen), rather than the first buffer. This is not intended
behavior, because the scratch buffer does not always (i) contain the content of
the first buffer, and (ii) have the same size as the first buffer;
CurrentMaxMutationLen is typically a lot larger than the size of the first
buffer. This patch fixes the issue by using the first buffer instead of the
scratch buffer in InsertPartOf/CopyPartOf calls.
A FuzzBench experiment was run to make sure that this change does not
inadvertently degrade the performance. The performance is largely the same; more
details can be found at:
https://storage.googleapis.com/fuzzer-test-suite-public/fixcrossover-report/index.html
This patch also adds two new tests, namely "cross_over_insert" and
"cross_over_copy", which specifically target InsertPartOf and CopyPartOf,
respectively.
- cross_over_insert.test checks if the fuzzer can use InsertPartOf to trigger
the crash.
- cross_over_copy.test checks if the fuzzer can use CopyPartOf to trigger the
crash.
These newly added tests were designed to pass with the current patch, but not
without the it (with
790878f291fa5dc58a1c560cb6cc76fd1bfd1c5a these tests do not
pass). To achieve this, -max_len was intentionally given a high value. Without
this patch, InsertPartOf/CopyPartOf will generate larger inputs, possibly with
unpredictable data in it, thereby failing to trigger the crash.
The test pass condition for these new tests is narrowed down by (i) limiting
mutation depth to 1 (i.e., a single CrossOver mutation should be able to trigger
the crash) and (ii) checking whether the mutation sequence of "CrossOver-" leads
to the crash.
Also note that these newly added tests and an existing test (cross_over.test)
all use "-reduce_inputs=0" flags to prevent reducing inputs; it's easier to
force the fuzzer to keep original input string this way than tweaking
cov-instrumented basic blocks in the source code of the fuzzer executable.
Differential Revision: https://reviews.llvm.org/D85554
Vitaly Buka [Thu, 27 Aug 2020 20:38:29 +0000 (13:38 -0700)]
[ValueTracking] Replace recursion with Worklist
Now findAllocaForValue can handle nontrivial phi cycles.
Cullen Rhodes [Thu, 27 Aug 2020 21:13:23 +0000 (21:13 +0000)]
Revert "[CodeGen][AArch64] Support arm_sve_vector_bits attribute"
Test CodeGen/attr-arm-sve-vector-bits-call.c is failing on some builders
[1][2]. Reverting whilst I investigate.
[1] http://lab.llvm.org:8011/builders/fuchsia-x86_64-linux/builds/10375
[2] https://luci-milo.appspot.com/p/fuchsia/builders/ci/clang-linux-x64/
b8870800848452818112
This reverts commit
42587345a3afc52c03c6e6095db773358a1b03e9.
Brad Smith [Thu, 27 Aug 2020 21:17:38 +0000 (17:17 -0400)]
[SSP] Restore setting the visibility of __guard_local to hidden for better code generation.
Patch by: Philip Guenther
Alexey Bataev [Thu, 27 Aug 2020 20:06:28 +0000 (16:06 -0400)]
[OPENMP]Do not crash for globals in inner regions with outer target
region.
If the global variable is used in the target region,it is always
captured, if not marked as declare target.
Azharuddin Mohammed [Thu, 27 Aug 2020 20:57:07 +0000 (13:57 -0700)]
[Driver][XRay][test] Update the macOS support check
For macOS, the code says, the XRay flag is only supported on x86_64.
Updating the test and making that check explicit.
Differential Revision: https://reviews.llvm.org/D85773
Shinji Okumura [Thu, 27 Aug 2020 20:54:01 +0000 (05:54 +0900)]
[Attributor] Do not manifest noundef for dead positions
Even if noundef is deduced for a position, we should not manifest it when the position is dead.
This is because the associated values with dead positions are replaced with undef values by AAIsDead.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86565
Saiyedul Islam [Thu, 27 Aug 2020 20:54:42 +0000 (20:54 +0000)]
[OpenMP] Fix a failing test after D85214
Removed version 45 testing from a failing test for now.
Matt Arsenault [Thu, 27 Aug 2020 16:40:03 +0000 (12:40 -0400)]
GlobalISel: Implement known bits for min/max
Matt Arsenault [Thu, 27 Aug 2020 17:25:12 +0000 (13:25 -0400)]
AArch64/GlobalISel: Fix missing function begin marker in test
Matt Arsenault [Sun, 28 Jun 2020 15:34:42 +0000 (11:34 -0400)]
MIR: Infer not-SSA for subregister defs
It's possible to have a single virtual register def with a subreg
index that would pass the previous check, but it's not possible to
have a subregister def in SSA.
This is in preparation for adding stricter checks for SSA MIR.
Vitaly Buka [Thu, 27 Aug 2020 20:53:28 +0000 (13:53 -0700)]
[StackSafety] Ignore allocas with partial lifetime markers
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D86672
Vitaly Buka [Thu, 27 Aug 2020 20:45:39 +0000 (13:45 -0700)]
[NFC][ValueTracking] Add OffsetZero into findAllocaForValue
For StackLifetime after finding alloca we need to check that
values ponting to the begining of alloca.
Reviewed By: eugenis
Differential Revision: https://reviews.llvm.org/D86692
Matt Arsenault [Thu, 27 Aug 2020 15:14:59 +0000 (11:14 -0400)]
AMDGPU: Use caller subtarget, not intrinsic declaration
Intrinsic declarations use the default subtarget, but this should be
using the subtarget for the calling function. I haven't been able to
come up with a case where it matters though.
Matt Arsenault [Thu, 27 Aug 2020 17:15:46 +0000 (13:15 -0400)]
GlobalISel: Add and_trivial_mask to all_combines
Also make up a new category of combines.
Krzysztof Parzyszek [Thu, 27 Aug 2020 20:16:39 +0000 (15:16 -0500)]
[Hexagon] Emit better 32-bit multiplication sequence for HVXv62+
Eli Friedman [Thu, 27 Aug 2020 20:17:47 +0000 (13:17 -0700)]
[RegisterScavenging] Delete dead function unprocess().
Shinji Okumura [Thu, 27 Aug 2020 20:16:18 +0000 (05:16 +0900)]
[Attributor] Do not add AA to dependency graph after the update stage
If an AA is registered to the dependency graph in the manifest stage, Attributor aborts in `::manifestAttributes()`.
This patch prevents such termination.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86734
Craig Topper [Thu, 27 Aug 2020 19:32:17 +0000 (12:32 -0700)]
[CodeGen] Use an AttrBuilder to bulk remove 'target-cpu', 'target-features', and 'tune-cpu' before re-adding in CodeGenModule::setNonAliasAttributes.
I think the removeAttributes interface should be faster than
calling removeAttribute 3 times.
Saiyedul Islam [Thu, 27 Aug 2020 19:35:36 +0000 (19:35 +0000)]
[OpenMP] Ensure testing for versions 4.5 and default - Part 3
This third patch in the series removes version 5.0 string from
test cases making them check for default version. It also add test
cases for version 4.5.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D85214
Roman Lebedev [Thu, 27 Aug 2020 19:31:40 +0000 (22:31 +0300)]
[InstSimplify] SimplifyPHINode(): check that instruction is in basic block first
As pointed out in post-commit review, this can legally be called
on instructions that are not inserted into basic blocks,
so don't blindly assume that there is basic block.
Christopher Tetreault [Thu, 27 Aug 2020 19:04:39 +0000 (12:04 -0700)]
[SVE] Remove bad call to VectorType::getNumElements() from HeapProfiler
Reviewed By: tejohnson
Differential Revision: https://reviews.llvm.org/D86727
Yang Fan [Thu, 27 Aug 2020 19:09:17 +0000 (12:09 -0700)]
[analyzer] NFC: Fix wrong parameter name in printFormattedEntry.
Parameters were in a different order in the header and in the implementation.
Fix surrounding comments a bit.
Differential Revision: https://reviews.llvm.org/D86691
Yang Fan [Thu, 27 Aug 2020 18:45:12 +0000 (11:45 -0700)]
[analyzer] Fix the debug print about debug egraph dumps requiring asserts.
There's no need to remind people about that when clang *is* built with asserts.
Differential Revision: https://reviews.llvm.org/D86334
Adam Balogh [Thu, 27 Aug 2020 15:06:10 +0000 (08:06 -0700)]
[analyzer] pr47037: CastValueChecker: Support for the new variadic isa<>.
llvm::isa<>() and llvm::isa_and_not_null<>() template functions recently became
variadic. Unfortunately this causes crashes in case of isa_and_not_null<>()
and incorrect behavior in isa<>(). This patch fixes this issue.
Differential Revision: https://reviews.llvm.org/D85728
Adam Balogh [Thu, 27 Aug 2020 15:01:43 +0000 (08:01 -0700)]
[analyzer] NFC: Store the pointee/referenced type for dynamic type tracking.
The successfulness of a dynamic cast depends only on the C++ class, not the pointer or reference. Thus if *A is a *B, then &A is a &B,
const *A is a const *B etc. This patch changes DynamicCastInfo to store
and check the cast between the unqualified pointed/referenced types.
It also removes e.g. SubstTemplateTypeParmType from both the pointer
and the pointed type.
Differential Revision: https://reviews.llvm.org/D85752
Dokyung Song [Wed, 19 Aug 2020 20:21:05 +0000 (20:21 +0000)]
Recommit "[libFuzzer] Fix value-profile-load test."
value-profile-load.test needs adjustment with a mutator change in
bb54bcf84970c04c9748004f3a4cf59b0c1832a7, which reverted as of now, but will be
recommitted after landing this patch.
This patch makes value-profile-load.test more friendly to (and aware of) the
current value profiling strategy, which is based on the hamming as well as the
absolute distance. To this end, this patch adjusts the set of input values that
trigger an expected crash. More specifically, this patch now uses a single value
0x01effffe as a crashing input, because this value is close to values like
{0x1ffffff, 0xffffff, ...}, which are very likely to be added to the corpus per
the current hamming- and absolute-distance-based value profiling strategy. Note
that previously the crashing input values were {1234567 * {1, 2, ...}, s.t. <
INT_MAX}.
Every byte in the chosen value 0x01effeef is intentionally different; this was
to make it harder to find the value without the intermediate inputs added to the
corpus by the value profiling strategy.
Also note that LoadTest.cpp now uses a narrower condition (Size != 8) for
initial pruning of inputs, effectively preventing libFuzzer from generating
inputs longer than necessary and spending time on mutating such long inputs in
the corpus - a functionality not meant to be tested by this specific test.
Differential Revision: https://reviews.llvm.org/D86247
Haojian Wu [Thu, 27 Aug 2020 18:43:20 +0000 (20:43 +0200)]
[libcxx] Fix the broken test after D82657.
Differential Revision: https://reviews.llvm.org/D86685
Shinji Okumura [Thu, 27 Aug 2020 18:29:39 +0000 (03:29 +0900)]
[Attributor] Guarantee getAAFor not to update AA in the manifestation stage
If we query an AA with `Attributor::getAAFor` in `AbstractAttribute::manifest`, the AA may be updated.
This patch makes use of the phase flag in Attributor, and handle `getAAFor` behavior according to the flag.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D86635
Vincent Zhao [Thu, 27 Aug 2020 18:57:36 +0000 (00:27 +0530)]
[MLIR] Fixed missing constraint append when adding an AffineIfOp domain
The prior diff that introduced `addAffineIfOpDomain` missed appending
constraints from the ifOp domain. This revision fixes this problem.
Differential Revision: https://reviews.llvm.org/D86421
Christopher Tetreault [Thu, 27 Aug 2020 18:19:46 +0000 (11:19 -0700)]
[SVE] Remove calls to VectorType::getNumElements from Transforms/Vectorize
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D82056
Saiyedul Islam [Thu, 27 Aug 2020 18:50:34 +0000 (18:50 +0000)]
[OpenMP] Ensure testing for versions 4.5 and default - Part 2
Many OpenMP Clang tests do not RUN for version 4.5 and the default
version. This second patch in the series handles test cases which
require updation in CHECK lines along with adding RUN lines for
the default version. It involves updating line number of pragmas.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D85150
Kiran Chandramohan [Thu, 13 Aug 2020 08:03:04 +0000 (09:03 +0100)]
[OpenMP][MLIR] Conversion pattern for OpenMP to LLVM
Adding a conversion pattern for the parallel Operation. This will
help the conversion of parallel operation with standard dialect to
parallel operation with llvm dialect. The type conversion of the block
arguments in a parallel region are controlled by the pattern for the
parallel Operation. Without this pattern, a parallel Operation with
block arguments cannot be converted from standard to LLVM dialect.
Other OpenMP operations without regions are marked as legal. When
translation of OpenMP operations with regions are added then patterns
for these operations can also be added.
Also uses all the standard to llvm patterns. Patterns of other dialects
can be added later if needed.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D86273
Jez Ng [Thu, 27 Aug 2020 18:10:59 +0000 (11:10 -0700)]
[lld-macho] Disable invalid/stub-link.s test for Mac
It seems to be failing on some Google Buildbots.
This diff also includes a minor fix for the install name of one of
libSystem's re-exports. I don't think it's the cause of the test
failure, though. The wrong install name just meant that the symbol
lookup failure would still happen, but it would have been caused by the
re-export not being found, instead of the arch failing to match.
Differential Revision: https://reviews.llvm.org/D86728
Louis Dionne [Thu, 27 Aug 2020 17:09:23 +0000 (13:09 -0400)]
[libc++][NFC] Define functor's call operator inline
This fixes a mismatched visibility attribute on the call operator in
addition to making the code clearer. Given this is a simple lambda
in essence, the intent has always been to give it inline visibility.
Christopher Tetreault [Thu, 27 Aug 2020 17:39:18 +0000 (10:39 -0700)]
[SVE] Remove calls to VectorType::getNumElements from IR
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D81500
Matt Arsenault [Thu, 27 Aug 2020 16:32:49 +0000 (12:32 -0400)]
GlobalISel: Use & operator on KnownBits
Avoid repeating for zero and one
Matt Arsenault [Thu, 27 Aug 2020 16:15:16 +0000 (12:15 -0400)]
GlobalISel: Implement known bits for G_MERGE_VALUES
Mikhail Maltsev [Thu, 27 Aug 2020 17:52:59 +0000 (18:52 +0100)]
[ARM][BFloat16] Change types of some Arm and AArch64 bf16 intrinsics
Add bitcode files which got truncated to 0 length in phabricator.
Differential Revision: https://reviews.llvm.org/D86146
Matt Arsenault [Thu, 27 Aug 2020 17:47:38 +0000 (13:47 -0400)]
GlobalISel: Remove leftover lit.local.cfg
The global-isel feature has been required for a long time and was
removed in
c9455d3c579292e7ae5b7559ad0302d459e69a95, so this was
causing all tests to be skipped.
Mikhail Maltsev [Thu, 27 Aug 2020 17:43:16 +0000 (18:43 +0100)]
[ARM][BFloat16] Change types of some Arm and AArch64 bf16 intrinsics
This patch adjusts the following ARM/AArch64 LLVM IR intrinsics:
- neon_bfmmla
- neon_bfmlalb
- neon_bfmlalt
so that they take and return bf16 and float types. Previously these
intrinsics used <8 x i8> and <4 x i8> vectors (a rudiment from
implementation lacking bf16 IR type).
The neon_vbfdot[q] intrinsics are adjusted similarly. This change
required some additional selection patterns for vbfdot itself and
also for vector shuffles (in a previous patch) because of SelectionDAG
transformations kicking in and mangling the original code.
This patch makes the generated IR cleaner (less useless bitcasts are
produced), but it does not affect the final assembly.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D86146
Craig Topper [Thu, 27 Aug 2020 17:30:47 +0000 (10:30 -0700)]
[X86] Don't call hasFnAttribute and getFnAttribute for 'prefer-vector-width' and 'min-legal-vector-width' in getSubtargetImpl
We only need to call getFnAttribute and then check if the Attribute
is None or not.
Owen Anderson [Wed, 26 Aug 2020 19:36:13 +0000 (19:36 +0000)]
Reapply D70800: Fix AArch64 AAPCS frame record chain
Original Commit Message:
After the commit r368987 (rG643adb55769e) was landed, the frame record (FP and LR register)
may be placed in the middle of a stack frame if a function has both callee-saved
general-purpose registers and floating point registers. This will break the stack unwinders
that simply walk through the frame records (based on the guarantee from AAPCS64
"The Frame Pointer" section). This commit fixes the problem by adding the frame record offset.
Patch By: logan
Differential Revision: D70800
Teresa Johnson [Thu, 27 Aug 2020 16:38:45 +0000 (09:38 -0700)]
[HeapProf] Fix bot failures from instrumentation pass
Fix bot failure from
7ed8124d46f94601d5f1364becee9cee8538265e:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/8533
Since we are always using dynamic shadow,
insertDynamicShadowAtFunctionEntry should always return true for
modifying the function.
LLVM GN Syncbot [Thu, 27 Aug 2020 17:08:02 +0000 (17:08 +0000)]
[gn build] Port
7ed8124d46f
Arthur Eubanks [Thu, 27 Aug 2020 17:05:34 +0000 (10:05 -0700)]
[gn build] Manually port c9455d3