[llvm] r283374 - Improve the debug-info test created in r274263.

Yunzhong Gao via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 5 13:26:29 PDT 2016


Author: ygao
Date: Wed Oct  5 15:26:29 2016
New Revision: 283374

URL: http://llvm.org/viewvc/llvm-project?rev=283374&view=rev
Log:
Improve the debug-info test created in r274263.

This patch is related to r274263 or Phabricator/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.

Differential Revision: https://reviews.llvm.org/D25290


Modified:
    llvm/trunk/test/CodeGen/X86/stack-protector.ll

Modified: llvm/trunk/test/CodeGen/X86/stack-protector.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/stack-protector.ll?rev=283374&r1=283373&r2=283374&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/stack-protector.ll (original)
+++ llvm/trunk/test/CodeGen/X86/stack-protector.ll Wed Oct  5 15:26:29 2016
@@ -3887,6 +3887,22 @@ entry:
 
 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
+
+; LINUX-X64-LABEL: test32:
+; LINUX-X64:       .loc 1 0 0 prologue_end
+; LINUX-X64-NEXT:  callq __stack_chk_fail
+
+; LINUX-KERNEL-X64-LABEL: test32:
+; LINUX-KERNEL-X64:       .loc 1 0 0 prologue_end
+; LINUX-KERNEL-X64-NEXT:  callq __stack_chk_fail
+
+; OPENBSD-AMD64-LABEL: test32:
+; OPENBSD-AMD64:       .loc 1 0 0 prologue_end
+; OPENBSD-AMD64-NEXT:  movl
+; OPENBSD-AMD64-NEXT:  callq __stack_smash_handler
   %0 = alloca [5 x i8], align 1
   ret void
 }
@@ -3915,11 +3931,12 @@ attributes #5 = { ssp "stack-protector-b
 !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)




More information about the llvm-commits mailing list