<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - opt cannot terminate with "opt -loop-rotate -loop-extract""
href="https://bugs.llvm.org/show_bug.cgi?id=40950">40950</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>opt cannot terminate with "opt -loop-rotate -loop-extract"
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Scalar Optimizations
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>cszide@163.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21559" name="attach_21559" title=".bc file of the source code">attachment 21559</a> <a href="attachment.cgi?id=21559&action=edit" title=".bc file of the source code">[details]</a></span>
.bc file of the source code
For this test case, opt cannot terminate. I have tested it using godbolt, and
the opt 6/7/truck versions all have this problem. The outputs of opt 6/7/truck
are as follows.
opt truck:
compiler-explorer/c-preload/compiler-wrapper: line 21: 27482 Killed
"$@"
Compiler returned: 137
opt 7:
compiler-explorer/c-preload/compiler-wrapper: line 21: 32256 Killed
"$@"
Compiler returned: 137
opt 6:
LLVM ERROR: out of memory
/compiler-explorer/c-preload/compiler-wrapper: line 21: 30493 Killed
"$@"
Compiler returned: 137
The followings are my test environment and test steps.
$clang -v
clang version 9.0.0 (trunk 355281)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$clang -O3 -c -emit-llvm -mllvm -disable-llvm-optzns small.c -o small.bc
$opt -loop-rotate -loop-extract -o small-opt.bc
In this step, opt will consume all RAM for a computer with 16GB RAM and not
terminate.
The followings are the source code of small.c and IR
int a;
c(d) {
for (; a;)
if (d)
break;
}
------------------------------
; ModuleID = 'small.bc'
source_filename = "small.c"
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@a = common dso_local global i32 0, align 4
; Function Attrs: nounwind uwtable
define dso_local i32 @c(i32) #0 {
%2 = alloca i32, align 4
%3 = alloca i32, align 4
store i32 %0, i32* %3, align 4, !tbaa !2
br label %4
; <label>:4: ; preds = %11, %1
%5 = load i32, i32* @a, align 4, !tbaa !2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
; <label>:7: ; preds = %4
%8 = load i32, i32* %3, align 4, !tbaa !2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
; <label>:10: ; preds = %7
br label %12
; <label>:11: ; preds = %7
br label %4
; <label>:12: ; preds = %10, %4
%13 = load i32, i32* %2, align 4
ret i32 %13
}
attributes #0 = { nounwind uwtable
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false"
"less-precise-fpmad"="false" "min-legal-vector-width"="0"
"no-frame-pointer-elim"="false" "no-infs-fp-math"="false"
"no-jump-tables"="false" "no-nans-fp-math"="false"
"no-signed-zeros-fp-math"="false" "no-trapping-math"="false"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false"
"use-soft-float"="false" }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"clang version 9.0.0 (trunk 355281)"}
!2 = !{!3, !3, i64 0}
!3 = !{!"int", !4, i64 0}
!4 = !{!"omnipotent char", !5, i64 0}
!5 = !{!"Simple C/C++ TBAA"}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>