harvard-acc / LLVM-Tracer

An LLVM pass to profile dynamic LLVM IR instructions and runtime values
Other
135 stars 35 forks source link

Unable to generate opt file #42

Closed liaomin111 closed 3 years ago

liaomin111 commented 3 years ago

Hello, I have some problems when generating dynamic trace with LLVM-Tracer 3.4 version. This is the link that I used to generate the dynamic trace miniFE ,I'm using the Reference 2.0 version. The following is the log

root@c7f18a28e1ce:/workspace/LLVM-Tracer/miniFE/ref/src# make clang -g -O0 -S -static -emit-llvm -I. -I../utils -I../fem -DMINIFE_SCALAR=double -DMINIFE_LOCAL_ORDINAL=int -DMINIFE_GLOBAL_ORDINAL=int -DMINIFE_CSR_MATRIX -DMINIFE_REPORT_RUSAGE -DMINIFE_INFO=1 -DMINIFE_KERNELS=0 -o main.llvm main.cpp
opt -S -load=/workspace/LLVM-Tracer/lib/full_trace.so -fulltrace -trace-all-callees main.llvm -o main-opt.llvm opt: /workspace/LLVM-Tracer/full-trace/full_trace.cpp:939: void Tracer::handleInstructionResult(llvm::Instruction, llvm::Instruction, InstEnv): Assertion `false && "Return instruction is terminator...\n"' failed. 0 opt 0x00000000018519d8 llvm::sys::PrintStackTrace(_IO_FILE) + 53 1 opt 0x0000000001851c68 2 opt 0x0000000001851631 3 libpthread.so.0 0x00007fb88dd9e390 4 libc.so.6 0x00007fb88d157428 gsignal + 56 5 libc.so.6 0x00007fb88d15902a abort + 362 6 libc.so.6 0x00007fb88d14fbd7 7 libc.so.6 0x00007fb88d14fc82 8 full_trace.so 0x00007fb88cf175b7 9 full_trace.so 0x00007fb88cf179e1 Tracer::runOnBasicBlock(llvm::BasicBlock&) + 1057 10 full_trace.so 0x00007fb88cf15cf0 Tracer::runOnFunction(llvm::Function&) + 208 11 opt 0x0000000001716004 llvm::FPPassManager::runOnFunction(llvm::Function&) + 330 12 opt 0x000000000171617a llvm::FPPassManager::runOnModule(llvm::Module&) + 120 13 opt 0x000000000171647a 14 opt 0x0000000001716972 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 262 15 opt 0x0000000001716b4b llvm::legacy::PassManager::run(llvm::Module&) + 39 16 opt 0x00000000008d2bc8 main + 5804 17 libc.so.6 0x00007fb88d142830 __libc_start_main + 240 18 opt 0x00000000008c4299 _start + 41 Stack dump:

  1. Program arguments: opt -S -load=/workspace/LLVM-Tracer/lib/full_trace.so -fulltrace -trace-all-callees main.llvm -o main-opt.llvm
  2. Running pass 'Function Pass Manager' on module 'main.llvm'.
  3. Running pass 'Add full Tracing Instrumentation for Aladdin' on function '@main' Makefile:43: recipe for target 'main-opt.llvm' failed make: *** [main-opt.llvm] Aborted (core dumped)

How can I solve this problem? Thank you very much for your help. -Min

xyzsam commented 3 years ago

It looks like you're trying to run a C++ program through LLVM-Tracer 3.4, which only supports C. Please upgrade to LLVM-Tracer 6.0 instead and try again.

Also, remember that even with LLVM-Tracer 6.0, tracing is only fully supported on C kernels, but the surrounding code can be C++. See https://github.com/harvard-acc/LLVM-Tracer/#c-support for more details.