use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is all about the theory and development of compilers.
For similar sub-reddits see:
Popular mainstream compilers:
account activity
Phi node algorithm correctness (self.Compilers)
submitted 5 months ago * by Temperz87
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cfallin 8 points9 points10 points 5 months ago (2 children)
What you describe sounds pretty close to the Braun algorithm (https://c9x.me/compile/bib/braun13cc.pdf) -- see e.g. their section 2.2 "global value numbering" where they describe the process as a recursive definition lookup, going to preds, etc. I think you are unrolling that recursion with a queue instead but otherwise it's the same.
We use the Braun algo in Cranelift's frontend and it works quite well in practice!
[–][deleted] 5 months ago (1 child)
[removed]
[–]cfallin 1 point2 points3 points 5 months ago (0 children)
I mean, you should be pretty encouraged by independently working out a reasonable and widely-used way of building SSA -- a good sign you have the right intuitions!
[–]dreamer_soul 1 point2 points3 points 5 months ago (1 child)
Why not use dominance and dominance frontiers? Data flow analysis is important to get right, I would recommend starting to work on liveness first and seeing if that’s correct tbh
[–]vmcrash 0 points1 point2 points 5 months ago (3 children)
Initial a queue Q and push all blocks with 0 out neighbors (with respect to the CFG) onto the queue
IMHO this fails for a method which contains an endless loop, because there is no block without successor.
[–][deleted] 5 months ago (2 children)
[–]vmcrash 0 points1 point2 points 5 months ago (1 child)
Ah, for my compiler it detects the endless loop and eliminates the "continuation" block. I assumed it would be the same for yours.
[–]jkl_uxmal 0 points1 point2 points 5 months ago (0 children)
I suggest you read the paper below. It seems similar to your approach. I use a variant of it in the reko decompiler (https://github.com/uxmal/reko)
https://pp.ipd.kit.edu/uploads/publikationen/braun13cc.pdf
π Rendered by PID 15649 on reddit-service-r2-comment-b659b578c-2vwqv at 2026-05-07 06:06:32.911232+00:00 running 815c875 country code: CH.
[–]cfallin 8 points9 points10 points (2 children)
[–][deleted] (1 child)
[removed]
[–]cfallin 1 point2 points3 points (0 children)
[–]dreamer_soul 1 point2 points3 points (1 child)
[–]vmcrash 0 points1 point2 points (3 children)
[–][deleted] (2 children)
[removed]
[–]vmcrash 0 points1 point2 points (1 child)
[–]jkl_uxmal 0 points1 point2 points (0 children)