brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 8d02944 Raw
66 lines · plain
1// RUN: mlir-opt -allow-unregistered-dialect -mlir-print-value-users -split-input-file %s | FileCheck %s2 3module {4    // CHECK: %[[ARG0:.+]]: i32, %[[ARG1:.+]]: i32, %[[ARG2:.+]]: i325    func.func @foo(%arg0: i32, %arg1: i32, %arg3: i32) -> i32 {6        // CHECK-NEXT: // %[[ARG0]] is used by %[[ARG0U1:.+]], %[[ARG0U2:.+]], %[[ARG0U3:.+]]7        // CHECK-NEXT: // %[[ARG1]] is used by %[[ARG1U1:.+]], %[[ARG1U2:.+]]8        // CHECK-NEXT: // %[[ARG2]] is unused9        // CHECK-NEXT: test.noop10        // CHECK-NOT: // unused11        "test.noop"() : () -> ()12        // When no result is produced, an id should be printed.13        // CHECK-NEXT: // id: %[[ARG0U3]]14        "test.no_result"(%arg0) {} : (i32) -> ()15        // Check for unused result.16        // CHECK-NEXT: %[[ARG0U2]] =17        // CHECK-SAME: // unused18        %1 = "test.unused_result"(%arg0, %arg1) {} : (i32, i32) -> i3219        // Check that both users are printed.20        // CHECK-NEXT: %[[ARG0U1]] =21        // CHECK-SAME: // users: %[[A:.+]]#0, %[[A]]#122        %2 = "test.one_result"(%arg0, %arg1) {} : (i32, i32) -> i3223        // For multiple results, users should be grouped per result.24        // CHECK-NEXT: %[[A]]:2 =25        // CHECK-SAME: // users: (%[[B:.+]], %[[C:.+]]), (%[[B]], %[[D:.+]])26        %3:2 = "test.many_results"(%2) {} : (i32) -> (i32, i32)27        // Two results are produced, but there is only one user.28        // CHECK-NEXT: // users:29        %7:2 = "test.many_results"() : () -> (i32, i32)30        // CHECK-NEXT: %[[C]] =31        // Result is used twice in next operation but it produces only one result.32        // CHECK-SAME: // user:33        %4 = "test.foo"(%3#0) {} : (i32) -> i3234        // CHECK-NEXT: %[[D]] =35        %5 = "test.foo"(%3#1, %4, %4) {} : (i32, i32, i32) -> i3236        // CHECK-NEXT: %[[B]] =37        // Result is not used in any other result but in two operations.38        // CHECK-SAME: // users:39        %6 = "test.foo"(%3#0, %3#1) {} : (i32, i32) -> i3240        "test.no_result"(%6) {} : (i32) -> ()41        "test.no_result"(%7#0) : (i32) -> ()42        return %6: i3243    }44}45 46// -----47 48module {49    // Check with nested operation.50    // CHECK: %[[CONSTNAME:.+]] = arith.constant51    %0 = arith.constant 42 : i3252    %test = "test.outerop"(%0) ({53        // CHECK: "test.innerop"(%[[CONSTNAME]]) : (i32) -> () // id: %54        "test.innerop"(%0) : (i32) -> ()55    // CHECK: (i32) -> i32 // users: %r, %s, %p, %p_0, %q56    }): (i32) -> i3257 58    // Check named results.59    // CHECK-NEXT: // users: (%u, %v), (unused), (%u, %v, %r, %s)60    %p:2, %q = "test.custom_result_name"(%test) {names = ["p", "p", "q"]} : (i32) -> (i32, i32, i32)61    // CHECK-NEXT: // users: (unused), (%u, %v)62    %r, %s = "test.custom_result_name"(%q#0, %q#0, %test) {names = ["r", "s"]} : (i32, i32, i32) -> (i32, i32)63    // CHECK-NEXT: // unused64    %u, %v = "test.custom_result_name"(%s, %q#0, %p) {names = ["u", "v"]} : (i32, i32, i32) -> (i32, i32)65}66