|
| 1 | +// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s |
| 2 | + |
| 3 | + |
| 4 | +module attributes {} { |
| 5 | + llvm.func @test(%arg0: !llvm.ptr) { |
| 6 | + %0 = llvm.mlir.constant(1 : i64) : i64 loc(#loc2) |
| 7 | + %1 = llvm.alloca %0 x i32 : (i64) -> !llvm.ptr loc(#loc2) |
| 8 | + %3 = llvm.mlir.constant(100 : index) : i64 loc(#loc2) |
| 9 | + %7 = llvm.trunc %0 : i64 to i32 loc(#loc2) |
| 10 | + llvm.br ^bb1(%7, %3 : i32, i64) loc(#loc2) |
| 11 | + ^bb1(%8: i32 loc(#loc4), %9: i64 loc(#loc5)): // 2 preds: ^bb0, ^bb2 |
| 12 | + %10 = llvm.icmp "sgt" %9, %0 : i64 loc(#loc3) |
| 13 | + llvm.cond_br %10, ^bb2, ^bb3 loc(#loc3) |
| 14 | + ^bb2: // pred: ^bb1 |
| 15 | + %13 = llvm.load %1 : !llvm.ptr -> i32 loc(#loc3) |
| 16 | + %14 = llvm.add %13, %7 : i32 loc(#loc3) |
| 17 | + %15 = llvm.sub %9, %0 : i64 loc(#loc3) |
| 18 | + llvm.br ^bb1(%14, %15 : i32, i64) loc(#loc3) |
| 19 | + ^bb3: // pred: ^bb1 |
| 20 | + llvm.return loc(#loc3) |
| 21 | + } loc(#loc6) |
| 22 | +} |
| 23 | + |
| 24 | +#int_ty = #llvm.di_basic_type<tag = DW_TAG_base_type, name = "integer", |
| 25 | + sizeInBits = 32, encoding = DW_ATE_signed> |
| 26 | +#file = #llvm.di_file<"test.f90" in ""> |
| 27 | +#cu = #llvm.di_compile_unit<id = distinct[0]<>, |
| 28 | + sourceLanguage = DW_LANG_Fortran95, file = #file, isOptimized = false, |
| 29 | + emissionKind = Full> |
| 30 | +#sp_ty = #llvm.di_subroutine_type<callingConvention = DW_CC_normal, |
| 31 | + types = #int_ty> |
| 32 | +#sp = #llvm.di_subprogram<id = distinct[1]<>, compileUnit = #cu, scope = #file, |
| 33 | + name = "test", file = #file, line = 1, scopeLine = 1, |
| 34 | + subprogramFlags = Definition, type = #sp_ty> |
| 35 | + |
| 36 | +#loc1 = loc("test.f90":1:1) |
| 37 | +#loc2 = loc("test.f90":15:22) |
| 38 | +#loc3 = loc("test.f90":26:3) |
| 39 | +#loc4 = loc("test.f90":8:2) |
| 40 | +#loc5 = loc("test.f90":9:5) |
| 41 | +#loc6 = loc(fused<#sp>[#loc1]) |
| 42 | + |
| 43 | +// CHECK-LABEl: define void @test |
| 44 | +// CHECK: phi i32{{.*}}!dbg ![[LOC1:[0-9]+]] |
| 45 | +// CHECK: phi i64{{.*}}!dbg ![[LOC2:[0-9]+]] |
| 46 | +// CHECK: ![[LOC1]] = !DILocation(line: 8, column: 2{{.*}}) |
| 47 | +// CHECK: ![[LOC2]] = !DILocation(line: 9, column: 5{{.*}}) |
0 commit comments