Paul Robinson [Tue, 6 Feb 2018 00:43:26 +0000 (00:43 +0000)]
Fix regex from r324279 more better.
llvm-svn: 324298
Reid Kleckner [Tue, 6 Feb 2018 00:06:45 +0000 (00:06 +0000)]
Fix LLD wasm error check on Windows, which prints "lld.EXE: error: ..."
llvm-svn: 324297
Alex Shlyapnikov [Mon, 5 Feb 2018 23:59:13 +0000 (23:59 +0000)]
[Sanitizers] Basic Solaris sanitizer support (PR 33274)
Summary:
This patch (on top of https://reviews.llvm.org/D35755) provides the clang side necessary
to enable the Solaris port of the sanitizers implemented by https://reviews.llvm.org/D40898,
https://reviews.llvm.org/D40899, and https://reviews.llvm.org/D40900).
A few features of note:
* While compiler-rt cmake/base-config-ix.cmake (COMPILER_RT_OS_DIR) places
the runtime libs in a tolower(CMAKE_SYSTEM_NAME) directory, clang defaults to
the OS part of the target triplet (solaris2.11 in the case at hand). The patch makes
them agree on compiler-rt's idea.
* While Solaris ld accepts a considerable number of GNU ld options for compatibility,
it only does so for the double-dash forms. clang unfortunately is inconsistent here
and sometimes uses the double-dash form, sometimes the single-dash one that
confuses the hell out of Solaris ld. I've changed the affected places to use the double-dash
form that should always work.
* As described in https://reviews.llvm.org/D40899, Solaris ld doesn't create the
__start___sancov_guards/__stop___sancov_guards labels gld/gold/lld do, so I'm
including additional runtime libs into the link that provide them.
* One test uses -fstack-protector, but unlike other systems libssp hasn't been folded
into Solaris libc, but needs to be linked with separately.
* For now, only 32-bit x86 asan is enabled on Solaris. 64-bit x86 should follow, but
sparc (which requires additional compiler-rt changes not yet submitted) fails miserably
due to a llvmsparc backend limitation:
fatal error: error in backend: Function "_ZN7testing8internal16BoolFromGTestEnvEPKcb": over-aligned dynamic alloca not supported.
However, inside the gcc tree, Solaris/sparc asan works almost as well as x86.
Reviewers: rsmith, alekseyshl
Reviewed By: alekseyshl
Subscribers: jyknight, fedor.sergeev, cfe-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D40903
llvm-svn: 324296
Craig Topper [Mon, 5 Feb 2018 23:57:03 +0000 (23:57 +0000)]
[X86] Auto-generate complete checks. NFC
llvm-svn: 324295
Craig Topper [Mon, 5 Feb 2018 23:57:01 +0000 (23:57 +0000)]
[X86] Relax restrictions on what setcc condition codes can be folded with a sext when AVX512 is enabled.
We now allow all signed comparisons and not equal. The complement that needs to be added for this is no worse than the extend. And the vector output forms of pcmpeq/pcmpgt have better latency than the k-register version on SKX.
llvm-svn: 324294
Davide Italiano [Mon, 5 Feb 2018 23:51:57 +0000 (23:51 +0000)]
[testsuite] Skip a flakey test.
llvm-svn: 324293
Marshall Clow [Mon, 5 Feb 2018 23:50:49 +0000 (23:50 +0000)]
Add issues in 'Review'
llvm-svn: 324292
Peter Collingbourne [Mon, 5 Feb 2018 23:46:32 +0000 (23:46 +0000)]
LTO: Also include dso-local bit for calls in ThinLTO cache key.
Differential Revision: https://reviews.llvm.org/D42934
llvm-svn: 324291
Marshall Clow [Mon, 5 Feb 2018 23:43:34 +0000 (23:43 +0000)]
Remove <experimental/string_view>; use <string_view> instead. See https://libcxx.llvm.org/TS_deprecation.html
llvm-svn: 324290
Sanjay Patel [Mon, 5 Feb 2018 23:43:05 +0000 (23:43 +0000)]
[LoopStrengthReduce, x86] don't add cost for a cmp that will be macro-fused (PR35681)
In the motivating case from PR35681 and represented by the macro-fuse-cmp test:
https://bugs.llvm.org/show_bug.cgi?id=35681
...there's a 37 -> 31 byte size win for the loop because we eliminate the big base
address offsets.
SPEC2017 on Ryzen shows no significant perf difference.
Differential Revision: https://reviews.llvm.org/D42607
llvm-svn: 324289
Eugene Zemtsov [Mon, 5 Feb 2018 23:31:58 +0000 (23:31 +0000)]
Disable test_restart_bug failing on Android
llvm-svn: 324288
Jason Molenda [Mon, 5 Feb 2018 23:10:51 +0000 (23:10 +0000)]
Fix the cputype comparison in GDBRemoteCommunicationServerCommon::Handle_qHostInfo
to use Mach-O cpu types instead of the ArchSpec enum value, and handle the case
of bridgeos.
llvm-svn: 324287
Peter Collingbourne [Mon, 5 Feb 2018 23:09:13 +0000 (23:09 +0000)]
IRGen: Move vtable load after argument evaluation.
This change reduces the live range of the loaded function pointer,
resulting in a slight code size decrease (~10KB in clang), and also
improves the security of CFI for virtual calls by making it less
likely that the function pointer will be spilled, and ensuring that
it is not spilled across a function call boundary.
Fixes PR35353.
Differential Revision: https://reviews.llvm.org/D42725
llvm-svn: 324286
Francis Visoiu Mistrih [Mon, 5 Feb 2018 23:06:47 +0000 (23:06 +0000)]
[PEI] Fix failing test caused by r324283
X86FrameLowering sets stack size to 0 if redzone is enabled.
llvm-svn: 324285
Vitaly Buka [Mon, 5 Feb 2018 23:02:09 +0000 (23:02 +0000)]
[Sanitizers, Darwin] Disable SANITIZER_SUPPORTS_WEAK_HOOKS before Mac OS X 10.9
Summary:
Before Xcode 4.5, undefined weak symbols don't work reliably on Darwin:
https://stackoverflow.com/questions/6009321/weak-symbol-link-on-mac-os-x
Therefore this patch disables their use before Mac OS X 10.9 which is the first version
only supported by Xcode 4.5 and above.
Reviewers: glider, kcc, vitalybuka
Reviewed By: vitalybuka
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D41346
llvm-svn: 324284
Francis Visoiu Mistrih [Mon, 5 Feb 2018 22:46:54 +0000 (22:46 +0000)]
[PEI][NFC] Move StackSize opt-remark code next to -warn-stack code
This allows us to make sure we're always having the same sizes in both
remarks and warnings.
llvm-svn: 324283
Erik Pilkington [Mon, 5 Feb 2018 22:41:20 +0000 (22:41 +0000)]
[demangler] Refactor the type parser
Differential revision: https://reviews.llvm.org/D41889
llvm-svn: 324282
Adrian Prantl [Mon, 5 Feb 2018 22:35:46 +0000 (22:35 +0000)]
CMake: fix build directory name in clean rule
llvm-svn: 324281
Davide Italiano [Mon, 5 Feb 2018 22:31:59 +0000 (22:31 +0000)]
[lang/Objc] UNXFAIL a test. Nullability has been implemented in clang.
(a while ago).
<rdar://problem/
20416388>
llvm-svn: 324280
Paul Robinson [Mon, 5 Feb 2018 22:30:00 +0000 (22:30 +0000)]
Fix Windows bots for test from r324270.
llvm-svn: 324279
Daniel Neilson [Mon, 5 Feb 2018 22:23:58 +0000 (22:23 +0000)]
[LowerMemIntrinsics] Update uses of deprecated MemIntrinsic::getAlignment API (NFC)
Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
LowerMemIntrinsics pass to cease using the old getAlignment() API of MemoryIntrinsic in
favour of getting source & dest specific alignments through the new API.
Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.
Reference
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20151109/312083.html
llvm-svn: 324278
Benjamin Kramer [Mon, 5 Feb 2018 22:10:39 +0000 (22:10 +0000)]
[clangd] Add a cstring include for strerror.
Apparently this doesn't get included transitively on some systems.
llvm-svn: 324277
Sanjay Patel [Mon, 5 Feb 2018 21:50:32 +0000 (21:50 +0000)]
[InstCombine] don't try to evaluate instructions with >1 use (revert r324014)
This example causes a compile-time explosion:
define i16 @foo(i16 %in) {
%x = zext i16 %in to i32
%a1 = mul i32 %x, %x
%a2 = mul i32 %a1, %a1
%a3 = mul i32 %a2, %a2
%a4 = mul i32 %a3, %a3
%a5 = mul i32 %a4, %a4
%a6 = mul i32 %a5, %a5
%a7 = mul i32 %a6, %a6
%a8 = mul i32 %a7, %a7
%a9 = mul i32 %a8, %a8
%a10 = mul i32 %a9, %a9
%a11 = mul i32 %a10, %a10
%a12 = mul i32 %a11, %a11
%a13 = mul i32 %a12, %a12
%a14 = mul i32 %a13, %a13
%a15 = mul i32 %a14, %a14
%a16 = mul i32 %a15, %a15
%a17 = mul i32 %a16, %a16
%a18 = mul i32 %a17, %a17
%a19 = mul i32 %a18, %a18
%a20 = mul i32 %a19, %a19
%a21 = mul i32 %a20, %a20
%a22 = mul i32 %a21, %a21
%a23 = mul i32 %a22, %a22
%a24 = mul i32 %a23, %a23
%T = trunc i32 %a24 to i16
ret i16 %T
}
llvm-svn: 324276
Jan Kratochvil [Mon, 5 Feb 2018 21:50:01 +0000 (21:50 +0000)]
refactor: DWARFCompileUnit::Producer -> DWARFProducer
Differential revision: https://reviews.llvm.org/D42891
llvm-svn: 324275
Krzysztof Parzyszek [Mon, 5 Feb 2018 21:27:16 +0000 (21:27 +0000)]
[SDAG] Legalize all CondCodes by inverting them and/or swapping operands
Differential Revision: https://reviews.llvm.org/D42788
llvm-svn: 324274
Daniel Neilson [Mon, 5 Feb 2018 21:23:22 +0000 (21:23 +0000)]
[SimplifyLibCalls] Update from deprecated IRBuilder API for creating memory intrinsics (NFC)
Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
SimplifyLibCalls pass to cease using the old IRBuilder createMemCpy/createMemMove
single-alignment APIs in favour of the new API that allows setting source and destination
alignments independently.
Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, r3L24148 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.
Reference
http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-
20151109/312083.html
llvm-svn: 324273
Rafael Espindola [Mon, 5 Feb 2018 20:55:46 +0000 (20:55 +0000)]
Replace ApplyDynamicRelocs with WriteAddends.
The difference is that WriteAddends also takes IsRela into
consideration.
llvm-svn: 324271
Paul Robinson [Mon, 5 Feb 2018 20:43:15 +0000 (20:43 +0000)]
[DWARF] Regularize dumping strings from line tables.
The major visible difference here is that in line-table dumps,
directory and file names are wrapped in double-quotes; previously,
directory names got single quotes and file names were not quoted at
all.
The improvement in this patch is that when a DWARF v5 line table
header has indirect strings, in a verbose dump these will all have
their section[offset] printed as well as the name itself. This
matches the format used for dumping strings in the .debug_info
section.
Differential Revision: https://reviews.llvm.org/D42802
llvm-svn: 324270
Akira Hatanaka [Mon, 5 Feb 2018 20:23:22 +0000 (20:23 +0000)]
Add support for attribute 'trivial_abi'.
The 'trivial_abi' attribute can be applied to a C++ class, struct, or
union. It makes special functions of the annotated class (the destructor
and copy/move constructors) to be trivial for the purpose of calls and,
as a result, enables the annotated class or containing classes to be
passed or returned using the C ABI for the underlying type.
When a type that is considered trivial for the purpose of calls despite
having a non-trivial destructor (which happens only when the class type
or one of its subobjects is a 'trivial_abi' class) is passed to a
function, the callee is responsible for destroying the object.
For more background, see the discussions that took place on the mailing
list:
http://lists.llvm.org/pipermail/cfe-dev/2017-November/055955.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-
20180101/thread.html#214043
rdar://problem/
35204524
Differential Revision: https://reviews.llvm.org/D41039
llvm-svn: 324269
Kostya Kortchinsky [Mon, 5 Feb 2018 20:17:24 +0000 (20:17 +0000)]
[sanitizer] Revert rL324263
Summary:
The 32-bit division breaks SizeClassAllocator64PopulateFreeListOOM which uses
Primary that has a maximum size > 32-bit.
Reviewers: alekseyshl
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D42928
llvm-svn: 324268
Sanjay Patel [Mon, 5 Feb 2018 19:59:52 +0000 (19:59 +0000)]
[InstCombine] add test corresponding to r324252 (PR36225); NFC
As PR36225 shows, we definitely don't want to enable the
canEvaluate* logic with phis.
There's still a question of whether we should just revert
r324014 completely because it exposes a compile-time sinkhole
(although that problem might exist independently).
llvm-svn: 324266
Daniel Neilson [Mon, 5 Feb 2018 19:39:38 +0000 (19:39 +0000)]
Add release note on change to memcpy/memmove/memset builtin signatures
Summary:
The signatures for the builtins @llvm.memcpy, @llvm.memmove, and @llvm.memset
where changed in rL322965. The number of arguments has decreased from five to
four with the removal of the alignment argument. Alignment is now conveyed
by supplying the align parameter attribute on the destination and/or source of
the cpy/move/set.
llvm-svn: 324265
Rafael Espindola [Mon, 5 Feb 2018 19:39:04 +0000 (19:39 +0000)]
Change the default of --apply-dynamic-relocs.
When using Elf_Rela every tool should use the addend in the
relocation.
We have --apply-dynamic-relocs to work around bugs in tools that don't
do that.
The default value of --apply-dynamic-relocs should be false to make
sure these bugs are more easily found in the future.
llvm-svn: 324264
Kostya Kortchinsky [Mon, 5 Feb 2018 19:22:56 +0000 (19:22 +0000)]
[sanitizer] SizeClassMap minor improvement/correctness changes
Summary:
In `ClassID`, make sure we use an unsigned as based for the `lbits` shift.
The previous code resulted in spurious sign extensions like for x64:
```
add esi, 0FFFFFFFFh
movsxd rcx, esi
and rcx, r15
```
The code with the `U` added is:
```
add esi, 0FFFFFFFFh
and rsi, r15
```
And for `MaxCachedHint`, use a 32-bit division instead of `64-bit`, which is
faster (https://lemire.me/blog/2017/11/16/fast-exact-integer-divisions-using-floating-point-operations/)
and already used in other parts of the code (64-bit `GetChunkIdx`, 32-bit
`GetMetaData` enforce 32-bit divisions)
Not major performance gains by any mean, but they don't hurt.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: kubamracek, delcypher, llvm-commits, #sanitizers
Differential Revision: https://reviews.llvm.org/D42916
llvm-svn: 324263
Rui Ueyama [Mon, 5 Feb 2018 19:14:03 +0000 (19:14 +0000)]
Allow both -no-omagic and --no-omagic.
Any multi-character option that doesn't start with "o" should be
allowed to start both with "-" and "--".
llvm-svn: 324262
Nirav Dave [Mon, 5 Feb 2018 18:58:58 +0000 (18:58 +0000)]
[X86] Teach DAG unfoldMemoryOperand to reconvert CMPs to tests
Summary:
Copy MI-level cmp->test conversion to SelectionDAG-level memory unfold.
This fixes a regression from upcoming D41293 change.
Reviewers: craig.topper, RKSimon
Reviewed By: craig.topper
Subscribers: llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D42808
llvm-svn: 324261
Craig Topper [Mon, 5 Feb 2018 18:31:04 +0000 (18:31 +0000)]
[X86] Artificially lower the complexity of the scalar ANDN patterns so that AND with immediate will match first.
This allows the immediate to folded into the and instead of being forced to move into a register. This can sometimes result in shorter encodings since the and can sign extend an immediate.
This also allows us to match an and to a movzx after a not.
This can cause an extra move if the input to the separate NOT has an additional user which requires a copy before the NOT.
llvm-svn: 324260
Jonas Hahnfeld [Mon, 5 Feb 2018 18:19:40 +0000 (18:19 +0000)]
[Options] Make --cuda-path-ignore-env a Flag, NFCI.
This option doesn't take an argument!
llvm-svn: 324259
Kostya Kortchinsky [Mon, 5 Feb 2018 18:06:45 +0000 (18:06 +0000)]
[sanitizer] Allocator local cache improvements
Summary:
Here are a few improvements proposed for the local cache:
- `InitCache` always read from `per_class_[1]` in the fast path. This was not
ideal as we are working with `per_class_[class_id]`. The latter offers the
same property we are looking for (eg: `max_count != 0` means initialized),
so we might as well use it and keep our memory accesses local to the same
`per_class_` element. So change `InitCache` to take the current `PerClass`
as an argument. This also makes the fast-path assembly of `Deallocate` a lot
more compact;
- Change the 32-bit `Refill` & `Drain` functions to mimic their 64-bit
counterparts, by passing the current `PerClass` as an argument. This saves
some array computations;
- As far as I can tell, `InitCache` has no place in `Drain`: it's either called
from `Deallocate` which calls `InitCache`, or from the "upper" `Drain` which
checks for `c->count` to be greater than 0 (strictly). So remove it there.
- Move the `stats_` updates to after we are done with the `per_class_` accesses
in an attempt to preserve locality once more;
- Change some `CHECK` to `DCHECK`: I don't think the ones changed belonged in
the fast path and seemed to be overly cautious failsafes;
- Mark some variables as `const`.
The overall result is cleaner more compact fast path generated code, and some
performance gains with Scudo (and likely other Sanitizers).
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D42851
llvm-svn: 324257
Pavel Labath [Mon, 5 Feb 2018 18:03:02 +0000 (18:03 +0000)]
Add a comment explaining how the input for GetModuleSpecifications_EarlySectionHeaders was generated
Davide pointed out this would be useful if the file ever needs to be
regenerated (and I certainly agree).
I also replace the test binary with a slightly smaller one -- I intended
to do this in the original commit, but I forgot to add it to the patch
as I was juggling several things at the same time.
llvm-svn: 324256
Sanjay Patel [Mon, 5 Feb 2018 17:53:29 +0000 (17:53 +0000)]
[InstCombine] add unsigned saturation subtraction canonicalizations
This is the instcombine part of unsigned saturation canonicalization.
Backend patches already commited:
https://reviews.llvm.org/D37510
https://reviews.llvm.org/D37534
It converts unsigned saturated subtraction patterns to forms recognized
by the backend:
(a > b) ? a - b : 0 -> ((a > b) ? a : b) - b)
(b < a) ? a - b : 0 -> ((a > b) ? a : b) - b)
(b > a) ? 0 : a - b -> ((a > b) ? a : b) - b)
(a < b) ? 0 : a - b -> ((a > b) ? a : b) - b)
((a > b) ? b - a : 0) -> - ((a > b) ? a : b) - b)
((b < a) ? b - a : 0) -> - ((a > b) ? a : b) - b)
((b > a) ? 0 : b - a) -> - ((a > b) ? a : b) - b)
((a < b) ? 0 : b - a) -> - ((a > b) ? a : b) - b)
Patch by Yulia Koval!
Differential Revision: https://reviews.llvm.org/D41480
llvm-svn: 324255
Pavel Labath [Mon, 5 Feb 2018 17:25:40 +0000 (17:25 +0000)]
Fix parsing of object files with "early" section headers
ObjectFileELF::GetModuleSpecifications contained a lot of tip-toing code
which was trying to avoid loading the full object file into memory. It
did this by trying to load data only up to the offset if was accessing.
However, in practice this was useless, as 99% of object files we
encounter have section headers at the end, so we would load the whole
file as soon as we start parsing the section headers.
In fact, this would break as soon as we encounter a file which does
*not* have section headers at the end (yaml2obj produces these), as the
access to .strtab (which we need to get the section names) was not
guarded by this offset check.
As this strategy was completely ineffective anyway, I do not attempt to
proliferate it further by guarding the .strtab accesses. Instead I just
lead the full file as soon as we are reasonably sure that we are indeed
processing an elf file.
If we really care about the load size here, we would need to reimplement
this to just load the bits of the object file we need, instead of
loading everything from the start of the object file to the given
offset. However, given that the OS will do this for us for free when
using mmap, I think think this is really necessary.
For testing this I check a (tiny) SO file instead of yaml2obj-ing it
because the fact that they come out first is an implementation detail of
yaml2obj that can change in the future.
llvm-svn: 324254
Peter Collingbourne [Mon, 5 Feb 2018 17:17:51 +0000 (17:17 +0000)]
LTO: Include dso-local bit in ThinLTO cache key.
Differential Revision: https://reviews.llvm.org/D42713
llvm-svn: 324253
Sanjay Patel [Mon, 5 Feb 2018 17:16:50 +0000 (17:16 +0000)]
[InstCombine] only allow narrow/wide evaluation of values with >1 use if that user is a binop
There was a logic hole in D42739 / rL324014 because we're not accounting for select and phi
instructions that might have repeated operands. This is likely a source of an infinite loop.
I haven't manufactured a test case to prove that, but it should be safe to speculatively limit
this transform to binops while we try to create that test.
llvm-svn: 324252
Kamil Rytarowski [Mon, 5 Feb 2018 17:12:23 +0000 (17:12 +0000)]
Sync PlatformNetBSD.cpp with Linux
Summary:
Various changes in logging from log->Printf() to generic LLDB_LOG().
Sponsored by <The NetBSD Foundation>
Reviewers: labath, joerg
Reviewed By: labath
Subscribers: llvm-commits, lldb-commits
Differential Revision: https://reviews.llvm.org/D42912
llvm-svn: 324251
Krzysztof Parzyszek [Mon, 5 Feb 2018 17:12:07 +0000 (17:12 +0000)]
[Hexagon] Memoize instruction positions in BitTracker
llvm-svn: 324250
Craig Topper [Mon, 5 Feb 2018 16:54:07 +0000 (16:54 +0000)]
[X86] Teach X86DAGToDAGISel::shrinkAndImmediate to preserve upper 32 zeroes of a 64 bit mask.
If the upper 32 bits of a 64 bit mask are all zeros, we have special isel patterns to use a 32-bit and instead of a 64-bit and by relying on the impliciting zeroing of 32 bit ops.
This patch teachs shrinkAndImmediate not to break that optimization.
Differential Revision: https://reviews.llvm.org/D42899
llvm-svn: 324249
Hans Wennborg [Mon, 5 Feb 2018 16:10:42 +0000 (16:10 +0000)]
Revert r323472 "[Debug] Add dbg.value intrinsics for PHIs created during LCSSA."
This broke the Chromium build; see PR36238.
> This patch is an enhancement to propagate dbg.value information when
> Phis are created on behalf of LCSSA. I noticed a case where a value
> carried across a loop was reported as <optimized out>.
>
> Specifically this case:
>
> int bar(int x, int y) {
> return x + y;
> }
>
> int foo(int size) {
> int val = 0;
> for (int i = 0; i < size; ++i) {
> val = bar(val, i); // Both val and i are correct
> }
> return val; // <optimized out>
> }
>
> In the above case, after all of the interesting computation completes
> our value is reported as "optimized out." This change will add a
> dbg.value to correct this.
>
> This patch also moves the dbg.value insertion routine from
> LoopRotation.cpp into Local.cpp, so that we can share it in both places
> (LoopRotation and LCSSA).
>
> Patch by Matt Davis!
>
> Differential Revision: https://reviews.llvm.org/D42551
llvm-svn: 324247
Mark Zeren [Mon, 5 Feb 2018 15:59:00 +0000 (15:59 +0000)]
[clang-format] Re-land: Fixup #include guard indents after parseFile()
Summary:
When a preprocessor indent closes after the last line of normal code we do not
correctly fixup include guard indents. For example:
#ifndef HEADER_H
#define HEADER_H
#if 1
int i;
# define A 0
#endif
#endif
incorrectly reformats to:
#ifndef HEADER_H
#define HEADER_H
#if 1
int i;
# define A 0
# endif
#endif
To resolve this issue we must fixup levels after parseFile(). Delaying
the fixup introduces a new state, so consolidate include guard search
state into an enum.
Reviewers: krasimir, klimek
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42035
llvm-svn: 324246
Benjamin Kramer [Mon, 5 Feb 2018 15:56:24 +0000 (15:56 +0000)]
BitTracker.h needs a full definition of MachineInstr, so include the defining file.
Patch by Dean Sturtevant!
Differential Revision: https://reviews.llvm.org/D42907
llvm-svn: 324245
Krzysztof Parzyszek [Mon, 5 Feb 2018 15:52:54 +0000 (15:52 +0000)]
[Hexagon] Forgot about HexagonISD::VZERO in selecting const vectors
llvm-svn: 324244
Krzysztof Parzyszek [Mon, 5 Feb 2018 15:46:41 +0000 (15:46 +0000)]
[Hexagon] Don't use garbage mask in HvxSelector::shuffp2
The function shuffp2 was breaking up a wide shuffle into a pair of
narrower ones, except that the narrower shuffle masks were actually
uninitialized.
llvm-svn: 324243
Teresa Johnson [Mon, 5 Feb 2018 15:44:27 +0000 (15:44 +0000)]
[ThinLTO] Convert dead alias to declarations
Summary:
This complements the fixes in r323633 and r324075 which drop the
definitions of dead functions and variables, respectively.
Fixes PR36208.
Reviewers: grimar, rafael
Subscribers: mehdi_amini, llvm-commits, inglorion
Differential Revision: https://reviews.llvm.org/D42856
llvm-svn: 324242
Krzysztof Parzyszek [Mon, 5 Feb 2018 15:40:06 +0000 (15:40 +0000)]
[Hexagon] Use V6_vmpyih for halfword multiplication
Unlike V6_vmpyhv, it produces the result in the exact form that is
expected without the need for a shuffle.
llvm-svn: 324241
Kamil Rytarowski [Mon, 5 Feb 2018 14:50:01 +0000 (14:50 +0000)]
Handle NetBSD symbol mangling devname -> __devname50
llvm-svn: 324240
Mark Zeren [Mon, 5 Feb 2018 14:47:04 +0000 (14:47 +0000)]
Revert "[clang-format] Fixup #include guard indents after parseFile()"
This reverts r324238 | mzeren-vmw | 2018-02-05 06:35:54 -0800 (Mon, 05 Feb 2018) | 35 lines
Incorrect version pushed upstream.
llvm-svn: 324239
Mark Zeren [Mon, 5 Feb 2018 14:35:54 +0000 (14:35 +0000)]
[clang-format] Fixup #include guard indents after parseFile()
Summary:
When a preprocessor indent closes after the last line of normal code we do not
correctly fixup include guard indents. For example:
#ifndef HEADER_H
#define HEADER_H
#if 1
int i;
# define A 0
#endif
#endif
incorrectly reformats to:
#ifndef HEADER_H
#define HEADER_H
#if 1
int i;
# define A 0
# endif
#endif
To resolve this issue we must fixup levels after parseFile(). Delaying
the fixup introduces a new state, so consolidate include guard search
state into an enum.
Reviewers: krasimir, klimek
Reviewed By: krasimir
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42035
llvm-svn: 324238
Dmitry Preobrazhensky [Mon, 5 Feb 2018 14:18:53 +0000 (14:18 +0000)]
[AMDGPU][MC] Corrected dst/data size for MIMG opcodes with d16 modifier
See bug 36154: https://bugs.llvm.org/show_bug.cgi?id=36154
Differential Revision: https://reviews.llvm.org/D42847
Reviewers: cfang, artem.tamazov, arsenm
llvm-svn: 324237
Pavel Labath [Mon, 5 Feb 2018 14:07:44 +0000 (14:07 +0000)]
Skip TestTargetSymbolsSepDebugSymlink on remote targets
Currently, our behavior when installing symlinks on the remote target is
broken (pr36237).
llvm-svn: 324236
Haojian Wu [Mon, 5 Feb 2018 13:23:48 +0000 (13:23 +0000)]
[clang-tidy] Fix incorrect code indention in the doc.
llvm-svn: 324235
Kamil Rytarowski [Mon, 5 Feb 2018 13:16:22 +0000 (13:16 +0000)]
Fix a crash in *NetBSD::Factory::Launch
Summary:
We cannot call process_up->SetState() inside
the NativeProcessNetBSD::Factory::Launch
function because it triggers a NULL pointer
deference.
The generic code for launching a process in:
GDBRemoteCommunicationServerLLGS::LaunchProcess
sets the m_debugged_process_up pointer after
a successful call to m_process_factory.Launch().
If we attempt to call process_up->SetState()
inside a platform specific Launch function we
end up dereferencing a NULL pointer in
NativeProcessProtocol::GetCurrentThreadID().
Use the proper call process_up->SetState(,false)
that sets notify_delegates to false.
Sponsored by <The NetBSD Foundation>
Reviewers: labath, joerg
Reviewed By: labath
Subscribers: lldb-commits
Differential Revision: https://reviews.llvm.org/D42868
llvm-svn: 324234
Haojian Wu [Mon, 5 Feb 2018 13:04:41 +0000 (13:04 +0000)]
[clang-tidy] tweak "misc-definitions-in-headers" doc, NFC.
llvm-svn: 324233
Igor Laevsky [Mon, 5 Feb 2018 12:47:40 +0000 (12:47 +0000)]
[llvm-opt-fuzzer] Fix build after rL324225
llvm-svn: 324232
Dmitry Preobrazhensky [Mon, 5 Feb 2018 12:45:43 +0000 (12:45 +0000)]
[AMDGPU][MC] Added validation of d16 and r128 modifiers of MIMG opcodes
See bugs 36094, 36095:
https://bugs.llvm.org/show_bug.cgi?id=36094
https://bugs.llvm.org/show_bug.cgi?id=36095
Differential Revision: https://reviews.llvm.org/D42692
Reviewers: vpykhtin, artem.tamazov, arsenm
llvm-svn: 324231
Pavel Labath [Mon, 5 Feb 2018 12:34:09 +0000 (12:34 +0000)]
TestLinuxCore -- add a check for thread name
We've had a bug (fixed by https://reviews.llvm.org/D42828) where the
thread name was being read incorrectly. Add a test for this behavior.
llvm-svn: 324230
Hiroshi Inoue [Mon, 5 Feb 2018 12:25:29 +0000 (12:25 +0000)]
[PowerPC] Check hot loop exit edge in PPCCTRLoops
PPCCTRLoops transform loops using mtctr/bdnz instructions if loop trip count is known and big enough to compensate for the cost of mtctr.
But if there is a loop exit edge which is known to be frequently taken (by builtin_expect or by PGO), we should not transform the loop to avoid the cost of mtctr instruction. Here is an example of a loop with hot exit edge:
for (unsigned i = 0; i < TripCount; i++) {
// do something
if (__builtin_expect(check(), 1))
break;
// do something
}
Differential Revision: https://reviews.llvm.org/D42637
llvm-svn: 324229
Clement Courbet [Mon, 5 Feb 2018 12:23:51 +0000 (12:23 +0000)]
[CodeGenSchedule][NFC] Always emit ProcResourceUnits.
Summary:
Right now only the ProcResourceUnits that are directly referenced by
instructions are emitted. This change emits all of them, so that
analysis passes can use the information.
This has no functional impact. It typically adds a few entries (e.g. 4
for X86/haswell) to the generated ProcRes table.
Reviewers: gchatelet
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42903
llvm-svn: 324228
Jonas Devlieghere [Mon, 5 Feb 2018 11:39:04 +0000 (11:39 +0000)]
[test] Un-XFAIL TestRaise.RaiseTestCase.test_restart_bug
This test was marked as an expected failure because of PR20231 but it
seems to consistently result in an unexpected success across the bots.
Let's try to re-enable this test again.
llvm-svn: 324227
Pavel Labath [Mon, 5 Feb 2018 11:30:46 +0000 (11:30 +0000)]
[dotest] make debug info variant accessible in setUp()
Summary:
This changes the way we store the debug info variant to make it
available earlier in the test bringup: instead of it being set by the
test wrapper method, it is set as a *property* of the wrapper method.
This way, we can inspect it as soon as self.testMethodName is
initialized. The retrieval is implemented by a new function
TestBase.getDebugInfo(), and all that's necessary to make it work is to
change self.debug_info into self.getDebugInfo().
While searching for debug_info occurences i noticed that TestLogging is
being replicated for no good reason, so I removed the replication there.
Reviewers: aprantl, jingham
Subscribers: eraman, JDevlieghere, lldb-commits
Differential Revision: https://reviews.llvm.org/D42836
llvm-svn: 324226
Igor Laevsky [Mon, 5 Feb 2018 11:05:47 +0000 (11:05 +0000)]
[llvm-opt-fuzzer] Avoid adding incorrect inputs to the fuzzer corpus
Differential Revision: https://reviews.llvm.org/D42414
llvm-svn: 324225
Jan Kratochvil [Mon, 5 Feb 2018 10:50:38 +0000 (10:50 +0000)]
Resolve binary symlinks before finding its separate .debug file
I have found LLDB cannot find separate debug info of Fedora /usr/bin/gdb.
It is because:
lrwxrwxrwx 1 root root 14 Jan 25 20:41 /usr/bin/gdb -> ../libexec/gdb*
-rwxr-xr-x 1 root root
10180296 Jan 25 20:41 /usr/libexec/gdb*
ls: cannot access '/usr/lib/debug/usr/bin/gdb-8.0.1-35.fc27.x86_64.debug': No such file or directory
-r--r--r-- 1 root root
29200464 Jan 25 20:41 /usr/lib/debug/usr/libexec/gdb-8.0.1-35.fc27.x86_64.debug
FYI that -8.0.1-35.fc27.x86_64.debug may look confusing, it was always just
.debug before.
Why is /usr/bin/gdb a symlink is offtopic for this bugreport, Fedora has it so
for some reasons.
It is always safest to look at the .debug file only after resolving all
symlinks on the binary file.
Differential revision: https://reviews.llvm.org/D42853
llvm-svn: 324224
James Henderson [Mon, 5 Feb 2018 10:47:13 +0000 (10:47 +0000)]
Fix more print format specifiers in debug_rnglists dumping
See also r324096.
I have made the assumption that DWARF64 is not an issue for the time
being with these fixes.
llvm-svn: 324223
Jan Kratochvil [Mon, 5 Feb 2018 10:46:56 +0000 (10:46 +0000)]
Fix upper->lower case for /usr/lib/debug/.build-id/**.debug
I have found the lookup by build-id
(when lookup by /usr/lib/debug/path/name/exec.debug failed) does not work as
LLDB tries the build-id hex string in uppercase but Fedora uses lowercase.
xubuntu-16.10 also uses lowercase during my test:
/usr/lib/debug/.build-id/6c/
61f3566329f43d03f812ae7057e9e7391b5ff6.debug
Differential revision: https://reviews.llvm.org/D42852
llvm-svn: 324222
Peter Smith [Mon, 5 Feb 2018 10:15:08 +0000 (10:15 +0000)]
[ELF] Implement --[no-]apply-dynamic-relocs option.
When resolving dynamic RELA relocations the addend is taken from the
relocation and not the place being relocated. Accordingly lld does not
write the addend field to the place like it would for a REL relocation.
Unfortunately there is some system software, in particlar dynamic loaders
such as Bionic's linker64 that use the value of the place prior to
relocation to find the offset that they have been loaded at. Both gold
and bfd control this behavior with the --[no-]apply-dynamic-relocs option.
This change implements the option and defaults it to true for compatibility
with gold and bfd.
Differential Revision: https://reviews.llvm.org/D42797
llvm-svn: 324221
Haojian Wu [Mon, 5 Feb 2018 10:14:16 +0000 (10:14 +0000)]
[clangd] Expclictly set the init value of -assume-header-dir option, NFC.
llvm-svn: 324220
George Rimar [Mon, 5 Feb 2018 09:47:24 +0000 (09:47 +0000)]
[ELF] - Report valid binary filename when reporting error.
We did not report valid filename for duplicate symbol error when
symbol came from binary input file.
Patch fixes it.
Differential revision: https://reviews.llvm.org/D42635
llvm-svn: 324217
Serguei Katkov [Mon, 5 Feb 2018 09:05:43 +0000 (09:05 +0000)]
Revert [SimplifyCFG] Relax restriction for folding unconditional branches
The patch causes the failure of the test
compiler-rt/test/profile/Linux/counter_promo_nest.c
To unblock buildbot, revert the patch while investigation is in progress.
Differential Revision: https://reviews.llvm.org/D42691
llvm-svn: 324214
Craig Topper [Mon, 5 Feb 2018 08:37:37 +0000 (08:37 +0000)]
[X86] Add isel patterns for selecting masked SUBV_BROADCAST with bitcasts. Remove combineBitcastForMaskedOp.
Add test cases for the merge masked versions to make sure we have all those covered.
llvm-svn: 324210
Max Kazantsev [Mon, 5 Feb 2018 08:09:49 +0000 (08:09 +0000)]
[NFC] Add tests for PR35743
llvm-svn: 324209
Serguei Katkov [Mon, 5 Feb 2018 07:56:43 +0000 (07:56 +0000)]
[SimplifyCFG] Relax restriction for folding unconditional branches
The commit rL308422 introduces a restriction for folding unconditional
branches. Specifically if empty block with unconditional branch leads to
header of the loop then elimination of this basic block is prohibited.
However it seems this condition is redundantly strict.
If elimination of this basic block does not introduce more back edges
then we can eliminate this block.
The patch implements this relax of restriction.
Reviewers: efriedma, mcrosier, pacxx, hsung, davidxl
Reviewed By: pacxx
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42691
llvm-svn: 324208
Craig Topper [Mon, 5 Feb 2018 06:56:33 +0000 (06:56 +0000)]
[X86] Remove unused lambda. NFC
llvm-svn: 324206
Craig Topper [Mon, 5 Feb 2018 06:00:23 +0000 (06:00 +0000)]
[X86] Remove X86ISD::SHUF128 from combineBitcastForMaskedOp. Use isel patterns instead.
We always created X86ISD::SHUF128 with a 64-bit element type so we can use isel patterns to detect a bitconvert to 32-bit to handle masking.
The test changes are because we also match the bitconvert even if there is no masking. This leads to unnecessary isel pattern, but it requires more multiclass hackery in tablegen to get rid of it.
llvm-svn: 324205
Serguei Katkov [Mon, 5 Feb 2018 05:49:47 +0000 (05:49 +0000)]
Re-apply [SCEV] Fix isLoopEntryGuardedByCond usage
ScalarEvolution::isKnownPredicate invokes isLoopEntryGuardedByCond without check
that SCEV is available at entry point of the loop. It is incorrect and fixed by patch.
To bugs additionally fixed:
assert is moved after the check whether loop is not a nullptr.
Usage of isLoopEntryGuardedByCond in ScalarEvolution::isImpliedCondOperandsViaNoOverflow
is guarded by isAvailableAtLoopEntry.
Reviewers: sanjoy, mkazantsev, anna, dorit, reames
Reviewed By: mkazantsev
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42417
llvm-svn: 324204
Erik Pilkington [Mon, 5 Feb 2018 02:34:41 +0000 (02:34 +0000)]
[demangler] return early if conditional expr parsing failed
This should fix some bugs found by oss-fuzz.
llvm-svn: 324203
Craig Topper [Sun, 4 Feb 2018 23:48:51 +0000 (23:48 +0000)]
[X86] Auto-generate full checks. NFC
llvm-svn: 324202
Daniil Fukalov [Sun, 4 Feb 2018 22:32:07 +0000 (22:32 +0000)]
Recommit rL323890: [AMDGPU] Add ds_fadd, ds_fmin, ds_fmax builtins functions
Fixed asserts in tests.
llvm-svn: 324201
Zvi Rackover [Sun, 4 Feb 2018 19:31:14 +0000 (19:31 +0000)]
X86 Tests: Add shuffle that can be improved by widening elements. NFC
To be improved by D42044
llvm-svn: 324200
Florian Hahn [Sun, 4 Feb 2018 18:40:24 +0000 (18:40 +0000)]
[PartialInliner] Update test (NFC).
llvm-svn: 324199
Florian Hahn [Sun, 4 Feb 2018 18:27:47 +0000 (18:27 +0000)]
[InlineFunction] Set arg attrs even if there only are VarArg attrs.
When using the partial inliner, we might have attributes for forwarded
varargs, but the CodeExtractor does not create an empty argument
attribute set for regular arguments in that case, because it does not know
of the additional arguments. So in case we have attributes for VarArgs, we
also have to make sure we create (empty) attributes for all regular arguments.
This fixes PR36210.
llvm-svn: 324197
Sander de Smalen [Sun, 4 Feb 2018 16:24:17 +0000 (16:24 +0000)]
[TableGen][AsmMatcherEmitter] Fix tied-constraint checking for InstAliases
Summary:
This is a bit of a reimplementation the work done in
https://reviews.llvm.org/D41446, since that patch only really works for
tied operands of instructions, not aliases.
Instead of checking the constraints based on the matched instruction's opcode,
this patch uses the match-info's convert function to check the operand
constraints for that specific instruction/alias.
This is based on the matched operands for the instruction, not the
resulting opcode of the MCInst.
This patch adds the following enum/table to the *GenAsmMatcher.inc file:
enum {
Tie0_1_1,
Tie0_1_2,
Tie0_1_5,
...
};
const char TiedAsmOperandTable[][3] = {
/* Tie0_1_1 */ { 0, 1, 1 },
/* Tie0_1_2 */ { 0, 1, 2 },
/* Tie0_1_5 */ { 0, 1, 5 },
...
};
And it is referenced directly in the ConversionTable, like this:
static const uint8_t ConversionTable[CVT_NUM_SIGNATURES][13] = {
...
{ CVT_95_addRegOperands, 1,
CVT_95_addRegOperands, 2,
CVT_Tied, Tie0_1_5,
CVT_95_addRegOperands, 6, CVT_Done },
...
The Tie0_1_5 (and corresponding table) encodes that:
* Result operand 0 is the operand to copy (which is e.g. done when
building up the operands to the MCInst in convertToMCInst())
* Asm operands 1 and 5 should be the same operands (which is checked
in checkAsmTiedOperandConstraints()).
Reviewers: olista01, rengolin, fhahn, craig.topper, echristo, apazos, dsanders
Reviewed By: olista01
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42293
llvm-svn: 324196
Chad Rosier [Sun, 4 Feb 2018 15:42:24 +0000 (15:42 +0000)]
[LV] Use Demanded Bits and ValueTracking for reduction type-shrinking
The type-shrinking logic in reduction detection, although narrow in scope, is
also rather ad-hoc, which has led to bugs (e.g., PR35734). This patch modifies
the approach to rely on the demanded bits and value tracking analyses, if
available. We currently perform type-shrinking separately for reductions and
other instructions in the loop. Long-term, we should probably think about
computing minimal bit widths in a more complete way for the loops we want to
vectorize.
PR35734
Differential Revision: https://reviews.llvm.org/D42309
llvm-svn: 324195
Eric Fiselier [Sun, 4 Feb 2018 08:02:35 +0000 (08:02 +0000)]
Fix initialization of array<const T, 0> with GCC.
Previously, when handling zero-sized array of const objects we
used a const version of aligned_storage_t, which is not an array type.
However, GCC complains about initialization of the form: array<const T, 0> arr = {};
This patch fixes that bug by making the dummy object used to represent
the zero-sized array an array itself. This avoids GCC's complaints
about the uninitialized const member.
llvm-svn: 324194
Eric Fiselier [Sun, 4 Feb 2018 07:37:09 +0000 (07:37 +0000)]
Mark LWG 3014 as complete. No code changes needed
llvm-svn: 324193
Eric Fiselier [Sun, 4 Feb 2018 07:35:36 +0000 (07:35 +0000)]
Implement LWG 3014 - Fix more noexcept issues in filesystem.
This patch removes the noexcept declaration from filesystem
operations which require creating temporary paths or
creating a directory iterator. Either of these operations
can throw.
llvm-svn: 324192
Eric Fiselier [Sun, 4 Feb 2018 07:29:53 +0000 (07:29 +0000)]
Mark LWG 3013 as already complete. See r316941
llvm-svn: 324191
Eric Fiselier [Sun, 4 Feb 2018 03:26:55 +0000 (03:26 +0000)]
Remove debug println from rec.dir.itr.increment test
llvm-svn: 324190
Eric Fiselier [Sun, 4 Feb 2018 03:10:53 +0000 (03:10 +0000)]
Implement LWG2989: path's streaming operators allow everything under the sun.
Because path can be constructed from a ton of different types, including string
and wide strings, this caused it's streaming operators to suck up all sorts
of silly types via silly conversions. For example:
using namespace std::experimental::filesystem::v1;
std::wstring w(L"wide");
std::cout << w; // converts to path.
This patch tentatively adopts the resolution to LWG2989 and fixes the issue
by making the streaming operators friends of path.
llvm-svn: 324189
Eric Fiselier [Sun, 4 Feb 2018 02:45:33 +0000 (02:45 +0000)]
Mark issue 2851 as complete
llvm-svn: 324188
Eric Fiselier [Sun, 4 Feb 2018 02:43:32 +0000 (02:43 +0000)]
Address LWG 2849 and fix missing failure condition in copy_file.
Previously copy_file didn't handle the case where the input and
output were the same file.
llvm-svn: 324187
Eric Fiselier [Sun, 4 Feb 2018 02:22:33 +0000 (02:22 +0000)]
correct comment about C++03 assignment operators
llvm-svn: 324186