[LLVMdev] Assertion in PHIElimination.cpp

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Jul 4 11:00:10 PDT 2012


On Jul 4, 2012, at 5:35 AM, Philipp Brüschweiler <blei42 at gmail.com> wrote:

> Hi everyone
> 
> I'm hitting an assertion in PHIElimination.cpp:375.
> 
> "Terminator instructions cannot use virtual registers unless"
> "they are the first terminator in a block!"
> 
> I was looking at the code around that location a bit and have not found
> a reason why this assertion has to hold, except for a comment:
>      // In our final twist, we have to decide which instruction kills the
>      // register.  In most cases this is the copy, however, the first
>      // terminator instruction at the end of the block may also use the value.
>      // In this case, we should mark *it* as being the killing block, not the
>      // copy.
> 
> Again, no reason is given why only the first terminator is allowed to
> use the register.

It seems nobody has needed it before.

commit 2adfa7e9320e79859beb556367ea607a329866b3
Author: Chris Lattner <sabre at nondot.org>
Date:   Tue Jan 3 23:12:21 2006

    Add support for targets (like Alpha) that have terminator instructions which
    use virtual registers.  We now allow the first instruction in a block of
    terminators to use virtual registers, and update phi elimination to correctly
    update livevar when eliminating phi's.  This fixes a problem on a testcase
    Andrew sent me.
    
    
    git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25083 91177308-0d34-0410-b5e6-96231b3b80d8

I don't think it is hard to fix, you simply need to find the last terminator reading SrcReg instead of insisting there can only be one. 

Patches welcome!

/jakob





More information about the llvm-dev mailing list