[PATCH] D133060: [Verifier] Skip debug location check for non-exact functions

Yuanfang Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 15:13:40 PDT 2022


ychen created this revision.
ychen added a reviewer: aprantl.
Herald added a subscriber: hiraditya.
Herald added a project: All.
ychen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Inliner could not inline these functions. Doing this is
instrumentation-friendly otherwise under some condition
this check triggers for un-inlinable callsites.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133060

Files:
  llvm/lib/IR/Verifier.cpp
  llvm/test/Verifier/callsite-dbgloc.ll


Index: llvm/test/Verifier/callsite-dbgloc.ll
===================================================================
--- llvm/test/Verifier/callsite-dbgloc.ll
+++ llvm/test/Verifier/callsite-dbgloc.ll
@@ -19,6 +19,13 @@
   ret void, !dbg !10
 }
 
+; Function Attrs: nounwind ssp uwtable
+define weak void @j() #0 !dbg !17 {
+entry:
+  call void (...) @i(), !dbg !18
+  ret void, !dbg !19
+}
+
 declare void @i(...) #1
 
 ; Function Attrs: nounwind ssp uwtable
@@ -27,6 +34,8 @@
 ; Manually removed !dbg.
 ; CHECK: inlinable function call in a function with debug info must have a !dbg location
   call void @h()
+; CHECK-NOT: inlinable function call in a function with debug info must have a !dbg location
+  call void @j()
   ret void, !dbg !13
 }
 
@@ -62,3 +71,6 @@
 !14 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 4, type: !8, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: false, unit: !0, retainedNodes: !2)
 !15 = !DILocation(line: 4, column: 12, scope: !14)
 !16 = !DILocation(line: 4, column: 17, scope: !14)
+!17 = distinct !DISubprogram(name: "j", scope: !1, file: !1, line: 5, type: !8, isLocal: false, isDefinition: true, scopeLine: 5, isOptimized: false, unit: !0, retainedNodes: !2)
+!18 = !DILocation(line: 4, column: 12, scope: !17)
+!19 = !DILocation(line: 4, column: 17, scope: !17)
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -3445,6 +3445,7 @@
   // debug-info-bearing function has a debug location attached to it. Failure to
   // do so causes assertion failures when the inliner sets up inline scope info.
   if (Call.getFunction()->getSubprogram() && Call.getCalledFunction() &&
+      Call.getCalledFunction()->hasExactDefinition() &&
       Call.getCalledFunction()->getSubprogram())
     CheckDI(Call.getDebugLoc(),
             "inlinable function call in a function with "


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133060.457105.patch
Type: text/x-patch
Size: 1950 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220831/75c2f4e5/attachment.bin>


More information about the llvm-commits mailing list