gollvm: sync with trunk at a61fa1a4b9d, part 2 Revise previous change in CL 240684, not all instances of deleteValue() were being handled properly. Change-Id: I5400919ee8b2440e6749f8f712ba7f83eeb89735 Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/241068 Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/bridge/go-llvm.cpp b/bridge/go-llvm.cpp index 630a49a..445259c 100644 --- a/bridge/go-llvm.cpp +++ b/bridge/go-llvm.cpp
@@ -2192,7 +2192,10 @@ llvm::cast<llvm::PointerType>(old->getType())->getElementType(); llvm::Constant *newDecl = module_->getOrInsertGlobal(gname, declTyp); old->replaceAllUsesWith(newDecl); - old->deleteValue(); + // NB: previously we had a call to old->deleteValue() here, but this + // appears to no longer be supported, and old->destroyConstant() + // results in an assert. For now leave the old constant around, just + // remove references to it. Bvariable *declbv = valueVarMap_[old]; declbv->setValue(newDecl); valueVarMap_.erase(old);