gollvm: sync with trunk at a61fa1a4b9d Update bridge to handle new restrictions on llvm::Constant::deleteValue(). Change-Id: Ifb9dedb951a1c40b165e85337283f52fe265ef2a Reviewed-on: https://go-review.googlesource.com/c/gollvm/+/240684 Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/bridge/go-llvm.cpp b/bridge/go-llvm.cpp index 92c0f54..630a49a 100644 --- a/bridge/go-llvm.cpp +++ b/bridge/go-llvm.cpp
@@ -2752,7 +2752,10 @@ llvm::Constant *newDeclVal = llvm::cast<llvm::Constant>( module_->getOrInsertFunction(fn, declFnTyp).getCallee()); declFnVal->replaceAllUsesWith(newDeclVal); - declFnVal->deleteValue(); + // NB: previously we had a call to declFnVal->deleteValue() here, but this + // appears to no longer be supported, and declFnVal->destroyConstant() + // results in an assert. For now leave the old constant around, just + // remove references to it. for (auto it = fcnDeclMap_.begin(); it != fcnDeclMap_.end(); it++) { if (it->first.second.compare(fns) == 0) { Bfunction *found = it->second;