[llvm-dev] [cfe-dev] Why Clang is yielding different LLVM IR return type forthe same function

Friedman, Eli via llvm-dev llvm-dev at lists.llvm.org
Tue Jul 3 10:23:36 PDT 2018


On 7/2/2018 10:29 PM, Zhang via llvm-dev wrote:
> Hi John.
> Thanks for the info. Currently I'm marking fooo() by hand by adding 
> the always_inline attribute then run the always inline pass using the 
> following code:
>
> ```
> AnalysisManager<Module> AM;
> AlwaysInlinerPass* 
> InlinerPass=cast<AlwaysInlinerPass>(createAlwaysInlinerLegacyPass());
> InlinerPass->run(M,AM);
> delete InlinerPass;
> ```
> However the CallSites are not inlined.
> Reading lib/Transforms/IPO/AlwaysInliner.cpp , it says 
> ``if (CS.getCalledFunction() == &F)`` , since after linking the 
> CallSites become indirect calls with Bitcast ConstantExpr as target I 
> think that's why the inliner has no effect.
> Any hints?

Run instcombine first.

-Eli

-- 
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180703/be7a373d/attachment.html>


More information about the llvm-dev mailing list