Commit Graph

114 Commits

Author SHA1 Message Date
Dan Gohman
f641395435 Revert r55467; it causes regressions in UnitTests/Vector/divides,
Benchmarks/sim/sim, and others on x86-64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55475 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 17:22:54 +00:00
Evan Cheng
9242cb8b82 If a copy isn't coalesced, but its src is defined by trivial computation. Re-materialize the src to replace the copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55467 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 07:53:51 +00:00
Owen Anderson
44eb65cf58 Convert uses of std::vector in TargetInstrInfo to SmallVector. This change had to be propoagated down into all the targets and up into all clients of this API.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54802 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 22:49:33 +00:00
Dan Gohman
a8c763b307 Use empty() instead of begin() == end().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54780 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-14 18:13:49 +00:00
Owen Anderson
03857b29d8 Make the allocation of LiveIntervals explicit, rather than holding them in the r2iMap_ by value. This will prevent references to them from being invalidated
if the map is changed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54763 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-13 21:49:13 +00:00
Evan Cheng
4fa393aae1 Remove #if 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54347 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 07:20:57 +00:00
Evan Cheng
068b4ff553 Fix PR2568: Fix bug that cause redudant kill marker after its live interval has been extended due to coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 07:10:38 +00:00
Owen Anderson
496bac5b08 Fix a compile-time regression introduced by my heuristic-changing patch. I forgot
to multiply the instruction count by a constant factor in a few places, which
caused the register allocator to require many more iterations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53959 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-23 19:47:27 +00:00
Owen Anderson
a1566f2e12 Change the heuristics used in the coalescer, register allocator, and within
live intervals itself to use an instruction count approximation that is 
not affected by inserting empty indices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-22 22:46:49 +00:00
Evan Cheng
76a4d58998 Subreg live interval valno may not have a corresponding def machineinstr since it's less precise.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-17 19:48:53 +00:00
Owen Anderson
b3db9c90d2 Use getMBBEndIdx rather than assuming that the end is right after the last instruction in the block.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52649 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-23 22:12:23 +00:00
Evan Cheng
c3417609ae Undo spill weight tweak. Need to investigate the performance regressions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 06:45:54 +00:00
Evan Cheng
e00f5de361 Coalesce copy from one register class to a sub register class. e.g. X86::MOV16to16_.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52480 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-19 01:39:21 +00:00
Evan Cheng
739583be56 When extending a liveinterval by commuting, don't throw away the live ranges that are not affected.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-17 20:11:16 +00:00
Owen Anderson
dbb8137c11 The coalescer doesn't need LiveVariables now that we have register use iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-30 22:37:27 +00:00
Evan Cheng
d77d4f98fb Fix PR2289: vr defined by multiple implicit_def as result of coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51648 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-28 17:40:10 +00:00
Evan Cheng
f4ea510371 Fix PR2343. An *interesting* coalescer bug.
BB1:                                                                                                                                                  
  vr1025 = copy vr1024                                                                                                                                
  ..                                                                                                                                                  
BB2:                                                                                                                                                  
  vr1024 = op                                                                                                                                         
         = op vr1025                                                                                                                                     
  <loop eventually branch back to BB1>

Even though vr1025 is copied from vr1024, it's not safe to coalesced them since live range of vr1025 intersects the def of vr1024. This happens when vr1025 is assigned the value of the previous iteration of vr1024 in the loop.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-21 22:34:12 +00:00
Dan Gohman
6ddba2b933 Change class' public PassInfo variables to by initialized with the
address of the PassInfo directly instead of calling getPassInfo.
This eliminates a bunch of dynamic initializations of static data.

