platform/upstream/llvm.git
7 years agoFix build breakage.
Zachary Turner [Fri, 4 Aug 2017 20:07:08 +0000 (20:07 +0000)]
Fix build breakage.

llvm-svn: 310112

7 years agominor grammar fix
Nico Weber [Fri, 4 Aug 2017 20:06:03 +0000 (20:06 +0000)]
minor grammar fix

llvm-svn: 310111

7 years ago[libFuzzer] remove the now redundant 'LLVMFuzzer-' prefix from libFuzzer tests
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

7 years agoCFI: Move STL allocator blacklist to clang
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

7 years ago[lld] Write the absolute PDB path to the debug directory.
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

7 years ago[llvm-pdbutil] Dump image section headers.
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

7 years ago[libFuzzer] split one test into several
Kostya Serebryany [Fri, 4 Aug 2017 20:01:04 +0000 (20:01 +0000)]
[libFuzzer] split one test into several

llvm-svn: 310106

7 years agoReland "CFI: blacklist STL allocate() from unrelated-casts"
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

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
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

7 years ago[PPCGCodeGeneration] [NFC] Log every location from which PPCGCodegen bails.
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

7 years ago[InstCombine] auto-generate test checks; NFC
Sanjay Patel [Fri, 4 Aug 2017 19:29:32 +0000 (19:29 +0000)]
[InstCombine] auto-generate test checks; NFC

llvm-svn: 310101

7 years ago[libFuzzer tests] Only enable libFuzzer tests if
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

7 years agoRevert "CFI: blacklist STL allocate() from unrelated-casts"
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

7 years ago[OPENMP] Unify generation of outlined function calls.
Alexey Bataev [Fri, 4 Aug 2017 19:10:54 +0000 (19:10 +0000)]
[OPENMP] Unify generation of outlined function calls.

llvm-svn: 310098

7 years agoCFI: blacklist STL allocate() from unrelated-casts
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

7 years ago[clang-tidy] Added clang-tidy test cases related to rL310095
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

7 years ago[ASTMatcher] Add handling for DeducedType to HasDeclarationMatcher
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

7 years ago[SystemZ] Add support for 128-bit atomic load/store/cmpxchg
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

7 years ago[SystemZ] Eliminate unnecessary serialization operations
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

7 years agoFix PR33514
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

7 years ago[libFuzzer] make trace-pc.test more reliable
Kostya Serebryany [Fri, 4 Aug 2017 18:43:39 +0000 (18:43 +0000)]
[libFuzzer] make trace-pc.test more reliable

llvm-svn: 310091

7 years agoSimplify. NFC.
Rafael Espindola [Fri, 4 Aug 2017 18:42:04 +0000 (18:42 +0000)]
Simplify. NFC.

llvm-svn: 310090

7 years ago[compiler-rt] Check for empty buffer in Addr2LineProcess::ReadFromSymbolizer
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

7 years ago[AMDGPU] Implement llvm.amdgcn.set.inactive intrinsic
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

7 years ago[AMDGPU] Add support for Whole Wavefront Mode
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

7 years ago[AMDGPU] refactor WQM pass in preparation for WWM (NFCI)
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

7 years ago[AMDGPU] Add an llvm.amdgcn.wqm intrinsic for WQM
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

7 years agoFix which file is in an error message.
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

7 years ago[MachineOperand] Add ChangeToTargetIndex method. NFC
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

7 years agoAdd OpenCL 2.0 atomic builtin functions as Clang builtin
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

7 years agoRemove redundant flag.
Rafael Espindola [Fri, 4 Aug 2017 17:43:54 +0000 (17:43 +0000)]
Remove redundant flag.

llvm-svn: 310079

7 years ago[Support] Remove getPathFromOpenFD, it was unused
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

7 years agoFixing buildbots: do not register check-fuzzer if clang or asan are not
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

7 years agoDrop Windows support from libFuzzer tests.
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

7 years agoPort libFuzzer tests to LIT. Do not require two-stage build for check-fuzzer.
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

7 years ago[Inliner] Fix a typo in option description. NFC.
Easwaran Raman [Fri, 4 Aug 2017 17:15:17 +0000 (17:15 +0000)]
[Inliner] Fix a typo in option description. NFC.

llvm-svn: 310073

7 years ago[ARM] Use searchable-table for banked registers
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

7 years ago[ArgPromotion] Preserve alignment of byval argument in new alloca
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

7 years agoclang-format: [JS] support fields with case/switch/default labels.
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

7 years ago[ConstantInt] Use ConstantInt::getValue instead of Constant::getUniqueInteger in...
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

7 years ago[AArch64] Fix an assertion for pre-index generation with unscaled loads/stores.
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

7 years agoAdjust the hotness threshold from 99.9% to 99%.
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

