Instruction does not dominate all uses! 解决

发布时间 2023-05-06 10:55:07作者: 园友1683564

报错现场:

Instruction does not dominate all uses!

%59 = mul i32 %58, %val
%56 = zext i32 %59 to i64
LLVM ERROR: Broken function found, compilation aborted!

 

原因:指令的插入点不对。被插入的指令需要的操作数,在插入点之后才产生。无米之炊

 

解决:

如果是使用 insertBefore insertAfter,那么:

NewInst->insertBefore(***);    改变 *** 这种插入点

如果使用了IRBuilder,

IRBuilder<>  Builder(****);     改变 **** 这个插入点