https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97417
--- Comment #12 from Levy <admin at levyhsu dot com> --- (In reply to Kito Cheng from comment #11) > > Two failed cases: shorten-memrefs-5.c & shorten-memrefs-6.c > > Seems like shorten_memrefs pass didn't handle zero_extend and sign_extend > with memory. > > You can take a look into > riscv-shorten-memrefs.c:pass_shorten_memrefs::analyze and add logic to > handle zero_extend and sign_extend. > > > > With one instruction less, the patched one seems right and even faster to > > me. However we still need a test on sign extend and check performance > > shorten_memrefs is optimize for size, the idea is transform several load > instructions with large immediate to a load immediate instruction and load > instructions with small immediate, to use C-extensions instruction as > possible. > > so the instruction count seems increased, but the code size is smaller. Thank you cheng, I'll have a look.