OSDN Git Service

android-x86/external-llvm.git
6 years agoSuppress a warning. NFC.
Gabor Horvath [Wed, 9 Aug 2017 10:38:53 +0000 (10:38 +0000)]
Suppress a warning. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310459 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AsmParser] Hash is not a comment on some targets
Oliver Stannard [Wed, 9 Aug 2017 09:40:51 +0000 (09:40 +0000)]
[AsmParser] Hash is not a comment on some targets

The '#' token is not a comment for all targets (on ARM and AArch64 it marks an
immediate operand), so we shouldn't treat it as such.

Comments are already converted to AsmToken::EndOfStatement by
AsmLexer::LexLineComment, so this check was unnecessary.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310457 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LCG] Completely remove the map-based association of post-order numbers
Chandler Carruth [Wed, 9 Aug 2017 09:37:39 +0000 (09:37 +0000)]
[LCG] Completely remove the map-based association of post-order numbers
to Nodes when removing ref edges from a RefSCC.

This map based association turns out to be pretty expensive for large
RefSCCs and pointless as we already have embedded data members inside
nodes that we use to track the DFS state. We can reuse one of those and
the map becomes unnecessary.

This also fuses the update of those numbers into the scan across the
pending stack of nodes so that we don't walk the nodes twice during the
DFS.

With this I expect the new PM to be faster than the old PM for the test
case I have been optimizing. That said, it also seems simpler and more
direct in many ways. The side storage was always pretty awkward.

The last remaining hot-spot in the profile of the LCG once this is done
will be the edge iterator walk in the DFS. I'll take a look at improving
that next.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310456 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GlobalOpt] Switch an explicit loop to llvm::all_of(). NFCI.
Davide Italiano [Wed, 9 Aug 2017 09:23:29 +0000 (09:23 +0000)]
[GlobalOpt] Switch an explicit loop to llvm::all_of(). NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310453 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LCG] Special case when removing a ref edge from a RefSCC leaves
Chandler Carruth [Wed, 9 Aug 2017 09:14:34 +0000 (09:14 +0000)]
[LCG] Special case when removing a ref edge from a RefSCC leaves
that RefSCC still connected.

This is common and can be handled much more efficiently. As soon as we
know we've covered every node in the RefSCC with the DFS, we can simply
reset our state and return. This avoids numerous data structure updates
and other complexity.

On top of other changes, this appears to get new PM back to parity with
the old PM for a large protocol buffer message source code. The dense
map updates are very hot in this function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310451 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LCG] Switch one of the update methods for the LazyCallGraph to support
Chandler Carruth [Wed, 9 Aug 2017 09:05:27 +0000 (09:05 +0000)]
[LCG] Switch one of the update methods for the LazyCallGraph to support
limited batch updates.

Specifically, allow removing multiple reference edges starting from
a common source node. There are a few constraints that play into
supporting this form of batching:

1) The way updates occur during the CGSCC walk, about the most we can
   functionally batch together are those with a common source node. This
   also makes the batching simpler to implement, so it seems
   a worthwhile restriction.
2) The far and away hottest function for large C++ files I measured
   (generated code for protocol buffers) showed a huge amount of time
   was spent removing ref edges specifically, so it seems worth focusing
   there.
3) The algorithm for removing ref edges is very amenable to this
   restricted batching. There are just both API and implementation
   special casing for the non-batch case that gets in the way. Once
   removed, supporting batches is nearly trivial.

This does modify the API in an interesting way -- now, we only preserve
the target RefSCC when the RefSCC structure is unchanged. In the face of
any splits, we create brand new RefSCC objects. However, all of the
users were OK with it that I could find. Only the unittest needed
interesting updates here.

How much does batching these updates help? I instrumented the compiler
when run over a very large generated source file for a protocol buffer
and found that the majority of updates are intrinsically updating one
function at a time. However, nearly 40% of the total ref edges removed
are removed as part of a batch of removals greater than one, so these
are the cases batching can help with.

When compiling the IR for this file with 'opt' and 'O3', this patch
reduces the total time by 8-9%.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310450 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add the rest of the ADC and SBB instructions to isDefConvertible.
Craig Topper [Wed, 9 Aug 2017 06:17:49 +0000 (06:17 +0000)]
[X86] Add the rest of the ADC and SBB instructions to isDefConvertible.

I don't know if this really affects anything. Just thought it was weird that we had all of the ADD/SUB/AND/OR/XOR instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310447 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Use regular dyn_cast instead of a matcher for a simple case. NFC
Craig Topper [Wed, 9 Aug 2017 06:17:48 +0000 (06:17 +0000)]
[InstCombine] Use regular dyn_cast instead of a matcher for a simple case. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310446 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ImplicitNullCheck] Fix the bug when dependent instruction accesses memory
Serguei Katkov [Wed, 9 Aug 2017 05:17:02 +0000 (05:17 +0000)]
[ImplicitNullCheck] Fix the bug when dependent instruction accesses memory

It is possible that dependent instruction may access memory.
In this case we must reject optimization because the memory change will
be visible in null handler basic block. So we will execute an instruction which
we must not execute if check fails.

Reviewers: sanjoy, reames
Reviewed By: sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D36392

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310443 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix broken pdb test.
Zachary Turner [Wed, 9 Aug 2017 04:48:16 +0000 (04:48 +0000)]
Fix broken pdb test.

For some reason I didn't see this failure the first time.  The
output format changed slightly, so we just have to update the
test for the new format.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310442 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix -Wreorder-fields warning.
Zachary Turner [Wed, 9 Aug 2017 04:34:11 +0000 (04:34 +0000)]
Fix -Wreorder-fields warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310440 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PDB] Fix an issue writing the publics stream.
Zachary Turner [Wed, 9 Aug 2017 04:23:59 +0000 (04:23 +0000)]
[PDB] Fix an issue writing the publics stream.