7 years ago[InstCombine] Fold single-use variable into assert.
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

7 years ago[InstCombine] Remove the (not (sext)) case from foldBoolSextMaskToSelect and inline...
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

7 years ago[InstCombine] Use ConstantInt::getFalse to reduce some code. NFC
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

7 years ago[ThinLTO] Add FunctionAttrs to ThinLTO index
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

7 years ago[InstCombine] narrow lshr with constant
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

7 years ago[AMDGPU][MC] Enabled expressions as operands
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

7 years ago[DAGCombiner] Extending pattern detection for vector shuffle.
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

7 years agoRevert r304953 for release 5.0.0
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

7 years ago[ForwardOpTree] Refactor out forwardSpeculatable(). NFC.
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

7 years ago[DSE] Merge stores when the later store only writes to memory locations the early...
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

7 years ago[InstCombine] Canonicalize clamp of float types to minmax in fast mode.
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

7 years agoAdd some tests for cast+clamp/min/max before D33186.
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

7 years ago[PM] Make the new-pm passes behave more like the legacy passes
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

7 years ago[clang-tidy] Add missing documents for "IgnoreMacros" option.
Haojian Wu [Fri, 4 Aug 2017 11:25:05 +0000 (11:25 +0000)]
[clang-tidy] Add missing documents for "IgnoreMacros" option.

llvm-svn: 310051

7 years ago[clang-tidy] Ignore macros in make-unique check.
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

7 years ago[ELF] - Move getSymbols() methods to InputFile.
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

7 years ago[AMDGPU] Fixed MSVC build break
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

7 years ago[Driver] Error if ARM mode was selected explicitly for M-profile CPUs.
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

7 years ago[ELF] - Remove ScriptLexer::Error field and check ErrorCount instead.
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

7 years ago[ELF] - Fix "--symbol-ordering-file doesn't work with linker scripts"
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

7 years ago[mips][microMIPS] Extending size reduction pass with ADDIUSP and ADDIUR1SP
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

7 years ago[Polly][PM] Register polly passes with the opt tool for the new-pm path
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

7 years ago[ELF] Explicitly write null bytes in string tables
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

7 years agoFix typo and update documentation.
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

7 years ago[ELF] - Replace parallelForEach with ranged form.
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

7 years ago[NFC] Fix r310036: Appease clang-format
Philip Pfaffe [Fri, 4 Aug 2017 08:26:45 +0000 (08:26 +0000)]
[NFC] Fix r310036: Appease clang-format

llvm-svn: 310039

7 years ago[mips] Fix typo (missed space) in the warning message
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

7 years ago[mips] Code formatting fix. NFC
Simon Atanasyan [Fri, 4 Aug 2017 08:25:09 +0000 (08:25 +0000)]
[mips] Code formatting fix. NFC

llvm-svn: 310037

7 years ago[NFC] ScopPass: Remove unused AnalysisKey from OwningInnerAnalysisManagerProxy
Philip Pfaffe [Fri, 4 Aug 2017 08:12:31 +0000 (08:12 +0000)]
[NFC] ScopPass: Remove unused AnalysisKey from OwningInnerAnalysisManagerProxy

llvm-svn: 310036

7 years ago[clang-tidy] Support initializer-list constructor cases in modernize-make-unique.
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

7 years agoDo not declare a variable which is used only in assert. NFC
Max Kazantsev [Fri, 4 Aug 2017 07:41:24 +0000 (07:41 +0000)]
Do not declare a variable which is used only in assert. NFC

llvm-svn: 310034

7 years ago[msan] Switch the pvalloc overflow test to a lit test
Benjamin Kramer [Fri, 4 Aug 2017 07:32:10 +0000 (07:32 +0000)]
[msan] Switch the pvalloc overflow test to a lit test

The test was not passing on targets where allocator_may_return_null
defaults to true. Change the test to a lit test so that we can test both
situations.

Patch by Kostya Kortchinsky!

Differential Revision: https://reviews.llvm.org/D36302

llvm-svn: 310033

7 years ago[IRCE] Handle loops with step different from 1/-1
Max Kazantsev [Fri, 4 Aug 2017 07:01:04 +0000 (07:01 +0000)]
[IRCE] Handle loops with step different from 1/-1

This patch generalizes IRCE to handle IV steps that are not equal to 1 or -1.

Differential Revision: https://reviews.llvm.org/D35539

llvm-svn: 310032

7 years ago[AMDGPU] Preserve inverted bit in SI_IF in presence of SI_KILL
Stanislav Mekhanoshin [Fri, 4 Aug 2017 06:58:42 +0000 (06:58 +0000)]
[AMDGPU] Preserve inverted bit in SI_IF in presence of SI_KILL

In case if SI_KILL is in between of the SI_IF and SI_END_CF we need
to preserve the bits actually flipped by if rather then restoring
the original mask.

