[PATCH] D25290: Improve the debug-info test created in r274263

Yunzhong Gao via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 11:54:05 PDT 2016


ygao created this revision.
ygao added a reviewer: dblaikie.
ygao added subscribers: aprantl, llvm-commits.

Hi,
This patch is related to r274263 or Phabricator/https://reviews.llvm.org/D21818.
This patch aims to improve the test case added in the previous commit to verify
specifically that the stack protector pass is adding the debug line info as
intended. Before, the test only verified that the verifier pass does not crash.
The current approach is to generate the assembly output and then look for the
.loc directive.

To recapture from the mailing list, I also attempted to use llc's -start-after
and -stop-after options to run and check a single pass, but it would involve
the MIR format which seems not ready for common use yet.

Please review whether this test seems reasonable,

- Gao


https://reviews.llvm.org/D25290

Files:
  test/CodeGen/X86/stack-protector.ll


Index: test/CodeGen/X86/stack-protector.ll
===================================================================
--- test/CodeGen/X86/stack-protector.ll
+++ test/CodeGen/X86/stack-protector.ll
@@ -3887,6 +3887,9 @@
 
 define void @test32() #1 !dbg !7 {
 entry:
+; LINUX-I386-LABEL: test32:
+; LINUX-I386:       .loc 1 0 0 prologue_end
+; LINUX-I386-NEXT:  calll __stack_chk_fail
   %0 = alloca [5 x i8], align 1
   ret void
 }
@@ -3915,11 +3918,12 @@
 !llvm.module.flags = !{!3, !4}
 !llvm.ident = !{!5}
 
-!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1)
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug)
 !1 = !DIFile(filename: "test.c", directory: "/tmp")
 !2 = !{}
 !3 = !{i32 2, !"Dwarf Version", i32 4}
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{!"clang version x.y.z"}
-!6 = distinct !DISubprogram(name: "__stack_chk_fail", scope: !1, unit: !0)
-!7 = distinct !DISubprogram(name: "foo", scope: !1, unit: !0)
+!6 = distinct !DISubprogram(name: "__stack_chk_fail", scope: !1, type: !8, unit: !0)
+!7 = distinct !DISubprogram(name: "test32", scope: !1, type: !8, unit: !0)
+!8 = !DISubroutineType(types: !2)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25290.73679.patch
Type: text/x-patch
Size: 1171 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161005/32a2115a/attachment.bin>


More information about the llvm-commits mailing list