[llvm-dev] Instruction Execution With Hard Limitation at Runtime

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 1 09:27:07 PDT 2019


Hi Duan,

On Mon, 1 Apr 2019 at 16:16, Duan Bing via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> ifElseEnd41:                                      ; preds = %ifElse40, %ifElseEnd56
>   call void @add_gas(i64 2)
>   %380 = phi i32 [ %378, %ifElseEnd56 ], [ %379, %ifElse40 ]
>   br label %ifElseEnd3
>
>
> Use still stuck around after Def is destroyed:  %380 = phi i32 [ %40, %ifThen1 ], [ <badref>, %ifElseEnd41 ], !dbg !27
> Assertion failed: (use_empty() && "Uses remain when a value is destroyed!"), function ~Value, file /Users/duanbing/Project/llvm/llvm/lib/IR/Value.cpp, line 90.
>
> Can you give me some tips about what's happened or how to debug this?

The issue is that phi instructions must always be at the start of
their basic block (see https://llvm.org/docs/LangRef.html#i-phi). You
can use BasicBlock::getFirstNonPHI to get the correct insertion point
for your call.

Cheers.

Tim.


More information about the llvm-dev mailing list