https://llvm.org/bugs/show_bug.cgi?id=30681

            Bug ID: 30681
           Summary: [crash] add-discriminators pass handles inlined
                    locations incorrectly
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Transformation Utilities
          Assignee: unassignedb...@nondot.org
          Reporter: apra...@apple.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Created attachment 17430
  --> https://llvm.org/bugs/attachment.cgi?id=17430&action=edit
t.ll

In the following example the add-discriminators pass is incorrectly setting the
scope of a non-inlined instruction (br) to the scope of its inlined predecessor
(%call.i).
This causes the LLVM Verifier to fail and assertions to fire.

To reproduce run:
clang-4.0 -cc1 -emit-obj  -disable-llvm-optzns t.ll -o /dev/null -mllvm
-debug-only=add-discriminators
warning: overriding the module target triple with x86_64-apple-darwin16.1.0
t.c:1:27:1  %call.i = tail call i8* @__memset_chk(i8* null, i32 0, i64 0, i64
%0) #2, !dbg !19
t.c:1:9:1  br label %for.cond, !dbg !21, !llvm.loop !22
!dbg attachment points at wrong subprogram for function
!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !8,
isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0,
variables: !2)
i32 ()* @f
  br label %for.cond, !dbg !21, !llvm.loop !22
!21 = !DILocation(line: 1, column: 9, scope: !20)
!20 = !DILexicalBlockFile(scope: !12, file: !1, discriminator: 1)
!12 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 1, type: !8,
isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0,
variables: !2)
!dbg attachment points at wrong subprogram for function
!7 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 1, type: !8,
isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0,
variables: !2)
i32 ()* @f
  br label %for.cond, !dbg !21, !llvm.loop !22
!21 = !DILocation(line: 1, column: 9, scope: !20)
!20 = !DILexicalBlockFile(scope: !12, file: !1, discriminator: 1)
!12 = distinct !DISubprogram(name: "g", scope: !1, file: !1, line: 1, type: !8,
isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: true, unit: !0,
variables: !2)
Assertion failed: (cast<DISubprogram>(Scope)->describes(MF->getFunction())),
function getOrCreateRegularScope, file ../lib/CodeGen/LexicalScopes.cpp, line
159.
Stack dump:
0.    Program arguments:
/Volumes/Fusion/Data/llvm/_build.ninja.release/bin/clang-4.0 -cc1 -emit-obj
-disable-llvm-optzns t.ll -o /dev/null -mllvm -debug-only=add-discriminators 
1.    Code generation
2.    Running pass 'Function Pass Manager' on module 't.ll'.
3.    Running pass 'Live DEBUG_VALUE analysis' on function '@f'
Abort trap: 6

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to