[LLVMdev] Add call printf instructions problems
Tim Northover
t.p.northover at gmail.com
Tue Dec 17 01:56:12 PST 2013
> But I got another problems. I successfully compile the pass and I can insert
> the call printf (C Lib function) instructions in the LLVM IR(eg: call.bc).
> If the call.bc didn't contain call printf instruction ,I can call printf
> successfully ,but if not ,there exists a problem. the llvm will rename my
> inserted call function , and the transformed code can not run correctly!
That looks like the issue Hongxu mentioned: you're always creating a
new Function (at which point LLVM renames it if one already exists)
when you should really be calling GetOrInsertFunction to lookup an
existing "printf" if it's available.
Cheers.
Tim.
More information about the llvm-dev
mailing list