In the refactor to merge the publics and globals stream, a bug
was introduced that wrote the wrong value for one of the fields
of the PublicsStreamHeader.  This caused debugging in WinDbg
to break.

We had no way of dumping any of these fields, so in addition to
fixing the bug I've added dumping support for them along with a
test that verifies the correct value is written.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310439 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PDB] Merge Global and Publics Builders.
Zachary Turner [Wed, 9 Aug 2017 04:23:25 +0000 (04:23 +0000)]
[PDB] Merge Global and Publics Builders.

The publics stream and globals stream are very similar. They both
contain a list of hash buckets that refer into a single shared stream,
the symbol record stream. Because of the need for each builder to manage
both an independent hash stream as well as a single shared record
stream, making the two builders be independent entities is not the right
design. This patch merges them into a single class, of which only a
single instance is needed to create all 3 streams.  PublicsStreamBuilder
and GlobalsStreamBuilder are now merged into the single GSIStreamBuilder
class, which writes all 3 streams at once.

Note that this patch does not contain any functionality change. So we're
still not yet writing any records to the globals stream. All we're doing
is making it so that when we do start writing records to the globals,
this refactor won't have to be part of that patch.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310438 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Add a test case for a missed opportunity to turn a select into logic...
Craig Topper [Wed, 9 Aug 2017 01:30:22 +0000 (01:30 +0000)]
[InstCombine] Add a test case for a missed opportunity to turn a select into logic ops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310434 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU] Revert r310429 changes in AMDKernelCodeT.h which broke some build bots.
Eugene Zelenko [Wed, 9 Aug 2017 00:06:29 +0000 (00:06 +0000)]
[AMDGPU] Revert r310429 changes in AMDKernelCodeT.h which broke some build bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310430 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Tue, 8 Aug 2017 23:53:55 +0000 (23:53 +0000)]
[AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310429 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[GlobalISel] Remove the GISelAccessor API."
Quentin Colombet [Tue, 8 Aug 2017 22:22:30 +0000 (22:22 +0000)]
Revert "[GlobalISel] Remove the GISelAccessor API."

This reverts commit r310115.

It causes a linker failure for the one of the unittests of AArch64 on one
of the linux bot:
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/3429

: && /home/fedora/gcc/install/gcc-7.1.0/bin/g++   -fPIC
-fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers -pedantic -Wno-long-long
-Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment
-ffunction-sections -fdata-sections -O2
-L/home/fedora/gcc/install/gcc-7.1.0/lib64 -Wl,-allow-shlib-undefined
-Wl,-O3 -Wl,--gc-sections
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o  -o
unittests/Target/AArch64/AArch64Tests
lib/libLLVMAArch64CodeGen.so.6.0.0svn lib/libLLVMAArch64Desc.so.6.0.0svn
lib/libLLVMAArch64Info.so.6.0.0svn lib/libLLVMCodeGen.so.6.0.0svn
lib/libLLVMCore.so.6.0.0svn lib/libLLVMMC.so.6.0.0svn
lib/libLLVMMIRParser.so.6.0.0svn lib/libLLVMSelectionDAG.so.6.0.0svn
lib/libLLVMTarget.so.6.0.0svn lib/libLLVMSupport.so.6.0.0svn -lpthread
lib/libgtest_main.so.6.0.0svn lib/libgtest.so.6.0.0svn -lpthread
-Wl,-rpath,/home/buildbots/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib
&& :
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x0):
undefined reference to `vtable for llvm::LegalizerInfo'
unittests/Target/AArch64/CMakeFiles/AArch64Tests.dir/InstSizes.cpp.o:(.toc+0x8):
undefined reference to `vtable for llvm::RegisterBankInfo'

The particularity of this bot is that it is built with
BUILD_SHARED_LIBS=ON

However, I was not able to reproduce the problem so far.
Reverting to unblock the bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310425 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMy commit r310346 introduced some valid warnings. This cleans them up.
Nemanja Ivanovic [Tue, 8 Aug 2017 22:17:31 +0000 (22:17 +0000)]
My commit r310346 introduced some valid warnings. This cleans them up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310424 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[MachineOutliner] Ensure AArch64 outliner doesn't mess with W30 or LR
Jessica Paquette [Tue, 8 Aug 2017 21:51:26 +0000 (21:51 +0000)]
[MachineOutliner] Ensure AArch64 outliner doesn't mess with W30 or LR

Before, the outliner would mark all instructions that read from/modify LR as
illegal. This doesn't handle W30, which overlaps with LR. This shouldn't be
outlined.

This commit fixes that by making modifiesRegister() and readsRegister() look at
W30 + take in a TRI argument. This makes sure that modifiesRegister() and
readsRegister() won't outline either of W30 and LR.

https://reviews.llvm.org/D36435

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310422 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[GVN] Remove stale entries in phitranslate cache when new phi is generated for PRE
Wei Mi [Tue, 8 Aug 2017 21:40:14 +0000 (21:40 +0000)]
[GVN] Remove stale entries in phitranslate cache when new phi is generated for PRE

When a new phi is generated for scalarpre of an expression, the phiTranslate cache
will become stale: Before PRE, the candidate expression must not be available in a
predecessor block, and phitranslate will cache the information. After PRE, the
expression will become available in all predecessor blocks, so the related entries
in phiTranslate cache becomes stale. The patch will simply remove the stale entries
so phiTranslate can be recomputed next time.

The stale entries in phitranslate cache will not affect correctness but will cause
missing PRE opportunity for later instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310421 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoBasicAA: assert on another case where aliasGEP shouldn't get a PartialAlias response
Nuno Lopes [Tue, 8 Aug 2017 21:25:26 +0000 (21:25 +0000)]
BasicAA: assert on another case where aliasGEP shouldn't get a PartialAlias response

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310420 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMake ICP uses PSI to check for hotness.
Dehao Chen [Tue, 8 Aug 2017 20:57:33 +0000 (20:57 +0000)]
Make ICP uses PSI to check for hotness.

