OSDN Git Service

android-x86/external-llvm.git
7 years ago[InstCombine] add test for missing icmp bool fold; NFC
Sanjay Patel [Wed, 17 May 2017 22:20:02 +0000 (22:20 +0000)]
[InstCombine] add test for missing icmp bool fold; NFC

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

7 years ago[InstCombine] move icmp bool canonicalizations to helper; NFC
Sanjay Patel [Wed, 17 May 2017 22:15:07 +0000 (22:15 +0000)]
[InstCombine] move icmp bool canonicalizations to helper; NFC

As noted in the post-commit comments in D32143, we should be
catching the constant operand cases sooner to be more efficient
and less likely to expose a missing fold.

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

7 years agoAMDGPU: Start defining a calling convention
Matt Arsenault [Wed, 17 May 2017 21:56:25 +0000 (21:56 +0000)]
AMDGPU: Start defining a calling convention

Partially implement callee-side for arguments and return values.
byval doesn't work properly, and most likely sret or other on-stack
return values most as well.

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

7 years agoCodeGen: Power: Add lowering for shifts of v1i128.
Kyle Butt [Wed, 17 May 2017 21:54:41 +0000 (21:54 +0000)]
CodeGen: Power: Add lowering for shifts of v1i128.

When legalizing vector operations on vNi128, they will be split to v1i128
because that is a legal type on ppc64, but then the compiler will crash in
selection dag because it fails to select for these operations. This patch fixes
shift operations. Logical shift right and left shift can be performed in the
vector unit, but algebraic shift right requires being split.

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

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

7 years agoFix PR33028
Michael Liao [Wed, 17 May 2017 21:48:00 +0000 (21:48 +0000)]
Fix PR33028

- '-verify-mahcineinstrs' starts to complain allocatable live-in physical
  registers on non-entry or non-landing-pad basic blocks.
- Refactor the XBEGIN translation to define EAX on a dedicated fallback code
  path due to XABORT. Add a pseudo instruction to define EAX explicitly to
  avoid add physical register live-in.

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

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

7 years agoAMDGPU: Remove old intrinsic uses
Matt Arsenault [Wed, 17 May 2017 21:38:21 +0000 (21:38 +0000)]
AMDGPU: Remove old intrinsic uses

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

7 years agoAMDGPU: Expand frame indexes to be relative to scratch wave offset
Matt Arsenault [Wed, 17 May 2017 21:23:14 +0000 (21:23 +0000)]
AMDGPU: Expand frame indexes to be relative to scratch wave offset

In order for an arbitrary callee to access an object
in a caller's stack frame, the 32-bit offset used as
the private pointer needs to be relative to the kernel's
scratch wave offset register.

Convert to this by finding the difference from the current
stack frame and scaling by the wavefront size.

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

7 years agoAMDGPU: Change mubuf soffset register when SP relative
Matt Arsenault [Wed, 17 May 2017 21:02:58 +0000 (21:02 +0000)]
AMDGPU: Change mubuf soffset register when SP relative

Check the MachinePointerInfo for whether the access is
supposed to be relative to the stack pointer.

No tests because this is used in later commits implementing
calls.

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

7 years ago[X86][AVX512] Add 512-bit vector ctlz costs + tests
Simon Pilgrim [Wed, 17 May 2017 21:02:18 +0000 (21:02 +0000)]
[X86][AVX512] Add 512-bit vector ctlz costs + tests

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

7 years ago[llvm-pdbdump] in yaml2pdb, generate default output filename if none given
Bob Haarman [Wed, 17 May 2017 20:46:48 +0000 (20:46 +0000)]
[llvm-pdbdump] in yaml2pdb, generate default output filename if none given

Summary:
llvm-pdbdump yaml2pdb used to fail with a misleading error
message ("An I/O error occurred on the file system") if no output file
was specified. This change adds an assert to PDBFileBuilder to check
that an output file name is specified, and makes llvm-pdbdump generate
an output file name based on the input file name if no output file
name is explicitly specified.

Reviewers: amccarth, zturner

Reviewed By: zturner

Subscribers: fhahn, llvm-commits

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

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

7 years agoupdate the test that should have been updated in r303292. (NFC)
Dehao Chen [Wed, 17 May 2017 20:44:08 +0000 (20:44 +0000)]
update the test that should have been updated in r303292. (NFC)

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

7 years agoAdd some helpers for manipulating BinaryStreamRefs.
Zachary Turner [Wed, 17 May 2017 20:42:52 +0000 (20:42 +0000)]
Add some helpers for manipulating BinaryStreamRefs.

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

7 years agoAMDGPU: Make better use of op_sel with high components
Matt Arsenault [Wed, 17 May 2017 20:30:58 +0000 (20:30 +0000)]
AMDGPU: Make better use of op_sel with high components

Handle more general swizzles.

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

7 years ago[InstSimplify] handle all icmp i1 X, C in one place; NFCI
Sanjay Patel [Wed, 17 May 2017 20:27:55 +0000 (20:27 +0000)]
[InstSimplify] handle all icmp i1 X, C in one place; NFCI

We already handled all of the new tests identically, but several
of those went through a lot of unnecessary processing before
getting folded.

Another motivation for grouping these cases together is that
InstCombine needs a similar fold. Currently, it handles the
'not' cases inefficiently which can lead to bugs as described
in the post-commit comments of:
https://reviews.llvm.org/D32143

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

7 years ago[BinaryStream] Reduce the amount of boiler plate needed to use.
Zachary Turner [Wed, 17 May 2017 20:23:31 +0000 (20:23 +0000)]
[BinaryStream] Reduce the amount of boiler plate needed to use.

