On 11/13/20 1:19 AM, Richard Sandiford via Gcc-patches wrote: > A later patch wants to be able to use the validate_change machinery > to reduce the XVECLEN of a PARALLEL. This should be more efficient > than allocating a separate PARALLEL at a possibly distant memory > location, especially since the new PARALLEL would be garbage rtl if > the new pattern turns out not to match. Combine already pulls this > trick with SUBST_INT. > > This patch adds a general helper for doing that. > > gcc/ > * recog.h (validate_change_xveclen): Declare. > * recog.c (change_t::old_len): New field. > (validate_change_1): Add a new_len parameter. Conditionally > replace the XVECLEN of an rtx, avoiding single-element PARALLELs. > (validate_change_xveclen): New function. > (cancel_changes): Undo changes made by validate_change_xveclen. OK. Presumably it's better to reduce the length of the existing vector, possibly losing a bit of memory off the end rather than releasing the existing vector and allocating a new one of the desired length (as you say it'd likely have no good locality). And note that when I say lose, I mean lose the ability to use those slots after we shrink the vector (say if we later wanted to lengthen it). The memory doesn't actually leak as it'll be released if we ever release the vector. Jeff
- Re: [11/23] Split update_cfg_for_un... Jeff Law via Gcc-patches
- [10/23] Tweak the way that is_a is imple... Richard Sandiford via Gcc-patches
- Re: [10/23] Tweak the way that is_a... Jeff Law via Gcc-patches
- [12/23] Export print-rtl.c:print_insn_wi... Richard Sandiford via Gcc-patches
- Re: [12/23] Export print-rtl.c:prin... Jeff Law via Gcc-patches
- [13/23] recog: Split out a register_asm_... Richard Sandiford via Gcc-patches
- Re: [13/23] recog: Split out a regi... Jeff Law via Gcc-patches
- [14/23] simplify-rtx: Put simplify routi... Richard Sandiford via Gcc-patches
- Re: [14/23] simplify-rtx: Put simpl... Jeff Law via Gcc-patches
- [15/23] recog: Add a validate_change_xve... Richard Sandiford via Gcc-patches
- Re: [15/23] recog: Add a validate_c... Jeff Law via Gcc-patches
- [16/23] recog: Add a way of temporarily ... Richard Sandiford via Gcc-patches
- Re: [16/23] recog: Add a way of tem... Jeff Law via Gcc-patches
- [17/23] recog: Add a class for propagati... Richard Sandiford via Gcc-patches
- Re: [17/23] recog: Add a class for ... Jeff Law via Gcc-patches
- [18/23] recog: Add an RAII class for und... Richard Sandiford via Gcc-patches
- Re: [18/23] recog: Add an RAII clas... Jeff Law via Gcc-patches
- [19/23] rtlanal: Add some new helper cla... Richard Sandiford via Gcc-patches
- Re: [19/23] rtlanal: Add some new h... Jeff Law via Gcc-patches
- Re: [19/23] rtlanal: Add some n... Richard Sandiford via Gcc-patches
- Re: [19/23] rtlanal: Add so... Jeff Law via Gcc-patches