Summary: Currently, ICP checks the count against a fixed value to see if it is hot enough to be promoted. This does not work for SamplePGO because sampled count may be much smaller. This patch uses PSI to check if the count is hot enough to be promoted.

Reviewers: davidxl, tejohnson, eraman

Reviewed By: davidxl

Subscribers: sanjoy, llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310416 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[codeview] Emit nested enums and typedefs from classes
Reid Kleckner [Tue, 8 Aug 2017 20:30:14 +0000 (20:30 +0000)]
[codeview] Emit nested enums and typedefs from classes

Previously we limited ourselves to only emitting nested classes, but we
need other kinds of types as well.

This fixes the Visual Studio STL visualizers, so that users can
visualize std::string and other objects.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310410 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Support pulling left shifts through a subtract with constant LHS
Craig Topper [Tue, 8 Aug 2017 20:14:11 +0000 (20:14 +0000)]
[InstCombine] Support pulling left shifts through a subtract with constant LHS

We already support pulling through an add with constant RHS. We can do the same for subtract.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310407 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAG] Introduce peekThroughBitcast function. NFCI.
Nirav Dave [Tue, 8 Aug 2017 20:01:18 +0000 (20:01 +0000)]
[DAG] Introduce peekThroughBitcast function. NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310405 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAG] Update comments. NFC.
Nirav Dave [Tue, 8 Aug 2017 19:52:19 +0000 (19:52 +0000)]
[DAG] Update comments. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310404 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU] Add llvm.amdgpu.update.dpp intrinsic
Connor Abbott [Tue, 8 Aug 2017 18:52:22 +0000 (18:52 +0000)]
[AMDGPU] Add llvm.amdgpu.update.dpp intrinsic

Summary:
Now that we've made all the necessary backend changes, we can add a new
intrinsic which exposes the new capabilities to IR producers. Since
llvm.amdgpu.update.dpp is a strict superset of llvm.amdgpu.mov.dpp, we
should deprecate the former. We also add tests for all the functionality
that was added in previous changes, now that we can access it via an IR
construct.

Reviewers: tstellar, arsenm

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310399 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NewGVN] Use a cast instead of a dyn_cast.
Chad Rosier [Tue, 8 Aug 2017 18:41:49 +0000 (18:41 +0000)]
[NewGVN] Use a cast instead of a dyn_cast.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310397 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PDB] Fix linking of function symbols and local variables.
Zachary Turner [Tue, 8 Aug 2017 18:34:44 +0000 (18:34 +0000)]
[PDB] Fix linking of function symbols and local variables.

The compiler outputs PROC32_ID symbols into the object files
for functions, and these symbols have an embedded type index
which, when copied to the PDB, refer to the IPI stream.  However,
the symbols themselves are also converted into regular symbols
(e.g. S_GPROC32_ID -> S_GPROC32), and type indices in the regular
symbol records refer to the TPI stream.  So this patch applies
two fixes to function records.
  1. It converts ID symbols to the proper non-ID record type.
  2. After remapping the type index from the object file's index
     space to the PDB file/IPI stream's index space, it then
     remaps that index to the TPI stream's index space by.

Besides functions, during the remapping process we were also
discarding symbol record types which we did not recognize.
In particular, we were discarding S_BPREL32 records, which is
what MSVC uses to describe local variables on the stack.  So
this patch fixes that as well by copying them to the PDB.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310394 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agodsymutil: support dwarf version mismatches between object and clang module
Adrian Prantl [Tue, 8 Aug 2017 18:26:12 +0000 (18:26 +0000)]
dsymutil: support dwarf version mismatches between object and clang module

This adds a missing call to maybeUpdateMaxDwarfVersion when visitng a
clang module. Failing to do so will cause a failure when emitting
DWARF 4 forms into a CU that AsmPrinter believes to be DWARF 2.

rdar://problem/33666528

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310392 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[LoopVectorize] Fix assertion failure in Fcmp vectorization
Anna Thomas [Tue, 8 Aug 2017 18:07:44 +0000 (18:07 +0000)]
[LoopVectorize] Fix assertion failure in Fcmp vectorization

Summary:
When vectorizing fcmps we can trip on incorrect cast assertion when setting the
FastMathFlags after generating the vectorized FCmp.
This can happen if the FCmp can be folded to true or false directly. The fix
here is to set the FastMathFlag using the FastMathFlagBuilder *before* creating
the FCmp Instruction. This is what's done by other optimizations such as
InstCombine.
Added a test case which trips on cast assertion without this patch.

Reviewers: Ayal, mssimpso, mkuper, gilr

Reviewed by: Ayal, mssimpso

Subscribers: llvm-commits, mzolotukhin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310389 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[ARM] Fix assembly and disassembly for VMRS/VMSR"
Tim Northover [Tue, 8 Aug 2017 17:16:46 +0000 (17:16 +0000)]
Revert "[ARM] Fix assembly and disassembly for VMRS/VMSR"

This reverts r310243. Only MVFR2 is actually restricted to v8 and it'll be a
little while before we can get a proper fix together. Better that we allow
incorrect code than reject correct in the meantime.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310384 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DomTree] Use a non-recursive DFS instead of a recursive one; NFC
Sanjoy Das [Tue, 8 Aug 2017 17:15:29 +0000 (17:15 +0000)]
[DomTree] Use a non-recursive DFS instead of a recursive one; NFC

Summary: The recursive DFS can stack overflow in pathological cases.

Reviewers: kuhar

Subscribers: mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310383 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[KnownBits][ValueTracking] Move the math for calculating known bits for add/sub into...
Craig Topper [Tue, 8 Aug 2017 16:29:35 +0000 (16:29 +0000)]
[KnownBits][ValueTracking] Move the math for calculating known bits for add/sub into a static method in KnownBits object

