Return Void from function LLVM
Asked Answered
V

2

7

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

Veto answered 15/11, 2014 at 17:43 Comment(0)
S
9

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

Subcartilaginous answered 16/11, 2014 at 2:11 Comment(0)
H
1

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

Hyperbolic answered 14/8, 2019 at 18:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.