Differential Revision: https://reviews.llvm.org/D36299

llvm-svn: 310031

7 years agoRevert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."
NAKAMURA Takumi [Fri, 4 Aug 2017 06:35:32 +0000 (06:35 +0000)]
Revert r309984, "Use "foo-12345.o" instead of "foo.o-12345" as temporary file name."

It generates MODULE-XXXXXXXXXXXX-%%%%%%%%.pcm, then GlobalModuleIndex.cpp is confused with the suffix ".pcm"

llvm-svn: 310030

7 years agoAvoid comparison between signed and unsigned in SCEVExitLimitForget tests
Max Kazantsev [Fri, 4 Aug 2017 06:03:51 +0000 (06:03 +0000)]
Avoid comparison between signed and unsigned in SCEVExitLimitForget tests

llvm-svn: 310029

7 years ago[AVR] Update target machine to use new constructor parameters
Dylan McKay [Fri, 4 Aug 2017 05:48:20 +0000 (05:48 +0000)]
[AVR] Update target machine to use new constructor parameters

The required parameters were changed in r309911.

llvm-svn: 310028

7 years ago[IRCE] Recognize loops with unsigned latch conditions
Max Kazantsev [Fri, 4 Aug 2017 05:40:20 +0000 (05:40 +0000)]
[IRCE] Recognize loops with unsigned latch conditions

This patch enables recognition of loops with ult/ugt latch conditions.

Differential Revision: https://reviews.llvm.org/D35302

llvm-svn: 310027

7 years agoRevert "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"
Petr Hosek [Fri, 4 Aug 2017 05:33:44 +0000 (05:33 +0000)]
Revert "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"

This breaks the build on clang-s390x-linux.

This reverts commit r310018.

llvm-svn: 310026

7 years ago[InstCombine] Move the call to foldSelectICmpAnd into foldSelectInstWithICmp. NFCI
Craig Topper [Fri, 4 Aug 2017 05:12:37 +0000 (05:12 +0000)]
[InstCombine] Move the call to foldSelectICmpAnd into foldSelectInstWithICmp. NFCI

llvm-svn: 310025

7 years ago[InstCombine] Remove unnecessary casts. NFC
Craig Topper [Fri, 4 Aug 2017 05:12:35 +0000 (05:12 +0000)]
[InstCombine] Remove unnecessary casts. NFC

We're calling an overload of getOpcode that already returns Instruction::CastOps.

llvm-svn: 310024

7 years agoFix SCEVExitLimitForget tests to make Sanitizer happy
Max Kazantsev [Fri, 4 Aug 2017 05:06:44 +0000 (05:06 +0000)]
Fix SCEVExitLimitForget tests to make Sanitizer happy

llvm-svn: 310023

7 years agoPrevent unused warning in non-assert builds (introduced in r310014).
Daniel Jasper [Fri, 4 Aug 2017 05:05:29 +0000 (05:05 +0000)]
Prevent unused warning in non-assert builds (introduced in r310014).

llvm-svn: 310022

7 years agoUn-revert r310014: false revert, it wasn't the cause of build break
Victor Leschuk [Fri, 4 Aug 2017 04:51:15 +0000 (04:51 +0000)]
Un-revert r310014: false revert, it wasn't the cause of build break

llvm-svn: 310021

7 years agoRevert r310014 as it breaks build lld-x86_64-darwin13
Victor Leschuk [Fri, 4 Aug 2017 04:43:54 +0000 (04:43 +0000)]
Revert r310014 as it breaks build lld-x86_64-darwin13

llvm-svn: 310020

7 years agoRevert "[coverage] Special-case calls to noreturn functions."
Vedant Kumar [Fri, 4 Aug 2017 04:08:23 +0000 (04:08 +0000)]
Revert "[coverage] Special-case calls to noreturn functions."

This reverts commit r309995. It looks like it's responsible for breaking
the stage2 coverage build:

http://green.lab.llvm.org/green/job/clang-stage2-coverage-R_build/1402

The cfe-commits discussion re: r309995 has more context.

llvm-svn: 310019

