Home | History | Annotate | Download | only in X86
      1 ; RUN: opt %s -sroa -verify -S -o - | FileCheck %s
      2 ; From:
      3 ; struct prog_src_register {
      4 ;   unsigned : 4;       
      5 ;   int Index : 12 + 1; 
      6 ;   unsigned : 12;      
      7 ;   unsigned : 4;       
      8 ;   int : 12 + 1        
      9 ; } src_reg_for_float() {
     10 ;   struct prog_src_register a;
     11 ;   memset(&a, 0, sizeof(a));
     12 ;   int local = a.Index;
     13 ;   return a;
     14 ; }
     15 ; ModuleID = 'pr22495.c'
     16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
     17 target triple = "x86_64-unknown-linux-gnu"
     18 
     19 ; When SROA is creating new smaller allocas, it may add padding.
     20 ;
     21 ; There should be no debug info for the padding.
     22 ; CHECK-NOT: DW_OP_bit_piece, 56
     23 ; CHECK: DIExpression(DW_OP_bit_piece, 32, 24)
     24 ; CHECK-NOT: DW_OP_bit_piece, 56
     25 ; CHECK: DIExpression(DW_OP_bit_piece, 0, 32)
     26 ; CHECK-NOT: DW_OP_bit_piece, 56
     27 %struct.prog_src_register = type { i32, i24 }
     28 
     29 ; Function Attrs: nounwind
     30 define i64 @src_reg_for_float() #0 !dbg !4 {
     31 entry:
     32   %retval = alloca %struct.prog_src_register, align 4
     33   %a = alloca %struct.prog_src_register, align 4
     34   %local = alloca i32, align 4
     35   call void @llvm.dbg.declare(metadata %struct.prog_src_register* %a, metadata !16, metadata !17), !dbg !18
     36   %0 = bitcast %struct.prog_src_register* %a to i8*, !dbg !19
     37   call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 8, i32 4, i1 false), !dbg !19
     38   call void @llvm.dbg.declare(metadata i32* %local, metadata !20, metadata !17), !dbg !21
     39   %1 = bitcast %struct.prog_src_register* %a to i32*, !dbg !21
     40   %bf.load = load i32, i32* %1, align 4, !dbg !21
     41   %bf.shl = shl i32 %bf.load, 15, !dbg !21
     42   %bf.ashr = ashr i32 %bf.shl, 19, !dbg !21
     43   store i32 %bf.ashr, i32* %local, align 4, !dbg !21
     44   %2 = bitcast %struct.prog_src_register* %retval to i8*, !dbg !22
     45   %3 = bitcast %struct.prog_src_register* %a to i8*, !dbg !22
     46   call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 8, i32 4, i1 false), !dbg !22
     47   %4 = bitcast %struct.prog_src_register* %retval to i64*, !dbg !22
     48   %5 = load i64, i64* %4, align 1, !dbg !22
     49   ret i64 %5, !dbg !22
     50 }
     51 
     52 ; Function Attrs: nounwind readnone
     53 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
     54 
     55 ; Function Attrs: nounwind
     56 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #2
     57 
     58 ; Function Attrs: nounwind
     59 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #2
     60 
     61 attributes #0 = { nounwind }
     62 attributes #1 = { nounwind readnone }
     63 attributes #2 = { nounwind }
     64 
     65 !llvm.dbg.cu = !{!0}
     66 !llvm.module.flags = !{!13, !14}
     67 !llvm.ident = !{!15}
     68 
     69 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.7.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
     70 !1 = !DIFile(filename: "<stdin>", directory: "")
     71 !2 = !{}
     72 !4 = distinct !DISubprogram(name: "src_reg_for_float", line: 7, isLocal: false, isDefinition: true, isOptimized: false, unit: !0, scopeLine: 7, file: !5, scope: !6, type: !7, variables: !2)
     73 !5 = !DIFile(filename: "pr22495.c", directory: "")
     74 !6 = !DIFile(filename: "pr22495.c", directory: "")
     75 !7 = !DISubroutineType(types: !8)
     76 !8 = !{!9}
     77 !9 = !DICompositeType(tag: DW_TAG_structure_type, name: "prog_src_register", line: 1, size: 64, align: 32, file: !5, elements: !10)
     78 !10 = !{!11}
     79 !11 = !DIDerivedType(tag: DW_TAG_member, name: "Index", line: 3, size: 13, align: 32, offset: 4, file: !5, scope: !9, baseType: !12)
     80 !12 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
     81 !13 = !{i32 2, !"Dwarf Version", i32 4}
     82 !14 = !{i32 2, !"Debug Info Version", i32 3}
     83 !15 = !{!"clang version 3.7.0 "}
     84 !16 = !DILocalVariable(name: "a", line: 8, scope: !4, file: !6, type: !9)
     85 !17 = !DIExpression()
     86 !18 = !DILocation(line: 8, scope: !4)
     87 !19 = !DILocation(line: 9, scope: !4)
     88 !20 = !DILocalVariable(name: "local", line: 10, scope: !4, file: !6, type: !12)
     89 !21 = !DILocation(line: 10, scope: !4)
     90 !22 = !DILocation(line: 11, scope: !4)
     91