Often you have an array and you just want to use it.  With the current
design, you have to first construct a `BinaryByteStream`, and then create
a `BinaryStreamRef` from it.  Worse, the `BinaryStreamRef` holds a pointer
to the `BinaryByteStream`, so you can't just create a temporary one to
appease the compiler, you have to actually hold onto both the `ArrayRef`
as well as the `BinaryByteStream` *AND* the `BinaryStreamReader` on top of
that.  This makes for very cumbersome code, often requiring one to store a
`BinaryByteStream` in a class just to circumvent this.

At the cost of some added complexity (not exposed to users, but internal
to the library), we can do better than this.  This patch allows us to
construct `BinaryStreamReaders` and `BinaryStreamWriters` directly from
source data (e.g. `StringRef`, `MutableArrayRef<uint8_t>`, etc).  Not only
does this reduce the amount of code you have to type and make it more
obvious how to use it, but it solves real lifetime issues when it's
inconvenient to hold onto a `BinaryByteStream` for a long time.

The additional complexity is in the form of an added layer of indirection.
Whereas before we simply stored a `BinaryStream*` in the ref, we now store
both a `BinaryStream*` **and** a `std::shared_ptr<BinaryStream>`.  When
the user wants to construct a `BinaryStreamRef` directly from an
`ArrayRef` etc, we allocate an internal object that holds ownership over a
`BinaryByteStream` and forwards all calls, and store this in the
`shared_ptr<>`.  This also maintains the ref semantics, as you can copy it
by value and references refer to the same underlying stream -- the one
being held in the object stored in the `shared_ptr`.

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

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

7 years ago[X86][AVX512] Add 512-bit vector cttz costs + tests
Simon Pilgrim [Wed, 17 May 2017 20:22:54 +0000 (20:22 +0000)]
[X86][AVX512] Add 512-bit vector cttz costs + tests

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

7 years agoOnly enable LiveRangeShrink for x86.
Dehao Chen [Wed, 17 May 2017 20:18:13 +0000 (20:18 +0000)]
Only enable LiveRangeShrink for x86.

Summary: Moving LiveRangeShrink to x86 as this pass is mostly useful for archtectures with great register pressure.

Reviewers: MatzeB, qcolombet

Reviewed By: qcolombet

Subscribers: jholewinski, jyknight, javed.absar, llvm-commits

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

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

7 years agoAMDGPU: Try to use op_sel when selecting packed instructions
Matt Arsenault [Wed, 17 May 2017 20:00:00 +0000 (20:00 +0000)]
AMDGPU: Try to use op_sel when selecting packed instructions

Avoids instructions to pack a vector when the source is really
a scalar being broadcast.

Also be smarter and look for per-component fneg.

Doesn't yet handle scalar from upper half of register
or other swizzles.

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

7 years ago[X86] Split ctpop/ctlz/cttz cost tests
Simon Pilgrim [Wed, 17 May 2017 19:57:20 +0000 (19:57 +0000)]
[X86] Split ctpop/ctlz/cttz cost tests

This will make things a lot easier to test all the permutations of avx512

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

7 years agoReapply part of rL303015, fixing just the DynamicLibaryTest. Add
Dimitry Andric [Wed, 17 May 2017 19:46:49 +0000 (19:46 +0000)]
Reapply part of rL303015, fixing just the DynamicLibaryTest.  Add
retrieval of the original argv[0] from the GoogleTest framework, so it
is more likely the correct main executable path is found.

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

7 years ago[WebAssembly][NFC] Update expected testsuite failures for newly passing tests
Jacob Gravelle [Wed, 17 May 2017 19:45:22 +0000 (19:45 +0000)]
[WebAssembly][NFC] Update expected testsuite failures for newly passing tests

Summary: r303050 fixes crashes when calling scalarizeMaskedMemIntrin pass from WebAssembly backend. This updates expected test failures for that.

Reviewers: sbc100

Subscribers: jfb, llvm-commits, dschuff

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

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

7 years agoAMDGPU: Use appropriate soffset for spilling
Matt Arsenault [Wed, 17 May 2017 19:37:57 +0000 (19:37 +0000)]
AMDGPU: Use appropriate soffset for spilling

This needs to be the frame offset register, and not the global
scratch wave offset register. For kernels, these are the same.

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

7 years agoRevert r303015, because it has the unintended side effect of breaking
Dimitry Andric [Wed, 17 May 2017 19:33:10 +0000 (19:33 +0000)]
Revert r303015, because it has the unintended side effect of breaking
driver-mode recognition in clang (this is because the sysctl method
always returns one and only one executable path, even for an executable
with multiple links):

Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD

Summary:

After rL301562, on FreeBSD the DynamicLibrary unittests fail, because
the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since
the path does not contain any slashes, retrieving the main executable
will not work.

Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3),
which is more reliable than fiddling with relative or absolute paths.

Also add retrieval of the original argv[] from the GoogleTest framework,
to use as a fallback for other OSes.

Reviewers: emaste, marsupial, hans, krytarowski

Reviewed By: krytarowski

Subscribers: krytarowski, llvm-commits

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

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

7 years agoAMDGPU: Fix min3/max3 combines for f16/i16
Matt Arsenault [Wed, 17 May 2017 19:25:06 +0000 (19:25 +0000)]
AMDGPU: Fix min3/max3 combines for f16/i16

Fix missing instruction definitions for min3/max3.

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

7 years ago[X86][AVX512] Add 512-bit vector bitreverse costs + tests
Simon Pilgrim [Wed, 17 May 2017 19:20:20 +0000 (19:20 +0000)]
[X86][AVX512] Add 512-bit vector bitreverse costs + tests

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

