[llvm-bugs] [Bug 34293] New: Optimizer fails to unroll the Coroutine-Loop.
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 22 18:04:21 PDT 2017
https://bugs.llvm.org/show_bug.cgi?id=34293
Bug ID: 34293
Summary: Optimizer fails to unroll the Coroutine-Loop.
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Loop Optimizer
Assignee: unassignedbugs at nondot.org
Reporter: peetlugen19 at yandex.com
CC: llvm-bugs at lists.llvm.org
Created attachment 19033
--> https://bugs.llvm.org/attachment.cgi?id=19033&action=edit
testcase
Test case: https://godbolt.org/g/esjnb2
I've also attached the test-case as an attachment.
LLVM-IR:
define void @printEquivalent()() local_unnamed_addr #0 !dbg !684 {
%1 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8],
[3 x i8]* @.str, i64 0, i64 0), i32 1), !dbg !685
%2 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8],
[3 x i8]* @.str, i64 0, i64 0), i32 3), !dbg !686
ret void, !dbg !687
}
declare i32 @printf(i8* nocapture readonly, ...) local_unnamed_addr #1
define i32 @main() local_unnamed_addr #2 personality i8* bitcast (i32 (...)*
@__gxx_personality_v0 to i8*) !dbg !688 {
br label %1, !dbg !693
; <label>:1: ; preds = %0, %5
%2 = phi i2 [ 0, %0 ], [ %7, %5 ]
switch i2 %2, label %4 [
i2 0, label %5
i2 1, label %3
i2 -2, label %9
]
; <label>:3: ; preds = %1
br label %5, !dbg !826
; <label>:4: ; preds = %1
unreachable, !dbg !824
; <label>:5: ; preds = %1, %3
%6 = phi i32 [ 3, %3 ], [ 1, %1 ]
%7 = phi i2 [ -2, %3 ], [ 1, %1 ]
%8 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8],
[3 x i8]* @.str, i64 0, i64 0), i32 %6), !dbg !828
br label %1, !dbg !693, !llvm.loop !830
; <label>:9: ; preds = %1
ret i32 0, !dbg !832
}
Issue:
The optimizer could have optimized the couroutine into something more like the
two sequential calls to printf. Instead, it isn't able to unroll the
"couroutine-loop".
--
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/20170823/63389475/attachment.html>
More information about the llvm-bugs
mailing list