0
 %1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([22 x i8]* @.str, i64 0, i64 0), i32 7) #3

For the above instruction, how can I check whether the call instruction contains printf ?

Dexter
  • 35
  • 1
  • 7

1 Answers1

1

Just compare the name of the called function:

bool isPrintfCall(CallInst &C) {
   auto *F = C.getCalledFunction();
   auto isPrintf = (F->getName() == "printf");
   return isPrintf;
}
SteffenG
  • 274
  • 2
  • 12
Joky
  • 1,608
  • 11
  • 15