移动函数体,避免完全克隆

lur*_*her 2 c++ optimization llvm cloning

这是从跟进的问题这一个.

我使用llvm::CloneFunctionInto定义llvm/Transforms/Utils/Cloning.h来生成代码生成后的新函数,并根据返回值的类型推断出正确的签名.这很好用,但速度很慢

我试图通过某种方式优化这一点来将函数体从旧函数移动或转移到新函数,是否有一个实用程序?

我试图通过查看CloneFunctionInto中的代码来破解传输的方法,但是想查看现有函数是否存在

lap*_*rej 5

Arg促销通行证中无耻地窃取(搜索拼接):

// Since we have now created the new function, splice the body of the old
// function right into the new function, leaving the old rotting hulk of the
// function empty.
NF->getBasicBlockList().splice(NF->begin(), F->getBasicBlockList());
Run Code Online (Sandbox Code Playgroud)

NF您正在克隆的新功能在哪里,是您刚刚克隆F的旧功能.