how to stop intrinsic being deleted

Hi,

So, I have inserted some calls to my intrinsic functions in a pass but there
are being removed. The purpose of the intrinsics are to increment a specific
register, the intrinsic call is lowered to a node that i have defined with
SDNPSideEffect and the instruction also is defined as 'hasSideEffects = 1'.
I have defined the instruction to return a i32 but take no arguments. Is
there any way to stop my instruction being deleted or do I need to define my
intrinsic as taking a register as an argument? And if this is the case, how
do I define a target specific register as an argument to the call?

Thanks,

Sam

Hi Sam,

So, I have inserted some calls to my intrinsic functions in a pass but there
are being removed.

is it being deleted by the IR level optimizers or during code generation?
Are you inserting it at IR level or during code generation?

Ciao, Duncan.

  The purpose of the intrinsics are to increment a specific

Hi Duncan,

I'm inserting it at the IR level. I know it gets to my ISelLowering class because I've had to modify my INTRINSIC_W_CHAIN function to fix crashes as well as handling the chain value so that the instruction can be selected.

Cheers,
Sam