1 ; RUN: opt < %s -licm -S | FileCheck %s
2 ; RUN: opt < %s -strip-debug -licm -S | FileCheck %s
3 ; RUN: opt < %s -licm -enable-mssa-loop-dependency=true -verify-memoryssa -S | FileCheck %s
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 ; Verify that the sdiv is hoisted out of the loop
9 ; even in the presence of a preceding debug intrinsic.
15 define void @fn1() !dbg !6 {
17 ; CHECK-NEXT: [[_TMP2:%.*]] = load i32, i32* @a, align 4
18 ; CHECK-NEXT: [[_TMP3:%.*]] = load i32, i32* @b, align 4
19 ; CHECK-NEXT: [[_TMP4:%.*]] = sdiv i32 [[_TMP2]], [[_TMP3]]
20 ; CHECK-NEXT: br label [[BB3:%.*]]
24 bb3: ; preds = %bb3, %0
25 call void @llvm.dbg.value(metadata i32* @c, metadata !10, metadata !DIExpression(DW_OP_deref)), !dbg !12
26 %_tmp2 = load i32, i32* @a, align 4
27 %_tmp3 = load i32, i32* @b, align 4
28 %_tmp4 = sdiv i32 %_tmp2, %_tmp3
29 store i32 %_tmp4, i32* @c, align 4
30 %_tmp6 = load volatile i32, i32* @c, align 4
34 ; Function Attrs: nounwind readnone speculatable
35 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
37 attributes #0 = { nounwind readnone speculatable }
40 !llvm.module.flags = !{!3, !4}
43 !0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "foo", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2)
44 !1 = !DIFile(filename: "foo.c", directory: "/")
46 !3 = !{i32 2, !"Dwarf Version", i32 4}
47 !4 = !{i32 2, !"Debug Info Version", i32 3}
49 !6 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 3, type: !7, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: false, unit: !0, retainedNodes: !2)
50 !7 = !DISubroutineType(types: !8)
52 !9 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
53 !10 = !DILocalVariable(name: "f", scope: !11, line: 5, type: !9)
54 !11 = distinct !DILexicalBlock(scope: !6, file: !1, line: 4, column: 12)
55 !12 = !DILocation(line: 5, column: 9, scope: !11)