This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Crash in remove_stmt_from_en_lp_fn() due to remving of gimple statement using gsi_remove

On Sat, 16 Nov 2019 at 11:28, Shubham Narlawar <> 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).

> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]