Dear sir or madam,<div><br></div><div>I am a 4-th year student at Yerevan State University, Armenia; and I am studying LLVM in order to write my Bachelor thesis.</div><div>I am trying to write an llvm pass that just removes all "Add" commands and gives some statstics. </div>
<div>Nevertheless, I get this segmentation fault:</div><div><br></div><div>................some rows about functions, that are not changed by my pass. The errors occurs after it has modified a "@_Z3addii" function.</div>
<meta http-equiv="content-type" content="text/html; charset=utf-8"><div><div>store i32 %b.0, i32* %4  and the type is ddddbbm 28</div><div>  %5 = load i32* %a_addr, align 4  and the type is ddddbbm 27</div><div>  %6 = load i32* %b_addr, align 4  and the type is ddddbbm 27</div>
<div>  %7 = add nsw i32 %5, %6  and the type is ddddbbm 8</div><div>  store i32 %7, i32* %0, align 4  and the type is ddddbbm 28</div><div>  %7 = add nsw i32 %5, %6   is erased, ba!</div><div>  %7 = load i32* %0, align 4  and the type is ddddbbm 27</div>
<div>  store i32 %7, i32* %retval, align 4  and the type is ddddbbm 28</div><div>  br label %return  and the type is ddddbbm 2</div><div>  ret i32 %retval1  and the type is ddddbbm 1</div><div>0  opt             0x00000000008ed93f</div>
<div>1  opt             0x00000000008edcea</div><div>2  libpthread.so.0 0x00007f9ba1183c60</div><div>3  opt             0x00000000004b3615 llvm::PATypeHolder::get() const + 21</div><div>4  opt             0x00000000008a4f11</div>
<div>5  opt             0x00000000008a9404</div><div>6  opt             0x0000000000882557 llvm::FPPassManager::runOnFunction(llvm::Function&) + 551</div><div>7  opt             0x00000000008825db llvm::FPPassManager::runOnModule(llvm::Module&) + 75</div>
<div>8  opt             0x0000000000882197 llvm::MPPassManager::runOnModule(llvm::Module&) + 503</div><div>9  opt             0x0000000000882299 llvm::PassManagerImpl::run(llvm::Module&) + 137</div><div>10 opt             0x00000000004ac451 main + 4881</div>
<div>11 libc.so.6       0x00007f9ba0459eff __libc_start_main + 255</div><div>12 opt             0x000000000049f5f9</div><div>Stack dump:</div><div>0.<span class="Apple-tab-span" style="white-space:pre">  </span>Program arguments: opt hello.bc -load ../llvm/llvm-2.9/plugin/BasicBlockStats.so -basic-block-stats -stats -o newhello.bc </div>
<div>1.<span class="Apple-tab-span" style="white-space:pre">    </span>Running pass 'Function Pass Manager' on module 'hello.bc'.</div><div>2.<span class="Apple-tab-span" style="white-space:pre"> </span>Running pass 'Module Verifier' on function '@_Z3addii'</div>
<div>Segmentation fault</div></div><div><br></div><div>Please find the source of my pass attached.</div><div>Hope to get a reply soon.</div><div><br></div><div>Regards,</div><div>Arshak Nazaryan</div><div><br></div>