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: [email protected]
Reporter: [email protected]
CC: [email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs