[llvm-dev] DebugLoc info is invalid after pass 'simplifycfg'

Fangqing Du via llvm-dev llvm-dev at lists.llvm.org
Tue Apr 23 16:13:47 PDT 2019


Hi all,

I'm not sure it's a bug or not.
After pass 'simplifycfg', some DebugLoc info is changed, and become invalid.
I use the bugpoint to reduce the case, and paste it here:
**************************************************************************************************
target datalayout =
"e-m:e-i64:64-i128:128-i256:256-i512:512-i1024:1024-i2048:2048-i4096:4096-n8:16:32:64-S128-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "x86_64-linux-none"

; Function Attrs: nounwind
define internal fastcc float @_Z12generic_fmaxIfET_S0_S0_(float %x, float
%y) unnamed_addr !dbg !3 {
entry:
  br i1 undef, label %if.then9, label %if.else17, !dbg !7

if.then9:                                         ; preds = %entry
  %call10 = call fastcc i32 @_Z13generic_isnanIfEiT_(float %y), !dbg !8
  unreachable

if.else17:                                        ; preds = %entry
  %call18 = call fastcc i32 @_Z13generic_isnanIfEiT_(float %y), !dbg !9
  unreachable
}

; Function Attrs: nounwind
declare dso_local fastcc i32 @_Z13generic_isnanIfEiT_(float) unnamed_addr


!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2}

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1,
producer: "clang version 7.0.0 ", isOptimized: true, runtimeVersion: 0,
emissionKind: LineTablesOnly)
!1 = !DIFile(filename: "test.cpp", directory: ".")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = distinct !DISubprogram(name: "generic_fmax<float>", scope: !4, file:
!4, line: 19, type: !5, isLocal: false, isDefinition: true, scopeLine: 20,
flags: DIFlagPrototyped, isOptimized: false, unit: !0)
!4 = !DIFile(filename: "test.h", directory: ".")
!5 = !DISubroutineType(types: !6)
!6 = !{}
!7 = !DILocation(line: 27, column: 13, scope: !3)
!8 = !DILocation(line: 28, column: 5, scope: !3)
!9 = !DILocation(line: 34, column: 13, scope: !3)
**************************************************************************************************

And after pass 'simplifycfg', the DebugLoc info attached to the call
instruction will be changed into '*!7 = !DILocation(line: 0, scope: !3)*',
which is invalid.
*after:*
**************************************************************************************************
target datalayout =
"e-m:e-i64:64-i128:128-i256:256-i512:512-i1024:1024-i2048:2048-i4096:4096-n8:16:32:64-S128-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024"
target triple = "x86_64-linux-none"

define internal fastcc float @_Z12generic_fmaxIfET_S0_S0_(float %x, float
%y) unnamed_addr !dbg !3 {
entry:
  %call10 = call fastcc i32 @_Z13generic_isnanIfEiT_(float %y), !dbg !7
  unreachable
}

declare dso_local fastcc i32 @_Z13generic_isnanIfEiT_(float) unnamed_addr

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2}

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1,
producer: "clang version 7.0.0 ", isOptimized: true, runtimeVersion: 0,
emissionKind: LineTablesOnly)
!1 = !DIFile(filename: "test.cpp", directory: ".")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = distinct !DISubprogram(name: "generic_fmax<float>", scope: !4, file:
!4, line: 19, type: !5, isLocal: false, isDefinition: true, scopeLine: 20,
flags: DIFlagPrototyped, isOptimized: false, unit: !0)
!4 = !DIFile(filename: "test.h", directory: ".")
!5 = !DISubroutineType(types: !6)
!6 = !{}
!7 = !DILocation(line: 0, scope: !3)
**************************************************************************************************

So can we just keep the original DebugLoc info for the call instruction?

Thanks,
Fangqing
Xilinx Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190423/7951ef39/attachment.html>


More information about the llvm-dev mailing list