[llvm] [SandboxIR] Add more Instruction member functions (PR #98588)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 10:52:35 PDT 2024


================
@@ -344,6 +451,33 @@ BasicBlock::iterator::getInstr(llvm::BasicBlock::iterator It) const {
   return cast_or_null<Instruction>(Ctx->getValue(&*It));
 }
 
+std::unique_ptr<Value> Context::detachLLVMValue(llvm::Value *V) {
+  std::unique_ptr<Value> Erased;
+  auto It = LLVMValueToValueMap.find(V);
+  if (It != LLVMValueToValueMap.end()) {
+    auto *Val = It->second.release();
+    Erased = std::unique_ptr<Value>(Val);
+    LLVMValueToValueMap.erase(It);
+  }
+  return Erased;
+}
+
+std::unique_ptr<Value> Context::detach(Value *V) {
+#ifndef NDEBUG
----------------
vporpo wrote:

Done

https://github.com/llvm/llvm-project/pull/98588


More information about the llvm-commits mailing list