[llvm-dev] Illegal instruction (core dumped) LLVM 8.0
hameeza ahmed via llvm-dev
llvm-dev at lists.llvm.org
Sun Aug 25 23:35:01 PDT 2019
Thank You.
I put
return 1;
in the end
......................
for(BasicBlock::iterator it = bb->begin(), end = bb->end();it!=end;++it) {
++op_counter[it->getOpcodeName()]; }
for (std::map<std::string, int>::iterator it =
op_counter.begin(), end = op_counter.end(); it != end; ++it) {
errs() << it->first << ":" << it->second << ","; }
}
globalCount+=instCount;
errs() << "\n"<<func.getName() << "\t" << instCount << "\t" << globalCount;
return 1;
}
Now it is working fine.
On Mon, Aug 26, 2019 at 1:27 AM Mehdi AMINI <joker.eph at gmail.com> wrote:
>
>
> On Sun, Aug 25, 2019 at 12:36 PM hameeza ahmed via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
>
>> Hello,
>> I have implemented a pass to count total number of instructions in LLVM
>> 8.0. Its source code is attached here. The pass runs fine with LLVM 4.0.
>> But with LLVM 8.0 following error is shown;
>>
>> $ $LLVMopt_BIN/opt -load $LLVM_SO/LLVMStatic-Info.so -one output-simple.bc
>> WARNING: You're attempting to print out a bitcode file.
>> This is inadvisable as it may cause display problems. If
>> you REALLY want to taste LLVM bitcode first-hand, you
>> can force output with the `-f' option.
>> %2+_Z5UsageiPPc 5 call:1,getelementptr:1,load:2,ret:1,
>> _Z5UsageiPPc 5 5Stack dump:
>> 0. Program arguments:opt -load /build/lib/LLVMStatic-Info.so -one
>> output-simple.bc
>> 1. Running pass 'Function Pass Manager' on module 'output-simple.bc'.
>> 2. Running pass 'Numbers of Opcodes inside the program' on function
>> '@_Z5UsageiPPc'
>> #0 0x0000000002636939 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
>> /llvm-8.0.0.src/lib/Support/Unix/Signals.inc:495:11
>> #1 0x0000000002636ae9 PrintStackTraceSignalHandler(void*)
>> /llvm-8.0.0.src/lib/Support/Unix/Signals.inc:559:1
>> #2 0x0000000002634bd6 llvm::sys::RunSignalHandlers()
>> /llvm-8.0.0.src/lib/Support/Signals.cpp:68:5
>> #3 0x000000000263718b SignalHandler(int)
>> /llvm-8.0.0.src/lib/Support/Unix/Signals.inc:358:1
>> #4 0x00007f9153c4f890 __restore_rt
>> (/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
>> #5 0x00007f91524b40fe (anonymous
>> namespace)::opcodecount::runOnFunction(llvm::Function&)
>> /llvm-8.0.0.src/lib/Transforms/Static-Info/Static-Info.cpp:30:1
>> #6 0x0000000001c64464
>> llvm::FPPassManager::runOnFunction(llvm::Function&)
>> /llvm-8.0.0.src/lib/IR/LegacyPassManager.cpp:1644:23
>> #7 0x0000000001c64845 llvm::FPPassManager::runOnModule(llvm::Module&)
>> /llvm-8.0.0.src/lib/IR/LegacyPassManager.cpp:1679:16
>> #8 0x0000000001c6507b (anonymous
>> namespace)::MPPassManager::runOnModule(llvm::Module&)
>> /llvm-8.0.0.src/lib/IR/LegacyPassManager.cpp:1744:23
>> #9 0x0000000001c64b1b llvm::legacy::PassManagerImpl::run(llvm::Module&)
>> /llvm-8.0.0.src/lib/IR/LegacyPassManager.cpp:1857:16
>> #10 0x0000000001c65651 llvm::legacy::PassManager::run(llvm::Module&)
>> /llvm-8.0.0.src/lib/IR/LegacyPassManager.cpp:1888:3
>> #11 0x0000000000b54d93 main /llvm-8.0.0.src/tools/opt/opt.cpp:835:12
>> #12 0x00007f91526dbb97 __libc_start_main
>> /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
>> #13 0x0000000000b0a5fa _start (/build/bin/opt+0xb0a5fa)
>> Illegal instruction (core dumped)
>>
>> what is the reason of this error?
>>
>
> Can you try adding a return statement to your run() method? It is
> returning a value and it is UB to not do so.
>
> --
> Mehdi
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190826/9c68621a/attachment.html>
More information about the llvm-dev
mailing list