How to change the source of a bitcast operator in a call instruction


I am trying to write a llvm pass to set a call instruction target function to a different target. The call instruction looks like following:

notail call void bitcast (void (i64, i64, i64)* @monitor to void (i64, i8*, i64))(i64 2193551, i8 bitcast (i32 (…)** @qcmp to i8*), i64 %18), !dbg !25563

I want to replace target monitor to a different target monitorA. The callInst->setCalledFunction entirely remove the bitcast operator. The bitcast->setOperand(0, F) throws assert error. What should be the solution?

Note: I am working on clang version 7.0.0