Commit Graph

11511 Commits

Author SHA1 Message Date
Evan Cheng
d158fba3e4 Add a peephole optimization to optimize pairs of bitcasts. e.g.
v2 = bitcast v1
...
v3 = bitcast v2
...
   = v3
=>
v2 = bitcast v1
...
   = v1
if v1 and v3 are of in the same register class.

bitcast between i32 and fp (and others) are often not nops since they
are in different register classes. These bitcast instructions are often
left because they are in different basic blocks and cannot be
eliminated by dag combine.

rdar://9104514


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127668 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 05:13:13 +00:00
Evan Cheng
bf34a5ec22 sext(undef) = 0, because the top bits will all be the same.
zext(undef) = 0, because the top bits will be zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127649 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 02:22:10 +00:00
Bill Wendling
28cc1aa3a7 There are some situations which can cause the URoR hack to infinitely recurse
and then go kablooie. The problem was that it was tracking the PHI nodes anew
each time into this function. But it didn't need to. And because the recursion
didn't know that a PHINode was visited before, it would go ahead and call
itself.

There is a testcase, but unfortunately it's too big to add. This problem will go
away with the EH rewrite.
<rdar://problem/8856298>


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127640 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-15 01:03:17 +00:00
Jakob Stoklund Olesen
cf03e35d90 Place context in member variables instead of passing around pointers.
Use the opportunity to get rid of the trailing underscore variable names.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127618 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 20:57:14 +00:00
Jakob Stoklund Olesen
766faf4b2b Rename members to match LLVM naming conventions more closely.
Remove the unused reserved_ bit vector, no functional change intended.

This doesn't break 'svn blame', this file really is all my fault.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127607 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 19:56:43 +00:00
Evan Cheng
34661e72fc BIT_CONVERT has been renamed to BITCAST.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127600 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 18:19:52 +00:00
Evan Cheng
5ae1da96f2 Minor optimization. sign-ext/anyext of undef is still undef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127598 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-14 18:15:55 +00:00
Jakob Stoklund Olesen
5522e8a936 Now that we are deleting unused live intervals during allocation, pointers may be reused.
Use the virtual register number as a cache tag instead. They are not reused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127561 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-13 01:29:32 +00:00
Jakob Stoklund Olesen
7792e980c4 Tell the register allocator about new unused virtual registers.
This allows the allocator to free any resources used by the virtual register,
including physical register assignments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127560 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-13 01:23:11 +00:00
Duncan Sands
ba9934648f Speculatively revert commit 127478 (jsjodin) in an attempt to fix the
llvm-gcc-i386-linux-selfhost and llvm-x86_64-linux-checks buildbots.
The original log entry:
Remove optimization emitting a reference insted of label difference, since
it can create more relocations. Removed isBaseAddressKnownZero method,
because it is no longer used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127540 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 13:07:37 +00:00
Jakob Stoklund Olesen
b1adbd1f67 Include snippets in the live stack interval.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127530 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 04:25:36 +00:00
Jakob Stoklund Olesen
10a433238f Spill multiple registers at once.
Live range splitting can create a number of small live ranges containing only a
single real use. Spill these small live ranges along with the large range they
are connected to with copies. This enables memory operand folding and maximizes
the spill to fill distance.

Work in progress with known bugs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127529 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 04:17:20 +00:00
Jakob Stoklund Olesen
55768d763d That's it, I am declaring this a failure of the C++03 STL.
There are too many compatibility problems with using mixed types in
std::upper_bound, and I don't want to spend 110 lines of boilerplate setting up
a call to a 10-line function. Binary search is not /that/ hard to implement
correctly.

