%1 = tail call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([22 x i8]* @.str, i64 0, i64 0), i32 7) #3
对于上述指令,如何检查调用指令是否包含printf?
答案 0 :(得分:1)
只需比较被调用函数的名称:
bool isPrintfCall(CallInst &C) {
auto *F = C.getCalledFunction();
auto isPrintf = (F->getName() == "printf");
return isPrintf;
}