126 lines · plain
1; RUN: opt -passes=licm %s -S | FileCheck %s2 3; CHECK: %arrayidx4.promoted = load i32, ptr %arrayidx4, align 44; CHECK-NOT: !dbg5; CHECK: br label %for.body6 7target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"8 9@a = dso_local local_unnamed_addr global i16 0, align 2, !dbg !010@b = dso_local local_unnamed_addr global i16 0, align 2, !dbg !611 12; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn13declare void @llvm.dbg.declare(metadata, metadata, metadata) #014 15declare i16 @e(i32)16 17define i16 @g() !dbg !13 {18entry:19 %l_284 = alloca [2 x [3 x [6 x i32]]], align 1620 call void @llvm.lifetime.start.p0(ptr nonnull %l_284), !dbg !2421 call void @llvm.dbg.declare(metadata ptr %l_284, metadata !17, metadata !DIExpression()), !dbg !2522 %0 = load i16, ptr @a, align 2, !dbg !26, !tbaa !2923 %cmp11 = icmp sgt i16 %0, -1, !dbg !3324 br i1 %cmp11, label %for.body.lr.ph, label %cleanup, !dbg !3425 26for.body.lr.ph: ; preds = %entry27 br label %for.body, !dbg !3428 29for.body: ; preds = %for.cond2, %for.body.lr.ph30 %call = call signext i16 @e(i32 1), !dbg !3531 %tobool = icmp eq i16 %call, 0, !dbg !3532 br i1 %tobool, label %for.cond2, label %for.body.cleanup_crit_edge, !dbg !3833 34for.cond2: ; preds = %for.body35 %arrayidx4 = getelementptr inbounds [2 x [3 x [6 x i32]]], ptr %l_284, i64 0, i64 1, i64 2, i64 5, !dbg !3936 %l = load i32, ptr %arrayidx4, !dbg !43, !tbaa !4437 %add = add i32 %l, 1, !dbg !4338 store i32 %add, ptr %arrayidx4, align 4, !dbg !43, !tbaa !4439 %arrayidx8 = getelementptr inbounds [2 x [3 x [6 x i32]]], ptr %l_284, i64 0, i64 1, i64 1, i64 4, !dbg !4640 %1 = load i32, ptr %arrayidx8, align 8, !dbg !46, !tbaa !4441 %conv9 = trunc i32 %1 to i16, !dbg !4642 store i16 %conv9, ptr @b, align 2, !dbg !47, !tbaa !2943 %2 = load i16, ptr @a, align 2, !dbg !26, !tbaa !2944 %cmp = icmp sgt i16 %2, -1, !dbg !3345 br i1 %cmp, label %for.body, label %for.cond.cleanup_crit_edge, !dbg !34, !llvm.loop !4846 47for.cond.cleanup_crit_edge: ; preds = %for.cond248 br label %cleanup, !dbg !3449 50for.body.cleanup_crit_edge: ; preds = %for.body51 br label %cleanup, !dbg !3852 53cleanup: ; preds = %for.body.cleanup_crit_edge, %for.cond.cleanup_crit_edge, %entry54 call void @llvm.lifetime.end.p0(ptr nonnull %l_284), !dbg !5155 ret i16 1, !dbg !5156}57 58; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn59declare void @llvm.lifetime.start.p0(ptr nocapture) #160 61; Function Attrs: argmemonly nocallback nofree nosync nounwind willreturn62declare void @llvm.lifetime.end.p0(ptr nocapture) #163 64; Function Attrs: nocallback nofree nosync nounwind readnone speculatable willreturn65declare void @llvm.dbg.value(metadata, metadata, metadata) #066 67attributes #0 = { nocallback nofree nosync nounwind readnone speculatable willreturn }68attributes #1 = { argmemonly nocallback nofree nosync nounwind willreturn }69 70!llvm.dbg.cu = !{!2}71!llvm.module.flags = !{!9, !10, !11}72!llvm.ident = !{!12}73 74!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())75!1 = distinct !DIGlobalVariable(name: "a", scope: !2, file: !3, line: 1, type: !8, isLocal: false, isDefinition: true)76!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 237d0e3c0416abf9919406bcc92874cfd15f5e0c)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None)77!3 = !DIFile(filename: "a.c", directory: "/home/davide/lldb-build/bin")78!4 = !{}79!5 = !{!0, !6}80!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())81!7 = distinct !DIGlobalVariable(name: "b", scope: !2, file: !3, line: 1, type: !8, isLocal: false, isDefinition: true)82!8 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)83!9 = !{i32 7, !"Dwarf Version", i32 4}84!10 = !{i32 2, !"Debug Info Version", i32 3}85!11 = !{i32 1, !"wchar_size", i32 4}86!12 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 237d0e3c0416abf9919406bcc92874cfd15f5e0c)"}87!13 = distinct !DISubprogram(name: "g", scope: !3, file: !3, line: 5, type: !14, scopeLine: 5, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !16)88!14 = !DISubroutineType(types: !15)89!15 = !{!8}90!16 = !{!17}91!17 = !DILocalVariable(name: "l_284", scope: !13, file: !3, line: 6, type: !18)92!18 = !DICompositeType(tag: DW_TAG_array_type, baseType: !19, size: 1152, elements: !20)93!19 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)94!20 = !{!21, !22, !23}95!21 = !DISubrange(count: 2)96!22 = !DISubrange(count: 3)97!23 = !DISubrange(count: 6)98!24 = !DILocation(line: 6, column: 3, scope: !13)99!25 = !DILocation(line: 6, column: 7, scope: !13)100!26 = !DILocation(line: 7, column: 10, scope: !27)101!27 = distinct !DILexicalBlock(scope: !28, file: !3, line: 7, column: 3)102!28 = distinct !DILexicalBlock(scope: !13, file: !3, line: 7, column: 3)103!29 = !{!30, !30, i64 0}104!30 = !{!"short", !31, i64 0}105!31 = !{!"omnipotent char", !32, i64 0}106!32 = !{!"Simple C/C++ TBAA"}107!33 = !DILocation(line: 7, column: 12, scope: !27)108!34 = !DILocation(line: 7, column: 3, scope: !28)109!35 = !DILocation(line: 8, column: 9, scope: !36)110!36 = distinct !DILexicalBlock(scope: !37, file: !3, line: 8, column: 9)111!37 = distinct !DILexicalBlock(scope: !27, file: !3, line: 7, column: 19)112!38 = !DILocation(line: 8, column: 9, scope: !37)113!39 = !DILocation(line: 11, column: 7, scope: !40)114!40 = distinct !DILexicalBlock(scope: !41, file: !3, line: 10, column: 14)115!41 = distinct !DILexicalBlock(scope: !42, file: !3, line: 10, column: 5)116!42 = distinct !DILexicalBlock(scope: !37, file: !3, line: 10, column: 5)117!43 = !DILocation(line: 11, column: 22, scope: !40)118!44 = !{!45, !45, i64 0}119!45 = !{!"int", !31, i64 0}120!46 = !DILocation(line: 16, column: 9, scope: !37)121!47 = !DILocation(line: 16, column: 7, scope: !37)122!48 = distinct !{!48, !34, !49, !50}123!49 = !DILocation(line: 17, column: 3, scope: !28)124!50 = !{!"llvm.loop.unroll.disable"}125!51 = !DILocation(line: 18, column: 1, scope: !13)126