Skip to content

Commit 202f30e

Browse files
authored
[IR2Vec][llvm-ir2vec] Add support for reading from stdin (#149213)
Add support for reading LLVM IR from stdin in the llvm-ir2vec tool. This allows usage of the tool in pipelines where LLVM IR is generated or transformed on-the-fly just like the other llvm tools. Useful in upcoming PRs. (Tracking issue - #141817)
1 parent 61a45d2 commit 202f30e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

llvm/tools/llvm-ir2vec/llvm-ir2vec.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ namespace ir2vec {
4848

4949
static cl::OptionCategory IR2VecToolCategory("IR2Vec Tool Options");
5050

51-
static cl::opt<std::string> InputFilename(cl::Positional,
52-
cl::desc("<input bitcode file>"),
53-
cl::Required,
54-
cl::cat(IR2VecToolCategory));
51+
static cl::opt<std::string>
52+
InputFilename(cl::Positional,
53+
cl::desc("<input bitcode file or '-' for stdin>"),
54+
cl::init("-"), cl::cat(IR2VecToolCategory));
5555

5656
static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
5757
cl::value_desc("filename"),
@@ -287,7 +287,7 @@ int main(int argc, char **argv) {
287287
if (Mode == TripletMode && Level.getNumOccurrences() > 0)
288288
errs() << "Warning: --level option is ignored in triplet mode\n";
289289

290-
// Parse the input LLVM IR file
290+
// Parse the input LLVM IR file or stdin
291291
SMDiagnostic Err;
292292
LLVMContext Context;
293293
std::unique_ptr<Module> M = parseIRFile(InputFilename, Err, Context);

0 commit comments

Comments
 (0)