[LLVMbugs] [Bug 23743] New: Sibling loops confuse spill placement
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jun 3 04:51:33 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23743
Bug ID: 23743
Summary: Sibling loops confuse spill placement
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Register Allocator
Assignee: unassignedbugs at nondot.org
Reporter: james.molloy at arm.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 14426
--> https://llvm.org/bugs/attachment.cgi?id=14426&action=edit
Testcase
In the attached testcase there is one loop with two child loops. The two child
loops are siblings to each other.
A reloaded is inserted in the second sibling loop, instead of a different
register being spilled outside the second loop.
The register being spilled is %vreg7:
selectOrSplit rGPR:%vreg45 [576r,656B:0)[656B,976r:1)[976r,1104B:2) 0 at 576r
1 at 656B-phi 2 at 976r w=2.185477e+05
%R10 is available at cost 1
Only trying the first 10 regs.
should evict: %vreg23 [160r,1184B:0) 0 at 160r w= 4.682460e+04
should evict: %vreg1 [80r,1184B:0) 0 at 80r w= 2.164171e+04
should evict: %vreg8 [560r,1104B:0) 0 at 560r w= 2.003648e+04
should evict: %vreg7 [496r,1104B:0) 0 at 496r w= 1.771947e+04
evicting %R6 interference: Cascade 4
unassigning %vreg7 from %R6: R6
assigning %vreg45 to %R6: R6 [576r,656B:0)[656B,976r:1)[976r,1104B:2) 0 at 576r
1 at 656B-phi 2 at 976r
queuing new interval: %vreg7 [496r,1104B:0) 0 at 496r
%vreg7 has the lowest spill cost because it is within an if/else inside the
second loop. However, spilling %vreg23 or %vreg1 would not be as costly as
%vreg7 because both of those registers are live-through the second loop (they
are only used in the first loop).
It appears the spill placement algorithm is aware of loop nest depth (implied
by block frequency) but unaware of loop hierarchy.
Compile with: llc -O3 test.ll and note:
.LBB0_5: @ %bb21
@ Parent Loop BB0_2 Depth=1
@ => This Inner Loop Header: Depth=2
sub.w r8, r7, #2
cmp r8, r4
bhi .LBB0_7
@ BB#6: @ %bb27
@ in Loop: Header=BB0_5 Depth=2
ldrb.w r5, [r9, r7]
lsl.w r2, lr, r11
eors r2, r5
ldr r5, [sp, #8] @ 4-byte Reload ***NAUGHTY***
and.w lr, r2, r5
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150603/3e507793/attachment.html>
More information about the llvm-bugs
mailing list