brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · d74c8b9 Raw
57 lines · plain
1; RUN: opt -S -passes=div-rem-pairs -mtriple=x86_64-unknown-unknown < %s | FileCheck %s2 3; Check that DivRemPairs's optimizeDivRem() propagates the debug location of4; replaced `%rem` to the new srem or urem instruction.5; @decompose_illegal_srem_same_block tests it when the operands of `%rem` is signed.6; @decompose_illegal_urem_same_block tests it when the operands of `%rem` is unsigned.7 8define void @decompose_illegal_srem_same_block(i32 %a, i32 %b) !dbg !5 {9; CHECK-LABEL: define void @decompose_illegal_srem_same_block(10; CHECK:         %rem.recomposed = srem i32 [[A:%.*]], [[B:%.*]], !dbg [[DBG10:![0-9]+]]11  %div = sdiv i32 %a, %b, !dbg !812  %t0 = mul i32 %div, %b, !dbg !913  %rem = sub i32 %a, %t0, !dbg !1014  call void @foo(i32 %rem, i32 %div), !dbg !1115  ret void, !dbg !1216}17 18define void @decompose_illegal_urem_same_block(i32 %a, i32 %b) !dbg !13 {19; CHECK-LABEL: define void @decompose_illegal_urem_same_block(20; CHECK:         %rem.recomposed = urem i32 [[A:%.*]], [[B:%.*]], !dbg [[DBG16:![0-9]+]]21  %div = udiv i32 %a, %b, !dbg !1422  %t0 = mul i32 %div, %b, !dbg !1523  %rem = sub i32 %a, %t0, !dbg !1624  call void @foo(i32 %rem, i32 %div), !dbg !1725  ret void, !dbg !1826}27 28declare void @foo(i32, i32)29 30!llvm.dbg.cu = !{!0}31!llvm.debugify = !{!2, !3}32!llvm.module.flags = !{!4}33 34!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)35!1 = !DIFile(filename: "realrem_preverse.ll", directory: "/")36!2 = !{i32 10}37!3 = !{i32 0}38!4 = !{i32 2, !"Debug Info Version", i32 3}39!5 = distinct !DISubprogram(name: "decompose_illegal_srem_same_block", linkageName: "decompose_illegal_srem_same_block", scope: null, file: !1, line: 1, type: !6, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)40!6 = !DISubroutineType(types: !7)41!7 = !{}42!8 = !DILocation(line: 1, column: 1, scope: !5)43!9 = !DILocation(line: 2, column: 1, scope: !5)44!10 = !DILocation(line: 3, column: 1, scope: !5)45!11 = !DILocation(line: 4, column: 1, scope: !5)46!12 = !DILocation(line: 5, column: 1, scope: !5)47!13 = distinct !DISubprogram(name: "decompose_illegal_urem_same_block", linkageName: "decompose_illegal_urem_same_block", scope: null, file: !1, line: 6, type: !6, scopeLine: 6, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)48!14 = !DILocation(line: 6, column: 1, scope: !13)49!15 = !DILocation(line: 7, column: 1, scope: !13)50!16 = !DILocation(line: 8, column: 1, scope: !13)51!17 = !DILocation(line: 9, column: 1, scope: !13)52!18 = !DILocation(line: 10, column: 1, scope: !13)53 54; CHECK: [[DBG10]] = !DILocation(line: 3,55; CHECK: [[DBG16]] = !DILocation(line: 8,56 57