8

I have created a function in LLVM IR. Now I want to create a return instruction return void.

I saw the function Create ReturnInst::(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd)

But I don't know what should retVal should be so that it returns return void

2 Answers 2

9

If you pass in nullptr to retVal (which is its default value too) that will give you a 'ret void'.

Sign up to request clarification or add additional context in comments.

Comments

1

Seems this code works: UndefValue::get(Type::getVoidTy(Context))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.