[#llvm-LoopRotation] = xref:llvm.adoc[llvm]::LoopRotation :relfileprefix: ../ :mrdocs: Convert a loop into a loop with bottom test. == Synopsis Declared in `<llvm/Transforms/Utils/LoopRotationUtils.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- bool LoopRotation( xref:llvm/Loop.adoc[Loop]* L, xref:llvm/LoopInfo.adoc[LoopInfo]* LI, xref:llvm/TargetTransformInfo.adoc[TargetTransformInfo] const* TTI, xref:llvm/AssumptionCache.adoc[AssumptionCache]* AC, xref:llvm/DominatorTree.adoc[DominatorTree]* DT, xref:llvm/ScalarEvolution.adoc[ScalarEvolution]* SE, xref:llvm/MemorySSAUpdater.adoc[MemorySSAUpdater]* MSSAU, xref:llvm/SimplifyQuery.adoc[SimplifyQuery] const& SQ, bool RotationOnly, unsigned int Threshold, bool IsUtilMode, bool PrepareForLTO = false, bool CheckExitCount = false); ---- == Description It may perform loop latch simplification as well if the flag RotationOnly is false. The flag Threshold represents the size threshold of the loop header. If the loop header's size exceeds the threshold, the loop rotation will give up. The flag IsUtilMode controls the heuristic used in the LoopRotation. If it is true, the profitability heuristic will be ignored. == Return Value True if the loop was modified. == Parameters [cols="1,4"] |=== | Name| Description | *L* | Loop to rotate. | *LI* | LoopInfo to keep consistent with the transformed CFG. | *TTI* | Target transform info used for header size metrics. | *AC* | Assumption cache used when collecting ephemeral values. | *DT* | Dominator tree to update. | *SE* | ScalarEvolution analysis to invalidate and optionally consult. | *MSSAU* | MemorySSA updater, or nullptr. | *SQ* | Simplify query used during latch simplification. | *RotationOnly* | If true, only rotate; if false, also simplify the latch. | *Threshold* | Maximum allowed size of the loop header; rotation is skipped when the header exceeds this threshold. | *IsUtilMode* | If true, ignore the profitability heuristic. | *PrepareForLTO* | If true, avoid rotating loops with inlining candidates that may be handled during LTO. | *CheckExitCount* | If true, consider ScalarEvolution exit‐count info when deciding whether rotating an already‐exiting latch is profitable. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#