在销毁Def后仍然使用:

时间:2014-11-14 16:37:07

标签: llvm

为什么会出错

While deleting: i32 %
Use still stuck around after Def is destroyed:  %in = alloca [3000 x i32], align 4
opt: Value.cpp:79: virtual llvm::Value::~Value(): Assertion `use_empty() && "Uses remain 
when a value is destroyed!"' failed.

当我运行包含这些行的LLVM Pass时 。 。

Type *t3=dyn_cast<Type>(ArrayType::get(Type::getInt32Ty(context),50));
AllocaInst *al2=new AllocaInst(t3,"ar",ins1);

。 。 。 我在这里尝试分配一个新数组。

1 个答案:

答案 0 :(得分:1)

我认为你的传递不只是发出一个alloca?上面的错误行有一个3000元素数组,而下面的代码片段生成一个50元素。

您是否正在对上面的alloca指令执行eraseFromParent()?指令在被销毁时不能有任何用途;你可能想看一下replaceAllUsesWith(),虽然如果没有关于你的传球正在做什么的更多信息我就不能说更多。