I want to reuse this code in SimplifyDemandedBits handling of Add/Sub. This will make that easier.

Wonder if we should use it in SelectionDAG's computeKnownBits too.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310378 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[RISCV] Fix warning about unused getSubtargetFeatureName()
Alex Bradbury [Tue, 8 Aug 2017 16:20:39 +0000 (16:20 +0000)]
[RISCV] Fix warning about unused getSubtargetFeatureName()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310375 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoBasicAA: aliasGEP shouldn't get a PartialAlias response here
Nuno Lopes [Tue, 8 Aug 2017 16:13:24 +0000 (16:13 +0000)]
BasicAA: aliasGEP shouldn't get a PartialAlias response here
add an assert() to ensure that's the case (as I'm not convinced it won't happen)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310373 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAGCombiner] simplifyShuffleMask - handle UNDEF inputs from shuffles as well as...
Simon Pilgrim [Tue, 8 Aug 2017 16:10:33 +0000 (16:10 +0000)]
[DAGCombiner] simplifyShuffleMask - handle UNDEF inputs from shuffles as well as BUILD_VECTOR

Minor extension to D36393

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310372 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[RISCV] Add basic RISCVAsmParser (missing files)
Alex Bradbury [Tue, 8 Aug 2017 14:43:36 +0000 (14:43 +0000)]
[RISCV] Add basic RISCVAsmParser (missing files)

This commit adds the files missing from rL310361. Apologies for the noise.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310363 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[RISCV] Add basic RISCVAsmParser
Alex Bradbury [Tue, 8 Aug 2017 14:32:35 +0000 (14:32 +0000)]
[RISCV] Add basic RISCVAsmParser

This doesn't yet support parsing things like %pcrel_hi(foo), but will handle
basic instructions with register or immediate operands.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310361 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PowerPC] Don't crash on larger splats achieved through 1-byte splats
Nemanja Ivanovic [Tue, 8 Aug 2017 13:52:45 +0000 (13:52 +0000)]
[PowerPC] Don't crash on larger splats achieved through 1-byte splats

We've implemented a 1-byte splat using XXSPLTISB on P9. However, LLVM will
produce a 1-byte splat even for wider element BUILD_VECTOR nodes. This patch
prevents crashing in that situation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310358 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[globalisel][tablegen] Remove unnecessary ; to satisfy ubuntu-gcc7.1-werror.
Daniel Sanders [Tue, 8 Aug 2017 13:21:26 +0000 (13:21 +0000)]
[globalisel][tablegen] Remove unnecessary ; to satisfy ubuntu-gcc7.1-werror.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310357 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAppease compilers that have the -Wcovered-switch-default switch.
Nemanja Ivanovic [Tue, 8 Aug 2017 12:41:56 +0000 (12:41 +0000)]
Appease compilers that have the -Wcovered-switch-default switch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310356 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Improved X86::CMOV to Branch heuristic.
Amjad Aboud [Tue, 8 Aug 2017 12:17:56 +0000 (12:17 +0000)]
[X86] Improved X86::CMOV to Branch heuristic.
Resolved PR33954.
This patch contains two more constraints that aim to reduce the noise cases where we convert CMOV into branch for small gain, and end up spending more cycles due to overhead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310352 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PowerPC] Eliminate compares - add i32 sext/zext handling for SETLE/SETGE
Nemanja Ivanovic [Tue, 8 Aug 2017 11:20:44 +0000 (11:20 +0000)]
[PowerPC] Eliminate compares - add i32 sext/zext handling for SETLE/SETGE

Adds handling for SETLE/SETGE comparisons on i32 values. Furthermore, it adds
the handling for the special case where RHS == 0.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310346 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAGCombiner] Simplify shuffle mask index if the referenced input element is UNDEF
Simon Pilgrim [Tue, 8 Aug 2017 11:03:30 +0000 (11:03 +0000)]
[DAGCombiner] Simplify shuffle mask index if the referenced input element is UNDEF

Fixes one of the cases in PR34041.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310344 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[globalisel][tablegen] Add support for importing 'imm' operands.
Daniel Sanders [Tue, 8 Aug 2017 10:44:31 +0000 (10:44 +0000)]
[globalisel][tablegen] Add support for importing 'imm' operands.

Summary:
This patch enables the import of rules containing 'imm' operands that do not
constrain the acceptable values using predicates. Support for ImmLeaf will
arrive in a later patch.

Depends on D35681

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, javed.absar, igorb, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310343 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PM] Fix a likely more critical infloop bug in the CGSCC pass manager.
Chandler Carruth [Tue, 8 Aug 2017 10:13:23 +0000 (10:13 +0000)]
[PM] Fix a likely more critical infloop bug in the CGSCC pass manager.

This was just a bad oversight on my part. The code in question should
never have worked without this fix. But it turns out, there are
relatively few places that involve libfunctions that participate in
a single SCC, and unless they do, this happens to not matter.

The effect of not having this correct is that each time through this
routine, the edge from write_wrapper to write was toggled between a call
edge and a ref edge. First time through, it becomes a demoted call edge
and is turned into a ref edge. Next time it is a promoted call edge from
a ref edge. On, and on it goes forever.

I've added the asserts which should have always been here to catch silly
mistakes like this in the future as well as a test case that will
actually infloop without the fix.

The other (much scarier) infinite-inlining issue I think didn't actually
occur in practice, and I simply misdiagnosed this minor issue as that
much more scary issue. The other issue *is* still a real issue, but I'm
somewhat relieved that so far it hasn't happened in real-world code
yet...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310342 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Cast to BinaryOperator earlier in foldSelectIntoOp to simplify the...
Craig Topper [Tue, 8 Aug 2017 06:19:24 +0000 (06:19 +0000)]
[InstCombine] Cast to BinaryOperator earlier in foldSelectIntoOp to simplify the code.

