From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8491D3858405; Fri, 29 Apr 2022 16:55:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8491D3858405 From: "msebor at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/29104] New: GDB very slow running LLVM opt Date: Fri, 29 Apr 2022 16:55:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 11.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gdb-prs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-prs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Apr 2022 16:55:11 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29104 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 li= nked with, and how long it takes to run it on its own to compile a simple progra= m (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 =3D call i64 @strlen(i8* %s) ret i64 %n } ; ModuleID =3D 'x.ll' source_filename =3D "x.ll" declare i64 @strlen(i8*) define i64 @f(i8* %s) { %n =3D 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 =3D 'x.ll' source_filename =3D "x.ll" declare i64 @strlen(i8*) define i64 @f(i8* %s) { %n =3D call i64 @strlen(i8* noundef nonnull dereferenceable(1) %s) ret i64 %n } Process 12635 exited with status =3D 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 =3D 'x.ll' source_filename =3D "x.ll" declare i64 @strlen(i8*) define i64 @f(i8* %s) { %n =3D 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 --=20 You are receiving this mail because: You are on the CC list for the bug.=