74 lines · plain
1; RUN: llvm-ir2vec embeddings --ir2vec-vocab-path=%ir2vec_test_vocab_dir/dummy_3D_nonzero_opc_vocab.json %s | FileCheck %s -check-prefix=CHECK-DEFAULT2; RUN: llvm-ir2vec embeddings --level=func --ir2vec-vocab-path=%ir2vec_test_vocab_dir/dummy_3D_nonzero_opc_vocab.json %s | FileCheck %s -check-prefix=CHECK-FUNC-LEVEL3; RUN: llvm-ir2vec embeddings --level=func --function=abc --ir2vec-vocab-path=%ir2vec_test_vocab_dir/dummy_3D_nonzero_opc_vocab.json %s | FileCheck %s -check-prefix=CHECK-FUNC-LEVEL-ABC4; RUN: not llvm-ir2vec embeddings --level=func --function=def --ir2vec-vocab-path=%ir2vec_test_vocab_dir/dummy_3D_nonzero_opc_vocab.json %s 2>&1 | FileCheck %s -check-prefix=CHECK-FUNC-DEF5; RUN: llvm-ir2vec embeddings --level=bb --ir2vec-vocab-path=%ir2vec_test_vocab_dir/dummy_3D_nonzero_opc_vocab.json %s | FileCheck %s -check-prefix=CHECK-BB-LEVEL6; RUN: llvm-ir2vec embeddings --level=bb --function=abc_repeat --ir2vec-vocab-path=%ir2vec_test_vocab_dir/dummy_3D_nonzero_opc_vocab.json %s | FileCheck %s -check-prefix=CHECK-BB-LEVEL-ABC-REPEAT7; RUN: llvm-ir2vec embeddings --level=inst --function=abc_repeat --ir2vec-vocab-path=%ir2vec_test_vocab_dir/dummy_3D_nonzero_opc_vocab.json %s | FileCheck %s -check-prefix=CHECK-INST-LEVEL-ABC-REPEAT8 9define dso_local noundef float @abc(i32 noundef %a, float noundef %b) #0 {10entry:11 %a.addr = alloca i32, align 412 %b.addr = alloca float, align 413 store i32 %a, ptr %a.addr, align 414 store float %b, ptr %b.addr, align 415 %0 = load i32, ptr %a.addr, align 416 %1 = load i32, ptr %a.addr, align 417 %mul = mul nsw i32 %0, %118 %conv = sitofp i32 %mul to float19 %2 = load float, ptr %b.addr, align 420 %add = fadd float %conv, %221 ret float %add22}23 24define dso_local noundef float @abc_repeat(i32 noundef %a, float noundef %b) #0 {25entry:26 %a.addr = alloca i32, align 427 %b.addr = alloca float, align 428 store i32 %a, ptr %a.addr, align 429 store float %b, ptr %b.addr, align 430 %0 = load i32, ptr %a.addr, align 431 %1 = load i32, ptr %a.addr, align 432 %mul = mul nsw i32 %0, %133 %conv = sitofp i32 %mul to float34 %2 = load float, ptr %b.addr, align 435 %add = fadd float %conv, %236 ret float %add37}38 39; CHECK-DEFAULT: Function: abc40; CHECK-DEFAULT-NEXT: [ 878.00 889.00 900.00 ]41; CHECK-DEFAULT-NEXT: Function: abc_repeat42; CHECK-DEFAULT-NEXT: [ 878.00 889.00 900.00 ]43 44; CHECK-FUNC-LEVEL: Function: abc 45; CHECK-FUNC-LEVEL-NEXT: [ 878.00 889.00 900.00 ]46; CHECK-FUNC-LEVEL-NEXT: Function: abc_repeat 47; CHECK-FUNC-LEVEL-NEXT: [ 878.00 889.00 900.00 ]48 49; CHECK-FUNC-LEVEL-ABC: Function: abc50; CHECK-FUNC-LEVEL-NEXT-ABC: [ 878.00 889.00 900.00 ]51 52; CHECK-FUNC-DEF: error: Function 'def' not found53 54; CHECK-BB-LEVEL: Function: abc55; CHECK-BB-LEVEL-NEXT: entry: [ 878.00 889.00 900.00 ]56; CHECK-BB-LEVEL-NEXT: Function: abc_repeat57; CHECK-BB-LEVEL-NEXT: entry: [ 878.00 889.00 900.00 ]58 59; CHECK-BB-LEVEL-ABC-REPEAT: Function: abc_repeat60; CHECK-BB-LEVEL-ABC-REPEAT-NEXT: entry: [ 878.00 889.00 900.00 ]61 62; CHECK-INST-LEVEL-ABC-REPEAT: Function: abc_repeat63; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: %a.addr = alloca i32, align 4 [ 91.00 92.00 93.00 ]64; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: %b.addr = alloca float, align 4 [ 91.00 92.00 93.00 ]65; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: store i32 %a, ptr %a.addr, align 4 [ 97.00 98.00 99.00 ]66; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: store float %b, ptr %b.addr, align 4 [ 97.00 98.00 99.00 ]67; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: %0 = load i32, ptr %a.addr, align 4 [ 94.00 95.00 96.00 ]68; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: %1 = load i32, ptr %a.addr, align 4 [ 94.00 95.00 96.00 ]69; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: %mul = mul nsw i32 %0, %1 [ 49.00 50.00 51.00 ]70; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: %conv = sitofp i32 %mul to float [ 130.00 131.00 132.00 ]71; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: %2 = load float, ptr %b.addr, align 4 [ 94.00 95.00 96.00 ]72; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: %add = fadd float %conv, %2 [ 40.00 41.00 42.00 ]73; CHECK-INST-LEVEL-ABC-REPEAT-NEXT: ret float %add [ 1.00 2.00 3.00 ]74