I tried terminating the binary search with a linear search, but that actually
made the algorithm slower against my expectation. Most live intervals have less
than 4 segments. The early test against endIndex() does pay, and this version is
25% faster than plain std::upper_bound().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-12 01:50:35 +00:00
Cameron Zwarich
53aac15a60 Fix the GCC test suite issue exposed by r127477, which was caused by stack
protector insertion not working correctly with unreachable code. Since that
revision was rolled out, this test doesn't actual fail before this fix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127497 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 21:51:56 +00:00
Owen Anderson
2ce5bf188d Teach FastISel to support register-immediate-immediate instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127496 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 21:33:55 +00:00
Jan Sjödin
e4f6d7461a Remove optimization emitting a reference insted of label difference, since it can create more relocations. Removed isBaseAddressKnownZero method, because it is no longer used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127478 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 19:37:02 +00:00
Andrew Trick
778583ad28 Replace -dag-chain-limit flag with constant. It has survived a release cycle without being touched, so no longer needs to pollute the hidden-help text.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127468 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 17:46:59 +00:00
John Wiegley
6fd2472b1b Fix use of CompEnd predicate to be standards conforming
The existing CompEnd predicate does not define a strict weak order as required
by the C++03 standard; therefore, its use as a predicate to std::upper_bound
is invalid. For a discussion of this issue, see
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#270

This patch replaces the asymmetrical comparison with an iterator adaptor that
achieves the same effect while being strictly standard-conforming by ensuring
an apples-to-apples comparison.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127462 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 08:54:34 +00:00
Evan Cheng
9ef82ce4fe Avoid replacing the value of a directly stored load with the stored value if the load is indexed. rdar://9117613.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127440 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 00:48:56 +00:00
Cameron Zwarich
6a951ac63f Add an option to disable critical edge splitting in PHIElimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127398 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 05:59:17 +00:00
Jakob Stoklund Olesen
47dbf6cef7 Change the Spiller interface to take a LiveRangeEdit reference.
This makes it possible to register delegates and get callbacks when the spiller
edits live ranges.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127389 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 01:51:42 +00:00
Jakob Stoklund Olesen
38f6bd0fc8 Make SpillIs an optional pointer. Avoid creating a bunch of temporary SmallVectors.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127388 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 01:21:58 +00:00
Evan Cheng
b0519e15f7 Re-commit 127368 and 127371. They are exonerated.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127380 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 00:16:32 +00:00
Evan Cheng
02d7c92982 Revert 127368 and 127371 for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127376 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 23:53:17 +00:00
Evan Cheng
17adafc6c1 Change the definition of TargetRegisterInfo::getCrossCopyRegClass to be more
flexible.

If it returns a register class that's different from the input, then that's the
register class used for cross-register class copies.
If it returns a register class that's the same as the input, then no cross-
register class copies are needed (normal copies would do).
If it returns null, then it's not at all possible to copy registers of the
specified register class.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127368 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 22:47:38 +00:00
Jakob Stoklund Olesen
5d96e5a1cc Make physreg coalescing independent on the number of uses of the virtual register.
The damage done by physreg coalescing only depends on the number of instructions
the extended physreg live range covers. This fixes PR9438.

The heuristic is still luck-based, and physreg coalescing really should be
disabled completely. We need a register allocator with better hinting support
before that is possible.

