[PATCH] Loop unswitching: support gswitch statements.

Andrew MacLeod amacleod@redhat.com
Mon Nov 8 19:45:45 GMT 2021

On 11/8/21 10:05 AM, Martin Liška wrote:
> On 9/28/21 22:39, Andrew MacLeod wrote:
>> In Theory, modifying the IL should be fine, it happens already in 
>> places, but its not extensively tested under those conditions yet.
> Hello Andrew.
> I've just tried using a global gimple_ranger and it crashes when loop 
> unswitching duplicates
> some BBs.
> Please try the attached patch for: 

hey Martin,

try using this in your tree.  Since nothing else is using a growing BB 
right now, I'll let you work with it and see if everything works as 
expected before checking it in, just in case we need more tweaking.   
With this,

make RUNTESTFLAGS=dg.exp=loop-unswitch*.c check-gcc

runs clean.

basically, I tried to grow it by either a factor of 10% for the current 
BB size when the grow is requested, or some double the needed extra 
size, or 128... whichever value is "maximum"    That means it shoudnt be 
asking for tooo much each time, but also not a minimum amount.

Im certainly open to suggestion on how much to grow it each time.    
Note the vector being grown is ONLY fo the SSA_NAme being asked for.. so 
it really an on-demand thing just for specific names, in your case, 
mostly just the switch index.

Let me know how this works for you, and if you have any other issues.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: m2.patch
Type: text/x-patch
Size: 1922 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20211108/e88ccb31/attachment.bin>

More information about the Gcc-patches mailing list