LLVM function parameters

Hi,

When using the LLVM IR builder, I have a situation that might have 5
parameters when building the function nodes and instructions.
Later on, I wish to remove one of the parameters so the same function
now has only 4 parameters. For example, the parameter may not actually
be used by any of the instructions in the function.
How do I remove a parameter from the function?
I am hoping that there is a way to do this with the LLVM IR builder,
without having to define the function parameters again, and then add
all the nodes and instructions again.

Can anyone suggest the best way to do this?

Kind Regards

James

There is no way to mutate the type of a function; you have to make a new one. That said, it's not actually that much code; see, for example, DeadArgumentEliminationPass::DeleteDeadVarargs in lib/Transforms/IPO/DeadArgumentElimination.cpp .

-Eli