Convert a test to FileCheck and force spilling by inserting an extra call. The
previous spilling behavior was dependent on misguided physreg coalescing
decisions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127351 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 19:27:06 +00:00
Andrew Trick
4bbf4678e3 Improve pre-RA-sched register pressure tracking for duplicate operands.
This helps cases like 2008-07-19-movups-spills.ll, but doesn't have an obvious impact on benchmarks


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127347 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 19:12:43 +00:00
Benjamin Kramer
d7cdc3e1f9 Fix typo, make helper static.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127335 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 16:19:12 +00:00
Benjamin Kramer
8104163fd1 Remove unused virtual dtor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127331 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 14:20:28 +00:00
Matt Beaumont-Gay
ab2ee2ea75 Add a virtual dtor to Delegate to silence -Wnon-virtual-dtor
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127311 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 04:02:15 +00:00
Jakob Stoklund Olesen
92a55f4bdd Add a LiveRangeEdit::Delegate protocol.
This will we used for keeping register allocator data structures up to date
while LiveRangeEdit is trimming live intervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127300 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 00:57:29 +00:00
Jakob Stoklund Olesen
f46aa914c8 Delete dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127295 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 00:07:39 +00:00
Jakob Stoklund Olesen
5881799d0c Delete dead code after rematerializing.
LiveRangeEdit::eliminateDeadDefs() will eventually be used by coalescing,
splitting, and spilling for dead code elimination. It can delete chains of dead
instructions as long as there are no dependency loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127287 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 22:46:11 +00:00
Jakob Stoklund Olesen
5bf76cd119 Fix the build for MSVC 9 whose upper_bound() wants to compare elements in the sorted array.
Patch by Olaf Krzikalla!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127264 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 19:37:54 +00:00
Eric Christopher
29449448b0 Fix some latent bugs if the nodes are unschedulable. We'd gotten away
with this before since none of the register tracking or nightly tests
had unschedulable nodes.

This should probably be refixed with a special default Node that just
returns some "don't touch me" values.

Fixes PR9427


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127263 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 19:35:47 +00:00
Oscar Fuentes
3aefa7771d Revert "Make a comparator's argument `const'. This fixes the build for
MSVC 9."

The "fix" was meaningless.

This reverts commit r127245.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127260 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 19:26:21 +00:00
Benjamin Kramer
f337fb2fa8 Reduce vector reallocations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127254 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 17:28:36 +00:00
Oscar Fuentes
86e4eeb6c7 Make a comparator's argument `const'. This fixes the build for MSVC 9.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127245 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 13:52:07 +00:00
Andrew Trick
0bf56c821c Further improvements to pre-RA-sched=list-ilp.
This change uses the MaxReorderWindow for both height and depth, which
tends to limit the negative effects of high register pressure.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127203 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-08 01:51:56 +00:00
Jakob Stoklund Olesen
0d8ccaa5c8 Let shrinkToUses optionally return a list of now dead machine instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127192 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 23:29:10 +00:00
Jakob Stoklund Olesen
1973b3e254 Make the UselessRegs argument optional in the LiveRangeEdit constructor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127181 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 22:42:16 +00:00
Cameron Zwarich
be2119e8e2 Move getRegPressureLimit() from TargetLoweringInfo to TargetRegisterInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127175 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 21:56:36 +00:00
Jakob Stoklund Olesen
a9d5c2715b Handle the special case of registers begin redefined by early-clobber defs.
In this case, the value need to be available at the load index instead of the
normal use index.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127167 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 18:56:16 +00:00
Owen Anderson
6154f6c929 Use the correct LHS type when determining the legalization of a shift's RHS type.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127163 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-07 18:29:47 +00:00
Eric Christopher
b43034d700 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127131 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 21:13:45 +00:00
NAKAMURA Takumi
511cab20cb lib/CodeGen/AsmPrinter/CMakeLists.txt: Fix CMake build, following up to r127099.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127114 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 00:13:15 +00:00
Andrew Trick
3c6e49504e Disable a couple of experimental heuristics to get the best results from the current implementation of -pre-RA-sched=list-ilp.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127113 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06 00:03:32 +00:00
Anton Korobeynikov
b5e16af9ea Some first rudimentary support for ARM EHABI: print exception table in "text mode".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127099 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 18:43:15 +00:00
Anton Korobeynikov
6dd97471c4 Add FrameSetup MI flags
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127098 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 18:43:04 +00:00
Jakob Stoklund Olesen
2b0f9e73d8 Work around a coalescer bug.
The coalescer can in very rare cases leave too large live intervals around after
rematerializing cheap-as-a-move instructions.

Linear scan doesn't really care, but live range splitting gets very confused
when a live range is killed by a ghost instruction.

I will fix this properly in the coalescer after 2.9 branches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127096 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05 18:33:49 +00:00