We no longer need the explicit operand count check or the later dynamic cast.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310339 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Fix warnings introduced by r310336
Tom Stellard [Tue, 8 Aug 2017 05:52:00 +0000 (05:52 +0000)]
AMDGPU: Fix warnings introduced by r310336

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310337 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Move R600 parts of AMDGPUISelDAGToDAG into their own class
Tom Stellard [Tue, 8 Aug 2017 04:57:55 +0000 (04:57 +0000)]
AMDGPU: Move R600 parts of AMDGPUISelDAGToDAG into their own class

Summary: This refactoring is required in order to split the R600 and GCN tablegen files.

Reviewers: arsenm

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310336 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Also remove SI from docs
Konstantin Zhuravlyov [Tue, 8 Aug 2017 04:28:31 +0000 (04:28 +0000)]
AMDGPU: Also remove SI from docs

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310335 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PM] Relax the spelling of a pass name slightly in this test.
Chandler Carruth [Tue, 8 Aug 2017 02:27:49 +0000 (02:27 +0000)]
[PM] Relax the spelling of a pass name slightly in this test.

I forgot that MSVC doesn't preserve this typedef, my bad.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310334 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[PM] Fix new LoopUnroll function pass by invalidating loop analysis
Chandler Carruth [Tue, 8 Aug 2017 02:24:20 +0000 (02:24 +0000)]
[PM] Fix new LoopUnroll function pass by invalidating loop analysis
results when a loop is completely removed.

This is very hard to manifest as a visible bug. You need to arrange for
there to be a subsequent allocation of a 'Loop' object which gets the
exact same address as the one which the unroll deleted, and you need the
LoopAccessAnalysis results to be significant in the way that they're
stale. And you need a million other things to align.

But when it does, you get a deeply mysterious crash due to actually
finding a stale analysis result. This fixes the issue and tests for it
by directly checking we successfully invalidate things. I have not been
able to get *any* test case to reliably trigger this. Changes to LLVM
itself caused the only test case I ever had to cease to crash.

I've looked pretty extensively at less brittle ways of fixing this and
they are actually very, very hard to do. This is a somewhat strange and
unusual case as we have a pass which is deleting an IR unit, but is not
running within that IR unit's pass framework (which is what handles this
cleanly for the normal loop unroll). And where there isn't a definitive
way to clear *all* of the stale cache entries. And where the pass *is*
updating the core analysis that provides the IR units!

For example, we don't have any of these problems with Function analyses
because it is easy to clear out function analyses when the functions
themselves may have been deleted -- we clear an entire module's worth!
But that is too heavy of a hammer down here in the LoopAnalysisManager
layer.

A better long-term solution IMO is to require that AnalysisManager's
make their keys durable to this kind of thing. Specifically, when
caching an analysis for one IR unit that is conceptually "owned" by
a higher level IR unit, the AnalysisManager should incorporate this into
its data structures so that we can reliably clear these results without
having to teach each and every pass to do so manually as we do here. But
that is a change for another day as it will be a fairly invasive change
to the AnalysisManager infrastructure. Until then, this fortunately
seems to be quite rare.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310333 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Tue, 8 Aug 2017 00:47:13 +0000 (00:47 +0000)]
[AMDGPU] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310328 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[libFuzzer] simplify code, NFC
Kostya Serebryany [Tue, 8 Aug 2017 00:17:20 +0000 (00:17 +0000)]
[libFuzzer] simplify code, NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310326 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[libFuzzer] remove stale code
Kostya Serebryany [Tue, 8 Aug 2017 00:14:49 +0000 (00:14 +0000)]
[libFuzzer] remove stale code

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310325 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[libFuzzer] simplify the implementation of -print_coverage=1
Kostya Serebryany [Tue, 8 Aug 2017 00:12:09 +0000 (00:12 +0000)]
[libFuzzer] simplify the implementation of -print_coverage=1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310324 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[KnownBits] Fix copy pasto in comment. NFC
Craig Topper [Mon, 7 Aug 2017 22:35:55 +0000 (22:35 +0000)]
[KnownBits] Fix copy pasto in comment. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310320 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][AVX] Added test for broadcast shuffle from binary sources with undefs (D36393)
Simon Pilgrim [Mon, 7 Aug 2017 22:20:06 +0000 (22:20 +0000)]
[X86][AVX] Added test for broadcast shuffle from binary sources with undefs (D36393)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310317 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Implement getMinimumNopSize
Matt Arsenault [Mon, 7 Aug 2017 22:00:58 +0000 (22:00 +0000)]
AMDGPU: Implement getMinimumNopSize

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310310 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Object] Initialize LoadConfig member to null
Reid Kleckner [Mon, 7 Aug 2017 21:23:38 +0000 (21:23 +0000)]
[Object] Initialize LoadConfig member to null

Executables may not contain a load config, and clients should be able to
test for nullability. Previously we'd return uninitialized memory. Now
getLoadConfig32/64 return valid pointers or null.

Fixes PR34108

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310308 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDo not instrument libFuzzer itself when built with -DLLVM_USE_SANITIZE_COVERAGE
George Karpenkov [Mon, 7 Aug 2017 20:56:11 +0000 (20:56 +0000)]
Do not instrument libFuzzer itself when built with -DLLVM_USE_SANITIZE_COVERAGE

Fixes regression from https://reviews.llvm.org/D36295

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310305 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-pdbutil] Don't crash when a section contrib's isect is invalid.
Zachary Turner [Mon, 7 Aug 2017 20:24:01 +0000 (20:24 +0000)]
[llvm-pdbutil] Don't crash when a section contrib's isect is invalid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310298 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMove the SampleProfileLoader right after EarlyFPM.
Dehao Chen [Mon, 7 Aug 2017 20:23:20 +0000 (20:23 +0000)]
Move the SampleProfileLoader right after EarlyFPM.

Summary: SampleProfileLoader pass do need to happen after some early cleanup passes so that inlining can happen correctly inside the SampleProfileLoader pass.