7 years agoAdd back a dummy --use-processes.
Rafael Espindola [Wed, 17 May 2017 18:55:01 +0000 (18:55 +0000)]
Add back a dummy --use-processes.

Some bots are using it.

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

7 years agoAlways use the multiprocess module.
Rafael Espindola [Wed, 17 May 2017 18:20:01 +0000 (18:20 +0000)]
Always use the multiprocess module.

This seems to work on freebsd and openbsd these days.

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

7 years agoRe-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"
Reid Kleckner [Wed, 17 May 2017 18:16:17 +0000 (18:16 +0000)]
Re-land r303274: "[CrashRecovery] Use SEH __try instead of VEH when available"

We have to check gCrashRecoveryEnabled before using __try.

In other words, SEH works too well and we ended up recovering from
crashes in implicit module builds that we weren't supposed to. Only
libclang is supposed to enable CrashRecoveryContext to allow implicit
module builds to crash.

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

7 years ago[GISel]: Fix undefined behavior in IRTranslator
Aditya Nandakumar [Wed, 17 May 2017 17:41:55 +0000 (17:41 +0000)]
[GISel]: Fix undefined behavior in IRTranslator

Make sure IRTranslator->MachineIRBuilder->DebugLoc doesn't
outlive the DILocation. Clear it at the end of
IRTranslator::runOnMachineFunction

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

7 years agoRevert "[CrashRecovery] Use SEH __try instead of VEH when available"
Reid Kleckner [Wed, 17 May 2017 17:15:00 +0000 (17:15 +0000)]
Revert "[CrashRecovery] Use SEH __try instead of VEH when available"

This reverts commit r303274, it appears to break some clang tests.

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

7 years ago[CrashRecovery] Use SEH __try instead of VEH when available
Reid Kleckner [Wed, 17 May 2017 17:02:16 +0000 (17:02 +0000)]
[CrashRecovery] Use SEH __try instead of VEH when available

Summary:
It avoids problems when other libraries raise exceptions. In particular,
OutputDebugString raises an exception that the debugger is supposed to
catch and suppress. VEH kicks in first right now, and that is entirely
incorrect.

Unfortunately, GCC does not support SEH, so I've kept the old buggy VEH
codepath around. We could fix it with SetUnhandledExceptionFilter, but
that is not per-thread, so a well-behaved library shouldn't set it.

Reviewers: zturner

Subscribers: llvm-commits, mgorny

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

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

7 years agoWorkaround for incorrect Win32 header on GCC.
Zachary Turner [Wed, 17 May 2017 16:39:33 +0000 (16:39 +0000)]
Workaround for incorrect Win32 header on GCC.

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

7 years ago[CodeView] Simplify the use of visiting type records & streams.
Zachary Turner [Wed, 17 May 2017 16:39:06 +0000 (16:39 +0000)]
[CodeView] Simplify the use of visiting type records & streams.

There is often a lot of boilerplate code required to visit a type
record or type stream.  The #1 use case is that you have a sequence
of bytes that represent one or more records, and you want to
deserialize each one, switch on it, and call a callback with the
deserialized record that the user can examine.  Currently this
requires at least 6 lines of code:

  codeview::TypeVisitorCallbackPipeline Pipeline;
  Pipeline.addCallbackToPipeline(Deserializer);
  Pipeline.addCallbackToPipeline(MyCallbacks);

  codeview::CVTypeVisitor Visitor(Pipeline);
  consumeError(Visitor.visitTypeRecord(Record));

With this patch, it becomes one line of code:

  consumeError(codeview::visitTypeRecord(Record, MyCallbacks));

This is done by having the deserialization happen internally inside
of the visitTypeRecord function.  Since this is occasionally not
desirable, the function provides a 3rd parameter that can be used
to change this behavior.

Hopefully this can significantly reduce the barrier to entry
to using the visitation infrastructure.

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

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

7 years ago[BitVector] Add find_[first,last]_[set,unset]_in.
Zachary Turner [Wed, 17 May 2017 15:49:45 +0000 (15:49 +0000)]
[BitVector] Add find_[first,last]_[set,unset]_in.

A lot of code is duplicated between the first_last and the
next / prev methods.  All of this code can be shared if they
are implemented in terms of find_first_in(Begin, End) etc,
in which case find_first = find_first_in(0, Size) and find_next
is find_first_in(Prev+1, Size), with similar reductions for
the other methods.

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

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

7 years ago[InstCombine] add isCanonicalPredicate() helper function and use it; NFCI
Sanjay Patel [Wed, 17 May 2017 14:21:19 +0000 (14:21 +0000)]
[InstCombine] add isCanonicalPredicate() helper function and use it; NFCI

There should be a slight efficiency improvement from handling icmp/fcmp with one matcher and reducing duplicated code.

The larger motivation is that there are questions about how predicate canonicalization is handled, and the refactoring
should make it easier if we want to change any of that behavior.

1. As noted in the code comment, we've chosen 3 of the 16 FCMP preds as not canonical. Why those 3? It goes back to
   rL32751 from what I can tell, but I'm not sure if there's a justification for that rule.
2. We currently do not canonicalize integer select conditions. Should we use the same rule that applies to branches
   for selects?
3. We currently do canonicalize some FP select conditions, and those rules would conflict with the rule shown here.
   Should one or both be changed?

No-functional-change-intended, but adding tests anyway because there's no coverage for most of the predicates.

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

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

7 years ago[globalisel][tablegen] Import rules containing intrinsic_wo_chain.
Daniel Sanders [Wed, 17 May 2017 13:39:49 +0000 (13:39 +0000)]
[globalisel][tablegen] Import rules containing intrinsic_wo_chain.

