https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92264
--- Comment #31 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 48073 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48073&action=edit gcc10-pr92264-wip.patch WIP patch to try special casing cselib handling of stack pointer VALUEs. The intent is that when we first cselib_lookup the stack pointer (e.g. at the start of a bb), we mark the created VALUE as SP_DERIVED_VALUE_P and when we lookup sp + CONST_INT, we try to canonicalize that lookup into lookup of that VALUE + adjusted offset. Grepping e.g. -fdump-rtl-postreload-cselib or -fdump-rtl-dse2-cselib for ^cselib.value shows that with -O2 -m32 we create significantly fewer new VALUEs as we can share the VALUEs that are that SP_DERIVED_VALUE_P VALUE + offset. Unfortunately, this ICEs during var-tracking due to VALUE canonicalization and PRESERVED_VALUE_P.