[llvm] [SandboxIR] Implement ReturnInst (PR #99784)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 22 14:14:35 PDT 2024


================
@@ -668,6 +710,11 @@ Value *Context::getOrCreateValueInternal(llvm::Value *LLVMV, llvm::User *U) {
     It->second = std::unique_ptr<StoreInst>(new StoreInst(LLVMSt, *this));
     return It->second.get();
   }
+  case llvm::Instruction::Ret: {
+    auto *LLVMRet = cast<llvm::ReturnInst>(LLVMV);
+    It->second = std::unique_ptr<ReturnInst>(new ReturnInst(LLVMRet, *this));
+    return It->second.get();
+  }
   default:
----------------
vporpo wrote:

That would be really nice, but I am not sure it can be done without a template. Because we need a cast: `auto *LLVMI = cast<LLVMT>(LLVM)` and a new: `new SBT(LLVMI, *this)`, where both `LLVMT` and `SBT` are types. I don't think I can get these types some other way using decltype.

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


More information about the llvm-commits mailing list