Summary:
As of this patch, 1018 out of 3938 rules are currently imported.

Depends on D32275

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

Reviewed By: qcolombet

Subscribers: dberris, igorb, llvm-commits

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

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

7 years ago[x86] Update tests in psubus.ll; NFC
Sanjay Patel [Wed, 17 May 2017 13:39:16 +0000 (13:39 +0000)]
[x86] Update tests in psubus.ll; NFC

Remove unnecessary memops to minimize tests.

Patch by Yulia Koval!

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

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

7 years ago[PPC] Properly update register save area offsets
Krzysztof Parzyszek [Wed, 17 May 2017 13:25:09 +0000 (13:25 +0000)]
[PPC] Properly update register save area offsets

The variables MinGPR/MinG8R were not updated properly when resetting the
offsets, which in the included testcase lead to saving the CR register
in the same location as R30.

This fixes another issue reported in PR26519.

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

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

7 years ago[GlobalISel][X86] Support add i64 in IA32.
Igor Breger [Wed, 17 May 2017 12:48:08 +0000 (12:48 +0000)]
[GlobalISel][X86] Support add i64 in IA32.

Summary: support G_UADDE instruction selection.

Reviewers: zvi, guyblank

Reviewed By: guyblank

Subscribers: rovka, kristof.beyls, llvm-commits

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

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

7 years ago[SystemZ] Modelling of costs of divisions with a constant power of 2.
Jonas Paulsson [Wed, 17 May 2017 12:46:26 +0000 (12:46 +0000)]
[SystemZ]  Modelling of costs of divisions with a constant power of 2.

Such divisions will eventually be implemented with shifts which should
be reflected in the cost function.

Review: Ulrich Weigand

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

7 years ago[globalisel][tablegen] Require that all registers between instructions of a match...
Daniel Sanders [Wed, 17 May 2017 12:43:30 +0000 (12:43 +0000)]
[globalisel][tablegen] Require that all registers between instructions of a match are virtual.

Summary:
Without this, it's possible to encounter multiple defs for a register.

This is triggered by the current version of D32868 when applied to trunk.

Reviewers: qcolombet, ab, t.p.northover, rovka, kristof.beyls

Reviewed By: qcolombet

Subscribers: llvm-commits, igorb

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

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

7 years agoReland r303247: [ARM] GlobalISel: Remove dead instruction selection code
Diana Picus [Wed, 17 May 2017 12:42:52 +0000 (12:42 +0000)]
Reland r303247: [ARM] GlobalISel: Remove dead instruction selection code

It only failed on llvm-clang-x86_64-expensive-checks-win, probably
because the TableGen stuff hasn't been regenerated.
Requires a clean build.

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

7 years ago[DWARF] - Cleanup relocations proccessing.
George Rimar [Wed, 17 May 2017 12:10:51 +0000 (12:10 +0000)]
[DWARF] - Cleanup relocations proccessing.

RelocAddrMap was a pair of <width, address>, where width is relocation size (4/8/x, x < 8),
and width field was never used in code.

Relocations proccessing loop had checks for width field. Does not look like DWARF parser
should do that. There is probably no much sense to validate relocations during proccessing
them in parser.

Patch removes relocation's width relative code from DWARFContext.

Differential revision: https://reviews.llvm.org/D33194

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

7 years agoRevert "[ARM] GlobalISel: Remove dead instruction selection code"
Diana Picus [Wed, 17 May 2017 11:56:07 +0000 (11:56 +0000)]
Revert "[ARM] GlobalISel: Remove dead instruction selection code"

This reverts commit r303247 because the tests are failing on some bots.
Sorry!

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

7 years ago[ARM] GlobalISel: Remove dead instruction selection code
Diana Picus [Wed, 17 May 2017 11:39:26 +0000 (11:39 +0000)]
[ARM] GlobalISel: Remove dead instruction selection code

We can now generate code for selecting G_ADD, G_SUB and G_MUL. Remove
the hand-written versions.

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

7 years ago[Sparc] Remove execute permissions from non-executable text files
Daniel Cederman [Wed, 17 May 2017 11:05:20 +0000 (11:05 +0000)]
[Sparc] Remove execute permissions from non-executable text files

Reviewers: jyknight, lero_chris, venkatra

Reviewed By: jyknight

Subscribers: llvm-commits

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

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

7 years agoFixup r303240: Use llvm::to_string instead of std::to_string
Diana Picus [Wed, 17 May 2017 09:25:08 +0000 (09:25 +0000)]
Fixup r303240: Use llvm::to_string instead of std::to_string

It turns out some of the buildbots don't have std::to_string around,
even in this day and age...

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

7 years ago[DebugInfo/DWARF] - Make comments to be in doxygen style. NFCi.
George Rimar [Wed, 17 May 2017 09:00:10 +0000 (09:00 +0000)]
[DebugInfo/DWARF] - Make comments to be in doxygen style. NFCi.

This changes "//" to "///" in llvm/DebugInfo/DWARF folder where appropriate
and also removes few trailing whitespaces.

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

7 years ago[GlobalISel][TableGen] Fix handling of default operands
Diana Picus [Wed, 17 May 2017 08:57:28 +0000 (08:57 +0000)]
[GlobalISel][TableGen] Fix handling of default operands

When looping through a destination pattern's operands to decide how many
default operands we need to introduce, we used to count the "expanded"
number of operands. So if one default operand would be rendered as 2
values, we'd count it as 2 operands, when in fact it needs to count as
only 1 operand regardless of how many values it expands to.

This turns out to be a problem only in some very specific cases, e.g.
when we have one operand with multiple default values followed by more
operands with default values (see the new test). In such a situation
we'd stop looping before looking at all the operands, and then error out
assuming that we don't have enough default operands to make up the
shortfall.

