123 lines · plain
1; RUN: opt -S -passes=globalopt < %s | FileCheck %s2 3;; Generated at -g from:4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5;;subroutine sub(inode,node)6;; implicit none7;; integer nodea,nodeb,jmax,inode,node8;; save nodea,nodeb,jmax9;; if(inode.eq.1) then10;; nodea=node11;; nodeb=node12;; jmax=013;; else14;; jmax=node+1+nodea+nodeb+jmax15;; return16;; endif17;;end18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19 20%struct.BSS1 = type <{ [12 x i8] }>21 22;CHECK: @.BSS1.0 = internal unnamed_addr global i32 0, align 32, !dbg ![[GVE1:.*]]23;CHECK: @.BSS1.1 = internal unnamed_addr global i32 0, align 4, !dbg ![[GVE2:.*]], !dbg ![[GVE4:.*]]24;CHECK: @.BSS1.2 = internal unnamed_addr global i32 0, align 8, !dbg ![[GVE3:.*]]25 26@.BSS1 = internal global %struct.BSS1 zeroinitializer, align 32, !dbg !0, !dbg !7, !dbg !10, !dbg !27, !dbg !2927@.C330_sub_ = internal constant i32 028@.C332_sub_ = internal constant i32 129 30define void @sub_(ptr noalias %inode, ptr noalias %node) !dbg !2 {31L.entry:32 call void @llvm.dbg.declare(metadata ptr %inode, metadata !16, metadata !DIExpression()), !dbg !1733 call void @llvm.dbg.declare(metadata ptr %node, metadata !18, metadata !DIExpression()), !dbg !1734 br label %L.LB1_36035 36L.LB1_360: ; preds = %L.entry37 %0 = load i32, ptr %inode, align 4, !dbg !1938 %1 = icmp ne i32 %0, 1, !dbg !1939 br i1 %1, label %L.LB1_356, label %L.LB1_370, !dbg !1940 41L.LB1_370: ; preds = %L.LB1_36042 %2 = load i32, ptr %node, align 4, !dbg !2043 store i32 %2, ptr @.BSS1, align 4, !dbg !2044 %3 = load i32, ptr %node, align 4, !dbg !2145 %4 = getelementptr i8, ptr @.BSS1, i64 4, !dbg !2146 store i32 %3, ptr %4, align 4, !dbg !2147 %5 = getelementptr i8, ptr @.BSS1, i64 8, !dbg !2248 store i32 0, ptr %5, align 4, !dbg !2249 br label %L.LB1_357, !dbg !2350 51L.LB1_356: ; preds = %L.LB1_36052 %6 = load i32, ptr %node, align 4, !dbg !2453 %7 = add nsw i32 %6, 1, !dbg !2454 %8 = load i32, ptr @.BSS1, align 4, !dbg !2455 %9 = add nsw i32 %7, %8, !dbg !2456 %10 = getelementptr i8, ptr @.BSS1, i64 4, !dbg !2457 %11 = load i32, ptr %10, align 4, !dbg !2458 %12 = add nsw i32 %9, %11, !dbg !2459 %13 = getelementptr i8, ptr @.BSS1, i64 8, !dbg !2460 %14 = load i32, ptr %13, align 4, !dbg !2461 %15 = add nsw i32 %12, %14, !dbg !2462 %16 = getelementptr i8, ptr @.BSS1, i64 8, !dbg !2463 store i32 %15, ptr %16, align 4, !dbg !2464 br label %L.LB1_354, !dbg !2565 66L.LB1_357: ; preds = %L.LB1_37067 br label %L.LB1_35468 69L.LB1_354: ; preds = %L.LB1_357, %L.LB1_35670 ret void, !dbg !2671}72 73; Function Attrs: nofree nosync nounwind readnone speculatable willreturn74declare void @llvm.dbg.declare(metadata, metadata, metadata)75 76!llvm.module.flags = !{!14, !15}77!llvm.dbg.cu = !{!4}78 79; CHECK-DAG: ![[GVE1]] = !DIGlobalVariableExpression(var: ![[GV1:.*]], expr: !DIExpression())80; CHECK-DAG: ![[GV1]] = distinct !DIGlobalVariable(name: "nodea"81; CHECK-DAG: ![[GVE2]] = !DIGlobalVariableExpression(var: ![[GV2:.*]], expr: !DIExpression())82; CHECK-DAG: ![[GV2]] = distinct !DIGlobalVariable(name: "nodeb"83; CHECK-DAG: ![[GVE3]] = !DIGlobalVariableExpression(var: ![[GV3:.*]], expr: !DIExpression())84; CHECK-DAG: ![[GV3]] = distinct !DIGlobalVariable(name: "jmax"85; CHECK-DAG: ![[GVE4]] = !DIGlobalVariableExpression(var: ![[GV4:.*]], expr: !DIExpression(DW_OP_plus_uconst, 2))86; CHECK-DAG: ![[GV4]] = distinct !DIGlobalVariable(name: "ivar2"87 88;; This does not make sense should be removed.89; CHECK-NOT: !DIGlobalVariable(name: "doesnotexist"90 91!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())92!1 = distinct !DIGlobalVariable(name: "nodea", scope: !2, file: !3, line: 3, type: !9, isLocal: true, isDefinition: true)93!2 = distinct !DISubprogram(name: "sub", scope: !4, file: !3, line: 1, type: !12, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition, unit: !4)94!3 = !DIFile(filename: "global-sra-struct-fit-segment.f90", directory: "/tmp")95!4 = distinct !DICompileUnit(language: DW_LANG_Fortran90, file: !3, producer: " F90 Flang - 1.5 2017-05-01", isOptimized: false, flags: "'+flang -g -O0 -S -emit-llvm'", runtimeVersion: 0, emissionKind: FullDebug, enums: !5, retainedTypes: !5, globals: !6, imports: !5, nameTableKind: None)96!5 = !{}97!6 = !{!0, !7, !10, !29}98!7 = !DIGlobalVariableExpression(var: !8, expr: !DIExpression(DW_OP_plus_uconst, 4))99!8 = distinct !DIGlobalVariable(name: "nodeb", scope: !2, file: !3, line: 3, type: !9, isLocal: true, isDefinition: true)100!9 = !DIBasicType(name: "integer", size: 32, align: 32, encoding: DW_ATE_signed)101!10 = !DIGlobalVariableExpression(var: !11, expr: !DIExpression(DW_OP_plus_uconst, 8))102!11 = distinct !DIGlobalVariable(name: "jmax", scope: !2, file: !3, line: 3, type: !9, isLocal: true, isDefinition: true)103!12 = !DISubroutineType(types: !13)104!13 = !{null, !9, !9}105!14 = !{i32 2, !"Dwarf Version", i32 4}106!15 = !{i32 2, !"Debug Info Version", i32 3}107!16 = !DILocalVariable(name: "inode", arg: 1, scope: !2, file: !3, line: 1, type: !9)108!17 = !DILocation(line: 0, scope: !2)109!18 = !DILocalVariable(name: "node", arg: 2, scope: !2, file: !3, line: 1, type: !9)110!19 = !DILocation(line: 5, column: 1, scope: !2)111!20 = !DILocation(line: 6, column: 1, scope: !2)112!21 = !DILocation(line: 7, column: 1, scope: !2)113!22 = !DILocation(line: 8, column: 1, scope: !2)114!23 = !DILocation(line: 9, column: 1, scope: !2)115!24 = !DILocation(line: 10, column: 1, scope: !2)116!25 = !DILocation(line: 11, column: 1, scope: !2)117!26 = !DILocation(line: 13, column: 1, scope: !2)118!27 = !DIGlobalVariableExpression(var: !28, expr: !DIExpression(DW_OP_constu, 4, DW_OP_minus))119!28 = distinct !DIGlobalVariable(name: "doesnotexist", scope: !2, file: !3, line: 3, type: !9, isLocal: true, isDefinition: true)120!29 = !DIGlobalVariableExpression(var: !30, expr: !DIExpression(DW_OP_plus_uconst, 6))121!30 = distinct !DIGlobalVariable(name: "ivar2", scope: !2, file: !3, line: 3, type: !31, isLocal: true, isDefinition: true)122!31 = !DIBasicType(name: "integer*2", size: 16, align: 16, encoding: DW_ATE_signed)123