llvm2alive: support parsing unreachable instructions with previously unseen operands
LLVM allows non-reachable instructions to be non-conforming
MODIFY
llvm_util/utils.cpp
llvm_util/utils.cpp
@@ -402,6 +402,15 @@ Value* get_operand(llvm::Value *v,
return constexpr_conv(cexpr);
}
+ // This must be an operand of an unreachable instruction as the operand
+ // hasn't been seen yet
+ if (isa<llvm::Instruction>(v)) {
+ auto val = make_unique<PoisonValue>(*ty);
+ auto ret = val.get();
+ current_fn->addConstant(std::move(val));
+ return ret;
+ }
+
return nullptr;
}

ADD
tests/alive-tv/unreachable-inst.srctgt.ll
+define void @src() {
+ ret void
+
+bogusBB:
+ %inc1 = fadd double %inc, 1.0
+ %inc = fadd double %inc1, 1.0
+ br label %bogusBB
+}
+
+define void @tgt() {
+ ret void
+}

llvm2alive: support parsing unreachable instructions with previously unseen operands
LLVM allows non-reachable instructions to be non-conforming