2015-02-10 00:57:22 +01:00
; RUN: opt %s -sroa -verify -S -o - | FileCheck %s
; From:
; struct prog_src_register {
; unsigned : 4;
; int Index : 12 + 1;
; unsigned : 12;
; unsigned : 4;
; int : 12 + 1
; } src_reg_for_float() {
; struct prog_src_register a;
; memset(&a, 0, sizeof(a));
; int local = a.Index;
; return a;
; }
; ModuleID = 'pr22495.c'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; When SROA is creating new smaller allocas, it may add padding.
;
; There should be no debug info for the padding.
2016-12-05 19:04:47 +01:00
; CHECK-NOT: DW_OP_LLVM_fragment, 56
2017-09-21 14:07:33 +02:00
; CHECK: DIExpression(DW_OP_LLVM_fragment, 0, 32)
; CHECK-NOT: DW_OP_LLVM_fragment, 56
2017-09-21 21:52:03 +02:00
; CHECK: DIExpression(DW_OP_LLVM_fragment, 32, 24)
; CHECK-NOT: DW_OP_LLVM_fragment, 56
2015-02-10 00:57:22 +01:00
%struct.prog_src_register = type { i32 , i24 }
; Function Attrs: nounwind
2015-11-05 23:03:56 +01:00
define i64 @src_reg_for_float ( ) #0 !dbg !4 {
2015-02-10 00:57:22 +01:00
entry:
%retval = alloca %struct.prog_src_register , align 4
%a = alloca %struct.prog_src_register , align 4
%local = alloca i32 , align 4
call void @llvm.dbg.declare ( metadata %struct.prog_src_register * %a , metadata !16 , metadata !17 ) , !dbg !18
%0 = bitcast %struct.prog_src_register * %a to i8 * , !dbg !19
2015-11-19 06:56:52 +01:00
call void @llvm.memset.p0i8.i64 ( i8 * %0 , i8 0 , i64 8 , i32 4 , i1 false ) , !dbg !19
2015-02-10 00:57:22 +01:00
call void @llvm.dbg.declare ( metadata i32 * %local , metadata !20 , metadata !17 ) , !dbg !21
%1 = bitcast %struct.prog_src_register * %a to i32 * , !dbg !21
2015-02-27 22:17:42 +01:00
%bf.load = load i32 , i32 * %1 , align 4 , !dbg !21
2015-02-10 00:57:22 +01:00
%bf.shl = shl i32 %bf.load , 15 , !dbg !21
%bf.ashr = ashr i32 %bf.shl , 19 , !dbg !21
store i32 %bf.ashr , i32 * %local , align 4 , !dbg !21
%2 = bitcast %struct.prog_src_register * %retval to i8 * , !dbg !22
%3 = bitcast %struct.prog_src_register * %a to i8 * , !dbg !22
2015-11-19 06:56:52 +01:00
call void @llvm.memcpy.p0i8.p0i8.i64 ( i8 * %2 , i8 * %3 , i64 8 , i32 4 , i1 false ) , !dbg !22
2015-02-10 00:57:22 +01:00
%4 = bitcast %struct.prog_src_register * %retval to i64 * , !dbg !22
2015-02-27 22:17:42 +01:00
%5 = load i64 , i64 * %4 , align 1 , !dbg !22
2015-02-10 00:57:22 +01:00
ret i64 %5 , !dbg !22
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare ( metadata , metadata , metadata ) #1
; Function Attrs: nounwind
2015-11-19 06:56:52 +01:00
declare void @llvm.memset.p0i8.i64 ( i8 * nocapture , i8 , i64 , i32 , i1 ) #2
2015-02-10 00:57:22 +01:00
; Function Attrs: nounwind
2015-11-19 06:56:52 +01:00
declare void @llvm.memcpy.p0i8.p0i8.i64 ( i8 * nocapture , i8 * nocapture readonly , i64 , i32 , i1 ) #2
2015-02-10 00:57:22 +01:00
attributes #0 = { nounwind }
attributes #1 = { nounwind readnone }
attributes #2 = { nounwind }
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !13 , !14 }
!llvm.ident = ! { !15 }
2016-04-15 17:57:41 +02:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , producer: "clang version 3.7.0 " , isOptimized: false , emissionKind: F u l l D e b u g , file: !1 , enums: !2 , retainedTypes: !2 , globals: !2 , imports: !2 )
2015-04-29 18:38:44 +02:00
!1 = !DIFile ( filename: "<stdin>" , directory: "" )
2015-02-10 00:57:22 +01:00
!2 = ! { }
2016-04-15 17:57:41 +02:00
!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 )
2015-04-29 18:38:44 +02:00
!5 = !DIFile ( filename: "pr22495.c" , directory: "" )
!6 = !DIFile ( filename: "pr22495.c" , directory: "" )
!7 = !DISubroutineType ( types: !8 )
2015-02-10 00:57:22 +01:00
!8 = ! { !9 }
2015-04-29 18:38:44 +02:00
!9 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "prog_src_register" , line: 1 , size: 64 , align: 32 , file: !5 , elements: !10 )
2015-02-10 00:57:22 +01:00
!10 = ! { !11 }
2015-04-29 18:38:44 +02:00
!11 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "Index" , line: 3 , size: 13 , align: 32 , offset: 4 , file: !5 , scope: !9 , baseType: !12 )
!12 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
2015-02-10 00:57:22 +01:00
!13 = ! { i32 2 , !"Dwarf Version" , i32 4 }
2015-03-03 18:24:31 +01:00
!14 = ! { i32 2 , !"Debug Info Version" , i32 3 }
2015-02-10 00:57:22 +01:00
!15 = ! { !"clang version 3.7.0 " }
2015-07-31 20:58:39 +02:00
!16 = !DILocalVariable ( name: "a" , line: 8 , scope: !4 , file: !6 , type: !9 )
2015-04-29 18:38:44 +02:00
!17 = !DIExpression ( )
!18 = !DILocation ( line: 8 , scope: !4 )
!19 = !DILocation ( line: 9 , scope: !4 )
2015-07-31 20:58:39 +02:00
!20 = !DILocalVariable ( name: "local" , line: 10 , scope: !4 , file: !6 , type: !12 )
2015-04-29 18:38:44 +02:00
!21 = !DILocation ( line: 10 , scope: !4 )
!22 = !DILocation ( line: 11 , scope: !4 )