Also, fold RegisterPassBase into PassInfo, make a bunch of its
data members const, and rearrange some code to initialize data
members in constructors instead of using setter member functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 02:05:11 +00:00
Dan Gohman
844731a7f1 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-13 00:00:25 +00:00
Evan Cheng
8509fcf8eb Another extract_subreg coalescing bug.
e.g.
vr1024<2> extract_subreg vr1025, 2
If vr1024 do not have the same register class as vr1025, it's not safe to coalesce this away. For example, vr1024 might be a GPR32 while vr1025 might be a GPR64.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50385 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-29 01:41:44 +00:00
Evan Cheng
a971dbdde2 - Check if a register is livein before removing it. It may have already been removed.
- Do not iterate over SmallPtrSet, the order of iteration is not deterministic.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50209 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-24 09:06:33 +00:00
Evan Cheng
a8f720d695 Correct comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49913 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 19:25:26 +00:00
Evan Cheng
883d260045 Not safe to "kill" a register if its live range extends pass the end of block branch.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49911 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 19:22:23 +00:00
Evan Cheng
639f493ebf Be more careful with insert_subreg and extract_subreg where either source or destination operand has already been coalesced with another register that's defined by a insert_subreg or extract_subreg.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 07:58:04 +00:00
Bill Wendling
f231778269 Use correct name for method in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 05:20:39 +00:00
Evan Cheng
621d157676 Fix a sub-register indice propagation bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-17 00:06:42 +00:00
Evan Cheng
9c1e06e187 After reading memory that's already freed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 20:24:25 +00:00
Evan Cheng
ff7a3e557e Fix PR2226. Avoid using uninitialized variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49807 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 18:48:43 +00:00
Evan Cheng
d94950c473 Avoid read after free.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49760 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-16 01:22:28 +00:00
Evan Cheng
d2012d0c4b Remove implicit_def instructions that become dead as result of coalescing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 23:48:35 +00:00
Evan Cheng
172b70c62a A copy instruction may use a register multiple times on some targets. Change them all.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49491 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-10 18:38:47 +00:00
Evan Cheng
7e073baedb - More aggressively coalescing away copies whose source is defined by an implicit_def.
- Added insert_subreg coalescing support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49448 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 20:57:25 +00:00
Evan Cheng
f20d943bc6 Missed a hasInterval check.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-09 01:30:15 +00:00
Evan Cheng
db9b1c3329 - Turn copies of implicit_def into implicit_def instructions.
- Be smarter about coalescing copies from implicit_def.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49168 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-03 16:41:54 +00:00
Evan Cheng
0c28432852 One more coalescer fix wrt deadness propagation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48837 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 20:15:49 +00:00
Evan Cheng
ed70cbb3f3 Avoid commuting a def MI in order to coalesce a copy instruction away if any use of the same val# is a copy instruction that has already been coalesced.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-26 19:03:01 +00:00
Evan Cheng
a2fb634def lastRegisterUse() should ignore identity copies. Those will be erased.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48759 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-25 02:02:19 +00:00
Evan Cheng
6f83fc8afb If the coalescer commuted a def MI to allow coalescing, it can changed a previously coalesced copy into an non-identity copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48752 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-24 23:31:21 +00:00
Evan Cheng
70366b96a5 A couple of kill marker maintainence bug.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48653 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-21 19:09:30 +00:00
Evan Cheng
82a6d23700 Fixed a coalescer bug caused by a typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-19 02:26:36 +00:00
Evan Cheng
3c88d742d4 Rewrite code that propagate isDead information after a dead copy is coalesced. This remove some ugly spaghetti code and fixed a number of subtle bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48490 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-18 08:26:47 +00:00
Evan Cheng
1c9b8cf28c Remove unused options.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-13 02:41:34 +00:00
Evan Cheng
4ff3f1cc57 - Fix a subtle bug in RemoveCopyByCommutingDef. ALR is the live range where the source is defined; BLR is the live range which is defined by the copy.
If ALR and BLR overlaps and end of BLR extends beyond end of ALR, e.g.                                                                                                 
 A = or A, B                                                                                                                                                            
 ...                                                                                                                                                                    
 B = A                                                                                                                                                                  
 ...                                                                                                                                                                    
 C = A<kill>                                                                                                                                                            
 ...                                                                                                                                                                    
   = B                                                                                                                                                                  
                                                                                                                                                                        
then do not add kills of A to the newly created B interval.
- Also fix some kill info update bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 08:11:32 +00:00
Evan Cheng
ecb2a8b9bc Fix a coalescer bug wrt how dead copy interval is shortened.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47966 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 22:09:42 +00:00
Evan Cheng
6130f66eaa Refactor code. Remove duplicated functions that basically do the same thing as
findRegisterUseOperandIdx, findRegisterDefOperandIndx. Fix some naming inconsistencies.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47927 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 00:59:57 +00:00
Evan Cheng
bec2c0c7e1 No need for coalescer to update kills. Only copies are coalesced and those instructions will be deleted. Doh.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47749 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-29 02:50:03 +00:00
Bill Wendling
e6d088acc9 Rename PrintableName to Name.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 21:47:57 +00:00
Bill Wendling
74ab84c31e Change "Name" to "AsmName" in the target register info. Gee, a refactoring tool
would have been a Godsend here!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47625 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 21:11:01 +00:00
Evan Cheng
4d535cadf1 Enable -coalescer-commute-instrs by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 20:40:22 +00:00
Evan Cheng
c886c460e4 This is possible:
vr1 = extract_subreg vr2, 3
...
vr3 = extract_subreg vr1, 2
The end result is vr3 is equal to vr2 with subidx 2.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47592 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-26 08:03:41 +00:00