Dear All, I have, in an LLVM bitcode program, the following phi node: %iftmp.225.0 = phi i8* [ getelementptr ([10 x i8]* @.str12597431, i32 0, i32 0), %bb114 ], [ getelementptr ([10 x i8]* @.str1258, i32 0, i32 0), %bb111 ], [ getelementptr ([10 x i8]* @.str1258, i32 0, i32 0), %bb111 ] This phi instruction has two arguments for the same incoming basic block. The only reason why it passes verification right now is because the same constant expression is used for the same basic block. Does anyone know what might be causing this phi to have the same incoming block listed multiple times? Should LLVM consider such a phi valid? -- John T.
On Mar 17, 2009, at 11:37 AMPDT, John Criswell wrote:> Dear All, > > I have, in an LLVM bitcode program, the following phi node: > > %iftmp.225.0 = phi i8* [ getelementptr ([10 x i8]* @.str12597431, > i32 0, > i32 0), %bb114 ], [ getelementptr ([10 x i8]* @.str1258, i32 0, i32 > 0), > %bb111 ], [ getelementptr ([10 x i8]* @.str1258, i32 0, i32 0), > %bb111 ] > > This phi instruction has two arguments for the same incoming basic > block. The only reason why it passes verification right now is > because > the same constant expression is used for the same basic block. > > Does anyone know what might be causing this phi to have the same > incoming block listed multiple times? Should LLVM consider such a phi > valid?I'm pretty sure I've seen this where %bb111 ends in a switch that has two cases that both lead to this phi.
On Tue, Mar 17, 2009 at 2:56 PM, Dale Johannesen <dalej at apple.com> wrote:> > On Mar 17, 2009, at 11:37 AMPDT, John Criswell wrote: > >> Dear All, >> >> I have, in an LLVM bitcode program, the following phi node: >> >> %iftmp.225.0 = phi i8* [ getelementptr ([10 x i8]* @.str12597431, >> i32 0, >> i32 0), %bb114 ], [ getelementptr ([10 x i8]* @.str1258, i32 0, i32 >> 0), >> %bb111 ], [ getelementptr ([10 x i8]* @.str1258, i32 0, i32 0), >> %bb111 ] >> >> This phi instruction has two arguments for the same incoming basic >> block. The only reason why it passes verification right now is >> because >> the same constant expression is used for the same basic block. >> >> Does anyone know what might be causing this phi to have the same >> incoming block listed multiple times? Should LLVM consider such a phi >> valid? > > I'm pretty sure I've seen this where %bb111 ends in a switch that has > two cases that both lead to this phi. >Does such a block have two outgoing edges? IE if i walk the predecessors of the successor, do i hit the same block twice? If so, then PHI's with two arguments from the same block would be legal. --Dan
Maybe Matching Threads
- [LLVMdev] PHIs with Same Basic Block Listed Twice
- Moving instructions from source Basic Block to dest Basic Block
- [LLVMdev] How to identify LLVM version?
- [LLVMdev] Confusion with a Use of a getelementptr instruction being a Use of a select instruction instead
- simplify CFG Pass in llvm