On Sat, 16 Nov 2019 at 11:28, Shubham Narlawar <gsocshub...@gmail.com> wrote: > > Hello, > > I'm writing a Simple LTO pass. I have placed my optimization routine under > execute() hook. In my optimization routine, I want to delete an > instruction for which I have the gimple_stmt_iterator. If I call > gsi_remove(gsi, true), it causes a crash in remove_stmt_from_en_lp_fn() > where it is expecting cfun and cfun is NULL. I assume you mean simple_ipa_opt_pass ? Maybe try calling push_cfun with appropriate function, to provide cfun context before calling gsi_remove (and pop_cfun after you're done).
Thanks, Prathamesh > > If I call gsi_remove(gsi, false), it goes through fine but at final link > stage it shows undefined reference to a certain function. It looks like > the entire function vanished. And the instruction I tried to delete was > not even a part of that function. > > Do I need to call update_ssa() after I delete the instruction using > gsi_remove(gsi, false)? > > Is there a simple manner in which I can delete the instruction without > having to go through writing the full blown LTO pass with > serializers/deserializers and the like? > > Thanks > > Shubham