[LLVMbugs] [Bug 5537] New: opt -strip does not remove all debug information
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Tue Nov 17 04:15:43 PST 2009
http://llvm.org/bugs/show_bug.cgi?id=5537
Summary: opt -strip does not remove all debug information
Product: new-bugs
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: timo.lindfors at iki.fi
CC: llvmbugs at cs.uiuc.edu
Steps to reproduce:
1) cat > testcase.c <<EOF
#include <stdio.h>
int main(int argc, char *argv[]) {
puts("Hello world");
return 0;
}
EOF
2) llvm-gcc -c -emit-llvm -g testcase.c
3) opt -strip testcase.o -o - | llvm-dis -o - -
4) llvm-gcc -c -emit-llvm testcase.c
5) llvm-dis -o - testcase.o
Expected results:
3 & 5) Using -g and opt -strip should cancel each other and result in no
debugging information.
Actual results:
3) opt -strip did not remove all debugging information:
; ModuleID = '<stdin>'
target datalayout =
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32"
target triple = "i386-pc-linux-gnu"
@0 = private constant [12 x i8] c"Hello world\00", align 1 ; <[12 x i8]*>
[#uses=1]
define i32 @main(i32, i8**) nounwind {
%3 = alloca i32 ; <i32*> [#uses=2]
%4 = alloca i8** ; <i8***> [#uses=2]
%5 = alloca i32 ; <i32*> [#uses=2]
%6 = alloca i32 ; <i32*> [#uses=2]
%7 = bitcast i32 0 to i32 ; <i32> [#uses=0]
%8 = bitcast i32* %3 to { }* ; <{ }*> [#uses=0]
store i32 %0, i32* %3
%9 = bitcast i8*** %4 to { }* ; <{ }*> [#uses=0]
store i8** %1, i8*** %4
%10 = call i32 @puts(i8* getelementptr inbounds ([12 x i8]* @0, i32 0, i32
0)) nounwind, !dbg !0 ; <i32> [#uses=0]
store i32 0, i32* %6, align 4, !dbg !9
%11 = load i32* %6, align 4, !dbg !9 ; <i32> [#uses=1]
store i32 %11, i32* %5, align 4, !dbg !9
br label %12, !dbg !9
; <label>:12 ; preds = %2
%13 = load i32* %5, !dbg !9 ; <i32> [#uses=1]
ret i32 %13, !dbg !9
}
declare i32 @puts(i8*)
!0 = metadata !{i32 4, i32 0, metadata !1, null}
!1 = metadata !{i32 458798, i32 0, metadata !2, metadata !"main", metadata
!"main", metadata !"main", metadata !2, i32 3, metadata !3, i1 false, i1 true};
[DW_TAG_subprogram ]
!2 = metadata !{i32 458769, i32 0, i32 1, metadata !"testcase.c", metadata
!"/home/lindi/tmp/nano-2.0.7/", metadata !"4.2.1 (Based on Apple Inc. build
5653) (LLVM build)", i1 true, i1 false, metadata !"", i32 0};
[DW_TAG_compile_unit ]
!3 = metadata !{i32 458773, metadata !2, metadata !"", metadata !2, i32 0, i64
0, i64 0, i64 0, i32 0, null, metadata !4, i32 0}; [DW_TAG_subroutine_type ]
!4 = metadata !{metadata !5, metadata !5, metadata !6}
!5 = metadata !{i32 458788, metadata !2, metadata !"int", metadata !2, i32 0,
i64 32, i64 32, i64 0, i32 0, i32 5}; [DW_TAG_base_type ]
!6 = metadata !{i32 458767, metadata !2, metadata !"char", metadata !2, i32 0,
i64 32, i64 32, i64 0, i32 0, metadata !7}; [DW_TAG_pointer_type ]
!7 = metadata !{i32 458767, metadata !2, metadata !"char", metadata !2, i32 0,
i64 32, i64 32, i64 0, i32 0, metadata !8}; [DW_TAG_pointer_type ]
!8 = metadata !{i32 458788, metadata !2, metadata !"char", metadata !2, i32 0,
i64 8, i64 8, i64 0, i32 0, i32 6}; [DW_TAG_base_type ]
!9 = metadata !{i32 5, i32 0, metadata !1, null}
More info:
1) distro is debian stable
2) architecture is x86
3) llvm version is 86985
4) llvm-gcc version is 86986
5) This is mostly an issue since both JIT and LLC seem to sometimes crash when
debug information is present (see for example bug #5525)
6) A workaround is to just pipe the IR through
sed 's/, !dbg ![0-9]*//g'
Maybe we need a new pass to remove metadata?
--
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