1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-01 16:33:37 +01:00
llvm-mirror/test/CodeGen/Blackfin
Jakob Stoklund Olesen 40c33bb2b2 Rebuild RegScavenger::DistanceMap each time it is needed.
The register scavenger maintains a DistanceMap that maps MI pointers to their
distance from the top of the current MBB. The DistanceMap is built
incrementally in forward() and in bulk in findFirstUse(). It is used by
scavengeRegister() to determine which candidate register has the longest
unused interval.

Unfortunately the DistanceMap contents can become outdated. The first time
scavengeRegister() is called, the DistanceMap is filled to cover the MBB. If
then instructions are inserted in the MBB (as they always are following
scavengeRegister()), the recorded distances are too short. This causes bad
behaviour in the included test case where a register use /after/ the current
position is ignored because findFirstUse() thinks is is /before/ the current
position. A "using an undefined register" assertion follows promptly.

The fix is to build a fresh DistanceMap at the top of scavengeRegister(), and
discard it after use. This means that DistanceMap is no longer needed as a
RegScavenger member variable, and forward() doesn't need to update it.

The fix then discloses issue number two in the same test case: The candidate
search in scavengeRegister() finds a CSR that has been saved in the prologue,
but is currently unused. It would be both inefficient and wrong to spill such
a register in the emergency spill slot. In the present case, the emergency
slot restore is placed immediately before the normal epilogue restore, leading
to a "Redefining a live register" assertion.

Fix number two: When scavengerRegister() stumbles upon an unused register that
is overwritten later in the MBB, return that register early. It is important
to verify that the register is defined later in the MBB, otherwise it might be
an unspilled CSR.

llvm-svn: 78650
2009-08-11 06:25:12 +00:00
..
2009-08-04-LowerExtract-Live.ll LowerSubregsInstructionPass::LowerExtract should not extend the live range of registers. 2009-08-04 20:01:11 +00:00
2009-08-11-RegScavenger-CSR.ll Rebuild RegScavenger::DistanceMap each time it is needed. 2009-08-11 06:25:12 +00:00
add-overflow.ll
add.ll
addsub-i128.ll Fix issue in regscavenger when scavenging a callee-saved register that has not been spilled. 2009-08-02 20:29:41 +00:00
basic-i1.ll
basic-i8.ll
basic-i16.ll
basic-i32.ll
basic-i64.ll
basictest.ll
burg.ll
cmp64.ll
cmp-small-imm.ll Never add a kill flag to a constrained physical register in a two-addr instruction. 2009-08-02 19:13:03 +00:00
ct32.ll
ct64.ll
ctlz16.ll
ctlz64.ll
ctpop16.ll
cttz16.ll
cycles.ll Add support for READCYCLECOUNTER in Blackfin back-end. 2009-08-08 21:42:22 +00:00
dg.exp
double-cast.ll
frameindex.ll
i1mem.ll
i1ops.ll
i8mem.ll
i17mem.ll
i56param.ll
i216mem.ll
i248mem.ll
i256mem.ll
i256param.ll
inline-asm.ll
int-setcc.ll
invalid-apint.ll
jumptable.ll
large-switch.ll
load-i16.ll
logic-i16.ll
many-args.ll
mulhu.ll
printf2.ll Turn some insert_subreg, extract_subreg, subreg_to_reg into implicit_defs. 2009-08-05 03:53:14 +00:00
printf.ll
promote-logic.ll Don't build illegal ops in DAGCombiner::SimplifyBinOpWithSameOpcodeHands(). 2009-08-08 20:42:17 +00:00
promote-setcc.ll Never add a kill flag to a constrained physical register in a two-addr instruction. 2009-08-02 19:13:03 +00:00
sdiv.ll
simple-select.ll
switch2.ll
switch.ll
sync-intr.ll Add some basic blackfin intrinsics. 2009-08-02 18:28:11 +00:00