7 years agoReland "[llvm][llvm-objcopy] Added support for outputting to binary in llvm-objcopy"
Petr Hosek [Fri, 4 Aug 2017 03:17:37 +0000 (03:17 +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: 310018

7 years ago[Driver][Fuchsia] Pass --hash-style=gnu to the linker
Petr Hosek [Fri, 4 Aug 2017 02:39:27 +0000 (02:39 +0000)]
[Driver][Fuchsia] Pass --hash-style=gnu to the linker

The .gnu_hash format is superior, and all versions of the Fuchsia
dynamic linker support it.

Differential Revision: https://reviews.llvm.org/D36254

llvm-svn: 310017

7 years ago[Support] Update comments about stdout, raw_fd_ostream, and outs()
Reid Kleckner [Fri, 4 Aug 2017 01:39:23 +0000 (01:39 +0000)]
[Support] Update comments about stdout, raw_fd_ostream, and outs()

The full story is in the comments:

  // Do not attempt to close stdout or stderr. We used to try to maintain the
  // property that tools that support writing file to stdout should not also
  // write informational output to stdout, but in practice we were never able to
  // maintain this invariant. Many features have been added to LLVM and clang
  // (-fdump-record-layouts, optimization remarks, etc) that print to stdout, so
  // users must simply be aware that mixed output and remarks is a possibility.

NFC, I am just updating comments to reflect reality.

llvm-svn: 310016

7 years agocoverage: Update tests to reflect changes from r310012
Vedant Kumar [Fri, 4 Aug 2017 01:22:19 +0000 (01:22 +0000)]
coverage: Update tests to reflect changes from r310012

llvm-svn: 310015

7 years agoTeach GlobalSRA to update the debug info for split-up globals.
Adrian Prantl [Fri, 4 Aug 2017 01:19:54 +0000 (01:19 +0000)]
Teach GlobalSRA to update the debug info for split-up globals.

This is similar to what we are doing in "regular" SROA and creates
DW_OP_LLVM_fragment operations to describe the resulting variables.

rdar://problem/33654891

llvm-svn: 310014

7 years ago[AMDGPU] Add missing hazard for DPP-after-EXEC-write
Connor Abbott [Fri, 4 Aug 2017 01:09:43 +0000 (01:09 +0000)]
[AMDGPU] Add missing hazard for DPP-after-EXEC-write

Summary:
Following the docs, we need at least 5 wait states between an EXEC write
and an instruction that uses DPP.

Reviewers: tstellar, arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, llvm-commits

Differential Revision: https://reviews.llvm.org/D34849

llvm-svn: 310013

7 years ago[llvm-cov] Ignore unclosed line segments when setting line counts
Vedant Kumar [Fri, 4 Aug 2017 00:36:24 +0000 (00:36 +0000)]
[llvm-cov] Ignore unclosed line segments when setting line counts

This patch makes a slight change to the way llvm-cov determines line
execution counts. If there are multiple line segments on a line, the
line count is the max count among the regions which start *and* end on
the line. This avoids an issue posed by deferred regions which start on
the same line as a terminated region, e.g:

  if (false)
    return; //< The line count should be 0, even though a new region
            //< starts at the semi-colon.
  foo();

Another change is that counts from line segments which don't correspond
to region entries are considered. This enables the first change, and
corrects an outstanding issue (see the showLineExecutionCounts.cpp test
change).

This is related to D35925.

Testing: check-profile, llvm-cov lit tests

Differential Revision: https://reviews.llvm.org/D36014

llvm-svn: 310012

7 years ago[llvm-cov] NFC: make_unique-ify two allocations
Vedant Kumar [Fri, 4 Aug 2017 00:36:24 +0000 (00:36 +0000)]
[llvm-cov] NFC: make_unique-ify two allocations

llvm-svn: 310011

7 years ago[Coverage] Precise region termination with deferred regions
Vedant Kumar [Fri, 4 Aug 2017 00:29:20 +0000 (00:29 +0000)]
[Coverage] Precise region termination with deferred regions

The current coverage implementation doesn't handle region termination
very precisely. Take for example an `if' statement with a `return':

  void f() {
    if (true) {
      return; // The `if' body's region is terminated here.
    }
    // This line gets the same coverage as the `if' condition.
  }

If the function `f' is called, the line containing the comment will be
marked as having executed once, which is not correct.

The solution here is to create a deferred region after terminating a
region. The deferred region is completed once the start location of the
next statement is known, and is then pushed onto the region stack.
In the cases where it's not possible to complete a deferred region, it
can safely be dropped.

Testing: lit test updates, a stage2 coverage-enabled build of clang
llvm-svn: 310010

7 years agoDisable libFuzzer tests on Windows
George Karpenkov [Fri, 4 Aug 2017 00:26:12 +0000 (00:26 +0000)]
Disable libFuzzer tests on Windows

Differential Revision: https://reviews.llvm.org/D36297

llvm-svn: 310009

7 years agoRevert "[TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is...
Vitaly Buka [Fri, 4 Aug 2017 00:25:24 +0000 (00:25 +0000)]
Revert "[TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true"

Breaks check-llvm under ubsan.

This reverts commit r309949.

llvm-svn: 310008

7 years agoAMDGPU: Remove pointless asserts
Matt Arsenault [Fri, 4 Aug 2017 00:00:13 +0000 (00:00 +0000)]
AMDGPU: Remove pointless asserts

llvm-svn: 310007