[llvm-bugs] [Bug 42878] New: -Og should not merge functions calls because it drops line number information

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 2 19:29:28 PDT 2019


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

            Bug ID: 42878
           Summary: -Og should not merge functions calls because it drops
                    line number information
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: jmuizelaar at mozilla.com
                CC: llvm-bugs at lists.llvm.org

Compiling the following code with: clang -g -Og -S -emit-llvm test.c

void crash() __attribute__((noreturn));

void f(int i) {
    if (i == 3) {
        crash();
    }
    crash();
}

gives:

; Function Attrs: noreturn nounwind ssp uwtable
define void @f(i32) local_unnamed_addr #0 !dbg !8 {
  call void @llvm.dbg.value(metadata i32 %0, metadata !13, metadata
!DIExpression()), !dbg !14
  tail call void (...) @crash() #3, !dbg !15
  unreachable, !dbg !16
}

with a line number of 0

!15 = !DILocation(line: 0, scope: !8)

LLVM should not merge calls to crash() when doing -Og because it means that the
call to crash() looses it's line number information and makes debugging quite
unpleasant.

The same problem also happens with something like:

void crash();

void f(int i) {
    if (i == 3) {
        crash();
    } else {
        crash();
    }
}

GCC's -Og does not have this problem.

-- 
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/20190803/0066aee4/attachment.html>


More information about the llvm-bugs mailing list