Commit Graph

13657 Commits

Author SHA1 Message Date
Chris Lattner
cd6015cc8a rearrange some logic, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157796 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01 05:01:15 +00:00
Eric Christopher
fc4199bf4a Add support for enum forward declarations.
Part of rdar://11570854

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157786 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01 00:22:32 +00:00
Manman Ren
91c5346d91 X86: replace SUB with CMP if possible
This patch will optimize the following
        movq    %rdi, %rax
        subq    %rsi, %rax
        cmovsq  %rsi, %rdi
        movq    %rdi, %rax
to
        cmpq    %rsi, %rdi
        cmovsq  %rsi, %rdi
        movq    %rdi, %rax

Perform this optimization if the actual result of SUB is not used.

rdar: 11540023


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157755 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31 17:20:29 +00:00
Jakob Stoklund Olesen
9cda1be0aa Prioritize smaller register classes for urgent evictions.
It helps compile exotic inline asm. In the test case, normal GR32
virtual registers use up eax-edx so the final GR32_ABCD live range has
no registers left. Since all the live ranges were tiny, we had no way of
prioritizing the smaller register class.

This patch allows tiny unspillable live ranges to be evicted by tiny
unspillable live ranges from a smaller register class.

<rdar://problem/11542429>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157715 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 21:46:58 +00:00
Owen Anderson
f917d20561 Switch the canonical FMA term operand order to match both the comment I wrote and the usual LLVM convention.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157708 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 18:54:50 +00:00
Owen Anderson
85ef6f4c99 Teach DAGCombine to canonicalize the position of a constant in the term operands of an FMA node.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157707 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 18:50:39 +00:00
Chad Rosier
06a23ea808 Remove extra space.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157706 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 18:47:55 +00:00
Jakob Stoklund Olesen
275fd2523e Remove some redundant tests.
An empty list is not represented as a null pointer. Let TRI do its own
shortcuts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157702 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 18:38:56 +00:00
Evan Cheng
eb25bd2356 Teach taildup to update livein set. rdar://11538365
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157663 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 00:42:39 +00:00
Evan Cheng
3d4166dff0 If-converter models predicated defs as read + write. The read should be marked as 'undef' since it may not already be live. This appeases -verify-machineinstrs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157662 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 00:42:02 +00:00
Bob Wilson
6e1b812850 Add an insertPass API to TargetPassConfig. <rdar://problem/11498613>
Besides adding the new insertPass function, this patch uses it to
enhance the existing -print-machineinstrs so that the MachineInstrs
after a specific pass can be printed.

Patch by Bin Zeng!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157655 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-30 00:17:12 +00:00
Evan Cheng
cac58aa80e Optional def can be either a def or a use (of reg0).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157640 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-29 19:40:44 +00:00
Lang Hames
f905f69668 Clear the entering, exiting and internal ranges of a bundle before collecting
ranges for the instruction about to be bundled. This fixes a bug in an external
project where an assertion was triggered due to spurious 'multiple defs' within
the bundle.

Patch by Ivan Llopard. Thanks Ivan!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157632 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-29 18:19:54 +00:00
Stepan Dyatkovskiy
0aa32d5d0f ConstantRangesSet renamed to IntegersSubset. CRSBuilder renamed to IntegersSubsetMapping.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157612 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-29 12:26:47 +00:00
Peter Collingbourne
b34d3aa35b Add llvm.fabs intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157594 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-28 21:48:37 +00:00
Stepan Dyatkovskiy
484fc93eff PR1255: Case Ranges
Implemented IntItem - the wrapper around APInt. Why not to use APInt item directly right now?
1. It will very difficult to implement case ranges as series of small patches. We got several large and heavy patches. Each patch will about 90-120 kb. If you replace ConstantInt with APInt in SwitchInst you will need to changes at the same time all Readers,Writers and absolutely all passes that uses SwitchInst.
2. We can implement APInt pool inside and save memory space. E.g. we use several switches that works with 256 bit items (switch on signatures, or strings). We can avoid value duplicates in this case.
3. IntItem can be easyly easily replaced with APInt.
4. Currenly we can interpret IntItem both as ConstantInt and as APInt. It allows to provide SwitchInst methods that works with ConstantInt for non-updated passes.

