diff --git a/hpvm/lib/Transforms/FuseHPVMTensorNodes/FuseHPVMTensorNodes.cpp b/hpvm/lib/Transforms/FuseHPVMTensorNodes/FuseHPVMTensorNodes.cpp index 616b8a9b572473ed4acb2f2316d88f41a06e434a..ecf6635e479af8eb6583a415a3e4014e98e40ce9 100644 --- a/hpvm/lib/Transforms/FuseHPVMTensorNodes/FuseHPVMTensorNodes.cpp +++ b/hpvm/lib/Transforms/FuseHPVMTensorNodes/FuseHPVMTensorNodes.cpp @@ -652,12 +652,17 @@ void FuseHPVMTensorNodes::updateParentNodeFunction(IntrinsicInst *II1, IItoRemove.clear(); // Then, iterate over uses of the second node's createNode intrinsic - for (Value::user_iterator i = II2->user_begin(), ie = II2->user_end(); - i != ie; ++i) { + // List all the IntrinsicInst users into `IIs` first, because it's unsafe to + // traverse the users while making changes to the users + // (we caught a bug here). + std::vector<IntrinsicInst *> IIs; + for (auto i = II2->user_begin(), ie = II2->user_end(); i != ie; ++i) { Instruction *VI = dyn_cast<Instruction>(*i); IntrinsicInst *II = dyn_cast<IntrinsicInst>(VI); assert(II && "Use of a node handle outside of a hpvm intrinsic\n"); - + IIs.push_back(II); + } + for (auto *II: IIs) { switch (II->getIntrinsicID()) { case Intrinsic::hpvm_createEdge: { assert(isOutgoingEdgeIntrinsic(II, II2) && diff --git a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/debug.cpp b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/debug.cpp index 8e5e1fe9689853ee3ff547b62c5d44660db27b04..2fdeb2f55bcff4895f66fcefee411f1f57cfe4ef 100644 --- a/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/debug.cpp +++ b/hpvm/projects/hpvm-tensor-rt/tensor_runtime/src/debug.cpp @@ -32,8 +32,8 @@ void ERROR(const char *format, ...) { return; va_list args; va_start(args, format); - printf("ERROR!: "); - vprintf(format, args); + fprintf(stderr, "ERROR!: "); + vfprintf(stderr, format, args); va_end(args); abort(); diff --git a/hpvm/projects/predtuner b/hpvm/projects/predtuner index d051790317d29a59ca15541d20c1a61318e56932..e799ec083ee25b6ec6621bfa95f36d77c6be6c8e 160000 --- a/hpvm/projects/predtuner +++ b/hpvm/projects/predtuner @@ -1 +1 @@ -Subproject commit d051790317d29a59ca15541d20c1a61318e56932 +Subproject commit e799ec083ee25b6ec6621bfa95f36d77c6be6c8e