pranavk / spatial-computing

This repository contains LLVM compiler passes (for now) to convert a C/C++ program to PDM (a synthesizable dataflow intermediate representation)
Apache License 2.0
5 stars 1 forks source link

doesn't work with llvm 3.5.0 #1

Open pranavk opened 9 years ago

pranavk commented 9 years ago

code gives seg fault when run with llvm 3.5.0

shamsuddin508 commented 9 years ago

use it in llvm 3.4.2

pranavk commented 9 years ago

I think that was probably because the binaries and the source code in which we put the llvm passes need to be the same version.

pranavk commented 9 years ago

I realised that there are some changes in LLVM version 3.5.0 and I think this code needs to be changed so that it works with LLVM 3.5.0.

hence, i am reopening this issue until it compiles with 3.5.0

pranavk commented 9 years ago

port branch taking care of the port to 3.5.0.

I have already tested it and it compiles successfuly. Few more days and we will merge it to master.

pranavk commented 9 years ago

There is a problem of infinite loop and then eventually segmentation fault.

From the stack trace it seems that it is all because of improper data structure used. Probably we need to do something more efficient.

Here is the stack trace :

0 opt 0x0000000000fdd155 llvm::sys::PrintStackTrace(_IOFILE) + 37 1 opt 0x0000000000fdd5a3 2 libpthread.so.0 0x00007f6c0b9fa0d0 3 opt 0x0000000000fe21a3 llvm::StringMapImpl::FindKey(llvm::StringRef) const + 67 4 opt 0x0000000000fe22a4 llvm::StringMapImpl::RemoveKey(llvm::StringMapEntryBase_) + 20 5 opt 0x0000000000f950c1 llvm::Value::setName(llvm::Twine const&) + 465 6 Spatial.so 0x00007f6c0a9f5389 WaveScalar::init(llvm::Function const&) + 489 7 Spatial.so 0x00007f6c0a9f4f6c WaveScalar::annotateWaves(llvm::Function const&, llvm::SmallVectorImpl<std::pair<llvm::BasicBlock const, llvm::BasicBlock const> >*) + 44 8 Spatial.so 0x00007f6c0a9f45a8 9 opt 0x0000000000f81fab llvm::FPPassManager::runOnFunction(llvm::Function&) + 315 10 opt 0x0000000000f8216b llvm::FPPassManager::runOnModule(llvm::Module&) + 43 11 opt 0x0000000000f825cb llvm::legacy::PassManagerImpl::run(llvm::Module&) + 859 12 opt 0x00000000005616bc main + 7004 13 libc.so.6 0x00007f6c0ac1afe0 __libc_start_main + 240 14 opt 0x000000000055d0b1

shashagit commented 9 years ago

I am not able to replicate this issue. Instead I get the correct output on the terminal followed by this error:

LLVM ERROR: IO failure on output stream.

Also the dfg.dot that this is generating does not seem correct. dfg dot

pranavk commented 9 years ago

"LLVM ERROR: IO failure on output stream."

is there because you are not using "-o" flag with opt to output the bitcode file. When -o flag is not used, it means that it will output the bitcode format on standard output stream which is the reason of IO failure by LLVM in this case.

I am able to resolve this issue easily by using -o flag with opt when executing pases.

pranavk commented 9 years ago

After some more investigation, I think the culprit is FindFunctionBackedges function that I used in waves.cpp.

If I comment that line, it obviously gives wrong information about waves and wave annotation is done wrongly but it doesn't output any error.

If you are able to solve this problem with above solution too, please let me know.

shashagit commented 9 years ago

Commenting FindFunctionBackedges clears out the seg faults. Nice observation!