[llvm] [SandboxIR] Implement ReturnInst (PR #99784)
Sriraman Tallam via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 22 13:13:58 PDT 2024
================
@@ -540,6 +540,48 @@ void StoreInst::dump() const {
dump(dbgs());
dbgs() << "\n";
}
+#endif // NDEBUG
+
+Value *ReturnInst::create(Value *RetVal, Instruction *InsertBefore,
+ Context &Ctx) {
+ llvm::Instruction *BeforeIR = InsertBefore->getTopmostLLVMInstruction();
+ auto &Builder = Ctx.getLLVMIRBuilder();
+ Builder.SetInsertPoint(BeforeIR);
+ llvm::ReturnInst *NewRI;
+ if (RetVal != nullptr)
+ NewRI = Builder.CreateRet(RetVal->Val);
+ else
+ NewRI = Builder.CreateRetVoid();
+ return Ctx.createReturnInst(NewRI);
+}
+
+Value *ReturnInst::create(Value *RetVal, BasicBlock *InsertAtEnd,
----------------
tmsri wrote:
Same comment here, return type should be ReturnInst *
https://github.com/llvm/llvm-project/pull/99784
More information about the llvm-commits
mailing list