[llvm-bugs] [Bug 45255] New: Loop with early continue does not produce same IR as loop without
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Mar 19 15:16:18 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45255
Bug ID: 45255
Summary: Loop with early continue does not produce same IR as
loop without
Product: libraries
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: Matthew.Arsenault at amd.com
CC: llvm-bugs at lists.llvm.org
Created attachment 23260
--> https://bugs.llvm.org/attachment.cgi?id=23260&action=edit
Testcase with early continue
This testcase has two versions of a program with a slightly different loop
structure.
The first testcase (extract.while.ll) looks like this:
while (I < N) {
if (foo()) {
++I;
continue;
}
bar();
++I;
}
The second version (extract.while.no.continue.ll looks like this:
while (I < N) {
if (!foo()) {
bar();
}
++I;
}
I would expect these to optimize to the same IR, but they do not. The form with
the continue ends up codegenning to something worse, and ends up about 50%
slower on AMDGPU.
Note the attached IR has already gone through the optimizer once, and the
second form was rotated and has the preheader. I've been operating under the
assumption I should be able to just run -loop-rotate on the first form to get
equivalent IR as the second form.
The relevant part of the testcase is while.body.i/if.then320.i. if.then320.i is
the continue block in the first version.
I'm able to get opt -loop-rotate to rotate this loop by increasing
-rotation-max-header-size to at least 18, and hacking
profitableToRotateLoopExitingLatch to always return true
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200319/aaa8fa37/attachment.html>
More information about the llvm-bugs
mailing list