llvm-project/llvm/test/tools/llvm-ir2vec/error-handling.ll
Nishant Sachdeva 92da1c0b9f
[llvm-ir2vec] vocab read refactor (#177837)
Modifying llvm-ir2vec vocab reading pipeline to use Vocabulary::fromFile
instead of a full pass invocation

Addresses - [comment](
https://github.com/llvm/llvm-project/pull/177092#pullrequestreview-3687563016)
and is a follow up of the patch
[here](https://github.com/llvm/llvm-project/pull/177348)
2026-01-27 13:05:03 +05:30

16 lines
882 B
LLVM

; Test error handling and input validation for llvm-ir2vec tool
; RUN: not llvm-ir2vec embeddings %s 2>&1 | FileCheck %s -check-prefix=CHECK-NO-VOCAB
; RUN: not llvm-ir2vec embeddings --function=nonexistent --ir2vec-vocab-path=%ir2vec_test_vocab_dir/dummy_3D_nonzero_opc_vocab.json %s 2>&1 | FileCheck %s -check-prefix=CHECK-FUNC-NOT-FOUND
; RUN: not llvm-ir2vec embeddings --function=nonexistent --ir2vec-vocab-path=%ir2vec_test_vocab_dir/incorrect_vocab1.json %s 2>&1 | FileCheck %s -check-prefix=CHECK-FUNC-INCORRECT-VOCAB
; Simple test function for valid IR
define i32 @test_func(i32 %a) {
entry:
ret i32 %a
}
; CHECK-NO-VOCAB: error: IR2Vec vocabulary file path not specified; You may need to set it using --ir2vec-vocab-path
; CHECK-FUNC-NOT-FOUND: error: Function 'nonexistent' not found
; CHECK-FUNC-INCORRECT-VOCAB: error: Missing 'Opcodes' section in vocabulary file