[LLVMdev] Removing function params.

James Courtier-Dutton james.dutton at gmail.com
Tue Oct 22 08:17:36 PDT 2013


Hi,

I am writing my own passes in LLVM.
I start with a function with various uses of a LLVM IR function
parameter: e.g. paramB.

After running one of my passes, all the uses of the paramB vanish.
How do I do the last step, and remove the paramB from the function
parameters in the LLVM IR?

I want to go from:
function test( int paramA, int paramB)
{ ... }

to:
function test( int paramA)
{ ... }

Is there an LLVM IR API method that does this, or do I have to create
a whole new function and add all the basic blocks and instructions
from the old one to it?

Also, how do I do the opposite:
I want to go from:
function test( int paramA)
{ ... }

to:
function test( int paramA, int paramB)
{ ... }


Kind Regards

James.



More information about the llvm-dev mailing list