Reviewers: chandlerc, davidxl, tejohnson

Reviewed By: chandlerc, tejohnson

Subscribers: sanjoy, mehdi_amini, eraman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310296 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReapply fix PR23384 (part 3 of 3) r304824 (was reverted in r305720).
Evgeny Stupachenko [Mon, 7 Aug 2017 19:56:34 +0000 (19:56 +0000)]
Reapply fix PR23384 (part 3 of 3) r304824 (was reverted in r305720).
The root cause of reverting was fixed - PR33514.

Summary:
The patch makes instruction count the highest priority for
 LSR solution for X86 (previously registers had highest priority).

Reviewers: qcolombet

Differential Revision: http://reviews.llvm.org/D30562

From: Evgeny Stupachenko <evstupac@gmail.com>
                         <evgeny.v.stupachenko@intel.com>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310289 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemoving an unused variable that was missed with the refactoring in r310272; NFC.
Aaron Ballman [Mon, 7 Aug 2017 19:26:17 +0000 (19:26 +0000)]
Removing an unused variable that was missed with the refactoring in r310272; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310285 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU] Add pseudo "old" source to all DPP instructions
Connor Abbott [Mon, 7 Aug 2017 19:10:56 +0000 (19:10 +0000)]
[AMDGPU] Add pseudo "old" source to all DPP instructions

Summary:
All instructions with the DPP modifier may not write to certain lanes of
the output if bound_ctrl=1 is set or any bits in bank_mask or row_mask
aren't set, so the destination register may be both defined and modified.
The right way to handle this is to add a constraint that the destination
register is the same as one of the inputs. We could tie the destination
to the first source, but that would be too restrictive for some use-cases
where we want the destination to be some other value before the
instruction executes. Instead, add a fake "old" source and tie it to the
destination. Effectively, the "old" source defines what value unwritten
lanes will get. We'll expose this functionality to users with a new
intrinsic later.

Also, we want to use DPP instructions for computing derivatives, which
means we need to set WQM for them. We also need to enable the entire
wavefront when using DPP intrinsics to implement nonuniform subgroup
reductions, since otherwise we'll get incorrect results in some cases.
To accomodate this, add a new operand to all DPP instructions which will
be interpreted by the SI WQM pass. This will be exposed with a new
intrinsic later. We'll also add support for Whole Wavefront Mode later.

I also fixed llvm.amdgcn.mov.dpp to overwrite the source and fixed up
the test. However, I could also keep the old behavior (where lanes that
aren't written are undefined) if people want it.

Reviewers: tstellar, arsenm

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310283 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Remove -mcpu=SI
Matt Arsenault [Mon, 7 Aug 2017 18:30:35 +0000 (18:30 +0000)]
AMDGPU: Remove -mcpu=SI

Leftover from before amdgcn/r600 split.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310277 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Remove redundant opt level check
Matt Arsenault [Mon, 7 Aug 2017 18:12:48 +0000 (18:12 +0000)]
AMDGPU: Remove redundant opt level check

addOptimizedRegAlloc isn't used for -O0 already.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310275 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Remove FixControlFlowLiveIntervals pass
Matt Arsenault [Mon, 7 Aug 2017 18:12:47 +0000 (18:12 +0000)]
AMDGPU: Remove FixControlFlowLiveIntervals pass

This hasn't done anything in a long time. This was
running after the the control flow pseudos were expanded,
so this would never find them. The control flow pseudo
expansion was moved to solve the problem this pass was
supposed to solve in the first place, except handling
it earlier also fixes it for fast regalloc which doesn't
use LiveIntervals.

Noticed by checking LCOV reports.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310274 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Support (X | C1) & C2 --> (X & C2^(C1&C2)) | (C1&C2) for vector splats
Craig Topper [Mon, 7 Aug 2017 18:10:39 +0000 (18:10 +0000)]
[InstCombine] Support (X | C1) & C2 --> (X & C2^(C1&C2)) | (C1&C2) for vector splats

Note the original code I deleted incorrectly listed this as (X | C1) & C2 --> (X & C2^(C1&C2)) | C1 Which is only valid if C1 is a subset of C2. This relied on SimplifyDemandedBits to remove any extra bits from C1 before we got to that code.

My new implementation avoids relying on that behavior so that it can be naively verified with alive.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310272 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Use a custom areInlineCompatible
Matt Arsenault [Mon, 7 Aug 2017 17:08:44 +0000 (17:08 +0000)]
AMDGPU: Use a custom areInlineCompatible

Fixes not inlining OpenCL library functions on AMDGPU,
which don't have an explicitly set target-cpu.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310269 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][AVX] Add full test coverage of subvector_broadcasts from registers
Simon Pilgrim [Mon, 7 Aug 2017 16:49:09 +0000 (16:49 +0000)]
[X86][AVX] Add full test coverage of subvector_broadcasts from registers

X86SubVBroadcast is for memory subvector broadcasts, but we must test that it handles all cases without the load as well just in case.

This was noticed while I was triaging the test cases from PR34041.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310268 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DebugInfo][DWARF] Address paulr's comment on rL310253.
Simon Dardis [Mon, 7 Aug 2017 16:08:11 +0000 (16:08 +0000)]
[DebugInfo][DWARF] Address paulr's comment on rL310253.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310267 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][AVX] Cleanup subvector broadcast tests - remove old prefixes.
Simon Pilgrim [Mon, 7 Aug 2017 15:50:43 +0000 (15:50 +0000)]
[X86][AVX] Cleanup subvector broadcast tests - remove old prefixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310265 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[x86] revert r310208 to investigate test-suite failures (PR34105 / PR34097)
Sanjay Patel [Mon, 7 Aug 2017 15:47:48 +0000 (15:47 +0000)]
[x86] revert r310208 to investigate test-suite failures (PR34105 / PR34097)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310264 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DebugInfo][DWARF] Correct some usages of PRIx32 to PRIx64
Simon Dardis [Mon, 7 Aug 2017 15:37:57 +0000 (15:37 +0000)]
[DebugInfo][DWARF] Correct some usages of PRIx32 to PRIx64

