1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 04:22:57 +02:00
llvm-mirror/test/Transforms/Inline/debug-invoke.ll
Duncan P. N. Exon Smith 0c1aee0b16 DI: Require subprogram definitions to be distinct
As a follow-up to r246098, require `DISubprogram` definitions
(`isDefinition: true`) to be 'distinct'.  Specifically, add an assembler
check, a verifier check, and bitcode upgrading logic to combat testcase
bitrot after the `DIBuilder` change.

While working on the testcases, I realized that
test/Linker/subprogram-linkonce-weak-odr.ll isn't relevant anymore.  Its
purpose was to check for a corner case in PR22792 where two subprogram
definitions match exactly and share the same metadata node.  The new
verifier check, requiring that subprogram definitions are 'distinct',
precludes that possibility.

I updated almost all the IR with the following script:

    git grep -l -E -e '= !DISubprogram\(.* isDefinition: true' |
    grep -v test/Bitcode |
    xargs sed -i '' -e 's/= \(!DISubprogram(.*, isDefinition: true\)/= distinct \1/'

Likely some variant of would work for out-of-tree testcases.

llvm-svn: 246327
2015-08-28 20:26:49 +00:00

38 lines
1009 B
LLVM

; RUN: opt < %s -always-inline -S | FileCheck %s
; Test that the debug location is preserved when rewriting an inlined call as an invoke
; CHECK: invoke void @test()
; CHECK-NEXT: to label {{.*}} unwind label {{.*}}, !dbg [[INL_LOC:!.*]]
; CHECK: [[SP:.*]] = distinct !DISubprogram(
; CHECK: [[INL_LOC]] = !DILocation(line: 1, scope: [[SP]], inlinedAt: [[INL_AT:.*]])
; CHECK: [[INL_AT]] = distinct !DILocation(line: 2, scope: [[SP]])
declare void @test()
declare i32 @__gxx_personality_v0(...)
attributes #0 = { alwaysinline }
define void @inl() #0 {
call void @test(), !dbg !3
ret void
}
define void @caller() personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
invoke void @inl()
to label %cont unwind label %lpad, !dbg !4
cont:
ret void
lpad:
landingpad { i8*, i32 }
cleanup
ret void
}
!llvm.module.flags = !{!1}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = distinct !DISubprogram()
!3 = !DILocation(line: 1, scope: !2)
!4 = !DILocation(line: 2, scope: !2)