42 lines · plain
1# REQUIRES: x86_64-linux2# Test error handling and input validation for llvm-ir2vec tool in MIR mode3 4# RUN: not llvm-ir2vec embeddings --mode=mir %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-VOCAB5# RUN: not llvm-ir2vec embeddings --mode=mir --mir2vec-vocab-path=%S/nonexistent-vocab.json %s 2>&1 | FileCheck %s -check-prefix=CHECK-VOCAB-NOT-FOUND6# RUN: not llvm-ir2vec embeddings --mode=mir --mir2vec-vocab-path=%S/../../CodeGen/MIR2Vec/Inputs/mir2vec_invalid_vocab.json %s 2>&1 | FileCheck %s -check-prefix=CHECK-INVALID-VOCAB7# RUN: not llvm-ir2vec embeddings --mode=mir --function=nonexistent_function --mir2vec-vocab-path=%S/../../CodeGen/MIR2Vec/Inputs/mir2vec_dummy_3D_vocab.json %s 2>&1 | FileCheck %s -check-prefix=CHECK-FUNC-NOT-FOUND8 9--- |10 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"11 target triple = "x86_64-unknown-linux-gnu"12 13 define dso_local noundef i32 @test_function(i32 noundef %a) {14 entry:15 ret i32 %a16 }17...18---19name: test_function20alignment: 1621tracksRegLiveness: true22registers:23 - { id: 0, class: gr32 }24liveins:25 - { reg: '$edi', virtual-reg: '%0' }26body: |27 bb.0.entry:28 liveins: $edi29 30 %0:gr32 = COPY $edi31 $eax = COPY %032 RET 0, $eax33 34# CHECK-NO-VOCAB: error: Failed to load MIR2Vec vocabulary - MIR2Vec vocabulary file path not specified; set it using --mir2vec-vocab-path35 36# CHECK-VOCAB-NOT-FOUND: error: Failed to load MIR2Vec vocabulary37# CHECK-VOCAB-NOT-FOUND: No such file or directory38 39# CHECK-INVALID-VOCAB: error: Failed to load MIR2Vec vocabulary - Missing 'Opcodes' section in vocabulary file40 41# CHECK-FUNC-NOT-FOUND: error: Function 'nonexistent_function' not found42