Commit Graph

23250 Commits

Author SHA1 Message Date
Duncan P. N. Exon Smith
8d8c981a1f DebugInfo: Remove dead DIDescriptor::getDescriptorField()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234665 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 23:53:44 +00:00
Tim Northover
f5e4c28c3f Generic: Make isMask_N and isShiftedMask_N consistent over 0
Previously, isMask_N returned false for 0 but isShiftedMask_N returned true.
Almost all uses are for pattern matching bitfield operations in the backends,
and expect false (this was discovered because of AArch64's copy of this logic).

Unfortunately, I couldn't put together a small non-fragile test for this. The
nature of the bitfield operations means that this edge case is only really
triggered for nodes like "(and N, 0)", which the DAG combiner is usually very
good at folding away before they get to this stage.

rdar://20501377

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234659 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 22:58:48 +00:00
Sanjoy Das
8aca90e5b6 [InstCombine][CodeGenPrep] Create llvm.uadd.with.overflow in CGP.
Summary:
This change moves creating calls to `llvm.uadd.with.overflow` from
InstCombine to CodeGenPrep.  Combining overflow check patterns into
calls to the said intrinsic in InstCombine inhibits optimization because
it introduces an intrinsic call that not all other transforms and
analyses understand.

Depends on D8888.

Reviewers: majnemer, atrick

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234638 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 21:07:09 +00:00
Rafael Espindola
e37b898edb Remember if lseek works in this FD.
It will be used in clang in a sec.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234619 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 18:15:51 +00:00
Duncan P. N. Exon Smith
139eb5f512 DebugInfo: Stop leaking temporaries in DIBuilder::createCompileUnit()
Stop leaking temporary nodes from `DIBuilder::createCompileUnit()`.
`replaceAllUsesWith()` doesn't delete the nodes, so we need to delete
them "manually" (well, `TempMDTuple` does that for us).

Similarly, stop leaking the temporary nodes used for variables of
subprograms.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234617 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 18:01:58 +00:00
Benjamin Kramer
b6ee41f057 [CallSite] Use the injected base class name. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234606 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 16:02:34 +00:00
Benjamin Kramer
e749325463 [CallSite] Make construction from Value* (or Instruction*) explicit.
CallSite roughly behaves as a common base CallInst and InvokeInst. Bring
the behavior closer to that model by making upcasts explicit. Downcasts
remain implicit and work as before.

Following dyn_cast as a mental model checking whether a Value *V isa
CallSite now looks like this: 
  if (auto CS = CallSite(V)) // think dyn_cast
instead of:
  if (CallSite CS = V)

This is an extra token but I think it is slightly clearer. Making the
ctor explicit has the advantage of not accidentally creating nullptr
CallSites, e.g. when you pass a Value * to a function taking a CallSite
argument.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234601 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 14:50:08 +00:00
Benjamin Kramer
c8eb88e744 Microoptimize DenseMap::clear.
Cache NumEntries locally, it's only used in an assert and using the member
variable prevents the compiler from eliminating the tombstone check for types
with trivial destructors. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234589 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 12:46:44 +00:00
Jingyue Wu
5733100450 Divergence analysis for GPU programs
Summary:
Some optimizations such as jump threading and loop unswitching can negatively
affect performance when applied to divergent branches. The divergence analysis
added in this patch conservatively estimates which branches in a GPU program
can diverge. This information can then help LLVM to run certain optimizations
selectively.

Test Plan: test/Analysis/DivergenceAnalysis/NVPTX/diverge.ll

Reviewers: resistor, hfinkel, eliben, meheff, jholewinski

Subscribers: broune, bjarke.roune, madhur13490, tstellarAMD, dberlin, echristo, jholewinski, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234567 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 05:03:50 +00:00
David Majnemer
d480d308b0 [WinEHPrepare] Don't rely on the order of IR
The IPToState table must be emitted after we have generated labels for
all functions in the table.  Don't rely on the order of the list of
globals.  Instead, utilize WinEHFuncInfo to tell us how many catch
handlers we expect to outline.  Once we know we've visited all the catch
handlers, emit the cppxdata.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234566 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-10 04:56:17 +00:00
Nemanja Ivanovic
c58b8f0b65 Add LLVM support for remaining integer divide and permute instructions from ISA 2.06
This is the patch corresponding to review:
http://reviews.llvm.org/D8406

It adds some missing instructions from ISA 2.06 to the PPC back end.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234546 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 23:54:37 +00:00
Rafael Espindola
427c073035 Simplify use of formatted_raw_ostream.
formatted_raw_ostream is a wrapper over another stream to add column and line
number tracking.

It is used only for asm printing.

This patch moves the its creation down to where we know we are printing
assembly. This has the following advantages:

* Simpler lifetime management: std::unique_ptr
* We don't compute column and line number of object files :-)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234535 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 21:06:08 +00:00
Jingyue Wu
154e053687 [NFC] add more comments for SLSR
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234505 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 17:04:28 +00:00
Rafael Espindola
6b5c9d5dd2 clang-format. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234502 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 16:43:22 +00:00
Rafael Espindola
e50dc9b89f clang-format this constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234501 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 16:37:11 +00:00
Rafael Espindola
1e2c16606d Don't repeat names in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234498 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 16:06:26 +00:00
Rafael Espindola
d92d26440c Use implicit calls to parent constructor. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234497 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 16:00:24 +00:00
Rafael Espindola
a93117c50d This reverts commit r234460 and r234461.
Revert "Add classof implementations to the raw_ostream classes."
Revert "Use the cast machinery to remove dummy uses of formatted_raw_ostream."

The underlying issue can be fixed without classof.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234495 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 15:54:59 +00:00
Rafael Espindola
23295f613b Use the cast machinery to remove dummy uses of formatted_raw_ostream.
If we know we are producing an object, we don't need to wrap the stream
in a formatted_raw_ostream anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234461 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 02:28:12 +00:00
Rafael Espindola
271631a0af Add classof implementations to the raw_ostream classes.
More uses to follow in a another patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234460 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 02:10:28 +00:00
Rafael Espindola
faae568179 Delete unused constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234459 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 01:11:26 +00:00
Eric Christopher
caf22112eb Update comment to refer to software floating point rather than
a local variable.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234457 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-09 00:14:49 +00:00
Rafael Espindola
ca3d6c0fe6 Don't repeat names in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234427 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 20:16:23 +00:00
Adam Nemet
cd13a3808a [LoopAccesses] Allow analysis to complete in the presence of uniform stores
(Re-apply r234361 with a fix and a testcase for PR23157)

Both run-time pointer checking and the dependence analysis are capable
of dealing with uniform addresses. I.e. it's really just an orthogonal
property of the loop that the analysis computes.

Run-time pointer checking will only try to reason about SCEVAddRec
pointers or else gives up. If the uniform pointer turns out the be a
SCEVAddRec in an outer loop, the run-time checks generated will be
correct (start and end bounds would be equal).

In case of the dependence analysis, we work again with SCEVs. When
compared against a loop-dependent address of the same underlying object,
the difference of the two SCEVs won't be constant. This will result in
returning an Unknown dependence for the pair.

When compared against another uniform access, the difference would be
constant and we should return the right type of dependence
(forward/backward/etc).

The changes also adds support to query this property of the loop and
modify the vectorizer to use this.

Patch by Ashutosh Nema!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234424 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 17:48:40 +00:00
Rafael Espindola
dc45a1ef4f Don't repeat names in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234412 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 16:33:46 +00:00
Simon Atanasyan
7db332b8ea [mips] Update MIPS relocations list
No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234408 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 14:55:31 +00:00
Rafael Espindola
f1f0734f14 Don't repeat names in comments. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234405 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 13:52:09 +00:00
Adam Nemet
b343d1cd85 Revert "[LoopAccesses] Allow analysis to complete in the presence of uniform stores"
This reverts commit r234361.

It caused PR23157.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234387 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-08 04:16:55 +00:00
Adam Nemet
a0834f1d87 [LoopAccesses] Allow analysis to complete in the presence of uniform stores
Both run-time pointer checking and the dependence analysis are capable
of dealing with uniform addresses. I.e. it's really just an orthogonal
property of the loop that the analysis computes.

Run-time pointer checking will only try to reason about SCEVAddRec
pointers or else gives up. If the uniform pointer turns out the be a
SCEVAddRec in an outer loop, the run-time checks generated will be
correct (start and end bounds would be equal).

In case of the dependence analysis, we work again with SCEVs. When
compared against a loop-dependent address of the same underlying object,
the difference of the two SCEVs won't be constant. This will result in
returning an Unknown dependence for the pair.

When compared against another uniform access, the difference would be
constant and we should return the right type of dependence
(forward/backward/etc).

The changes also adds support to query this property of the loop and
modify the vectorizer to use this.

Patch by Ashutosh Nema!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234361 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 21:46:16 +00:00
Rafael Espindola
ceea19a30c Use support::endian. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234359 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 21:22:05 +00:00
Pete Cooper
bf36adeed4 Add boolean to PrintStackTraceOnErrorSignal to disable crash reporting.
The current crash reporting on Mac OS is only disabled via an environment variable.
This adds a boolean (default false) which can also disable crash reporting.

The only client right now is the unittests which don't ever want crash reporting, but do want to detect killed programs.

Reduces the time to run the APFloat unittests on my machine from

[----------] 47 tests from APFloatTest (51250 ms total)

to

[----------] 47 tests from APFloatTest (765 ms total)

Reviewed by Reid Kleckner and Justin Bogner

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234353 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 20:43:23 +00:00
Rafael Espindola
696a3454de Remove dead code. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234352 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 20:38:45 +00:00
Reid Kleckner
1106660066 [WinEH] Fix xdata generation when no catch object is present
The lack of a catch object is indicated by a frame escape index of -1.

Fixes PR23137.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234346 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 19:46:38 +00:00
Sanjay Patel
bf9be6b7e2 move helper function closer to use; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234344 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 19:13:06 +00:00
Duncan P. N. Exon Smith
8d06b52675 DebugInfo: Remove constructors for DIRef<>
Remove all constructors for `DIRef<>` *except* the ones forwarding from
`TypedDebugNodeRef`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234340 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 18:41:54 +00:00
Sanjay Patel
876ee73d21 add some const to FastMathFlags getters; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234337 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 18:38:35 +00:00
Duncan P. N. Exon Smith
05d49df6d8 Workaround continued bot failures with MDTupleTypedArrayWrapper
Change the explicit constructor to be more specific.  I think this will
get us past the continued bot failures [1] with older clangs.

[1]: http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/8203

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234331 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 17:07:01 +00:00
Duncan P. N. Exon Smith
2e25115e02 IR: Remove MDTupleTypedArrayWrapper::operator MDTuple*()
Remove `MDTupleTypedArrayWrapper::operator MDTuple*()`, since it causes
ambiguity (at least in some [1] compilers [2]) when using indexes to
`MDTupleTypedArrayWrapper::operator[](unsigned)` that are convertible to
(but not the same as) `unsigned`.

[1]: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/2308
[2]: http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/4442

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234326 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 16:50:39 +00:00
Rafael Espindola
1252bb4b17 Clear the stub map in getSortedStubs.
This makes sure they are only output once (and frees a bit of memory).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234313 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 12:59:28 +00:00
Duncan P. N. Exon Smith
92d1a52362 DebugInfo: Remove DITypedArray<>, replace with typedefs
Replace all uses of `DITypedArray<>` with `MDTupleTypedArrayWrapper<>`
and `MDTypeRefArray`.  The APIs are completely different, but the
provided functionality is the same: treat an `MDTuple` as if it's an
array of a particular element type.

To simplify this patch a bit, I've temporarily typedef'ed
`DebugNodeArray` to `DIArray` and `MDTypeRefArray` to `DITypeArray`.
I've also temporarily conditionalized the accessors to check for null --
eventually these should be changed to asserts and the callers should
check for null themselves.

There's a tiny accompanying patch to clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234290 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 04:14:33 +00:00
Duncan P. N. Exon Smith
b135631d2e DebugInfo: Remove DICompositeType mutation API
Change `DIBuilder` to mutate `MDCompositeTypeBase` directly, and remove
the wrapping API in `DICompositeType`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234289 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 04:12:02 +00:00
Duncan P. N. Exon Smith
351071c069 DebugInfo: Use DebugNodeRef in MDImportedEntity::getEntity()
A quick cleanup to sue `DebugNodeRef` instead of `Metadata*` for
`MDImportedEntity::getEntity()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234288 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 04:07:31 +00:00
Duncan P. N. Exon Smith
550b962059 DebugInfo: Move DIFlag accessors from DIVariable to MDLocalVariable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234287 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 03:55:30 +00:00
Duncan P. N. Exon Smith
c6ac80b701 DebugInfo: Move DIExpression bit-piece API to MDExpression
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234286 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 03:49:59 +00:00
Duncan P. N. Exon Smith
fb2e97e4aa DebugInfo: Remove special iterators from DIExpression
Remove special iterators from `DIExpression` in favour of same in
`MDExpression`.  There should be no functionality change here.

Note that the APIs are slightly different: `getArg(unsigned)` counts
from 0, not 1, in the `MDExpression` version of the iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234285 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 03:45:57 +00:00
Adam Nemet
ad8a6b66d9 [LoopAccesses] New API to query if memchecks are necessary after partitioning
This is used by Loop Distribution.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234283 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 03:35:26 +00:00
Duncan P. N. Exon Smith
320efb05a1 DebugInfo: Move DISubprogram::is*() queries to MDSubprogram
Move body of `DISubprogram::isPrivate()` (etc.) to `MDSubprogram`, and
change the versions in `DISubprogram` to forward there.

This is just like r234275, but for subprograms instead of types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234282 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 03:33:57 +00:00
Duncan P. N. Exon Smith
8395c21d77 DebugInfo: Move DIType::is*() queries to MDType
Move body of `DIType::isObjectPointer()` (etc.) to `MDType`, and change
the versions in `DIType` to forward there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234275 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 01:24:30 +00:00
Duncan P. N. Exon Smith
5f3bcf7dc4 DebugInfo: Move DIFlag-related API from DIDescriptor to DebugNode
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234274 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 01:21:40 +00:00
Duncan P. N. Exon Smith
329f8219cd IR: Rename MDSubrange::getLo() to getLowerBound()
During initial review, the `lo:` field was renamed to `lowerBound:`.
Make the same change to the C++ API.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234267 91177308-0d34-0410-b5e6-96231b3b80d8
2015-04-07 00:39:59 +00:00