brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · b8f4c3d Raw
64 lines · plain
1// RUN: mlir-opt %s -split-input-file --test-verify-uselistorder -verify-diagnostics2 3// COM: --test-verify-uselistorder will randomly shuffle the uselist of every4//      value and do a roundtrip to bytecode. An error is returned if the5//      uselist order are not preserved when doing a roundtrip to bytecode. The6//      test needs to verify diagnostics to be functional.7 8func.func @base_test(%arg0 : i32) -> i32 {9  %0 = arith.constant 45 : i3210  %1 = arith.constant 46 : i3211  %2 = "test.addi"(%arg0, %arg0) : (i32, i32) -> i3212  %3 = "test.addi"(%2, %0) : (i32, i32) -> i3213  %4 = "test.addi"(%2, %1) : (i32, i32) -> i3214  %5 = "test.addi"(%3, %4) : (i32, i32) -> i3215  %6 = "test.addi"(%5, %4) : (i32, i32) -> i3216  %7 = "test.addi"(%6, %4) : (i32, i32) -> i3217  return %7 : i3218}19 20// -----21 22func.func @test_with_multiple_uses_in_same_op(%arg0 : i32) -> i32 {23  %0 = arith.constant 45 : i3224  %1 = arith.constant 46 : i3225  %2 = "test.addi"(%arg0, %arg0) : (i32, i32) -> i3226  %3 = "test.addi"(%2, %0) : (i32, i32) -> i3227  %4 = "test.addi"(%2, %1) : (i32, i32) -> i3228  %5 = "test.addi"(%2, %2) : (i32, i32) -> i3229  %6 = "test.addi"(%3, %4) : (i32, i32) -> i3230  %7 = "test.addi"(%6, %5) : (i32, i32) -> i3231  %8 = "test.addi"(%7, %4) : (i32, i32) -> i3232  %9 = "test.addi"(%8, %4) : (i32, i32) -> i3233  return %9 : i3234}35 36// -----37 38func.func @test_with_multiple_block_arg_uses(%arg0 : i32) -> i32 {39  %0 = arith.constant 45 : i3240  %1 = arith.constant 46 : i3241  %2 = "test.addi"(%arg0, %arg0) : (i32, i32) -> i3242  %3 = "test.addi"(%2, %arg0) : (i32, i32) -> i3243  %4 = "test.addi"(%2, %1) : (i32, i32) -> i3244  %5 = "test.addi"(%2, %2) : (i32, i32) -> i3245  %6 = "test.addi"(%3, %4) : (i32, i32) -> i3246  %7 = "test.addi"(%6, %5) : (i32, i32) -> i3247  %8 = "test.addi"(%7, %4) : (i32, i32) -> i3248  %9 = "test.addi"(%8, %4) : (i32, i32) -> i3249  return %9 : i3250}51 52// -----53 54// Test that use-lists in region with no dominance are preserved55test.graph_region {56  %0 = "test.foo"(%1) : (i32) -> i3257  test.graph_region attributes {a} {58    %a = "test.a"(%b) : (i32) -> i3259    %b = "test.b"(%2) : (i32) -> i3260  }61  %1 = "test.bar"(%2) : (i32) -> i3262  %2 = "test.baz"() : () -> i3263}64