Dan Gohman
0402315d41
Use setPreservesAll and setPreservesCFG in CodeGen passes.
...
llvm-svn: 77754
2009-07-31 23:37:33 +00:00
Evan Cheng
84517443ca
Let callers decide the sub-register index on the def operand of rematerialized instructions.
...
Avoid remat'ing instructions whose def have sub-register indices for now. It's just really really hard to get all the cases right.
llvm-svn: 75900
2009-07-16 09:20:10 +00:00
Torok Edwin
08954aa4e1
Fix assert(0) conversion, as suggested by Chris.
...
llvm-svn: 75423
2009-07-12 20:07:01 +00:00
Torok Edwin
ccb29cd290
Convert more assert(0)+abort() -> LLVM_UNREACHABLE,
...
and abort()/exit() -> llvm_report_error().
llvm-svn: 75363
2009-07-11 13:10:19 +00:00
Lang Hames
dab7b06de9
Improved tracking of value number kills. VN kills are now represented
...
as an (index,bool) pair. The bool flag records whether the kill is a
PHI kill or not. This code will be used to enable splitting of live
intervals containing PHI-kills.
A slight change to live interval weights introduced an extra spill
into lsr-code-insertion (outside the critical sections). The test
condition has been updated to reflect this.
llvm-svn: 75097
2009-07-09 03:57:02 +00:00
Lang Hames
16cab1935e
VNInfo cleanup.
...
llvm-svn: 73634
2009-06-17 21:01:20 +00:00
Evan Cheng
210fc62a91
In some rare cases, the register allocator can spill registers but end up not utilizing registers at all. The fundamental problem is linearscan's backtracking can end up freeing more than one allocated registers. However, reloads and restores might be folded into uses / defs and freed registers might not be used at all.
...
VirtRegMap keeps track of allocations so it knows what's not used. As a horrible hack, the stack coloring can color spill slots with *free* registers. That is, it replace reload and spills with copies from and to the free register. It unfold instructions that load and store the spill slot and replace them with register using variants.
Not yet enabled. This is part 1. More coming.
llvm-svn: 70787
2009-05-03 18:32:42 +00:00
Bob Wilson
51856173c8
Fix pr3954. The register scavenger asserts for inline assembly with
...
register destinations that are tied to source operands. The
TargetInstrDescr::findTiedToSrcOperand method silently fails for inline
assembly. The existing MachineInstr::isRegReDefinedByTwoAddr was very
close to doing what is needed, so this revision makes a few changes to
that method and also renames it to isRegTiedToUseOperand (for consistency
with the very similar isRegTiedToDefOperand and because it handles both
two-address instructions and inline assembly with tied registers).
llvm-svn: 68714
2009-04-09 17:16:43 +00:00
Owen Anderson
4486c1fac0
Remove the "fast" cases for spill and restore point determination, as these were subtlely wrong in obscure cases. Patch the testcase
...
to account for this change.
llvm-svn: 68093
2009-03-31 08:27:09 +00:00
Owen Anderson
0422efc994
Give the pre-alloc splitter access to the VirtRegMap. It doesn't do anything
...
useful with it at the moment, but it will in the future.
llvm-svn: 67012
2009-03-14 21:40:05 +00:00
Owen Anderson
380b3838f6
(Hopefully) silence a warning.
...
llvm-svn: 66158
2009-03-05 08:23:20 +00:00
Owen Anderson
ad503987a8
Be more careful about choosing restore points when doing restore folding. This fixes some subtle miscompilations.
...
llvm-svn: 66147
2009-03-05 07:19:18 +00:00
Owen Anderson
0dedc114de
Add a restore folder, which shaves a dozen or so machineinstrs off oggenc. Update a testcase to check this.
...
llvm-svn: 66029
2009-03-04 08:52:31 +00:00
Owen Anderson
f13820148b
Fix a crash in the pre-alloc splitter exposed by recent codegen changes.
...
llvm-svn: 65121
2009-02-20 10:02:23 +00:00
Evan Cheng
b5f0ec3eb7
Add TargetInstrInfo::isSafeToMoveRegisterClassDefs. It returns true if it's safe to move an instruction which defines a value in the register class. Replace pre-splitting specific IgnoreRegisterClassBarriers with this new hook.
...
llvm-svn: 63936
2009-02-06 17:17:30 +00:00
Owen Anderson
7411523ee6
Pre-alloc splitting needs to be more careful to avoid inserting spills/restores
...
between call frame setup/restore points. Unfortunately, this regresses
code size a bit, but at least it's correct now!
llvm-svn: 63837
2009-02-05 05:58:41 +00:00
Owen Anderson
4eda2cbe5f
MergeValueInto is too smart: it might choose to do the merge the opposite direction.
...
Live interval reconstruction needs to account for this, and scour its maps to
prevent dangling references.
llvm-svn: 63558
2009-02-02 22:42:01 +00:00
Evan Cheng
03f862579c
Refactor PerformPHIConstruction, no functionality changes.
...
llvm-svn: 63536
2009-02-02 18:33:18 +00:00
Owen Anderson
19616c08a0
Fix test failures causes by my previous commit.
...
llvm-svn: 63492
2009-02-01 08:41:54 +00:00
Owen Anderson
66838e9a27
Fix an issue in PHI construction that was exposed by GCC 4.2 producing a different set iteration order for the reg_iterator.
...
llvm-svn: 63490
2009-02-01 07:06:00 +00:00
Owen Anderson
bf77d2eb9d
Correct the algorithms for choosing spill and restore points so that we don't try to insert loads/stores between call frame setup and the actual call.
...
This fixes the last known failure for the pre-alloc-splitter.
llvm-svn: 63339
2009-01-29 22:13:06 +00:00
Owen Anderson
c0924a0632
Fix an issue where restores could be inserted after a terminator instruction,
...
and an iterator invalidation issue.
FreeBench/pifft no longer miscompiles with these fixes!
llvm-svn: 63293
2009-01-29 08:22:06 +00:00
Owen Anderson
a590802ed6
Comments are good. :-)
...
llvm-svn: 63276
2009-01-29 05:41:02 +00:00
Owen Anderson
b05ce78c51
Add support for aggressive load-use-store folding. This takes care of the
...
vast majority of code size regressions introduced by pre-alloc-splitting.
llvm-svn: 63274
2009-01-29 05:28:55 +00:00
Owen Anderson
431053ed2c
Make the pre-split-limit option more useful by using a per-function counter.
...
llvm-svn: 63091
2009-01-27 05:01:15 +00:00
Owen Anderson
e84c3f261e
Reapply r63025 and r63026, with fixes for the failing testcases.
...
llvm-svn: 63049
2009-01-26 21:57:31 +00:00
Bill Wendling
e7fa3c37c6
Also revert r63206
...
llvm-svn: 63041
2009-01-26 21:30:17 +00:00
Bill Wendling
a39c83d118
Temporarily revert r63025 until the testsuite failures can be fixed.
...
llvm-svn: 63040
2009-01-26 21:27:03 +00:00
Owen Anderson
5e235d3a7e
Get rid of a bunch of dead code now that interval reconstruction is enabled.
...
llvm-svn: 63026
2009-01-26 19:18:06 +00:00
Owen Anderson
feffdec244
Fix an issue where LiveIntervals was trying to be smart about removing kill
...
markers, and ended up foiling the interval reconstruction.
This allows us to turn on reconstruction in the pre alloc splitter, which
fixes a number of miscompilations.
llvm-svn: 63025
2009-01-26 19:12:06 +00:00
Evan Cheng
72287a599f
Silence a bogus compiler warning.
...
llvm-svn: 63021
2009-01-26 18:33:51 +00:00
Owen Anderson
ee34b8f179
Some cleanups. No functional changes.
...
llvm-svn: 62917
2009-01-24 10:07:43 +00:00
Owen Anderson
a2ca64a39a
Stage two of fixing pre-alloc-splitting's code size issues: filter out restores that are just
...
going to be re-spilled again.
This also helps performance. Pre-alloc-splitting now seems to be an overall win on SPEC.
llvm-svn: 62834
2009-01-23 03:28:53 +00:00
Owen Anderson
48abf2380b
Add an initial pass at dead spill/restore removal for pre alloc splitting.
...
llvm-svn: 62821
2009-01-23 00:23:32 +00:00
Owen Anderson
fe48dfa0f2
I accidentally removed this check in an earlier commit, which cause breakage in the pre alloc splitter.
...
llvm-svn: 62678
2009-01-21 08:18:03 +00:00
Owen Anderson
be7a29de0b
Be more aggressive about renumbering vregs after splitting them.
...
llvm-svn: 62639
2009-01-21 00:13:28 +00:00
Evan Cheng
c544cb0eca
Change TargetInstrInfo::isMoveInstr to return source and destination sub-register indices as well.
...
llvm-svn: 62600
2009-01-20 19:12:24 +00:00
Owen Anderson
45cfef2cb6
More two-address fixes. This gets lua working with join-creation enabled.
...
llvm-svn: 62073
2009-01-12 03:10:40 +00:00
Owen Anderson
f04100a50d
The phi construction algorithm used for interval reconstruction is complicated by
...
two address instructions. We need to keep track of things we've processed AS USES
independetly of whether we've processed them as defs.
This fixes all known miscompilations when reconstruction is turned on.
llvm-svn: 61802
2009-01-06 07:53:32 +00:00
Owen Anderson
96fce00dc0
Get rid of sentinel insertion in interval reconstruction. It just masked the
...
problem, rather than fixing it. The problem has now been fixed the right way.
llvm-svn: 61723
2009-01-05 18:32:26 +00:00
Owen Anderson
8b86b9ca47
Get live interval reconstruction several steps closer to working.
...
llvm-svn: 61514
2008-12-31 02:00:25 +00:00
Duncan Sands
43b18241ff
Add braces, as suggested by a gcc warning.
...
llvm-svn: 61465
2008-12-29 08:05:02 +00:00
Owen Anderson
b5232286a7
Fix up kill/dead marking in the new live interval reconstruction code.
...
llvm-svn: 61460
2008-12-28 23:35:13 +00:00
Owen Anderson
37751bb9d9
Add prototype code for recomputing a live interval's ranges and valnos through recursive phi construction.
...
llvm-svn: 61458
2008-12-28 21:48:48 +00:00
Owen Anderson
ad4d2ab15b
Re-apply r61158 in a form that no longer breaks tests.
...
llvm-svn: 61182
2008-12-18 01:27:19 +00:00
Owen Anderson
59727c0496
Revert r61158 for now, as it caused some test failures.
...
llvm-svn: 61159
2008-12-17 22:17:27 +00:00
Owen Anderson
9389176009
Fix miscompilations caused by renumbering, and enable it as part of prealloc splitting.
...
llvm-svn: 61158
2008-12-17 22:06:59 +00:00
Owen Anderson
5121ec3821
Add code to renumber split intervals into new vregs. This is disabled for now until I finish working out some iterator invalidation issues.
...
llvm-svn: 61104
2008-12-16 21:35:08 +00:00
Owen Anderson
12679470bf
Switch to top-down mode and fix a crasher this exposed caused by an error in the
...
live interval updating.
llvm-svn: 60652
2008-12-07 05:33:18 +00:00
Owen Anderson
0bcbe8f6a8
Factor out some common code.
...
llvm-svn: 60553
2008-12-04 21:20:30 +00:00