This series is an update of: https://gcc.gnu.org/pipermail/gcc-patches/2025-April/679924.html
As discussed in that thread, the changes since last time are to make distribute_links start from the last use, where easy, and to avoid an unnecessary insn walk for split_i2i3. The first three patches improve combine's compile time in the original PR101523 testcase by about 13x, reduce memory usage by about 100x, and keep the output code unchanged. But combine still takes up an inordinate percentage of total compile time. The final patch therefore adds the insn limit that was the main focus of the v1 patch above. With the addition of the middle two patches in the series, I thought it was worth rerunning a variant of Jakub's tests in the PR116398 trail. I tried setting the param to every multiple of 50 in the range [100,6000], measuring: - compile time, as a percentage of the compile time with just patches 1-3 applied - the number of successful combinations, as a percentage of the number with just patches 1-3 applied I've attached the results as a csv and plotted them as an SVG graph. Jakub's original suggestion of 3000 still looks like a good compromise from this (16.5% of compile time, 61.3% of successful combinations). Tested on aarch64-linux-gnu and x86_64-linux-gnu. I'll also test on powerpc. Richard
param,time,successes 100,0.733272227,8.753456711 150,0.824931256,12.46543289 200,1.008249313,15.64560732 250,1.191567369,18.46415656 300,1.374885426,20.70835992 350,1.466544455,22.29312912 400,1.74152154,23.67581366 450,1.924839597,25.01595405 500,2.016498625,26.31355031 550,2.199816682,27.89831951 600,2.383134739,28.91937886 650,2.658111824,30.08934269 700,3.024747938,32.12082536 750,3.391384051,33.8119549 800,3.666361137,35.19463944 850,4.216315307,37.18357796 900,4.582951421,38.55562646 950,5.041246563,39.73622633 1000,5.132905591,40.75728568 1050,5.499541705,41.66134865 1100,5.866177819,42.45905127 1150,6.049495875,43.28866199 1200,6.324472961,44.01191236 1250,6.416131989,44.63943842 1300,6.782768103,45.30950862 1350,6.782768103,45.6711338 1400,6.966086159,45.9157626 1450,7.241063245,46.16039141 1500,7.241063245,46.56456073 1550,8.0659945,47.85152095 1600,8.524289643,49.28738566 1650,9.440879927,50.65943416 1700,10.08249313,51.97830249 1750,10.6324473,53.09508615 1800,10.99908341,53.81833652 1850,11.45737855,54.29695809 1900,11.54903758,54.7862157 1950,12.00733272,55.14784088 2000,12.00733272,55.58391832 2050,12.46562786,56.1582642 2100,12.83226398,56.39225697 2150,13.19890009,56.8283344 2200,13.65719523,57.60476494 2250,13.93217232,57.92384599 2300,13.93217232,58.18974686 2350,14.57378552,58.81727292 2400,14.66544455,59.10444586 2450,14.94042163,59.37034673 2500,15.03208066,59.58306743 2550,15.03208066,59.77451606 2600,15.39871677,60.01914486 2650,15.85701192,60.21059349 2700,15.67369386,60.40204212 2750,16.04032997,60.57221868 2800,15.85701192,60.66794299 2850,15.94867094,60.71048713 2900,16.131989,60.7636673 2950,16.22364803,60.83811955 3000,16.40696609,61.25292491 3050,17.4152154,62.39098064 3100,19.15673694,63.43331206 3150,20.07332722,64.42246331 3200,20.62328139,65.40097852 3250,21.44821265,66.23058924 3300,21.99816682,66.76239098 3350,22.45646196,67.1027441 3400,22.63978002,67.52818549 3450,22.82309808,67.73027016 3500,24.1979835,68.20889173 3550,24.10632447,68.57051691 3600,24.8395967,68.70878536 3650,25.57286893,69.25122314 3700,25.29789184,69.79366092 3750,25.4812099,69.97447352 3800,26.48945921,70.42118698 3850,27.77268561,70.93171666 3900,27.03941338,71.20825356 3950,27.49770852,71.45288237 4000,28.04766269,71.68687513 4050,28.23098075,72.00595618 4100,28.41429881,72.30376516 4150,29.14757104,72.55902999 4200,29.33088909,72.73984259 4250,30.33913841,72.88874708 4300,29.97250229,72.97383535 4350,29.69752521,73.02701553 4400,30.52245646,73.06955967 4450,30.15582035,73.28228037 4500,31.34738772,74.12252712 4550,33.18056829,75.43075941 4600,35.01374885,76.60072325 4650,36.48029331,77.69623484 4700,38.68010999,78.71729419 4750,38.95508708,79.52563284 4800,40.3299725,80.01489045 4850,40.23831347,80.38715167 4900,40.69660862,80.65305254 4950,41.52153987,80.81259307 5000,41.70485793,81.13167411 5050,41.70485793,81.40821102 5100,42.16315307,81.53584344 5150,44.36296975,81.9506488 5200,43.35472044,82.41863433 5250,43.99633364,82.63135503 5300,45.18790101,83.09934057 5350,45.55453712,83.57796214 5400,45.82951421,83.82259094 5450,46.92942255,84.07785578 5500,46.74610449,84.32248458 5550,47.29605866,84.63092959 5600,49.58753437,84.92873857 5650,48.395967,85.22654754 5700,49.49587534,85.48181238 5750,49.12923923,85.70516911 5800,50.04582951,85.88598171 5850,50.87076077,85.93916188 5900,51.604033,85.99234205 5950,49.77085243,86.05615826 6000,50.41246563,86.26887896