[llvm-bugs] [Bug 49872] New: SROA does not maintain the llvm.dbg.declare intrinsics well

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 6 19:54:30 PDT 2021


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

            Bug ID: 49872
           Summary: SROA does not maintain the llvm.dbg.declare intrinsics
                    well
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: chenzheng1030 at hotmail.com
                CC: llvm-bugs at lists.llvm.org

```

define dso_local void @s1([1 x i8] %arg) local_unnamed_addr #0 !dbg !5 {
s1_entry:
  %_param_arg = alloca [1 x i8], align 4
  %arg.fca.0.extract = extractvalue [1 x i8] %arg, 0
  %arg.fca.0.gep = getelementptr inbounds [1 x i8], [1 x i8]* %_param_arg, i64
0, i64 0
  store i8 %arg.fca.0.extract, i8* %arg.fca.0.gep, align 4
  call void @llvm.dbg.declare(metadata [1 x i8]* %_param_arg, metadata !10,
metadata !DIExpression()), !dbg !11
  %_dconcat_res_conv_ = getelementptr inbounds [1 x i8], [1 x i8]* %_param_arg,
i64 0, i64 0, !dbg !12
  store i8 122, i8* %_dconcat_res_conv_, align 1, !dbg !12
  ret void, !dbg !13
}

declare void @llvm.dbg.declare(metadata, metadata, metadata) #5

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

!0 = !{i32 2, !"Dwarf Version", i32 3}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!2 = distinct !DICompileUnit(language: DW_LANG_Fortran95, file: !3,
isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4,
splitDebugInlining: false)
!3 = !DIFile(filename: "1.f", directory: ".")
!4 = !{}
!5 = distinct !DISubprogram(name: "s1", linkageName: "s1", scope: !3, file: !3,
line: 1, type: !6, scopeLine: 1, flags: DIFlagPrototyped, spFlags:
DISPFlagDefinition, unit: !2, retainedNodes: !4)
!6 = !DISubroutineType(types: !7)
!7 = !{!8, !9}
!8 = !DIBasicType(tag: DW_TAG_unspecified_type, name: "void")
!9 = !DIStringType(name: "char string", size: 8)
!10 = !DILocalVariable(name: "arg", arg: 1, scope: !5, file: !3, type: !9)
!11 = !DILocation(line: 0, scope: !5)
!12 = !DILocation(line: 4, scope: !5)
!13 = !DILocation(line: 5, scope: !5)
!14 = distinct !DISubprogram(name: "p", linkageName: "main", scope: !3, file:
!3, line: 7, type: !15, scopeLine: 7, flags: DIFlagPrototyped, spFlags:
DISPFlagDefinition, unit: !2, retainedNodes: !4)
!15 = !DISubroutineType(types: !16)
!16 = !{!17}
!17 = !DIBasicType(name: "INTEGER", size: 32, encoding: DW_ATE_signed)
!18 = !DILocation(line: 8, scope: !14)
```

Compiling on PowerPC, we get:
```
$ clang 1.ll -O2 

clang-13: include/llvm/Support/Casting.h:269: typename llvm::cast_retty<X,
Y*>::ret_type llvm::cast(Y*) [with X = llvm::DIBasicType; Y = const
llvm::DIType; typename llvm::cast_retty<X, Y*>::ret_type = const
llvm::DIBasicType*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
...
 #8 0x00003fffa185b6c4 __assert_fail
(/opt/at12.0/lib64/power8/libc.so.6+0x3b6c4)
 #9 0x000000001404f104 llvm::DebugHandlerBase::isUnsignedDIType(llvm::DIType
const*) 
#10 0x0000000014092b80 llvm::DwarfUnit::addConstantValue(llvm::DIE&, unsigned
long, llvm::DIType const*) 
#11 0x00000000140f8e74
llvm::DwarfCompileUnit::constructVariableDIEImpl(llvm::DbgVariable const&,
bool) 
#12 0x00000000140f91e0
llvm::DwarfCompileUnit::constructVariableDIE(llvm::DbgVariable&, bool) 
```

-- 
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/20210407/7442602a/attachment.html>


More information about the llvm-bugs mailing list