These lead to tests failing spuriously as the values after being rendered to a
string were incorrect.

Reviewers: clayborg

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310262 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SLP] General improvements of SLP vectorization process.
Alexey Bataev [Mon, 7 Aug 2017 15:25:49 +0000 (15:25 +0000)]
[SLP] General improvements of SLP vectorization process.

Patch tries to improve two-pass vectorization analysis, existing in SLP vectorizer. What it does:

1. Defines key nodes, that are the vectorization roots. Previously vectorization started if StoreInst or ReturnInst is found. For now, the vectorization started for all Instructions with no users and void types (Terminators, StoreInst) + CallInsts.
2. CmpInsts, InsertElementInsts and InsertValueInsts are stored in the
array. This array is processed only after the vectorization of the
first-after-these instructions key node is finished. Vectorization goes
in reverse order to try to vectorize as much code as possible.

Reviewers: mzolotukhin, Ayal, mkuper, gilr, hfinkel, RKSimon

Subscribers: ashahid, anemet, RKSimon, mssimpso, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310260 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix typo in comment
Matt Arsenault [Mon, 7 Aug 2017 14:58:43 +0000 (14:58 +0000)]
Fix typo in comment

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310259 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAMDGPU: Cleanup subtarget features
Matt Arsenault [Mon, 7 Aug 2017 14:58:04 +0000 (14:58 +0000)]
AMDGPU: Cleanup subtarget features

Try to avoid mutually exclusive features. Don't use
a real default GPU, and use a fake "generic". The goal
is to make it easier to see which set of features are
incompatible between feature strings.

Most of the test changes are due to random scheduling changes
from not having a default fullspeed model.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310258 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "[SLP] General improvements of SLP vectorization process."
Alexey Bataev [Mon, 7 Aug 2017 14:51:52 +0000 (14:51 +0000)]
Revert "[SLP] General improvements of SLP vectorization process."

This reverts commit r310255.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310257 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector.
Nirav Dave [Mon, 7 Aug 2017 14:07:49 +0000 (14:07 +0000)]
[DAG] Extend visitSCALAR_TO_VECTOR optimization to truncated vector.

Relanding after case to insert explicit truncation as necessary.

Allow SCALAR_TO_VECTOR of EXTRACT_VECTOR_ELT to reduce to
EXTRACT_SUBVECTOR of vector shuffle when output is smaller. Marginally
improves vector shuffle computations.

Reviewers: efriedma, RKSimon, spatel

Subscribers: javed.absar, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310256 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SLP] General improvements of SLP vectorization process.
Alexey Bataev [Mon, 7 Aug 2017 14:03:17 +0000 (14:03 +0000)]
[SLP] General improvements of SLP vectorization process.

Summary:
Patch tries to improve two-pass vectorization analysis, existing in SLP vectorizer. What it does:
1. Defines key nodes, that are the vectorization roots. Previously vectorization started if StoreInst or ReturnInst is found. For now, the vectorization started for all Instructions with no users and void types (Terminators, StoreInst) + CallInsts.
2. CmpInsts, InsertElementInsts and InsertValueInsts are stored in the array. This array is processed only after the vectorization of the first-after-these instructions key node is finished. Vectorization goes in reverse order to try to vectorize as much code as possible.

Reviewers: mzolotukhin, Ayal, mkuper, gilr, hfinkel, RKSimon

Subscribers: ashahid, anemet, RKSimon, mssimpso, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310255 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true
Nirav Dave [Mon, 7 Aug 2017 13:55:27 +0000 (13:55 +0000)]
[TableGen] AsmMatcher: fix OpIdx computation when HasOptionalOperands is true

Relanding after fixing UB issue with DefaultOffsets.

Consider the following instruction: "inst.eq $dst, $src" where ".eq"
is an optional flag operand.  The $src and $dst operands are
registers.  If we parse the instruction "inst r0, r1", the flag is not
present and it will be marked in the "OptionalOperandsMask" variable.
After the matching is complete we call the "convertToMCInst" method.

The current implementation works only if the optional operands are at
the end of the array.  The "Operands" array looks like [token:"inst",
reg:r0, reg:r1].  The first operand that must be added to the MCInst
is the destination, the r0 register.  The "OpIdx" (in the Operands
array) for this register is 2.  However, since the flag is not present
in the Operands, the actual index for r0 should be 1.  The flag is not
present since we rely on the default value.

This patch removes the "NumDefaults" variable and replaces it with an
array (DefaultsOffset).  This array contains an index for each operand
(excluding the mnemonic).  At each index, the array contains the
number of optional operands that should be subtracted.  For the
previous example, this array looks like this: [0, 1, 1].  When we need
to access the r0 register, we compute its index as 2 -
DefaultsOffset[1] = 1.

Patch by Alexandru Guduleasa!

Reviewers: SamWot, nhaustov, niravd

Reviewed By: niravd

