[llvm] r295537 - [IR/Verifier] Don't visit DISubprograms more than needed.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 17 19:02:45 PST 2017
Author: davide
Date: Fri Feb 17 21:02:44 2017
New Revision: 295537
URL: http://llvm.org/viewvc/llvm-project?rev=295537&view=rev
Log:
[IR/Verifier] Don't visit DISubprograms more than needed.
Before this patch we happened to visit twice, one when scanning
MDNodes and the other one while visiting the function. Remove
the explicit call to visitDISubprogram there, so we don't emit
the same error twice in case the verifier fail and we save some
time when running it.
Thanks to Justin Bogner for the report and Adrian for the quick
review!
PR: 31995
Added:
llvm/trunk/test/DebugInfo/Generic/invalid.ll
Modified:
llvm/trunk/lib/IR/Verifier.cpp
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=295537&r1=295536&r2=295537&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Fri Feb 17 21:02:44 2017
@@ -2119,8 +2119,6 @@ void Verifier::visitFunction(const Funct
if (!N)
return;
- visitDISubprogram(*N);
-
// Check that all !dbg attachments lead to back to N (or, at least, another
// subprogram that describes the same function).
//
Added: llvm/trunk/test/DebugInfo/Generic/invalid.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/invalid.ll?rev=295537&view=auto
==============================================================================
--- llvm/trunk/test/DebugInfo/Generic/invalid.ll (added)
+++ llvm/trunk/test/DebugInfo/Generic/invalid.ll Fri Feb 17 21:02:44 2017
@@ -0,0 +1,17 @@
+; RUN: not opt -verify %s 2>&1 | FileCheck %s
+
+; Make sure we emit this diagnostic only once (which means we don't visit the
+; same DISubprogram twice.
+; CHECK: subprogram definitions must have a compile unit
+; CHECK-NEXT: !3 = distinct !DISubprogram(name: "patatino", scope: null, isLocal: false, isDefinition: true, isOptimized: false)
+; CHECK-NOT: subprogram definitions must have a compile unit
+; CHECK-NOT: !3 = distinct !DISubprogram(name: "patatino", scope: null, isLocal: false, isDefinition: true, isOptimized: false)
+
+define void @tinkywinky() !dbg !3 { ret void }
+
+!llvm.module.flags = !{!4}
+!llvm.dbg.cu = !{!0}
+!0 = distinct !DICompileUnit(language: 12, file: !1)
+!1 = !DIFile(filename: "/home/davide", directory: "/home/davide")
+!3 = distinct !DISubprogram(name: "patatino", isDefinition: true)
+!4 = !{i32 2, !"Debug Info Version", i32 3}
More information about the llvm-commits
mailing list