Sanjay Patel [Fri, 4 Aug 2017 22:30:34 +0000 (22:30 +0000)]
[InstCombine] narrow truncated add/sub/mul with constant
Name: narrow_sub
%sub = sub i32 C1, %x
%r = trunc i32 %sub to i8
=>
%xn = trunc i32 %x to i8
%narrowC = trunc i32 C1 to i8
%r = sub i8 %narrowC, %xn
Name: narrow_add
%add = add i32 %x, C1
%r = trunc i32 %add to i8
=>
%xn = trunc i32 %x to i8
%narrowC = trunc i32 C1 to i8
%r = add i8 %xn, %narrowC
Name: narrow_mul
%mul = mul i32 %x, C1
%r = trunc i32 %mul to i8
=>
%xn = trunc i32 %x to i8
%narrowC = trunc i32 C1 to i8
%r = mul i8 %xn, %narrowC
http://rise4fun.com/Alive/QpS
This doesn't solve PR34046 (failure to recognize rotate):
https://bugs.llvm.org/show_bug.cgi?id=34046
...but it reduces an extra complication in the description examples
to a form that we can more easily match.
llvm-svn: 310141
Kamil Rytarowski [Fri, 4 Aug 2017 22:27:01 +0000 (22:27 +0000)]
Add NetBSD support in interception.h
Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, kcc, filcab, vitalybuka
Reviewed By: vitalybuka
Subscribers: llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36323
llvm-svn: 310140
Kamil Rytarowski [Fri, 4 Aug 2017 22:23:52 +0000 (22:23 +0000)]
Add NetBSD support in sanitizer_syscall_generic.inc
Summary:
This adds:
- NetBSD specific aliases for renamed syscalls,
- differentiate internal_syscall, internal_syscall64, internal_syscall_ptr as there are various types of syscalls on NetBSD.
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, kcc, vitalybuka, filcab
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D36316
llvm-svn: 310139
Reid Kleckner [Fri, 4 Aug 2017 21:52:25 +0000 (21:52 +0000)]
[libclang] Determinize order of platform availability attrs
Previously this code was doing std::sort on IdentifierInfo pointers. Now
it sorts alphabetically by platform name.
This should de-flake clang/test/Index/availability.c, which was failing
non-deterministically for me.
llvm-svn: 310138
Reid Kleckner [Fri, 4 Aug 2017 21:52:00 +0000 (21:52 +0000)]
[Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows
Summary:
Tools like clang that use RemoveFileOnSignal on their output files
weren't actually able to clean up their outputs before this change. Now
the call to llvm::sys::fs::remove succeeds and the temporary file is
deleted. This is a stop-gap to fix clang before implementing the
solution outlined in PR34070.
Reviewers: davide
Subscribers: llvm-commits, hiraditya
Differential Revision: https://reviews.llvm.org/D36337
llvm-svn: 310137
Kostya Serebryany [Fri, 4 Aug 2017 21:35:11 +0000 (21:35 +0000)]
[libFuzzer] add -fsanitize-coverage-pc-table to -fsanitize=fuzzer
llvm-svn: 310136
Alexey Bataev [Fri, 4 Aug 2017 21:27:11 +0000 (21:27 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."
This reverts commit r310104.
llvm-svn: 310135
Alexey Bataev [Fri, 4 Aug 2017 21:26:25 +0000 (21:26 +0000)]
Revert "[OPENMP] Fix for pacify buildbots, NFC."
This reverts commit r310120.
llvm-svn: 310134
Kostya Kortchinsky [Fri, 4 Aug 2017 21:26:20 +0000 (21:26 +0000)]
[asan] Fix unsupported test on Android
Summary:
`pvalloc` appears to not be available on Android. Mark the failing test as
unsupported on that platform.
Reviewers: alekseyshl, vitalybuka
Reviewed By: alekseyshl, vitalybuka
Subscribers: srhines, kubamracek, llvm-commits
Differential Revision: https://reviews.llvm.org/D36339
llvm-svn: 310133
Vlad Tsyrklevich [Fri, 4 Aug 2017 21:21:00 +0000 (21:21 +0000)]
Reland "CFI: blacklist STL allocate() from unrelated-casts"
Reland r310097 with a fix for a debug assertion in NamedDecl.getName()
Differential Revision: https://reviews.llvm.org/D36294
llvm-svn: 310132
Zachary Turner [Fri, 4 Aug 2017 21:18:17 +0000 (21:18 +0000)]
More PDB buildbot fixes.
llvm-svn: 310131
Zachary Turner [Fri, 4 Aug 2017 21:15:12 +0000 (21:15 +0000)]
Fix broken PDB tests.
llvm-svn: 310130
Kyle Butt [Fri, 4 Aug 2017 21:13:41 +0000 (21:13 +0000)]
BlockPlacement: add a flag to force cold block outlining w/o a profile.
NFC.
llvm-svn: 310129
Zachary Turner [Fri, 4 Aug 2017 21:10:04 +0000 (21:10 +0000)]
[pdbutil] When dumping section contribs, show the section name.
llvm-svn: 310128
Petr Hosek [Fri, 4 Aug 2017 21:09:26 +0000 (21:09 +0000)]
Reland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"
This change adds the "-O binary" flag which directs llvm-objcopy to
output the object file to the same format as GNU objcopy does when given
the flag "-O binary". This was done by splitting the Object class into
two subclasses ObjectELF and ObjectBianry which each output a different
format but relay on the same code to read in the Object in Object.
Patch by Jake Ehrlich
Differential Revision: https://reviews.llvm.org/D34480
llvm-svn: 310127
Kostya Serebryany [Fri, 4 Aug 2017 20:47:22 +0000 (20:47 +0000)]
[libFuzzer] re-enable fuzzer-printcovpcs.test
llvm-svn: 310126
Adrian Prantl [Fri, 4 Aug 2017 20:41:37 +0000 (20:41 +0000)]
Remove unused include directive and un-break the module build.
llvm-svn: 310124
Nico Weber [Fri, 4 Aug 2017 20:40:38 +0000 (20:40 +0000)]
Revert r310055, it caused PR34074.
llvm-svn: 310123
Sanjay Patel [Fri, 4 Aug 2017 20:38:33 +0000 (20:38 +0000)]
[InstCombine] add vector tests for truncated math; NFC
llvm-svn: 310122
Vlad Tsyrklevich [Fri, 4 Aug 2017 20:37:49 +0000 (20:37 +0000)]
Revert "Reland "CFI: blacklist STL allocate() from unrelated-casts""
This reverts commit r310105.
llvm-svn: 310121
Alexey Bataev [Fri, 4 Aug 2017 20:29:52 +0000 (20:29 +0000)]
[OPENMP] Fix for pacify buildbots, NFC.
llvm-svn: 310120
Kostya Kortchinsky [Fri, 4 Aug 2017 20:28:59 +0000 (20:28 +0000)]
[asan] Check for pvalloc overlow
Summary:
Last one of the `pvalloc` overflow checks!
`CheckForPvallocOverflow` was introduced with D35818 to detect when `pvalloc`
would wrap when rounding up to the next multiple of the page size.
Add this check to ASan's `pvalloc` implementation.
Reviewers: alekseyshl
Reviewed By: alekseyshl
Subscribers: llvm-commits, kubamracek
Differential Revision: https://reviews.llvm.org/D36257
llvm-svn: 310119
Nico Weber [Fri, 4 Aug 2017 20:24:13 +0000 (20:24 +0000)]
Revert r310058, it caused PR34073.
llvm-svn: 310118
Amara Emerson [Fri, 4 Aug 2017 20:19:46 +0000 (20:19 +0000)]
[SCEV] Preserve NSW information for sext(subtract).
Pushes the sext onto the operands of a Sub if NSW is present.
Also adds support for propagating the nowrap flags of the
llvm.ssub.with.overflow intrinsic during analysis.
Differential Revision: https://reviews.llvm.org/D35256
llvm-svn: 310117
Kamil Rytarowski [Fri, 4 Aug 2017 20:17:24 +0000 (20:17 +0000)]
Add NetBSD support in sanitizer_procmaps_freebsd.cc
Summary:
This adds NetBSD specific:
- ReadProcMaps()
- MemoryMappingLayout::Next()
This code is largely shared with FreeBSD.
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.
Sponsored by <The NetBSD Foundation>
Reviewers: kcc, joerg, filcab, vitalybuka, fjricci
Reviewed By: fjricci
Subscribers: emaste, kubamracek, mgorny, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D35551
llvm-svn: 310116
Quentin Colombet [Fri, 4 Aug 2017 20:15:46 +0000 (20:15 +0000)]
[GlobalISel] Remove the GISelAccessor API.
Its sole purpose was to avoid spreading around ifdefs related to
building global-isel. Since r309990, GlobalISel is not optional anymore,
thus, we can get rid of this mechanism all together.
NFC.
llvm-svn: 310115
Quentin Colombet [Fri, 4 Aug 2017 20:15:41 +0000 (20:15 +0000)]
[GlobalISel] Remove a stall comment in CMake.
Thanks to Diana Picus <diana.picus@linaro.org> for noticing.
NFC
llvm-svn: 310114
Kostya Serebryany [Fri, 4 Aug 2017 20:09:15 +0000 (20:09 +0000)]
[libFuzzer] make a test more robust
llvm-svn: 310113
Zachary Turner [Fri, 4 Aug 2017 20:07:08 +0000 (20:07 +0000)]
Fix build breakage.
llvm-svn: 310112
Nico Weber [Fri, 4 Aug 2017 20:06:03 +0000 (20:06 +0000)]
minor grammar fix
llvm-svn: 310111
Kostya Serebryany [Fri, 4 Aug 2017 20:05:25 +0000 (20:05 +0000)]
[libFuzzer] remove the now redundant 'LLVMFuzzer-' prefix from libFuzzer tests
llvm-svn: 310110
Vlad Tsyrklevich [Fri, 4 Aug 2017 20:04:01 +0000 (20:04 +0000)]
CFI: Move STL allocator blacklist to clang
Summary:
The regular expression to match STL allocators can't easily account for
C++ mangling compression and fails to match some valid instances of STL
allocators. Perform this logic in clang instead.
Motivated by crbug.com/751385.
Reviewers: pcc, kcc, llvm-commits
Reviewed By: pcc
Differential Revision: https://reviews.llvm.org/D36291
llvm-svn: 310109
Zachary Turner [Fri, 4 Aug 2017 20:02:55 +0000 (20:02 +0000)]
[lld] Write the absolute PDB path to the debug directory.
This matches the behavior of MSVC's linker.
Differential Revision: https://reviews.llvm.org/D36334
llvm-svn: 310108
Zachary Turner [Fri, 4 Aug 2017 20:02:38 +0000 (20:02 +0000)]
[llvm-pdbutil] Dump image section headers.
Image section headers are stored in the DBI stream, but we
had no way to dump them. This patch adds dumping support,
along with some tests that LLD actually dumps them correctly.
Differential Revision: https://reviews.llvm.org/D36332
llvm-svn: 310107
Kostya Serebryany [Fri, 4 Aug 2017 20:01:04 +0000 (20:01 +0000)]
[libFuzzer] split one test into several
llvm-svn: 310106
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:50:39 +0000 (19:50 +0000)]
Reland "CFI: blacklist STL allocate() from unrelated-casts"
Reland r310097 with a unit test fix for MS ABI build bots.
Differential Revision: https://reviews.llvm.org/D36294
llvm-svn: 310105
Alexey Bataev [Fri, 4 Aug 2017 19:46:10 +0000 (19:46 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.
Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.
Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.
llvm-svn: 310104
Siddharth Bhat [Fri, 4 Aug 2017 19:36:40 +0000 (19:36 +0000)]
[PPCGCodeGeneration] [NFC] Log every location from which PPCGCodegen bails.
This is useful when trying to understand why no GPU code was produced.
Differential Revision: https://reviews.llvm.org/D36318
llvm-svn: 310103
Sanjay Patel [Fri, 4 Aug 2017 19:29:32 +0000 (19:29 +0000)]
[InstCombine] auto-generate test checks; NFC
llvm-svn: 310101
George Karpenkov [Fri, 4 Aug 2017 19:29:16 +0000 (19:29 +0000)]
[libFuzzer tests] Only enable libFuzzer tests if
-DLIBFUZZER_ENABLE_TESTS=ON is set.
llvm-svn: 310100
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:17:16 +0000 (19:17 +0000)]
Revert "CFI: blacklist STL allocate() from unrelated-casts"
This reverts commit r310097.
llvm-svn: 310099
Alexey Bataev [Fri, 4 Aug 2017 19:10:54 +0000 (19:10 +0000)]
[OPENMP] Unify generation of outlined function calls.
llvm-svn: 310098
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:10:11 +0000 (19:10 +0000)]
CFI: blacklist STL allocate() from unrelated-casts
Summary:
Previously, STL allocators were blacklisted in compiler_rt's
cfi_blacklist.txt because they mandated a cast from void* to T* before
object initialization completed. This change moves that logic into the
front end because C++ name mangling supports a substitution compression
mechanism for symbols that makes it difficult to blacklist the mangled
symbol for allocate() using a regular expression.
Motivated by crbug.com/751385.
Reviewers: pcc, kcc
Reviewed By: pcc
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D36294
llvm-svn: 310097
Florian Gross [Fri, 4 Aug 2017 19:01:56 +0000 (19:01 +0000)]
[clang-tidy] Added clang-tidy test cases related to rL310095
Differential Revision: https://reviews.llvm.org/D36308
llvm-svn: 310096
Florian Gross [Fri, 4 Aug 2017 18:59:19 +0000 (18:59 +0000)]
[ASTMatcher] Add handling for DeducedType to HasDeclarationMatcher
HasDeclarationMatcher did not handle DeducedType, it always returned false for deduced types.
So with code like this:
struct X{};
auto x = X{};
This did no longer match:
varDecl(hasType(recordDecl(hasName("X"))))
Because HasDeclarationMatcher didn't resolve the DeducedType of x.
Differential Revision: https://reviews.llvm.org/D36308
llvm-svn: 310095
Ulrich Weigand [Fri, 4 Aug 2017 18:57:58 +0000 (18:57 +0000)]
[SystemZ] Add support for 128-bit atomic load/store/cmpxchg
This adds support for the main 128-bit atomic operations,
using the SystemZ instructions LPQ, STPQ, and CDSG.
Generating these instructions is a bit more complex than usual
since the i128 type is not legal for the back-end. Therefore,
we have to hook the LowerOperationWrapper and ReplaceNodeResults
TargetLowering callbacks.
llvm-svn: 310094
Ulrich Weigand [Fri, 4 Aug 2017 18:53:35 +0000 (18:53 +0000)]
[SystemZ] Eliminate unnecessary serialization operations
We currently emit a serialization operation (bcr 14, 0) before every
atomic load and after every atomic store. This is overly conservative.
The SystemZ architecture actually does not require any serialization
for atomic loads, and a serialization after an atomic store only if
we need to enforce sequential consistency. This is what other compilers
for the platform implement as well.
llvm-svn: 310093
Evgeny Stupachenko [Fri, 4 Aug 2017 18:46:13 +0000 (18:46 +0000)]
Fix PR33514
Summary:
The bug was uncovered after fix of PR23384 (part 3 of 3).
The patch restricts pointer multiplication in SCEV computaion for ICmpZero.
Reviewers: qcolombet
Differential Revision: http://reviews.llvm.org/D36170
From: Evgeny Stupachenko <evstupac@gmail.com>
<evgeny.v.stupachenko@intel.com>
llvm-svn: 310092
Kostya Serebryany [Fri, 4 Aug 2017 18:43:39 +0000 (18:43 +0000)]
[libFuzzer] make trace-pc.test more reliable
llvm-svn: 310091
Rafael Espindola [Fri, 4 Aug 2017 18:42:04 +0000 (18:42 +0000)]
Simplify. NFC.
llvm-svn: 310090
Alex Shlyapnikov [Fri, 4 Aug 2017 18:39:36 +0000 (18:39 +0000)]
[compiler-rt] Check for empty buffer in Addr2LineProcess::ReadFromSymbolizer
This fixes a bug in the ReadFromSymbolizer method of the
Addr2LineProcess class; if the input is too large, the returned buffer
will be null and will consequently fail the CHECK. The proposed fix is
to simply check if the buffer consists of only a null-terminator and
return if so (in effect skipping that frame). I tested by running one of
the unit tests both before and after my change.
Submitted on behalf of david-y-lam.
Reviewers: eugenis, alekseyshl, kcc
Reviewed By: alekseyshl
Differential Revision: https://reviews.llvm.org/D36207
llvm-svn: 310089
Connor Abbott [Fri, 4 Aug 2017 18:36:54 +0000 (18:36 +0000)]
[AMDGPU] Implement llvm.amdgcn.set.inactive intrinsic
Summary:
This intrinsic lets us set inactive lanes to an identity value when
implementing wavefront reductions. In combination with Whole Wavefront
Mode, it lets inactive lanes be skipped over as required by GLSL/Vulkan.
Lowering the intrinsic needs to happen post-RA so that RA knows that the
destination isn't completely overwritten due to the EXEC shenanigans, so
we need another pseudo-instruction to represent the un-lowered
intrinsic.
Reviewers: tstellar, arsenm
Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye
Differential Revision: https://reviews.llvm.org/D34719
llvm-svn: 310088
Connor Abbott [Fri, 4 Aug 2017 18:36:52 +0000 (18:36 +0000)]
[AMDGPU] Add support for Whole Wavefront Mode
Summary:
Whole Wavefront Wode (WWM) is similar to WQM, except that all of the
lanes are always enabled, regardless of control flow. This is required
for implementing wavefront reductions in non-uniform control flow, where
we need to use the inactive lanes to propagate intermediate results, so
they need to be enabled. We need to propagate WWM to uses (unless
they're explicitly marked as exact) so that they also propagate
intermediate results correctly. We do the analysis and exec mask munging
during the WQM pass, since there are interactions with WQM for things
that require both WQM and WWM. For simplicity, WWM is entirely
block-local -- blocks are never WWM on entry or exit of a block, and WWM
is not propagated to the block level. This means that computations
involving WWM cannot involve control flow, but we only ever plan to use
WWM for a few limited purposes (none of which involve control flow)
anyways.
Shaders can ask for WWM using the @llvm.amdgcn.wwm intrinsic. There
isn't yet a way to turn WWM off -- that will be added in a future
change.
Finally, it turns out that turning on inactive lanes causes a number of
problems with register allocation. While the best long-term solution
seems like teaching LLVM's register allocator about predication, for now
we need to add some hacks to prevent ourselves from getting into trouble
due to constraints that aren't currently expressed in LLVM. For the gory
details, see the comments at the top of SIFixWWMLiveness.cpp.
Reviewers: arsenm, nhaehnle, tpr
Subscribers: kzhuravl, wdng, mgorny, yaxunl, dstuttard, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D35524
llvm-svn: 310087
Connor Abbott [Fri, 4 Aug 2017 18:36:50 +0000 (18:36 +0000)]
[AMDGPU] refactor WQM pass in preparation for WWM (NFCI)
Summary:
Right now, the WQM pass conflates two different things when tracking the
Needs of an instruction:
1. Needs can be StateWQM, which is propagated to other instructions, and
means that this instruction (and everything it depends on) must be
calculated in WQM.
2. Needs can be StateExact, which is not propagated to other
instructions, and means that this instruction must not be calculated in
WQM and WQM-ness must not be propagated past this instruction.
This works now because there are only two different states, but in the
future we want to be able to express things like "calculate this in WQM,
but please disable WWM and don't propagate it" (to implement
@llvm.amdgcn.set.inactive). In order to do this, we need to split the
per-instruction Needs field in two: a new Needs field, which can only
contain StateWQM (and in the future, StateWWM) and is propagated to
sources, and a Disables field, which can also contain just StateWQM or
nothing for now.
We keep the per-block tracking the same for now, by translating
Needs/Disables to the old representation with only StateWQM or
StateExact. The other place that needs special handling is when we
emit the state transitions. We could just translate back to the old
representation there as well, which we almost do, but instead of 0 as a
placeholder value for "any state," we explicitly or together all the
states an instruction is allowed to be in. This lets us refactor the
code in preparation for WWM, where we'll need to be able to handle
things like "this instruction must be in Exact or WQM, but not WWM."
Reviewers: arsenm, nhaehnle, tpr
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, t-tye, llvm-commits
Differential Revision: https://reviews.llvm.org/D35523
llvm-svn: 310086
Connor Abbott [Fri, 4 Aug 2017 18:36:49 +0000 (18:36 +0000)]
[AMDGPU] Add an llvm.amdgcn.wqm intrinsic for WQM
Summary:
Previously, we assumed that certain types of instructions needed WQM in
pixel shaders, particularly DS instructions and image sampling
instructions. This was ok because with OpenGL, the assumption was
correct. But we want to start using DPP instructions for derivatives as
well as other things, so the assumption that we can infer whether to use
WQM based on the instruction won't continue to hold. This intrinsic lets
frontends like Mesa indicate what things need WQM based on their
knowledge of the API, rather than second-guessing them in the backend.
We need to keep around the old method of enabling WQM, but eventually we
should remove it once Mesa catches up. For now, this will let us use DPP
instructions for computing derivatives correctly.
Reviewers: arsenm, tpr, nhaehnle
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D35167
llvm-svn: 310085
Rafael Espindola [Fri, 4 Aug 2017 18:33:16 +0000 (18:33 +0000)]
Fix which file is in an error message.
When reporting an invalid relocation we were blaming the destination
file instead of the file with the relocation.
llvm-svn: 310084
Marcello Maggioni [Fri, 4 Aug 2017 18:24:09 +0000 (18:24 +0000)]
[MachineOperand] Add ChangeToTargetIndex method. NFC
Differential Revision: https://reviews.llvm.org/D36301
llvm-svn: 310083
Yaxun Liu [Fri, 4 Aug 2017 18:16:31 +0000 (18:16 +0000)]
Add OpenCL 2.0 atomic builtin functions as Clang builtin
OpenCL 2.0 atomic builtin functions have a scope argument which is ideally
represented as synchronization scope argument in LLVM atomic instructions.
Clang supports translating Clang atomic builtin functions to LLVM atomic
instructions. However it currently does not support synchronization scope
of LLVM atomic instructions. Without this, users have to use LLVM assembly
code to implement OpenCL atomic builtin functions.
This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin
functions, which supports generating LLVM atomic instructions with
synchronization scope operand.
Currently only constant memory scope argument is supported. Support of
non-constant memory scope argument will be added later.
Differential Revision: https://reviews.llvm.org/D28691
llvm-svn: 310082
Rafael Espindola [Fri, 4 Aug 2017 17:43:54 +0000 (17:43 +0000)]
Remove redundant flag.
llvm-svn: 310079
Reid Kleckner [Fri, 4 Aug 2017 17:43:49 +0000 (17:43 +0000)]
[Support] Remove getPathFromOpenFD, it was unused
Summary:
It was added to support clang warnings about includes with case
mismatches, but it ended up not being necessary.
Reviewers: twoh, rafael
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D36328
llvm-svn: 310078
George Karpenkov [Fri, 4 Aug 2017 17:43:29 +0000 (17:43 +0000)]
Fixing buildbots: do not register check-fuzzer if clang or asan are not
present.
llvm-svn: 310077
George Karpenkov [Fri, 4 Aug 2017 17:43:28 +0000 (17:43 +0000)]
Drop Windows support from libFuzzer tests.
Differential Revision: https://reviews.llvm.org/D36205
llvm-svn: 310076
George Karpenkov [Fri, 4 Aug 2017 17:19:45 +0000 (17:19 +0000)]
Port libFuzzer tests to LIT. Do not require two-stage build for check-fuzzer.
This revision ports all libFuzzer tests apart from the unittest to LIT.
The advantages of doing so include:
- Tests being self-contained
- Much easier debugging of a single test
- No need for using a two-stage compilation
The unit-test is still compiled using CMake, but it does not need a
freshly built compiler.
NOTE: The previous two-stage bot configuration will NOT work, as in the
second stage build LLVM_USE_SANITIZER is set, which disables ASAN from
being built.
Thus bots will be reconfigured in the next few commits.
Differential Revision: https://reviews.llvm.org/D36295
llvm-svn: 310075
Easwaran Raman [Fri, 4 Aug 2017 17:15:17 +0000 (17:15 +0000)]
[Inliner] Fix a typo in option description. NFC.
llvm-svn: 310073
Javed Absar [Fri, 4 Aug 2017 17:10:11 +0000 (17:10 +0000)]
[ARM] Use searchable-table for banked registers
This is a continuation of https://reviews.llvm.org/D36219
This patch uses reverse mapping (encoding->name) in
ARMInstPrinter::printBankedRegOperand to get rid of
hard-coded values (as pointed out by @olista01).
Reviewed by: @fhahn, @rovka, @olista01
Differential Revision: https://reviews.llvm.org/D36260
llvm-svn: 310072
Reid Kleckner [Fri, 4 Aug 2017 17:09:11 +0000 (17:09 +0000)]
[ArgPromotion] Preserve alignment of byval argument in new alloca
The frontend may have requested a higher alignment for any reason, and
downstream optimizations may already have taken advantage of it. We
should keep the same alignment when moving the allocation from the
parameter area to the local variable area.
Fixes PR34038
llvm-svn: 310071
Martin Probst [Fri, 4 Aug 2017 17:07:15 +0000 (17:07 +0000)]
clang-format: [JS] support fields with case/switch/default labels.
Summary:
`case:` and `default:` would normally parse as labels for a `switch` block.
However in TypeScript, they can be used in field declarations, e.g.:
interface I {
case: string;
}
This change special cases parsing them in declaration lines to avoid wrapping
them.
Reviewers: djasper
Subscribers: klimek, cfe-commits
Differential Revision: https://reviews.llvm.org/D36148
llvm-svn: 310070
Craig Topper [Fri, 4 Aug 2017 16:59:29 +0000 (16:59 +0000)]
[ConstantInt] Use ConstantInt::getValue instead of Constant::getUniqueInteger in a few places where we obviously have a ConstantInt. NFC
getUniqueInteger will ultimately call ConstantInt::getValue, but calling ConstantInt::getValue should be inlined.
llvm-svn: 310069
Chad Rosier [Fri, 4 Aug 2017 16:44:06 +0000 (16:44 +0000)]
[AArch64] Fix an assertion for pre-index generation with unscaled loads/stores.
Differential Revision: https://reviews.llvm.org/D36248
PR34035
llvm-svn: 310066
Dehao Chen [Fri, 4 Aug 2017 16:20:54 +0000 (16:20 +0000)]
Adjust the hotness threshold from 99.9% to 99%.
Summary: We originally set the hotness threshold as 99.9% to be consistent with gcc FDO. But because the inline heuristic is different between 2 compilers: llvm uses bottom-up algorithm while gcc uses priority based. The LLVM algorithm tends to inline too much early that prevents hot callsites from further inlined into its caller. Due to this restriction, we think it is reasonable to lower the hotness threshold to give priority to those that are really hot. Our experiments show that this change would improve performance on large applications. Note that the inline heuristic has great room for further tuning. Once the inline heuristics are refined, we could adjust this threshold to allow inlining for less hot callsites.
Reviewers: davidxl, tejohnson, eraman
Reviewed By: tejohnson
Subscribers: sanjoy, llvm-commits
Differential Revision: https://reviews.llvm.org/D36317
llvm-svn: 310065
Benjamin Kramer [Fri, 4 Aug 2017 16:08:41 +0000 (16:08 +0000)]
[InstCombine] Fold single-use variable into assert.
Avoids unused variable warnings in Release builds. No functional change.
llvm-svn: 310064
Craig Topper [Fri, 4 Aug 2017 16:07:20 +0000 (16:07 +0000)]
[InstCombine] Remove the (not (sext)) case from foldBoolSextMaskToSelect and inline the remaining code to match visitOr
Summary:
The (not (sext)) case is really (xor (sext), -1) which should have been simplified to (sext (xor, 1)) before we got here. So we shouldn't need to handle it.
With that taken care of we only need to two cases so don't need the swap anymore. This makes us in sync with the equivalent code in visitOr so inline this to match.
Reviewers: spatel, eli.friedman, majnemer
Reviewed By: spatel
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36240
llvm-svn: 310063
Craig Topper [Fri, 4 Aug 2017 16:07:18 +0000 (16:07 +0000)]
[InstCombine] Use ConstantInt::getFalse to reduce some code. NFC
llvm-svn: 310062
Charles Saternos [Fri, 4 Aug 2017 16:00:58 +0000 (16:00 +0000)]
[ThinLTO] Add FunctionAttrs to ThinLTO index
Adds function attributes to index: ReadNone, ReadOnly, NoRecurse, NoAlias. This attributes will be used for future ThinLTO optimizations that will propagate function attributes across modules.
llvm-svn: 310061
Sanjay Patel [Fri, 4 Aug 2017 15:42:47 +0000 (15:42 +0000)]
[InstCombine] narrow lshr with constant
Name: narrow_shift
Pre: C1 < 8
%zx = zext i8 %x to i32
%l = lshr i32 %zx, C1
=>
%narrowC = trunc i32 C1 to i8
%ns = lshr i8 %x, %narrowC
%l = zext i8 %ns to i32
http://rise4fun.com/Alive/jIV
This isn't directly applicable to PR34046 as written, but we
need to have more narrowing folds like this to be sure that
rotate patterns are recognized.
llvm-svn: 310060
Dmitry Preobrazhensky [Fri, 4 Aug 2017 13:55:24 +0000 (13:55 +0000)]
[AMDGPU][MC] Enabled expressions as operands
See bug 33579: https://bugs.llvm.org//show_bug.cgi?id=33579
Reviewers: vpykhtin, SamWot, arsenm
Differential Revision: https://reviews.llvm.org/D36091
llvm-svn: 310059
Simon Pilgrim [Fri, 4 Aug 2017 12:46:35 +0000 (12:46 +0000)]
[DAGCombiner] Extending pattern detection for vector shuffle.
If all the operands of a BUILD_VECTOR extract elements from same vector then split the vector efficiently based on the maximum vector access index.
Committed on behalf of @jbhateja (Jatin Bhateja)
Differential Revision: https://reviews.llvm.org/D35788
llvm-svn: 310058
Stefan Maksimovic [Fri, 4 Aug 2017 12:37:34 +0000 (12:37 +0000)]
Revert r304953 for release 5.0.0
This is causing failures when compiling clang with -O3
as one of the structures used by clang is passed by
value and uses the fastcc calling convention.
Faliures manifest for stage2 mips build.
llvm-svn: 310057
Michael Kruse [Fri, 4 Aug 2017 12:28:42 +0000 (12:28 +0000)]
[ForwardOpTree] Refactor out forwardSpeculatable(). NFC.
The method forwardSpeculatable forwards speculatively executable
instructions and is currently the only way to forward an
instruction.
In the future we intend to add more methods.
llvm-svn: 310056
Filipe Cabecinhas [Fri, 4 Aug 2017 12:28:36 +0000 (12:28 +0000)]
[DSE] Merge stores when the later store only writes to memory locations the early store also wrote to.
Summary:
This fixes PR31777.
If both stores' values are ConstantInt, we merge the two stores
(shifting the smaller store appropriately) and replace the earlier (and
larger) store with an updated constant.
In the future we should also support vectors of integers. And maybe
float/double if we can.
Reviewers: hfinkel, junbuml, jfb, RKSimon, bkramer
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D30703
llvm-svn: 310055
Nikolai Bozhenov [Fri, 4 Aug 2017 12:22:17 +0000 (12:22 +0000)]
[InstCombine] Canonicalize clamp of float types to minmax in fast mode.
Summary:
This commit allows matchSelectPattern to recognize clamp of float
arguments in the presence of FMF the same way as already done for
integers.
This case is a little different though. With integers, given the
min/max pattern is recognized, DAGBuilder starts selecting MIN/MAX
"automatically". That is not the case for float, because for them only
full FMINNAN/FMINNUM/FMAXNAN/FMAXNUM ISD nodes exist and they do care
about NaNs. On the other hand, some backends (e.g. X86) have only
FMIN/FMAX nodes that do not care about NaNS and the former NAN/NUM
nodes are illegal thus selection is not happening. So I decided to do
such kind of transformation in IR (InstCombiner) instead of
complicating the logic in the backend.
Reviewers: spatel, jmolloy, majnemer, efriedma, craig.topper
Reviewed By: efriedma
Subscribers: hiraditya, javed.absar, n.bozhenov, llvm-commits
Patch by Andrei Elovikov <andrei.elovikov@intel.com>
Differential Revision: https://reviews.llvm.org/D33186
llvm-svn: 310054
Nikolai Bozhenov [Fri, 4 Aug 2017 12:21:03 +0000 (12:21 +0000)]
Add some tests for cast+clamp/min/max before D33186.
Summary:
- add more tests
- pr27236.ll: rename %tmpN -> %N because otherwise a FileCheck
variable for newly appeared unnamed value would use the same name as
tmpN (as generated by update_test_checks.py)
- run update_test_checks.py
Reviewers: efriedma
Reviewed By: efriedma
Subscribers: n.bozhenov, llvm-commits
Patch by Andrei Elovikov <andrei.elovikov@intel.com>
Differential Revision: https://reviews.llvm.org/D35002
llvm-svn: 310053
Philip Pfaffe [Fri, 4 Aug 2017 11:28:51 +0000 (11:28 +0000)]
[PM] Make the new-pm passes behave more like the legacy passes
Summary:
Testing the new-pm passes becomes much easier once they behave more like the
old passes in terms of the order in which Scops are processed and printed. This
requires three changes:
- ScopInfo: Use an ordered map to store scops
- ScopInfo: Iterate and print Scops in reverse order to match legacy PM behaviour
- ScopDetection: print function name in ScopAnalysisPrinter
Reviewers: grosser, Meinersbur, bollu
Reviewed By: grosser
Subscribers: pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D36303
llvm-svn: 310052
Haojian Wu [Fri, 4 Aug 2017 11:25:05 +0000 (11:25 +0000)]
[clang-tidy] Add missing documents for "IgnoreMacros" option.
llvm-svn: 310051
Haojian Wu [Fri, 4 Aug 2017 11:18:00 +0000 (11:18 +0000)]
[clang-tidy] Ignore macros in make-unique check.
Summary:
The check doesn't fully support smart-ptr usages inside macros, which
may cause incorrect fixes, or even crashes, ignore them for now.
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: JDevlieghere, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D36264
llvm-svn: 310050
George Rimar [Fri, 4 Aug 2017 11:07:42 +0000 (11:07 +0000)]
[ELF] - Move getSymbols() methods to InputFile.
It can help to detemplate code.
Differential revision: https://reviews.llvm.org/D35936
llvm-svn: 310049
Florian Gross [Fri, 4 Aug 2017 10:53:07 +0000 (10:53 +0000)]
[AMDGPU] Fixed MSVC build break
Error was:
field of type 'llvm::ArgDescriptor' has private default constructor
const AMDGPUFunctionArgInfo AMDGPUArgumentUsageInfo::ExternFunctionInfo{};
^
llvm-svn: 310048
Florian Hahn [Fri, 4 Aug 2017 10:40:18 +0000 (10:40 +0000)]
[Driver] Error if ARM mode was selected explicitly for M-profile CPUs.
Summary:
M-class profiles do not support ARM execution mode, so providing
-marm/-mno-thumb does not make sense in combination with -mcpu/-march
options that support the M-profile.
This is a follow-up patch to D35569 and it seemed pretty clear that we
should emit an error in the driver in this case.
We probably also should warn/error if the provided -mcpu/-march options
do not match, e.g. -mcpu=cortex-m0 -march=armv8-a is invalid, as
cortex-m0 does not support armv8-a. But that should be a separate patch
I think.
Reviewers: echristo, richard.barton.arm, rengolin, labrinea, charles.baylis
Reviewed By: rengolin
Subscribers: aemerson, javed.absar, kristof.beyls, cfe-commits
Differential Revision: https://reviews.llvm.org/D35826
llvm-svn: 310047
George Rimar [Fri, 4 Aug 2017 10:34:14 +0000 (10:34 +0000)]
[ELF] - Remove ScriptLexer::Error field and check ErrorCount instead.
D35945 introduces change when there is useless to check Error flag
in few places, but ErrorCount must be checked instead.
But then we probably can just check ErrorCount always. That should simplify
things. Patch do that.
Differential revision: https://reviews.llvm.org/D36266
llvm-svn: 310046
George Rimar [Fri, 4 Aug 2017 10:25:29 +0000 (10:25 +0000)]
[ELF] - Fix "--symbol-ordering-file doesn't work with linker scripts"
This is PR33889,
Patch adds support of combination of linkerscript and
-symbol-ordering-file option.
If no sorting commands are present in script inside section declaration
and no --sort-section option specified, code uses sorting from ordering
file if any exist.
Differential revision: https://reviews.llvm.org/D35843
llvm-svn: 310045
Zoran Jovanovic [Fri, 4 Aug 2017 10:18:44 +0000 (10:18 +0000)]
[mips][microMIPS] Extending size reduction pass with ADDIUSP and ADDIUR1SP
Author: milena.vujosevic.janicic
The patch extends size reduction pass for MicroMIPS.
The following instructions are examined and transformed, if possible:
ADDIU instruction is transformed into 16-bit instruction ADDIUSP
ADDIU instruction is transformed into 16-bit instruction ADDIUR1SP
Usage of u_int64_t replaced by uint64_t to avoid issues because of which previous patch version was reverted:
Differential Revision: https://reviews.llvm.org/D34511
llvm-svn: 310044
Philip Pfaffe [Fri, 4 Aug 2017 09:28:09 +0000 (09:28 +0000)]
[Polly][PM] Register polly passes with the opt tool for the new-pm path
Summary: When polly is linked into the tools because of the LLVM_POLLY_LINK_INTO_TOOLS option being set, we need to register its passes with the PassBuilder. Because polly is linked in, we can directly call its callback registration method, which registers the appropriate callbacks with the new PM's PassBuilder. This essentially follows exactly the way it worked with the legacy PM.
Reviewers: grosser, chandlerc, bollu
Reviewed By: grosser
Subscribers: pollydev, llvm-commits
Differential Revision: https://reviews.llvm.org/D36273
llvm-svn: 310043
James Henderson [Fri, 4 Aug 2017 09:07:55 +0000 (09:07 +0000)]
[ELF] Explicitly write null bytes in string tables
Following r309829, if a string table appears in an executable segment, the strings
will not be null terminated. This is a problem, for example, for the .dynstr
section when using -no-rosegment. The strings end up being terminated with 0xcc
because prior to this patch, LLD did not explicitly write the null terminators.
This change fixes that by always writing the null terminators.
Reviewers: rafael
Differential Revision: https://reviews.llvm.org/D36267
llvm-svn: 310042
Manuel Klimek [Fri, 4 Aug 2017 08:41:42 +0000 (08:41 +0000)]
Fix typo and update documentation.
The hasDeclaration documentation was outdated after r288366.
llvm-svn: 310041
George Rimar [Fri, 4 Aug 2017 08:30:16 +0000 (08:30 +0000)]
[ELF] - Replace parallelForEach with ranged form.
Makes code a bit more convinent to write/read.
Differential revision: https://reviews.llvm.org/D36089
llvm-svn: 310040
Philip Pfaffe [Fri, 4 Aug 2017 08:26:45 +0000 (08:26 +0000)]
[NFC] Fix r310036: Appease clang-format
llvm-svn: 310039
Simon Atanasyan [Fri, 4 Aug 2017 08:25:15 +0000 (08:25 +0000)]
[mips] Fix typo (missed space) in the warning message
llvm-svn: 310038
Simon Atanasyan [Fri, 4 Aug 2017 08:25:09 +0000 (08:25 +0000)]
[mips] Code formatting fix. NFC
llvm-svn: 310037
Philip Pfaffe [Fri, 4 Aug 2017 08:12:31 +0000 (08:12 +0000)]
[NFC] ScopPass: Remove unused AnalysisKey from OwningInnerAnalysisManagerProxy
llvm-svn: 310036
Haojian Wu [Fri, 4 Aug 2017 08:07:05 +0000 (08:07 +0000)]
[clang-tidy] Support initializer-list constructor cases in modernize-make-unique.
Reviewers: alexfh
Reviewed By: alexfh
Subscribers: malcolm.parsons, JDevlieghere, xazax.hun, cfe-commits
Differential Revision: https://reviews.llvm.org/D36016
llvm-svn: 310035