Subscribers: vitalybuka, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310254 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[DebugInfo][DWARF] Use PRIx64 explicitly in output.
Simon Dardis [Mon, 7 Aug 2017 13:30:03 +0000 (13:30 +0000)]
[DebugInfo][DWARF] Use PRIx64 explicitly in output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310253 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess (VF16...
Michael Zuckerman [Mon, 7 Aug 2017 13:22:39 +0000 (13:22 +0000)]
[X86][LLVM]Expanding Supports lowerInterleavedStore() in X86InterleavedAccess (VF16 stride 4).

This patch expands the support of lowerInterleavedStore to 16x8i stride 4.

LLVM creates suboptimal shuffle code-gen for AVX2. In overall, this patch is a specific fix for the pattern (Strid=4 VF=16) and we plan to include more patterns in the future.

The patch goal is to optimize the following sequence:
At the end of the computation, we have ymm2, ymm0, ymm12 and ymm3 holding
each 16 chars:

c0, c1, , c16
m0, m1, , m16
y0, y1, , y16
k0, k1, ., k16

And these need to be transposed/interleaved and stored like so:

c0 m0 y0 k0 c1 m1 y1 k1 c2 m2 y2 k2 c3 m3 y3 k3 ....

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310252 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AMDGPU][MC] Corrected VOP3 version of v_interp_* instructions for VI
Dmitry Preobrazhensky [Mon, 7 Aug 2017 13:14:12 +0000 (13:14 +0000)]
[AMDGPU][MC] Corrected VOP3 version of v_interp_* instructions for VI

See bug 32621: https://bugs.llvm.org//show_bug.cgi?id=32621

Reviewers: vpykhtin, SamWot, arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310251 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[llvm-objdump] Use PRIx64 for output of ARM64_RELOC_ADDEND
Simon Dardis [Mon, 7 Aug 2017 12:29:38 +0000 (12:29 +0000)]
[llvm-objdump] Use PRIx64 for output of ARM64_RELOC_ADDEND

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310250 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86][AVX] Added test for broadcast shuffle with undefs (PR34041)
Simon Pilgrim [Mon, 7 Aug 2017 12:24:33 +0000 (12:24 +0000)]
[X86][AVX] Added test for broadcast shuffle with undefs (PR34041)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310249 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ARM] Fix assembly and disassembly for VMRS/VMSR
Andre Vieira [Mon, 7 Aug 2017 08:41:05 +0000 (08:41 +0000)]
[ARM] Fix assembly and disassembly for VMRS/VMSR

This patch addresses two issues with assembly and disassembly for VMRS/VMSR:

1.currently VMRS/VMSR instructions accessing fpsid, mvfr{0-2} and fpexc, are
  accepted for non ARMv8-A targets.

2. all VMRS/VMSR instructions accept writing/reading to PC and SP, when only
   ARMv7-A and ARMv8-A should be allowed to write/read to SP and none to PC.

This patch addresses those issues and adds tests for these cases.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310243 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[asan] Fix asan dynamic shadow check before copyArgsPassedByValToAllocas
Vitaly Buka [Mon, 7 Aug 2017 07:35:33 +0000 (07:35 +0000)]
[asan] Fix asan dynamic shadow check before copyArgsPassedByValToAllocas

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310242 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[asan] Disable checking of arguments passed by value for --asan-force-dynamic-shadow
Vitaly Buka [Mon, 7 Aug 2017 07:12:34 +0000 (07:12 +0000)]
[asan] Disable checking of arguments passed by value for --asan-force-dynamic-shadow

Fails with "Instruction does not dominate all uses!"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310241 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd -asan-force-dynamic-shadow test
Vitaly Buka [Mon, 7 Aug 2017 07:12:33 +0000 (07:12 +0000)]
Add -asan-force-dynamic-shadow test

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310240 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SelectionDAG] reset NewNodesMustHaveLegalTypes flag between basic blocks
Guy Blank [Mon, 7 Aug 2017 05:51:14 +0000 (05:51 +0000)]
[SelectionDAG] reset NewNodesMustHaveLegalTypes flag between basic blocks

The NewNodesMustHaveLegalTypes flag is set to false at the beginning of CodeGenAndEmitDAG, and set to true after legalizing types.
But before calling CodeGenAndEmitDAG we build the DAG for the basic block.
So for the first basic block NewNodesMustHaveLegalTypes would be 'false' during the SDAG building, and for all other basic blocks it would be 'true'.

This patch sets the flag to false before SDAG building each basic block.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310239 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Reassociate] Use a range loop for clarity. NFCI.
Davide Italiano [Mon, 7 Aug 2017 01:57:21 +0000 (01:57 +0000)]
[Reassociate] Use a range loop for clarity. NFCI.

While here, rename `i` to `Rank` as the latter is more
self-explanatory (and this code also uses `I` two lines below to
identify an Instruction).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310238 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Reassociate] Try to bail out early when canonicalizing.
Davide Italiano [Mon, 7 Aug 2017 01:49:09 +0000 (01:49 +0000)]
[Reassociate] Try to bail out early when canonicalizing.

This commit rearranges the checks to avoid calls to getRank()
when not needed (e.g. when RHS == LHS).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310237 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Remove shift handling from OptAndOp.
Craig Topper [Sun, 6 Aug 2017 23:30:49 +0000 (23:30 +0000)]
[InstCombine] Remove shift handling from OptAndOp.

Summary: This is all handled by SimplifyDemandedBits.

Reviewers: spatel, davide

Reviewed By: davide

Subscribers: davide, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310234 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Support (X ^ C1) & C2 --> (X & C2) ^ (C1&C2) for vector splats.
Craig Topper [Sun, 6 Aug 2017 23:11:49 +0000 (23:11 +0000)]
[InstCombine] Support (X ^ C1) & C2 --> (X & C2) ^ (C1&C2) for vector splats.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310233 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[InstCombine] Support '(C - X) ^ signmask -> (C + signmask - X)' and '(X + C) ^ signm...
Craig Topper [Sun, 6 Aug 2017 22:17:21 +0000 (22:17 +0000)]
[InstCombine] Support '(C - X) ^ signmask -> (C + signmask - X)' and '(X + C) ^ signmask -> (X + C + signmask)' for vector splats.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310232 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[SLPVectorizer][X86] Cleanup test case. NFCI
Simon Pilgrim [Sun, 6 Aug 2017 20:50:19 +0000 (20:50 +0000)]
[SLPVectorizer][X86] Cleanup test case. NFCI

Remove excess attributes/metadata

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310227 91177308-0d34-0410-b5e6-96231b3b80d8