brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · d167c1b Raw
74 lines · plain
1// RUN: mlir-opt -allow-unregistered-dialect %s -inline -split-input-file | FileCheck %s2 3// This file tests the callgraph dead code elimination performed by the inliner.4 5// Function is already dead.6// CHECK-NOT: func private @dead_function7func.func private @dead_function() {8  return9}10 11// Function becomes dead after inlining.12// CHECK-NOT: func private @dead_function_b13func.func @dead_function_b() {14  return15}16 17// CHECK: func @live_function()18func.func @live_function() {19  call @dead_function_b() : () -> ()20  return21}22 23// Same as above, but a transitive example.24 25// CHECK: func @live_function_b26func.func @live_function_b() {27  return28}29// CHECK-NOT: func private @dead_function_c30func.func private @dead_function_c() {31  call @live_function_b() : () -> ()32  return33}34// CHECK-NOT: func private @dead_function_d35func.func private @dead_function_d() {36  call @dead_function_c() : () -> ()37  call @dead_function_c() : () -> ()38  return39}40// CHECK: func @live_function_c41func.func @live_function_c() {42  call @dead_function_c() : () -> ()43  call @dead_function_d() : () -> ()44  return45}46 47// Function is referenced by non-callable top-level user.48// CHECK: func private @live_function_d49func.func private @live_function_d() {50  return51}52 53"live.user"() {use = @live_function_d} : () -> ()54 55// -----56 57// This test checks that the inliner can properly handle the deletion of58// functions in different SCCs that are referenced by calls materialized during59// canonicalization.60// CHECK: func @live_function_e61func.func @live_function_e() {62  call @dead_function_e() : () -> ()63  return64}65// CHECK-NOT: func @dead_function_e66func.func private @dead_function_e() -> () {67  "test.fold_to_call_op"() {callee=@dead_function_f} : () -> ()68  return69}70// CHECK-NOT: func private @dead_function_f71func.func private @dead_function_f() {72  return73}74