<div class="gmail_quote">Hi LLVMers,<br><br>    I am working on my llvm school project optimization pass. It's relatively simple, and it tries to remove redundant bitcast instructions followed by load instructions. At first, I'm using as input a bytecode generated by a simple Java test program.<br>

    I've already found the reduntant instructions by looking at it's CFG, and I also could implement the code to substitute their references, in order to eliminate all dependencies on these instructions (the number of their uses are changed to zero).<br>

   The point is that when I finally attempt to remove the redundant unused instructions from the generated code, there is a seg fault error.<br>   To remove them, I'm using this function:<br><br>void EraseInst(Instruction &I) {<br>

            assert(I.use_empty() && "Cannot erase used instructions!");<br>            I.eraseFromParent();<br>}<br><br>So please, if anyone could help me on this, i would be very grateful!<br><br>PS: It's also following my pass and the bytecode used for tests.<br>

<br>Thanks for the attention,<font color="#888888"><br>Alysson<br>
</font></div>