[LLVMdev] Mandatory duplicated incoming nodes on phis

Gary Benson gbenson at redhat.com
Wed Aug 27 03:37:45 PDT 2008


Hi,

I noticed that if you create a switch with multiple cases going to
the same destination, then if that destination contains phis you
need to add the incoming value an equivalent number of times.  The
attached code seems wrong, but it compiles as correct, and removing
the duplicated incoming node causes an error.  Is this expected?

Cheers,
Gary

--
http://gbenson.net/
-------------- next part --------------
define internal i32 @func419(i32* %foo_addr, i32* %bar_addr, i32 %baz) {
       %method = load i32* %foo_addr
       br label %not_zero

not_zero:
        switch i32 %baz, label %no_exception9 [
                 i32 6, label %bci_56
                 i32 7, label %bci_56
        ]

no_exception9:
        %bar = load i32* %bar_addr
        br label %bci_56

bci_56:
	%method1 = phi i32 [ %method, %not_zero ], [ %method, %not_zero ], [ %bar, %no_exception9 ]
        ret i32 %method1
}


More information about the llvm-dev mailing list