This also allows us to peel loops with a select:
for (int i = 0; i <= N; ++i); f3(i == 0 ? a : b); // select instruction
into:
f3(a); // peel one iteration for (int i = 1; i <= N; ++i) f3(b);
Paths
| Differential D151052
[LoopUnroll] Peel iterations based on select conditions ClosedPublic Authored by caojoshua on May 21 2023, 2:32 PM.
Details Summary This also allows us to peel loops with a select: for (int i = 0; i <= N; ++i); f3(i == 0 ? a : b); // select instruction into: f3(a); // peel one iteration for (int i = 1; i <= N; ++i) f3(b);
Diff Detail
Event Timeline
caojoshua retitled this revision from [LoopUnroll] Peel iterations based on select, and, or conditions to [LoopUnroll] Peel iterations based on select conditions. Comment ActionsRestrict patch to only handle selects. Handle and/or in another patch.
caojoshua added inline comments.
Comment Actions LGTM
This revision is now accepted and ready to land.May 24 2023, 12:31 AM This revision was landed with ongoing or failed builds.May 24 2023, 12:58 AM Closed by commit rG849d01bf3d97: [LoopUnroll] Peel iterations based on select conditions (authored by caojoshua). · Explain Why This revision was automatically updated to reflect the committed changes. caojoshua marked an inline comment as done.
Revision Contents
Diff 524133 llvm/lib/Transforms/Utils/LoopPeel.cpp
llvm/test/Transforms/LoopUnroll/peel-loop-conditions.ll
|
Why is this code needed now?