[LLVMdev] Linearscan allocator bug?

Reid Spencer reid at x10sys.com
Tue Jun 22 10:10:03 PDT 2004


Hi Vladimir.

On Tue, 2004-06-22 at 07:01, Vladimir Prus wrote:
> Folks, 
> I'm running into something which looks like a bug in linearscan allocator. Of 
> course I can't be 100% sure it's not some unobvious mistake on my part, so 
> I'd like to hear your opinion.

Yes, there's a known bug in the linear scan allocator. It causes a few
of the nightly tests to fail.

I'll defer to the experts on your analysis below, but if you're close to
finding this problem, you might want to talk to Alkis who wrote linear
scan (I think).

Reid.

> 
> First, I attach two files -- LLVM asm and the asm for my target. The problem 
> with assembler is: on line 171 it uses register gr2, which is copied from gr6 
> above, on line 161. The only predecessor of this basic block is jump on line 
> 90. The problem is that gr6 is not initialized in the interval from the 
> function entry till the jump.
> 
> I also attach the debug dumps from my backend. 
> 
> The basic block in question is shortcirc_done.1 (line 198 in the log). It 
> starts with:
> 
>     %reg1060 = phi %reg1032, mbb<shortcirc_next.0.selectcont.selectcont,
> 
> The predecessor is at line 155 and the register 1032 is assigned a value on 
> line 140 (in shortcirc_next.0.selectcont): 
> 
>     %reg1032 = move %reg103
> 
> After register allocation the code in shortcirc_done.1 is (line 334):
> 
>     %gr2 = move %gr6
> 
> the predecessor in at line 285 and the code in shortcirc_next.0.selectcont is 	   
> (line 268)
> 
>     %gr4 = move %gr2
> 
> while I'd expect destination register should be gr6.
> 
> In fact, gr6 is first used here (line 289):
> 
>         if <>0 goto %disp(label shortcirc_done.1)
> 	%gr2 = move %gr4
> 	%gr5 = move %gr1
> 	%gr6 = move %gr4
> 	%gr1 = move %gr1
> 
> So, it's possible that jump goes to shortcirc_done.1 which then uses gr6 and 
> gets back results. 
> 
> Any ideas?
> 
> - Volodya
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20040622/7d5e8cd7/attachment.sig>


More information about the llvm-dev mailing list