[LLVMbugs] [Bug 2083] New: Optimisation breaks debug records: region.start/region.end

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Feb 22 06:51:34 PST 2008


http://llvm.org/bugs/show_bug.cgi?id=2083

           Summary: Optimisation breaks debug records:
                    region.start/region.end
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Archive library
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: richard.smith at antixlabs.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=1447)
 --> (http://llvm.org/bugs/attachment.cgi?id=1447)
Demo sourtce file

The test case is a C program which makes a series of calls to function check().
When compiled with no optimisation and disassembled thusly:

% llvm-gcc 20000223-1.c -g -c --emit-llvm
% llvm-dis -f 20000223-1.o

you will see that in the code for function check() there are debug intrinsic
functions for a region start and end, and the region.end is correctly matched
to the block (first and last lines of the code fragment):

20000223-1.o.ll (fragment):

        call void @llvm.dbg.region.start( {  }* bitcast (%llvm.dbg.block.type*
@llvm.dbg.block to {  }*) )
        call void @llvm.dbg.stoppoint( i32 12, i32 0, {  }* bitcast
(%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to {  }*) )
        call void @abort( )
        unreachable
                ; No predecessors!
        call void @llvm.dbg.stoppoint( i32 12, i32 0, {  }* bitcast
(%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to {  }*) )
        call void @llvm.dbg.region.end( {  }* bitcast (%llvm.dbg.block.type*
@llvm.dbg.block to {  }*) )

If you now optimise by running opt and disassemble:

opt -f -std-compile-opts 20000223-1.o -o 20000223-1.o
llvm-dis -f 20000223-1.o

you will see that the region.end has been amended and is now incorrectly paired
with a subprogram. Furthermore, this function check() is inlined into the main
function and the problem is replicated in each case.

20000223-1.o.ll (fragment):

cond_true:      ; preds = %entry
    call void @llvm.dbg.region.start( {  }* bitcast (%llvm.dbg.block.type*
@llvm.dbg.block to {  }*) )
    call void @llvm.dbg.stoppoint( i32 12, i32 0, {  }* bitcast
(%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to {  }*) )
    call void @abort( )
    unreachable

return:     ; preds = %entry
    call void @llvm.dbg.stoppoint( i32 14, i32 0, {  }* bitcast
(%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to {  }*) )
    call void @llvm.dbg.region.end( {  }* bitcast (%llvm.dbg.subprogram.type*
@llvm.dbg.subprogram to {  }*) )


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list