[cfe-dev] how does clang control whether the unroll-loop pass work or not by default?

Michael Kruse via cfe-dev cfe-dev at lists.llvm.org
Sat Mar 28 02:39:50 PDT 2020


Am Do., 26. März 2020 um 21:44 Uhr schrieb 林政宗 via cfe-dev
<cfe-dev at 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


More information about the cfe-dev mailing list