DependableSystemsLab / LLFI

LLFI is an LLVM based fault injection tool, that injects faults into the LLVM IR of the application source code. The faults can be injected into specific program points, and the effect can be easily tracked back to the source code. Please refer to the paper below. NOTE: If you publish a paper using LLFI, please add it to PaperLLFI.bib
http://blogs.ubc.ca/karthik/2014/02/23/quantifying-the-accuracy-of-high-level-fault-injection-techniques/
Other
68 stars 35 forks source link

Instruction does not dominate all uses! #81

Closed adslwy closed 8 years ago

adslwy commented 8 years ago

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[]) {

int rows; int cols ; int nonezero; //get the size of input matrix
//int n = 3;

typedef Eigen::Triplet<double> T;//use to store row, col, v_ij

vector<T> tripletList;  //use to store all the row

/***************beging to construct the matrix****************/

 fstream read;

 read.open("/Users/wuyue/Desktop/dataset/bcsstm22.mtx", ios::in);

int row=0 ; int col=0; float value=0; //get the value
read>>rows; read >> cols; read>>nonezero;

// cout<<"matrix has "<<rows<<" rows "<< cols<<" cols "<<nonezero<<" nonezero values"<<endl; }`

abrahamchan commented 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.

abrahamchan commented 8 years ago

This has been addressed with commit 0d1226b.