At the moment this only affects ARM.

The patch removes the loop counting default operands entirely and
assumes that we'll have to introduce values for any default operand that
we find (i.e. we're assuming it cannot be given as a child at all). It
also extracts the code for adding renderers for default operands into a
helper method.

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

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

7 years ago[RuntimeDyld] Fix debug section relocation (pr20457)
Pavel Labath [Wed, 17 May 2017 08:47:28 +0000 (08:47 +0000)]
[RuntimeDyld] Fix debug section relocation (pr20457)

Summary:
Debug info sections, (or non-SHF_ALLOC sections in general) should be
linked as if their load address was zero to emulate the behavior of the
static linker.

This bug was discovered because it was breaking lldb expression evaluation on
linux.

Reviewers: lhames

Subscribers: aprantl, eugene, clayborg, lldb-commits, llvm-commits

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

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

7 years agoMake sure -optimize-regalloc=false is used correctly by user.
Jonas Paulsson [Wed, 17 May 2017 07:36:03 +0000 (07:36 +0000)]
Make sure -optimize-regalloc=false is used correctly by user.

Don't allow -optimize-regalloc=false with -regalloc given for anything other
than 'fast'. The other register allocators depend on the supporting passes
added by addOptimizedRegAlloc().

Reviewers: Quentin Colombet, Matthias Braun
https://reviews.llvm.org/D33181

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

7 years ago[APInt] Use getWord to shorten some code. NFC
Craig Topper [Wed, 17 May 2017 06:45:30 +0000 (06:45 +0000)]
[APInt] Use getWord to shorten some code. NFC

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

7 years ago[SCEV] Always sort AddRecExprs from different loops by dominance
Max Kazantsev [Wed, 17 May 2017 04:09:14 +0000 (04:09 +0000)]
[SCEV] Always sort AddRecExprs from different loops by dominance

Sorting of AddRecExprs by loop nesting does not make sense since we only invoke
the CompareSCEVComplexity for AddRecExprs that are used by one SCEV. This
guarantees that there is always a dominance relationship between them. This
patch removes the sorting by nesting which is a dead code in current usage of
this function.

Reviewed By: sanjoy

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

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

7 years ago[SCEV][NFC] Replace redundant dyn_cast with cast in getAddExpr
Max Kazantsev [Wed, 17 May 2017 03:58:42 +0000 (03:58 +0000)]
[SCEV][NFC] Replace redundant dyn_cast with cast in getAddExpr

Replace dyn_cast which is ensured by isa just one line above with cast.

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

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

7 years ago[coroutines] Handle spills before catchswitch
Gor Nishanov [Wed, 17 May 2017 03:09:22 +0000 (03:09 +0000)]
[coroutines] Handle spills before catchswitch

If we need to spill the result of the PHI instruction, we insert the spill after
all of the PHIs and EHPads, however, in a catchswitch block there is no
room to insert the spill. Make room by splitting away catchswitch into a separate
block.

Before the fix:

    catch.dispatch:
       %val = phi i32 [ 1, %if.then ], [ 2, %if.else ]
       %switch = catchswitch within none [label %catch] unwind label %cleanuppad

After:

    catch.dispatch:
       %val = phi i32 [ 1, %if.then ], [ 2, %if.else ]
       %tok = cleanuppad within none []
       ; spill goes here
       cleanupret from %tok unwind label %catch.dispatch.switch
    catch.dispatch.switch:
       %switch = catchswitch within none [label %catch] unwind label %cleanuppad

https://reviews.llvm.org/D31846

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

7 years agoAdded LLVM_DUMP_METHOD attributes for MatchableInfo::dump(). Defined it only if dump...
Galina Kistanova [Wed, 17 May 2017 02:20:05 +0000 (02:20 +0000)]
Added LLVM_DUMP_METHOD attributes for MatchableInfo::dump(). Defined it only if dump is enabled.

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

7 years agoBitVector: add iterators for set bits
Francis Visoiu Mistrih [Wed, 17 May 2017 01:07:53 +0000 (01:07 +0000)]
BitVector: add iterators for set bits

Differential revision: https://reviews.llvm.org/D32060

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

7 years ago[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Tue, 16 May 2017 23:10:25 +0000 (23:10 +0000)]
[ADT] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

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

7 years agoFix for compilers with older CRT header libraries.
Zachary Turner [Tue, 16 May 2017 22:59:34 +0000 (22:59 +0000)]
Fix for compilers with older CRT header libraries.

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

7 years ago[Support] Ignore OutputDebugString exceptions in our crash recovery.
Zachary Turner [Tue, 16 May 2017 22:50:32 +0000 (22:50 +0000)]
[Support] Ignore OutputDebugString exceptions in our crash recovery.

Since we use AddVectoredExceptionHandler, we get notified of
every exception that gets raised by a program.  Sometimes these
are not necessarily errors though, and this can be especially
true when linking against a library that we have no control
over, and may raise an exception internally which it intends
to catch.

In particular, the Windows API OutputDebugString does exactly
this.  It raises an exception inside of a __try / __except,
giving the debugger a chance to handle the exception to print
the message to the debug console.

But this doesn't interoperate nicely with our vectored exception
handler, which just sees another exception and decides that we
need to terminate the program.

Add a special case for this so that we ignore ODS exceptions
and continue normally.

Note that a better fix is to simply not use vectored exception
handlers and use SEH instead, but given that MinGW doesn't support
SEH, this is the only solution for MinGW.

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

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

7 years ago[IR] Prefer use_empty() to !hasNUsesOrMore(1) for clarity.
Davide Italiano [Tue, 16 May 2017 22:38:40 +0000 (22:38 +0000)]
[IR] Prefer use_empty() to !hasNUsesOrMore(1) for clarity.

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

7 years ago[NewGVN] Re-enable test now that the nondeterminism has been fixed.
Davide Italiano [Tue, 16 May 2017 22:27:06 +0000 (22:27 +0000)]
[NewGVN] Re-enable test now that the nondeterminism has been fixed.

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

7 years agollvm/test/Transforms/InstCombine/debuginfo-skip.ll REQUIRES +asserts.
NAKAMURA Takumi [Tue, 16 May 2017 22:19:56 +0000 (22:19 +0000)]
llvm/test/Transforms/InstCombine/debuginfo-skip.ll REQUIRES +asserts.

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

7 years agoAdd test for FixedStreamArrayIterator::operator->
Adrian McCarthy [Tue, 16 May 2017 22:11:25 +0000 (22:11 +0000)]
Add test for FixedStreamArrayIterator::operator->

The operator-> implementation comes from iterator_facade_base, so it should
just work given that the iterator has a tested operator*.  But r302257 showed
that required careful handling of for the const qualifier.  This patch ensures
the fix in r302257 doesn't regress.

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

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

7 years agoUpdate doxygen description of a method. NFC
Paul Robinson [Tue, 16 May 2017 21:53:30 +0000 (21:53 +0000)]
Update doxygen description of a method. NFC

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

7 years ago[InstSimplify] add folds for constant mask of value shifted by constant
Sanjay Patel [Tue, 16 May 2017 21:51:04 +0000 (21:51 +0000)]
[InstSimplify] add folds for constant mask of value shifted by constant

We would eventually catch these via demanded bits and computing known bits in InstCombine,
but I think it's better to handle the simple cases as soon as possible as a matter of efficiency.

This fold allows further simplifications based on distributed ops transforms. eg:
  %a = lshr i8 %x, 7
  %b = or i8 %a, 2
  %c = and i8 %b, 1

InstSimplify can directly fold this now:
  %a = lshr i8 %x, 7

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

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

7 years agoThe patch exclude a case from zero check skip in
Evgeny Stupachenko [Tue, 16 May 2017 21:44:59 +0000 (21:44 +0000)]
The patch exclude a case from zero check skip in
 CTLZ idiom recognition (r303102).

Summary:

The following case:
i = 1;
if(n)
  while (n >>= 1)
    i++;
use(i);

Was converted to:

i = 1;
if(n)
  i += builtin_ctlz(n >> 1, false);
use(i);

Which is not correct. The patch make it:

i = 1;
if(n)
  i += builtin_ctlz(n >> 1, true);
use(i);

From: Evgeny Stupachenko <evstupac@gmail.com>

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

7 years agoRe-commit r302678, fixing PR33053.
Amara Emerson [Tue, 16 May 2017 21:29:22 +0000 (21:29 +0000)]
Re-commit r302678, fixing PR33053.

The issue was that the AArch64 TTI hook allowed unpacked integer cmp reductions
which didn't have a lowering.

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

7 years ago[Inliner] Do not mix callsite and callee hotness based updates.
Easwaran Raman [Tue, 16 May 2017 21:18:09 +0000 (21:18 +0000)]
[Inliner] Do not mix callsite and callee hotness based updates.

Update threshold based on callee's hotness only when BFI is not available.
Otherwise use only callsite's hotness. This makes it easier to reason about
hotness related threshold updates.

Differential revision: https://reviews.llvm.org/D33157

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

7 years ago[PPC] Add -ppc-asm-full-reg-names to atomic-2.ll. NFC.
Tim Shen [Tue, 16 May 2017 20:58:55 +0000 (20:58 +0000)]
[PPC] Add -ppc-asm-full-reg-names to atomic-2.ll. NFC.

Differential Revisions: https://reviews.llvm.org/D32763

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

7 years agoTest for r303197
Matthias Braun [Tue, 16 May 2017 20:53:27 +0000 (20:53 +0000)]
Test for r303197

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

7 years ago[PPC] Lower load acquire/seq_cst trailing fence to cmp + bne + isync.
Tim Shen [Tue, 16 May 2017 20:18:06 +0000 (20:18 +0000)]
[PPC] Lower load acquire/seq_cst trailing fence to cmp + bne + isync.

Summary:
This fixes pr32392.

The lowering pipeline is:
llvm.ppc.cfence in IR -> PPC::CFENCE8 in isel -> Actual instructions in
expandPostRAPseudo.

The reason why expandPostRAPseudo is chosen is because previous passes
are likely eliminating instructions like cmpw 3, 3 (early CSE) and bne-
7, .+4 (some branch pass(s)).

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

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

7 years agoAdd hasProfileSummary and has{Sample|Instrumentation}Profile methods
Easwaran Raman [Tue, 16 May 2017 20:14:39 +0000 (20:14 +0000)]
Add hasProfileSummary and has{Sample|Instrumentation}Profile methods

ProfileSummaryInfo already checks whether the module has sample profile
in determining profile counts. This will also be useful in inliner to
clean up threshold updates.

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

7 years ago[InstCombine] auto-generate better checks; NFC
Sanjay Patel [Tue, 16 May 2017 20:09:32 +0000 (20:09 +0000)]
[InstCombine] auto-generate better checks; NFC

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

7 years agoIn debug builds non-trivial amount of time is spent in InstCombine processing
Dmitry Mikulin [Tue, 16 May 2017 20:08:49 +0000 (20:08 +0000)]
In debug builds non-trivial amount of time is spent in InstCombine processing
@llvm.dbg.* calls in visitCallInst(). They can be safely ignored.

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

7 years agoNewGVN: Only do something in verifyStoreExpressions if assertions are enabled, to...
Daniel Berlin [Tue, 16 May 2017 20:02:45 +0000 (20:02 +0000)]
NewGVN: Only do something in verifyStoreExpressions if assertions are enabled, to avoid unused code warnings.

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

7 years agoNewGVN: Fix PR 33051 by making sure we remove old store expressions
Daniel Berlin [Tue, 16 May 2017 19:58:47 +0000 (19:58 +0000)]
NewGVN: Fix PR 33051 by making sure we remove old store expressions
from the ExpressionToClass mapping.

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

7 years agoRevert "[X86] Replace slow LEA instructions in X86"
Reid Kleckner [Tue, 16 May 2017 19:55:03 +0000 (19:55 +0000)]
Revert "[X86] Replace slow LEA instructions in X86"

This reverts commit r303183, it broke various buildbots and introduced
sanitizer errors.

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

7 years agoElide stores which are overwritten without being observed.
Nirav Dave [Tue, 16 May 2017 19:43:56 +0000 (19:43 +0000)]
Elide stores which are overwritten without being observed.

Summary:
In SelectionDAG, when a store is immediately chained to another store
to the same address, elide the first store as it has no observable
effects. This is causes small improvements dealing with intrinsics
lowered to stores.

Test notes:

* Many testcases overwrite store addresses multiple times and needed
  minor changes, mainly making stores volatile to prevent the
  optimization from optimizing the test away.

* Many X86 test cases optimized out instructions associated with
  associated with va_start.

* Note that test_splat in CodeGen/AArch64/misched-stp.ll no longer has
  dependencies to check and can probably be removed and potentially
  replaced with another test.

Reviewers: rnk, john.brawn

Subscribers: aemerson, rengolin, qcolombet, jyknight, nemanjai, nhaehnle, javed.absar, llvm-commits

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

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

7 years agoShrinkWrap: Add skipFunction() call
Matthias Braun [Tue, 16 May 2017 18:43:30 +0000 (18:43 +0000)]
ShrinkWrap: Add skipFunction() call

ShrinkWrapping is a performance optimization that can safely be skipped,
so we can add `if (!skipFunction()) return;`

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

7 years ago[MetadataLoader] Remove unused Vector. NFCI.
Davide Italiano [Tue, 16 May 2017 18:41:46 +0000 (18:41 +0000)]
[MetadataLoader] Remove unused Vector. NFCI.

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

7 years agoRevert "[ARM] Mark LEApcrel instructions as isAsCheapAsAMove"
Renato Golin [Tue, 16 May 2017 17:59:07 +0000 (17:59 +0000)]
Revert "[ARM] Mark LEApcrel instructions as isAsCheapAsAMove"

Revert "[ARM] Mark LEApcrel as not having side effects"

This reverts commit r303054 and r303053, as they broke the ARM
self-hosting buildbots:

http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/1550

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost-neon/builds/1349

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost/builds/1845

Offline investigation on course.

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

7 years ago[AMDGPU] Use GCNRPTracker dumper methods in scheduler
Stanislav Mekhanoshin [Tue, 16 May 2017 16:31:45 +0000 (16:31 +0000)]
[AMDGPU] Use GCNRPTracker dumper methods in scheduler

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

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

7 years ago[InstCombine] add motivational comment for tests; NFC
Sanjay Patel [Tue, 16 May 2017 16:30:46 +0000 (16:30 +0000)]
[InstCombine] add motivational comment for tests; NFC

The referenced tests are derived from:
https://bugs.llvm.org/show_bug.cgi?id=32791
and:
https://reviews.llvm.org/D33172

The motivation for including negative tests may not be clear, so I'm adding an explanatory comment here.
In the post-commit thread for r303133:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170515/453793.html
...it was mentioned that we don't want to add redundant tests. This is a valid point. But in this case,
we have a patch under review (D33172) that demonstrates that no existing regression tests are affected by
a proposed code change, but these are. Therefore, I think these tests have value not visible in any
existing regression tests regardless of whether they show a transform.

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

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

7 years ago[AMDGPU] Cache live-ins and register pressure in scheduler
Stanislav Mekhanoshin [Tue, 16 May 2017 16:11:26 +0000 (16:11 +0000)]
[AMDGPU] Cache live-ins and register pressure in scheduler

Using LIS can be quite expensive, so caching of calculated region
live-ins and pressure is implemented. It does two things:

1. Caches the info for the second stage when we schedule with
   decreased target occupancy.
2. Tracks the basic block from top to bottom thus eliminating the
   need to scan whole register file liveness at every region split
   in the middle of the block.

The scheduling is now done in 3 stages instead of two, with the first
one being really a no-op and only used to collect scheduling regions
as sent by the scheduler driver.

There is no functional change to the current behavior, only compilation
speed is affected. In general computeBlockPressure() could be simplified
if we switch to backward RP tracker, because scheduler sends regions
within a block starting from the last upward. We could use a natural
order of upward tracker to seamlessly change between regions of the same
block, since live reg set of a previous tracked region would become a
live-out of the next region. That however requires fixing upward tracker
to properly account defs and uses of the same instruction as both are
contributing to the current pressure. When we converge on the produced
pressure we should be able to switch between them back and forth. In
addition, backward tracker is less expensive as it uses LIS in recede
less often than forward uses it in advance.

At the moment the worst known case compilation time has improved from 26
minutes to 8.5.

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

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

7 years ago[X86] Replace slow LEA instructions in X86
Lama Saba [Tue, 16 May 2017 16:01:36 +0000 (16:01 +0000)]
[X86] Replace slow LEA instructions in X86

  According to Intel's Optimization Reference Manual for SNB+:
  " For LEA instructions with three source operands and some specific situations, instruction latency has increased to 3 cycles, and must
    dispatch via port 1:
  - LEA that has all three source operands: base, index, and offset
  - LEA that uses base and index registers where the base is EBP, RBP,or R13
  - LEA that uses RIP relative addressing mode
  - LEA that uses 16-bit addressing mode "
  This patch currently handles the first 2 cases only.

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

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

7 years agoRevert 303174, 303176, and 303178
Matthew Simpson [Tue, 16 May 2017 15:50:30 +0000 (15:50 +0000)]
Revert 303174, 303176, and 303178

These commits are breaking the bots. Reverting to investigate.

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

7 years ago[DAG] Prune deleted nodes in TokenFactor
Nirav Dave [Tue, 16 May 2017 15:49:02 +0000 (15:49 +0000)]
[DAG] Prune deleted nodes in TokenFactor

Fix visitTokenFactor to correctly remove deleted nodes. NFC.

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

7 years ago[AMDGPU] Turn register pressure estimation into forward tracker
Stanislav Mekhanoshin [Tue, 16 May 2017 15:43:52 +0000 (15:43 +0000)]
[AMDGPU] Turn register pressure estimation into forward tracker

This factors register pressure estimation mechanism from the
GCNSchedStrategy into the forward tracker to unify interface
with other strategies and expose it to other interested phases.

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

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

7 years agoMake test target-specific
Matthew Simpson [Tue, 16 May 2017 15:33:22 +0000 (15:33 +0000)]
Make test target-specific

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

7 years agoFix test case to unbreak bots
Matthew Simpson [Tue, 16 May 2017 15:20:27 +0000 (15:20 +0000)]
Fix test case to unbreak bots

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

7 years ago[LV] Avoid potentential division by zero when selecting IC
Matthew Simpson [Tue, 16 May 2017 14:43:55 +0000 (14:43 +0000)]
[LV] Avoid potentential division by zero when selecting IC

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

7 years ago[coroutines] Handle unwind edge splitting
Gor Nishanov [Tue, 16 May 2017 14:11:39 +0000 (14:11 +0000)]
[coroutines] Handle unwind edge splitting

Summary:
RewritePHIs algorithm used in building of CoroFrame inserts a placeholder
```
%placeholder = phi [%val]
```
on every edge leading to a block starting with PHI node with multiple incoming edges,
so that if one of the incoming values was spilled and need to be reloaded, we have a
place to insert a reload. We use SplitEdge helper function to split the incoming edge.

SplitEdge function does not deal with unwind edges comping into a block with an EHPad.

This patch adds an ehAwareSplitEdge function that can correctly split the unwind edge.

For landing pads, we clone the landing pad into every edge block and replace the original
landing pad with a PHI collection the values from all incoming landing pads.

For WinEH pads, we keep the original EHPad in place and insert cleanuppad/cleapret in the
edge blocks.

Reviewers: majnemer, rnk

Reviewed By: majnemer

Subscribers: EricWF, llvm-commits

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

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

7 years ago[DWARF] - Add RelocAddrEntry for cleanup. NFCi.
George Rimar [Tue, 16 May 2017 14:05:45 +0000 (14:05 +0000)]
[DWARF] - Add RelocAddrEntry for cleanup. NFCi.

Was mentioned as possible cleanup during review of D33184.

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

7 years ago[GlobalISel][X86] Split memop test file. NFC
Igor Breger [Tue, 16 May 2017 13:37:31 +0000 (13:37 +0000)]
[GlobalISel][X86] Split memop test file. NFC

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

7 years agoFix an improperly placed curly bracket. NFC.
Chad Rosier [Tue, 16 May 2017 12:43:23 +0000 (12:43 +0000)]
Fix an improperly placed curly bracket. NFC.

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

7 years ago[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRange...
George Rimar [Tue, 16 May 2017 12:30:59 +0000 (12:30 +0000)]
[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRangesVector.

Recommit of r303159 "[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRangesVector"
All places were shitched to use DWARFAddressRange now.

Suggested during review of D33184.

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

7 years agoRevert r303159 "[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for...
George Rimar [Tue, 16 May 2017 12:05:03 +0000 (12:05 +0000)]
Revert r303159 "[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRangesVector."

Something went wrong, it broke BB.
http://green.lab.llvm.org/green//job/clang-stage1-cmake-RA-incremental_build/38477/consoleFull#-200034420049ba4694-19c4-4d7e-bec5-911270d8a58c

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

7 years ago[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRange...
George Rimar [Tue, 16 May 2017 11:54:19 +0000 (11:54 +0000)]
[DWARF] - Use DWARFAddressRange struct instead of uint64_t pair for DWARFAddressRangesVector.

Suggested during review of D33184.

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

7 years ago[LTO] Print time-passes information at conclusion of LTO codegen
James Henderson [Tue, 16 May 2017 09:43:21 +0000 (09:43 +0000)]
[LTO] Print time-passes information at conclusion of LTO codegen

The information collected when requested by -time-passes is only printed when
llvm_shutdown is called at the moment. This means that when linking against the LTO
library dynamically and using the C interface, it is not possible to see the timing
information, because llvm_shutdown cannot be called. This change modifies the LTO
code generation functions for both regular LTO and thin LTO to explicitly print and
reset the timing information.

I have tested that this works with our proprietary linker. However, as this relies
on a specific method of building and linking against the LTO library, I'm not sure
how or if this can be tested in the LLVM testsuite.

Reviewed by: mehdi_amini

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

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