Closed adslwy closed 8 years ago
I looked into this issue and I found that the problem is in the InstTracePass.
%7 = invoke %"class.std::basic_istream"* @_ZNSirsERi(%"class.std::basic_istream"* %6, i32* %rows) to label %8 unwind label %10, !llfi_index !11 store %"class.std::basic_istream"* %7, %"class.std::basic_istream"** %llfi_trace20
The instruction trace pass attempts to add a store instruction after an invoke instruction in the same block. However, invoke is a terminator instruction of basic blocks. This causes the error "Instruction does not dominate all uses!" to be thrown.
For the time being, we will remove instruction traces after invoke instructions.
This has been addressed with commit 0d1226b.
I meet this problem when running instrument, the problem comes from read file, and the llvm error looks like this: Instruction does not dominate all uses! %230 = invoke %"class.std::1::basic_istream"* @_ZNSt3113basic_istreamIcNS_11char_traitsIcEEErsERi(%"class.std::1::basic_istream"* %229, i32* %nonezero) to label %231 unwind label %237, !llfi_index !316 store %"class.std::1::basic_istream"* %230, %"class.std::1::basic_istream"\ %llfi_trace630 Broken module found, compilation aborted! 0 opt 0x0000000103c77778 llvm::sys::PrintStackTrace(sFILE*) + 40 1 opt 0x0000000103c77c30 SignalHandler(int) + 416 2 libsystem_platform.dylib 0x00007fff93b2deaa _sigtramp + 26 ......
The problem comes from below code in instrument: if retcode == 0:
execlist = [optbin, '-load', llfilib, '-profilingpass'] execlist2 = ['-o', proffile + _suffixOfIR(), llfi_indexed_file + _suffixOfIR()] print(execlist) execlist.extend(compileOptions) execlist.extend(execlist2) if options["readable"]: execlist.append("-S") retcode = execCompilation(exec list) and retcode return -4.
The platform I use is OS X 10.11, and I run with the simple install version of LLFI, another thing need to mention is that when generate makefile, I have to add std head file into the clang++ search path --stdlib=libc++ -isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ to make it compile. Otherwise, clang++ will not find
the code segment that I run met the above problem shows below `#include
include
include
using namespace std; int main(int argc, const char * argv[]) {
// cout<<"matrix has "<<rows<<" rows "<< cols<<" cols "<<nonezero<<" nonezero values"<<endl; }`