<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div style="margin: 0;">Hi,</div><div style="margin: 0;"><br></div><div style="margin: 0;">besides unroll, I wonder how clang controls inliner. The inliner computes the Cost and Threshold and makes decision whether to inline.</div><div style="margin: 0;">I modified the OptimizeSize into 100 in CodeGenOptions.def:</div><div style="margin: 0;">-----------------------------------------------------------------------------------------</div><div style="margin: 0;">VALUE_CODEGENOPT(OptimizeSize, 2, 100) ///< If -Os (==1) or -Oz (==2) is specified.<br></div><div style="margin: 0;">-----------------------------------------------------------------------------------------</div><div style="margin: 0;">the original value is 0. But I found that it doesn't affect the threshold. And even the value of CodeGenOpts.OptimizeSize (BackendUtil.cpp:575) is 0.</div><div style="margin: 0;">How could I control the initial value of threshold of inliner ? And how could I control the value of CodeGenOpts.OptimizeSize . </div><div style="margin: 0;">Is it possible to control the initial threshold value by passing arguments or options to clang?</div><div style="margin: 0;"><br></div><div style="margin: 0;">Thanks!</div><div style="margin: 0;">Jerry</div><div style="margin: 0;"><br></div><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><p style="margin: 0;"><br></p><div style="position:relative;zoom:1"></div><div id="divNeteaseMailCard"></div><p style="margin: 0;"><br></p><pre><br>At 2020-03-28 17:39:50, "Michael Kruse" <cfe-dev@meinersbur.de> wrote:
>Am Do., 26. März 2020 um 21:44 Uhr schrieb 林政宗 via cfe-dev
><cfe-dev@lists.llvm.org>:
>> Thanks, I think the option in PassManagerBuilder.cpp controls the loop-unroll pass in llvm. Is there a loop-unroll pass or loop-unroll function in clang that will unroll loops in frontend and the generated llvm IR by clang is the unrolled version? and if there is one, how does clang control it? Thanks in advance. Best regards, Jerry
>
>There is no such "pre-unrolling" in clang. That would be redundant.
>
>clang's -funroll-loops -fno-unroll-loops is translated to the value of
>PassManagerBuilder::DisableUnrollLoops
>
>Loop hints such as `#pragma unroll` is translated to metadata:
>https://llvm.org/docs/LangRef.html#llvm-loop-unroll
>
>Michael
</pre></div><br><br><span title="neteasefooter"><p> </p></span>