[llvm-bugs] [Bug 26786] New: [globalopt] Crash after dropping user that still has debug value

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 1 04:19:41 PST 2016


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

            Bug ID: 26786
           Summary: [globalopt] Crash after dropping user that still has
                    debug value
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: mattias.v.eriksson at ericsson.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15965
  --> https://llvm.org/bugs/attachment.cgi?id=15965&action=edit
Reduced input file with crash in globalopt

With the attached file running:

opt -globalopt -o /dev/null bugpoint-reduced-simplified.ll

crashes like this:
opt: ../include/llvm/Support/Casting.h:81: static bool
llvm::isa_impl_cl<llvm::BasicBlock, llvm::Value *>::doit(const From *) [To =
llvm::BasicBlock, From = llvm::Value *]: Assertion `Val && "isa<> used on a
null pointer"' failed.
0  opt             0x00000000023c542e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46
1  opt             0x00000000023c5839
2  opt             0x00000000023c4143 llvm::sys::RunSignalHandlers() + 131
3  opt             0x00000000023c5c7f
4  libpthread.so.0 0x00007f88d8f5e340
5  libc.so.6       0x00007f88d8186cc9 gsignal + 57
6  libc.so.6       0x00007f88d818a0d8 abort + 328
7  libc.so.6       0x00007f88d817fb86
8  libc.so.6       0x00007f88d817fc32
9  opt             0x0000000000ea11ae
10 opt             0x0000000000ea1158
11 opt             0x0000000000ea1132
12 opt             0x0000000000ea10d5
13 opt             0x0000000001937277
llvm::ValueEnumerator::EnumerateValue(llvm::Value const*) + 471
14 opt             0x000000000193789d
llvm::ValueEnumerator::EnumerateMetadata(llvm::Metadata const*) + 301
15 opt             0x000000000193638e
llvm::ValueEnumerator::ValueEnumerator(llvm::Module const&, bool) + 2702
16 opt             0x0000000001909052
17 opt             0x0000000001908bff llvm::WriteBitcodeToFile(llvm::Module
const*, llvm::raw_ostream&, bool, bool) + 335
18 opt             0x0000000001908a90
19 opt             0x0000000001dca9e1
20 opt             0x0000000001dca4db
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 347
21 opt             0x0000000001dcaf21
llvm::legacy::PassManager::run(llvm::Module&) + 33
22 opt             0x000000000091f2ec main + 8588
23 libc.so.6       0x00007f88d8171ec5 __libc_start_main + 245
24 opt             0x00000000008f3748
Stack dump:
0.      Program arguments: build-master/bin/opt -globalopt -o /dev/null
bugpoint-reduced-simplified.ll 
1.      Running pass 'Bitcode Writer' on module
'bugpoint-reduced-simplified.ll'.
Aborted


I have been debugging this for a while and found that globalopt tries to
extract the bitcast from:

  store i16 0, i16* bitcast (i16** @a.1 to i16*), align 8, !dbg !11

This bitcast also exists in debug info:

  tail call void @llvm.dbg.value(metadata i16* bitcast (i16** @a.1 to i16*),
i64 0, metadata !1, metadata !9), !dbg !10

In makeAllConstantUsesInstructions(Constant *C) dropAllReferences is called on
the bitcast expression and this seems to break the instruction with the
llvm.dbg.value

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160301/165c36b7/attachment.html>


More information about the llvm-bugs mailing list