我用最少的指令(通常是 3-5)分割所有基本块:
llvm::SplitBlock(BasicBlock, &*BasicBlockiter, Pass);
并尝试从 IR 获取目标文件
llc -filetype=obj 2.ll
我收到以下错误:
Instruction does not dominate all uses!
%1 = alloca i32
%mul = load i32* %1
Instruction does not dominate all uses!
%1 = alloca i32
%99 = load i32* %1
和
While deleting: i32 %
Use still stuck around after Def is destroyed: %var = alloca i32
Assertion failed: use_empty() && "Uses remain when a value is destroyed!"
和
error: expected instruction opcode
invoke.cont2: ; preds = %main_block, %invoke
.cont
红外:
invoke.cont2: ; preds = %main_block, %invoke.cont
%call4 = invoke i32 @_ZStorSt13_Ios_OpenmodeS_(i32 8, i32 16)
to label %invoke.cont3 unwind label %lpad1
store i32 %call4, i32* %var4
我认为拆分后,指令位于不同的基本块中。如果我将块分成 10-15 条指令,一切都很好。如何预测/检查并避免此错误?