public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29104] New: GDB very slow running LLVM opt
@ 2022-04-29 16:55 msebor at gmail dot com
  2022-04-29 18:01 ` [Bug gdb/29104] " tromey at sourceware dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: msebor at gmail dot com @ 2022-04-29 16:55 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=29104

            Bug ID: 29104
           Summary: GDB very slow running LLVM opt
           Product: gdb
           Version: 11.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: msebor at gmail dot com
  Target Milestone: ---

GDB takes an inordinate amount of time to start the LLVM opt program (the
optimizer process), making it exceedingly tedious to debug.

The test case below shows the size of the executable, the libraries it's linked
with, and how long it takes to run it on its own to compile a simple program (0
seconds), how long it takes to run it in LLDB (5 seconds), and how long in GDB
(26 seconds).

Importantly, while LLDB takes 5 seconds to start up and load the program and
then no time at all to run it each time, in GDB each invocation of the run
command takes the same excessive amount of time (i.e., 25 seconds on my
machine).  That makes GDB essentially unusable to debug LLVM.

I'm using GNU gdb (GDB) Fedora 11.1-5.fc35.

$ cat x.ll && time /build/llvm-gcc/bin/opt -S -instcombine x.ll && time lldb
-batch /build/llvm-gcc/bin/opt -o run -- -S -instcombine x.ll && time gdb
--batch -nx -ex "r -S -instcombine x.ll" /build/llvm-gcc/bin/opt
declare i64 @strlen(i8*)

define i64 @f(i8* %s) {
  %n = call i64 @strlen(i8* %s)
  ret i64 %n
}
; ModuleID = 'x.ll'
source_filename = "x.ll"

declare i64 @strlen(i8*)

define i64 @f(i8* %s) {
  %n = call i64 @strlen(i8* noundef nonnull dereferenceable(1) %s)
  ret i64 %n
}

real    0m0.022s
user    0m0.016s
sys     0m0.006s
(lldb) target create "/build/llvm-gcc/bin/opt"
Current executable set to '/build/llvm-gcc/bin/opt' (x86_64).
(lldb) settings set -- target.run-args  "-S" "-instcombine" "x.ll"
(lldb) run
; ModuleID = 'x.ll'
source_filename = "x.ll"

declare i64 @strlen(i8*)

define i64 @f(i8* %s) {
  %n = call i64 @strlen(i8* noundef nonnull dereferenceable(1) %s)
  ret i64 %n
}
Process 12635 exited with status = 0 (0x00000000)
Process 12635 launched: '/build/llvm-gcc/bin/opt' (x86_64)

real    0m5.394s
user    0m30.647s
sys     0m1.196s
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
; ModuleID = 'x.ll'
source_filename = "x.ll"

declare i64 @strlen(i8*)

define i64 @f(i8* %s) {
  %n = call i64 @strlen(i8* noundef nonnull dereferenceable(1) %s)
  ret i64 %n
}
[Inferior 1 (process 12720) exited normally]

real    0m25.887s
user    0m28.233s
sys     0m0.446s

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-05-09 17:31 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-29 16:55 [Bug gdb/29104] New: GDB very slow running LLVM opt msebor at gmail dot com
2022-04-29 18:01 ` [Bug gdb/29104] " tromey at sourceware dot org
2022-04-29 18:16 ` msebor at gmail dot com
2022-04-29 19:07 ` tromey at sourceware dot org
2022-04-29 19:21 ` msebor at gmail dot com
2022-04-29 19:27 ` msebor at gmail dot com
2022-04-29 20:08 ` tromey at sourceware dot org
2022-04-29 22:38 ` msebor at gmail dot com
2022-05-09 17:31 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).