[LLVMbugs] [Bug 22598] New: Passing big array to some function makes compilation very slow
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sun Feb 15 09:59:52 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22598
Bug ID: 22598
Summary: Passing big array to some function makes compilation
very slow
Product: libraries
Version: 3.5
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: lin90162 at gmail.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Hi.
When I was developing my compiler with LLVM, I noticed the case when
compilation didn't finish. I reduced the LLVM IR which my compiler emitted as
below
;;;;;;;;;;;;;;
;; Start ;;
;;;;;;;;;;;;;;
; ModuleID = 'foo.dcs'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-darwin13.4.0"
; Function Attrs: nounwind
define i32 @foo([30000 x i64] %x) #0 {
entry:
ret i32 0
}
; Function Attrs: nounwind
define i32 @main() #0 {
entry:
%0 = alloca [30000 x i64]
%1 = bitcast [30000 x i64]* %0 to i8*
call void @llvm.memset.p0i8.i64(i8* %1, i8 0, i64 240000, i32 8, i1 false)
%2 = load [30000 x i64]* %0
%3 = call i32 @foo([30000 x i64] %2)
ret i32 0
}
; Function Attrs: nounwind
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #0
attributes #0 = { nounwind }
;;;;;;;;;;;;
;; end ;;
;;;;;;;;;;;;
When above code was compiled with llc like below,
$ llc foo.ll
llc took too much time and I ended up with terminating the process. It seemed
that passing [30000 x i64] made compilation very slow because the issue didn't
occur when I removed calling @foo() and definition of @foo(). And it seemed
not to go into infinite loop because compilation finished when I reduced the
size of array (e.g. 30000 -> 3000).
As I described above, this issue occurred on my compiler at first. So I tried
debugging with lldb in my desktop. As the result, it occured in
hasNUsesOfValue() member function of SDNode class which is called by run()
member function of llvm::PassManager. lldb also said that it entered for loop
in hasNUsesOfValue() very often.
https://github.com/llvm-mirror/llvm/blob/release_35/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L6321
At last my environment is below:
- LLVM (http://llvm.org/):
LLVM version 3.5.0
Optimized build with assertions.
Built Sep 6 2014 (01:11:29).
Default target: x86_64-apple-darwin13.4.0
Host CPU: core-avx2
- iMac 2013 mid
And I confirmed that LLC 3.5.1 in Linux occurred the same problem with above
LLVM IR code.
As reference, my compiler is below:
https://github.com/rhysd/Dachs
--
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/20150215/7a3ce034/attachment.html>
More information about the llvm-bugs
mailing list