Why I need it right now? Currently I need to update SimplifyCFG pass (EqualityComparisons). I need to work with APInts directly a lot, so peaces of code
ConstantInt *V = ...;
if (V->getValue().ugt(AnotherV->getValue()) {
  ...
}
will look awful. Much more better this way:
IntItem V = ConstantIntVal->getValue();
if (AnotherV < V) {
}

Of course any reviews are welcome.

P.S.: I'm also going to rename ConstantRangesSet to IntegersSubset, and CRSBuilder to IntegersSubsetMapping (allows to map individual subsets of integers to the BasicBlocks).
Since in future these classes will founded on APInt, it will possible to use them in more generic ways.




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157576 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-28 12:39:09 +00:00
Peter Collingbourne
27302f0739 Have getOrCreateSubprogramDIE store the DIE for a subprogram
definition in the map before calling itself to retrieve the
DIE for the declaration.  Without this change, if this causes
getOrCreateSubprogramDIE to be recursively called on the definition,
it will create multiple DIEs for that definition.  Fixes PR12831.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157541 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-27 18:36:44 +00:00
Benjamin Kramer
cf1d69df7e Missed parens.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157527 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-27 10:56:55 +00:00
Benjamin Kramer
4fae58b32d r157525 didn't work, just disable iterator checking.
This is obviosly right but I don't see how to do this with proper vector
iterators without building a horrible mess of workarounds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157526 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-27 10:24:52 +00:00
Benjamin Kramer
dc54f8ebe2 SDAGBuilder: Avoid iterator invalidation harder.
vector.begin()-1 is invalid too.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157525 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-27 09:44:52 +00:00
Benjamin Kramer
5db954dab9 SDAGBuilder: Don't create an invalid iterator when there is only one switch case.
Found by libstdc++'s debug mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157522 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-26 21:19:12 +00:00
Benjamin Kramer
c511b2a5a1 SelectionDAGBuilder: When emitting small compare chains for switches order them by using edge weights.
SimplifyCFG tends to form a lot of 2-3 case switches when merging branches. Move
the most likely condition to the front so it is checked first and the others can
be skipped. This is currently not as effective as it could be because SimplifyCFG
destroys profiling metadata when merging branches and switches. Merging branch
weight metadata is tricky though.

This code touches at most 3 cases so I didn't use a proper sorting algorithm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157521 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-26 20:01:32 +00:00
Benjamin Kramer
9632f77f8d ScoreboardHazardRecognizer: Remove dead conditional in debug code.
Negative cycles are filtered out earlier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157514 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-26 11:37:37 +00:00
Justin Holewinski
d2ea0e10cb Change interface for TargetLowering::LowerCallTo and TargetLowering::LowerCall
to pass around a struct instead of a large set of individual values.  This
cleans up the interface and allows more information to be added to the struct
for future targets without requiring changes to each and every target.

NV_CONTRIB

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157479 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 16:35:28 +00:00
Andrew Trick
c7a098fbb2 misched: trace formatting
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157455 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 02:02:39 +00:00
Eli Friedman
2db0e9ebb6 Simplify code for calling a function where CanLowerReturn fails, fixing a small bug in the process.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157446 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 00:09:29 +00:00
Kaelyn Uhrain
5402efa3dc Silence unused variable warnings from when assertions are disabled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157438 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 23:37:49 +00:00
Andrew Trick
8ddd9d5b2b misched: Use the same scheduling heuristics with -misched-topdown/bottomup.
(except the part about choosing direction)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157437 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 23:11:17 +00:00
Andrew Trick
bb0a242d86 misched: Trace regpressure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157429 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 22:11:14 +00:00
Andrew Trick
f323424d71 misched: Give each ReadyQ a unique ID
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157428 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 22:11:12 +00:00
Andrew Trick
0a39d4e4c8 misched: Added ScoreboardHazardRecognizer.
The Hazard checker implements in-order contraints, or interlocked
resources. Ready instructions with hazards do not enter the available
queue and are not visible to other heuristics.

The major code change is the addition of SchedBoundary to encapsulate
the state at the top or bottom of the schedule, including both a
pending and available queue.

The scheduler now counts cycles in sync with the hazard checker. These
are minimum cycle counts based on known hazards.

Targets with no itinerary (x86_64) currently remain at cycle 0. To fix
this, we need to provide some maximum issue width for all targets. We
also need to add the concept of expected latency vs. minimum latency.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157427 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 22:11:09 +00:00
Andrew Trick
2aa689dfbf misched: Release bottom roots in reverse order.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157426 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 22:11:05 +00:00
Andrew Trick
8c2d9212a9 misched: rename ReadyQ class
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157425 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 22:11:03 +00:00
Andrew Trick
c8fe4ecb47 misched: copy comments so compareRPDelta is readable by itself.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157424 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 22:11:01 +00:00
Andrew Trick
5f887fab35 regpressure: Added RegisterPressure::dump
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157423 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 22:10:59 +00:00
Andrew Trick
a7de4b99e4 regpressure: physreg livein/out fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157422 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 22:10:57 +00:00
Craig Topper
e329810482 Mark some static arrays as const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157377 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-24 06:35:32 +00:00
Jakob Stoklund Olesen
d74d284757 Add a last resort tryInstructionSplit() to RAGreedy.
Live ranges with a constrained register class may benefit from splitting
around individual uses. It allows the remaining live range to use a
larger register class where it may allocate. This is like spilling to a
different register class.

This is only attempted on constrained register classes.

<rdar://problem/11438902>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157354 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 22:37:27 +00:00
Bill Wendling
dbb4e57a3c Forgot to reverse conditional.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157349 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 22:12:50 +00:00
Bill Wendling
20350db448 Reduce indentation by early detection of 'continue'. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157348 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 22:09:50 +00:00
Jakob Stoklund Olesen
e3b548219f Correctly deal with identity copies in RegisterCoalescer.
Now that the coalescer keeps live intervals and machine code in sync at
all times, it needs to deal with identity copies differently.

When merging two virtual registers, all identity copies are removed
right away. This means that other identity copies must come from
somewhere else, and they are going to have a value number.

Deal with such copies by merging the value numbers before erasing the
copy instruction. Otherwise, we leave dangling value numbers in the live
interval.

This fixes PR12927.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157340 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 20:21:06 +00:00
Patrik Hägglund
d76938788b Small fix for the debug output from PBQP (PR12822).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157319 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 12:12:58 +00:00
Eric Christopher
bb0f6eac1f Add support for C++11 enum classes in llvm.
Part of rdar://11496790

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157303 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-23 00:09:20 +00:00
Eric Christopher
4d069bf8ec Untabify and 80-col.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157274 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-22 18:45:24 +00:00
Eric Christopher
4a5d839dfa Formatting consistency.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157273 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-22 18:45:18 +00:00
Jakob Stoklund Olesen
76ff741836 Only erase virtregs with no uses left.
Also make sure registers aren't erased twice if the dead def mentions
the register twice.

This fixes PR12911.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157254 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-22 14:52:12 +00:00
Owen Anderson
4b6e6750fe Fix use of an unitialized value in the LegalizeOps expansion for ISD::SUB. No in-tree targets exercise this path.
Patch by Micah Villmow.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157215 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-21 22:39:20 +00:00
Chad Rosier
f496deaa03 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157195 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-21 17:13:41 +00:00
Jakob Stoklund Olesen
1dc12aa148 Give a small negative bias to giant edge bundles.
This helps compile time when the greedy register allocator splits live
ranges in giant functions. Without the bias, we would try to grow
regions through the giant edge bundles, usually to find out that the
region became too big and expensive.

If a live range has many uses in blocks near the giant bundle, the small
negative bias doesn't make a big difference, and we still consider
regions including the giant edge bundle.

Giant edge bundles are usually connected to landing pads or indirect
branches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157174 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-21 03:11:23 +00:00
Jakob Stoklund Olesen
857ed22604 Clear kill flags on the fly when joining intervals.
With physreg joining out of the way, it is easy to recognize the
instructions that need their kill flags cleared while testing for
interference.

This allows us to skip the final scan of all instructions for an 11%
speedup of the coalescer pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157169 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-20 21:41:05 +00:00