LCSSA ?

85 views
Skip to first unread message

Jorropo

unread,
Jan 14, 2026, 2:56:18 AM (7 days ago) Jan 14
to golang-dev
I think I remember someone working on LCSSA, would someone which CL I am talking about?
I need it for https://github.com/golang/go/issues/77089 I've written a working implementation but it is very hacky and does not support multi-exit loops.

With LCSSA I could rely on all loop → exit* dependencies to have a phi node in the first exiting blocks (even if the phi is a no-op).

Alexander Musman

unread,
Jan 14, 2026, 5:59:18 AM (7 days ago) Jan 14
to Jorropo, golang-dev
Hi,
I did some experimenting with doing this transform here: 655376: cmd/compile: loop rotate for bottom testing | https://go-review.googlesource.com/c/go/+/655376 . Current version maybe would need some limiting by heuristic, to avoid code size increase. It is also before prove and does not support multi exit with breaks (but exits through panics from bound checks should work fine). The most challenging thing seems to be that subsequent passes do not expect such form and may need update (I did some updates to schedule, loopbce but some still need to be done, probably nil check opt, register allocator (at least sometimes I noticed the shuffling code does not work well in transformed loop, adding unnecessary copies). And I guess my change broke the downwards counting loop transform in prove as well 🙂
Feel free to cherry pick changes from it, or I could update/extract any changes if they work in your case.

Thanks,
Alexander

ср, 14 янв. 2026 г., 10:56 Jorropo <jorro...@gmail.com>:
I think I remember someone working on LCSSA, would someone which CL I am talking about?
I need it for https://github.com/golang/go/issues/77089 I've written a working implementation but it is very hacky and does not support multi-exit loops.

With LCSSA I could rely on all loop → exit* dependencies to have a phi node in the first exiting blocks (even if the phi is a no-op).

--
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/golang-dev/CAHWihb-cP4kirR5g5S7mQU3uzqjfUE_BnLvKJyzHZDsC5JJ7JA%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages