Open edumoot opened 4 months ago
We can not find a piece of information as the following, compared with the debug information generated through 'clang -g -O0 case.c -o case.out':
0x000000b9: DW_TAG_variable
DW_AT_location (DW_OP_fbreg -72)
DW_AT_name ("localData1")
DW_AT_decl_file ("/home/ad/Downloads/lldb/reproduce_bugs/case.c")
DW_AT_decl_line (15)
DW_AT_type (0x0000003d "Data")
0x000000c5: DW_TAG_lexical_block
DW_AT_low_pc (0x0000000000001199)
DW_AT_high_pc (0x000000000000122e)
0x000000cb: DW_TAG_variable
DW_AT_location (DW_OP_fbreg -40)
DW_AT_name ("localData2")
DW_AT_decl_file ("/home/ad/Downloads/lldb/reproduce_bugs/case.c")
DW_AT_decl_line (18)
DW_AT_type (0x0000003d "Data")
Debug information of local variables, like 'localData1', is missing from the binary after we apply this optimization sequence:
function<eager-inv>(float2int,lower-constant-intrinsics,loop(loop-rotate<no-header-duplication;no-prepare-for-lto>,loop-deletion),loop-distribute,inject-tli-mappings,loop-vectorize<no-interleave-forced-only;vectorize-forced-only;>,loop-load-elim,instcombine<max-iterations=1000;no-use-loop-info>,simplifycfg<bonus-inst-threshold=1;forward-switch-cond;switch-range-to-icmp;switch-to-lookup;no-keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,vector-combine,instcombine<max-iterations=1000;no-use-loop-info>,loop-unroll<O2>,transform-warning,sroa<preserve-cfg>,instcombine<max-iterations=1000;no-use-loop-info>,loop-mssa(licm<allowspeculation>),alignment-from-assumptions,loop-sink,instsimplify,div-rem-pairs,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>)
@llvm/issue-subscribers-debuginfo
Author: Yachao Zhu (edumoot)
LLVM 18.1.2 (commit 261aae0c) LLVM 17.0.6 (commit, 6009fe18)
Reproduce with:
Results:
We cannot get debug information of local variables on line 16 and on line 24.
and the same problem exists in GDB.
cat case.c