This level of technical obsession proves that elite engineering roles are won through monastic repetition rather than mere talent. It is a sobering display of discipline that puts the superficial learning habits of most developers to shame.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
studying compilers every day until i land a compiler role (day 221)
Added:and we're live. Um, even if a little bit late. Um, ignore the fact that I've like pushed the stream time back half an hour across the last well half hour. Um, anyways, hello all hello world. This is day 221 of studying compilers every day and studying compilers every day until I land a compiler role. Um, yeah, last time we did more reading about value numbering. Um, we kind of figured out what we were supposed to do for like the hash implementation. So, this time I think we're going to try and implement it. Um, yeah, it should be it should be a pretty good time. Um, yeah. So, if we go to our transforms, we have this nice little GBN thing. Uh, what I want to do is I want to make two GBN passes. Uh, one of them will be like the hashbased one and the other one will be the partition based one because I think it'd be interesting to learn about both and both have like different advantages over the other. So, uh, yeah, we're going to we're going to give it a try. I'm going to we're going to figure out how to like structure it and it's going to be it's going to be interesting. Um, yeah.
Also, something I was thinking about is like if we wanted to split up inst combine into like different passes as well. Um, yeah, there's like there's some like interesting stuff we could do here.
Um, yeah, something I was thinking about is literally just like we like tried to make these like separate passes at one point and it didn't really work. But I'm kind of curious if we can just like if we can kind of do that again and just like store the different passes inside like the big inst combine pass. Um it might be interesting, it might not be.
We'll see. We'll see how it ends up working, but that's not the focus for now. Uh for now, we're just focused on GVN. So we're going to we're going to give it a shot.
Um yeah, so I posted my Discord last time.
We have a big like we have like our big hashbased reference here. So this is like how we're going to be implementing it. I'm going to have this up on my second monitor, but it won't be up on like it won't be up on like the primary monitor at least. It'll just be up on the side. Um although actually maybe if I just open this.
Yeah. Okay. We could have that.
Uh what's a fire emblem? Thank you for being an inspiration to me. Um I I appreciate it. Um, thank you for thank you for being here as well because obviously streaming would be a lot less enjoyable for me if it was just me yapping to myself.
Um, okay. Let's let's give this a shot.
So, uh, where am I? I'm here.
Um, also I should probably open up the PDF again.
Let's see. Where does this live?
Here it is.
Okay.
So, we're doing hashbased right now.
Let me water.
Okay.
So, let's let's get into it.
So, I guess we could kind of just like we can kind of just like try to oneshot it off of this, though.
Inspire to stay consistent with all I do like you are. Um, I appreciate it. Um, I think it's important to take breaks every now and then, especially when you're like when you're like feeling a little bit burnt out or like if you're just like generally a little bit tired.
Like it's important to be ambitious, but it's also important to like at least be somewhat balanced with it. Um, in terms of compiler stuff, um, if you've like seen my recommendations, I think that'd probably be a really good place to start at least.
Um, okay, let's let's figure out how to do this.
Oh man.
Yeah, we're going to need to like traverse this like in some way.
How do we set up like traversals again?
I think we Yeah, we did something like that in me to regge or we have like utils traversal.
Yeah. Okay.
Uh so we can do like Oh man.
I think we should we should implement this like DVNT function.
Yeah. So we'll we'll do that real quick.
I think that's a good first step.
So, we should do Oh, man.
Uh, let's do like void dvnt.
And then we take mr basic block star basic block. We'll do that.
And then let's paste this down here somewhere.
Also, is this is this the correct order in the header that I wanted? No, definitely not.
Yeah. Okay. So, let's fix that as well real quick. Let's do that.
Um, actually, when we register, do we want that? How do we want to format this? How do we want to be consistent?
I guess we could put it below. I think it's but it's like a helper for this. So like it feels wrong. I don't know. Let's let's fix this formatting as well. I think so. We have that. We have that. That's fine. That's fine.
That's fine.
Okay. So we want this to go like here then.
So we'll we'll implement it like that.
And that should be clean enough.
We'll do that.
Oh man, this is this is scary.
Um, I think we necessarily insert the fees at the start. So, we could probably just like iterate through it. Um, I don't think it's like a hard-coded constraint. So, maybe we should just like we should be careful with it.
Um, I guess they they should be at the start anyways if we're like constructing it correctly.
So, I think we should try to preserve that.
So, we can do uh make this out of order fee safe.
Yeah, we'll do that, I guess. So, hi in basic block get instructions.
We can do something there. Is this a ref? Yeah, cuz that's a unique pointer. Okay.
Um, so we want a dynamic cast fee dynamic cast to MR fee or construction fee star.
Yeah, we can do that.
Then if it's a fee, then we can Oh, Jesus.
Uh, we can do something with this.
Uh, we need to figure out redundant slash meaningless.
Um, okay.
Well, we'll worry about this in a second.
Or redundant map or insert into map.
else uh number and add wait what into N.
Wait.
Oh, I see. Okay.
So we should if it meaningless if it's meaningless or redundant then we map to uh map to equivalent I guess uh insert and number I guess make new value number insert I guess we'll do we'll do that I I think that's how I want to structure it. Um, over here, let's see what other instructions do we have at least.
We have binary op.
So, we want we can actually just yank that line.
We do that.
Binary op. We do that.
Uh maybe we should h I kind of want to pull out I.Git. I don't know what my standard for that is though. We might do it in some places.
We might not.
We definitely did it like I think. What is a good place to look for that?
Probably surely in combine, right? Surely we did like some stuff here.
So instructions.
Oh, I see. We have iterator.
Um H.
Right. Cuz we do replacement at the end, right?
So this should be fine then in theory.
Yeah, we should we should try to do the get thing and do let's just do that maybe.
Yeah, we can do that. That cleans it up a little bit.
Um, okay. So then if bin op then we want to do something here.
What other types of instructions do we have with calls? I don't think we can number those cuz those might have side effects.
Allocate I don't think we should load. I don't think we should. Store we shouldn't. fees. We already handled parallel copy should not exist at this point and everything else doesn't really make sense. So I think we could kind of just do this and this should be sufficient.
Um yeah, maybe in the future we might do like intrinsics once we implement them, but I'm not sure what that'll look like.
It might be interesting.
Um yeah, so let's let's let's give this a shot.
Um, so want to replace operands.
Uh, we can't overwrite it though, right?
What what did the thing what did the paper say about uh what's it called? the unified hash table.
Um, oh, that's a fun deal. Uh, how many interviews have you already done for compilers roles? Um, honestly, not a lot because this this upcoming summer I have an internship. Um, so in that sense, I've like not really been recruiting for full-time, but I'm going to be starting that fairly soon at least. So, I'll I'll keep you updated at least.
Uh, yeah, most of most of this has just been like skills building, though, so that's kind of that's kind of my life at least.
Um, okay.
Placements cannot be performed online.
Okay. So that also means we h that has implications for like this thing uh this like overwrite thing we can't overwrite.
Um maybe we need to like make a new expression.
That's like really awkward at least. I don't really like it.
Yeah, that's kind of gross actually.
We might just have to like I think this is this goes back to like the hashing thing.
Um yeah, there's not a great way to do this at least. Um how difficult do you find going to resources like those papers? Um it's like fine. I think I just have to like do a lot of translation on the fly, which is like admittedly part of the learning at least, but it feels a little bit like an engineering task, which is kind of the fun part of writing code.
Um, I think we should we should make two hashmaps.
I think one of them should be like or actually h Yeah. How do we want to map this?
We need like a we need like a second layer of indirection, right? Cuz it's like I guess I could draw this out. At least what I'm thinking. Where is my paint donut? There it is.
So, we want like one map at least. So, this one is like the required map.
So we go from like a variable or let's just like let's just go like here and then we can insert the other one here.
We have like a uh instruction and then we want like uh I guess canonicalized or like numbered version of instruction like value. I guess maybe this should just be like bal.
So we at least want like some sort of mapping here. But then the question is like how do we do how do we actually like make this work? Um if we have like two instructions that are two instructions that are like identical construction like how do we how do we like do this mapping? So I think we want like another layer of indirection somewhere here which is like a value number and then we have like one mapping from a value to its value number and another from a value number to like an equivalent value. I think that's like the least awful way to do it but I think we kind of we kind of just got to deal with it.
It's a little bit scary but I'm sure it's fine.
Um yeah.
So let's do like we can kind of just like handwave it for now and then we can figure out the concrete implementation later.
We want to make the equivalent expression somehow.
If found map to equivalent else insert new value number.
So we want to do that.
So after all of that.
So then we've walked we've walked all the instructions and then we want to walk the successors.
So we want basic block accessories. This is basic block edges.
Uh unique edges and then we want to adjust the inputs.
Yeah. So we want to do that. We want to do like replacement there. I think I want to do dot here.
And then so we want child in DT.
Oh, we need the children in the dominator tree. Why don't I have a thing for this? That's really annoying.
Uh, how do we how do we do that?
Yeah, we're going to need to update our dominator tree then.
Get children of basic block. At least that's how we want to implement it.
Then we went to DVNT of I guess child.
This is this should be a putter. So that should be good, right? And then that should be good.
And then we do all the replacement at the end.
So what is DVNT stand for again?
Um do value numbering.
Wait, where did it go? Technique. Okay.
Okay. So, this should just be the numbering and then we do like the replacement after. I think I think that is how it's supposed to be done at least with like this type of hash setup.
Um, okay.
Let's see.
What do we want to do from here? Let's Let's implement the dominator tree get children thing because we need that.
Save those and then we could do this.
Is this actually just is that just the get children implementation?
Wait.
Wait a second.
Where is the tree?
Oh, okay. So, just immediate dominates.
Okay. So, I should I need to change this name. This is like really stupid actually.
Yeah. Let's rename that.
Right.
What is this? Yeah. Okay.
Let's just rename it like that.
Actually, I don't even know if that name is that wrong, though.
We'll just we'll just use that for now.
I'm lazy.
Okay. Uh we have those in harpoon still.
Let's get rid of those.
Okay.
So, we want we can do that.
That should be correct at least. I'm actually not sure if we construct it in that way. I don't I don't remember documenting enough of this. So, we're going to need to check this um each pair.
Okay. Yeah. So it is it is immediate which is good.
So we can we can just do that. I think that's fine.
Yeah, we'll do that. Um all right. Now we can let's add a commit real quick.
Uh actually let's just do star mem to regge update header function order formatting build out gvn hash version more okay now we got to figure out what to do here this is Scary. This is really scary.
We can read through this at least.
So, fees require special treatment. Must have previously assigned value numbers to all the inputs.
Um, yeah. Okay.
How do we skip that?
And then we can decide if eliminatable.
Okay. So we should also check if like if there are back edges, right?
Wait, what?
Oh man.
Reversibly reverse reverse post order.
Okay.
Uh meaningless. We can definitely just replace I think. Yeah, that makes sense.
How do we want to map this though? How do we want to design the data structures? I think we do want two maps.
Um, but how do we want to how do we want to set this up? We definitely want a value number to like value number to a value somewhere.
So, we should do that.
Let's add that somewhere here.
got an uned map from let's just do like we could do a literal value number.
So a that to a value star uh num to value I guess.
And then we want some sort of a map which is not going to make me very happy.
Oh man.
Do we want like uh value type and then Oh man, this is a little ridiculous.
How do we hash this?
Okay, let's look this up. GBN hashing recursive hashing.
Rolling hash. That's what it is, right?
Um, that's really annoying.
There's got to be a better way for this.
I think this is probably it.
Um, structure hashing. What is happening here?
Oh, we're using strings. Gh, yuck.
Oh, we can do bits. Okay, that might be funny. We could definitely do that. I think that might be fun.
Um, okay.
Uh, how do we want to encode this though? This is going to be so ugly if we do it that way.
I'm like kind of I'm kind of scared.
Let's see. Let's see what LVM's docs say for this.
Um let's see what is happening here.
Is this the Okay, this is new GBN.
So, this is also partition based it looks like.
Um, yeah, I want to implement this eventually, but it scares me. So, we're going to do that later.
Um, herm hush.
H. That's not helpful.
I'll see you.
What the hell?
What if I just like hashed the two string or like made some sort of a gross thing with that?
Um, oh man, hashing is hard. Hashing is very difficult.
Okay. Um, structure hashing. Is this the same? That's the same link.
What is happening here?
Oh god, why is it so slow?
Oh man. Okay, that's that's great.
Uh, okay.
How is this usually done?
How do you like combine hashes?
I've heard of Exor.
But I don't think this is enough of a guarantee. I think you'd need to do a stronger guarantee.
At least if we're exing multiple things.
Uh it should not be symmetric as well.
Um, oh god.
Yeah, this is not a great this is not great.
So m times a hash plus the other hash.
Yeah. How do we how do we even want to combine things for the hash? Right.
So many design decisions. That's This is like the one of the big challenges of this. I don't know how I want to do this.
Uh we definitely want value to numb and we want something.
So Mr. Valley value star to like I don't think it will be this simple unfortunately.
Um, yeah.
How do we even like implement a proper hash for this?
Um, what is what is here?
There is an implementation.
Oh, yeah. I I'm going to read this eventually, I think.
Um, yeah. Let's look at this.
This is This is our other This is the one that like we were looking at at least before.
Um.
Ah.
Yeah. Okay.
The following value name is a save variable name.
Yeah, that makes sense.
Oh, actually that makes a lot of sense.
Yeah.
Okay.
Uh okay. We might we might do it that way. We might not.
Um let's see.
Yeah, I guess we could try to do it the simple way first and then we can optimize it at some other point. I kind of want to just like do it the better way though first.
Um, all that changes just like how we do this, right?
At least if we look back here with this unified hasht thing.
Okay.
No hasht entries are removed when using a unified table.
Yeah. So we cannot immediately remove things which makes sense.
So then yeah, we can we need a second pass which should be nice.
Um yeah, let's just let's give it a try.
I think this might be interesting. Let's Let's see what we can do with it.
So, I kind of like the pseudo code. I think this is kind of what we're doing.
Um, so we set value numbers.
Oh man.
Yeah, I also don't know how we're going to do this as well. That kind of scares me a little bit.
Uh what's up, friend gamer?
Yeah, genuinely how do we how do we I guess do this properly?
How do we value number this?
I guess if we're getting value numbers for the operands, we can just like this is this is really awkward. We could make like one map for like fees and one map for binary ops.
We might do that. I think that might be the least awful way to do this.
Um, oh man, I'm really scared. I'm really scared of this. I also think there might be like an interesting uniqueness thing that happens, but we'll figure that out.
So we want like uh next none I guess we can do that and then hopefully we don't run out of numbers there.
So, we want what? Fee to numb. And then we want bin op to numb. And then we probably we probably want like more.
Um.
Oh man.
Yeah. I think the only other numberable things are like literally values, right?
Or just like uh numbers. Like literally numbers.
Yeah.
Um a this is such a headache. What What are we even numbering here?
Value numbers for each operand.
This is difficult. I can't give a person a break after one pet dies. Damn.
Another That's That is very unfortunate.
Um I'm sorry.
Um, and Scoliosis. Damn, that is that is very unfortunate.
Um, yeah, I don't even know how to map this, but I'm I'm sorry if I like at the end of the day, I don't think I'm like particularly like as a streamer, I don't think my role is necessarily supposed to be like support. So, I'm not really like I can't really comment too too much on that. Um, yeah, that does that does suck, but I I hope you also have like other people that you can talk with about this as well.
Um, yeah, this is actually like kind of difficult.
This is kind of difficult to I guess implement.
Where is their implementation of this?
Um, surely they've put it somewhere, right?
Oh, I should implement FSBuzz as a test.
That might be fun.
Yeah, these might be fun.
These might be fun benchmarks.
Let me write that down before I forget.
Uh, what the hell is on this sticky note? I see broad stuff.
Uh, where' my pen go? There it is.
Okay.
Do they have their implementation anywhere?
I hope they do.
That might be helpful to look at at least.
Doesn't look like they do. That's unlucky.
Um, yeah, I guess we'll figure this out as we go. We definitely want like this like numb to bow thing.
I don't really know what to do with it though.
Uh we also want a constructor as well because we need to initialize next num.
Yeah. So let's do that real quick.
Next num gets zero.
Yeah, we can do that.
Oh man.
Yeah. Okay. So then if you just do like H.
So if it's meaningless then we should just like Yeah, I guess either way we're doing a mapping, right? So we want How do we how do we define meaningless?
I also think we want to like skip processing fees at some point, right?
uh hash GVN unified hasht. table.
This is so annoying.
Maybe we shouldn't do it that way. Is there even like a performance improvement there? I guess this matters for like the partial thing, right? Yeah, partial redundancy elimination.
Um, oh man, interesting.
Yeah. Okay.
I want to I want to do this. I really want to implement that.
I don't even know how I would go about implementing this.
How do we hash these?
Surely this is something explained earlier, right?
Uh probably equal.
Okay. Wait. Two arrays.
So variable names to value numbers and then value numbers to variable names. Okay.
Yeah, I mean that's simple enough. At least we could do we could think about that.
Uh where is like is there like a hash explanation?
God damn it. Um, I guess we could have like a default expert hash, right?
We just need to like we just need to modify the hash specifically for like um specifically for binary binary ops at least.
And just pray there's no collision.
Uh how do we feel about entering the GCC mines on Monday? I'm I'm a little bit scared. Um, I don't I don't even know if like there will be any interesting compiler stuff to do or if I'll just be like doing like quant work, which is also like fine by the way. But like, yeah, we'll we'll see how all that goes.
Um, it's going to be a good time though, ideally.
Uh, made some progress and got a mod for Minecraft Neoforge 26.1.2.
Hell yeah, that's nice.
What is the hashing scheme here? I still don't understand the hashing scheme we want to generate trade. I mean like I just want to make code go fast. Low key I do not care a lot about like finance. I just want to make code fast and I think that is a pretty good place to make code fast.
Um, what's happening here?
Yeah, I s What is the hashing scheme?
What is the hashing scheme that they like encourage for this?
Try for similar. Yeah, I think I think that's a pretty reasonable place to end up.
Uh it's I think it's like particularly ripe for uh for hardware as well, right?
So if you wanted to like get into that side of it, I think that would be a great place to go.
Bonza IMC. Yeah, I could see that. I very much could see that happening.
Uh, maybe I should make like a utilities library.
That might be funny.
H is it possible to like combine three hashes? Um, are you applying to places already? I'm like clean I'm in like cleaning up resume right now or cleaning up resume sort of land. Um I'll probably start applying like Friday I think.
Yeah. I I don't even want to think about doing week code. That's that scares me a lot.
That's not going to be fun.
Multi-et discrimination. What is happening here?
Um, oh man.
So, what is what is the you I don't think it like is there like an artifact maybe I can look at.
No.
Great.
That's not helpful.
Um, G.
Okay.
Um, combine hashes.
Three hashes or multiple hashes.
Yeah, this is scary.
Hash combine.
What a what a comment.
That's pretty funny.
Um yeah, we should What is the best way to combine multiple hashes?
Uh is there anything interesting here?
Let's make this dark mode. Sure.
So that makes sense. We just do that.
Yeah. So that's that's like what I want at least.
Hash next door is bad.
Yeah. Okay.
So then concatenation.
Oh, I see. Okay. I mean, that should work.
But then we have like this problem.
Oh, I see. Sure.
T's difficult.
Um. Oh yeah, that is the problem.
Serialization.
Do that. I see.
Okay. Well, this is going to be awful. This is going to be so awful.
I think we're just going to have to like do some like crazy string hashing [ __ ] unfortunately.
But yeah, we're going to need to figure this out. Um, how the hell do we generate a hash?
I guess we could just use that as like the number, right? We don't need two tables then if we're doing it that way, right? So, ah, no, we do need two val we do we do need two tables, but we can simplify it a little bit.
Um, C++ hash stood hash. Oh god, that's not readable.
Why is it so small?
Uh what even is this even useful for us stood hash or do we just want to like make a thing for it?
I think we should just like make a we should just make a type right. So, let's let's make a thing.
Uh, and then we'll do like class or we should probably make like a GVN hash thing and then we can use that as well in there. I don't know what this should look like. I don't know if we even want it to be a class. I think we could get away with just making UT 64 on it and just like pray that everything is fine.
I don't I don't know. I don't know how I don't know how to design hashes. This is like really scary.
So, what is the C++ hash thing?
I guess we could just like hash the string and that would be fine, right? We we might want to do that.
So, can we just like stood hash string?
Is that a thing?
And then what else is here?
Uh, this really sucks.
All right, we'll figure this out next time. Let's just like let's just leave it at this.
Hashell GBN whip day 221. 221 221.
Yeah, let's just push. We'll just call it a day here. Um I'm tired, so we're we're calling the stream here. Uh thank you all so much for showing up today.
There's a lot of thinking that to be done and currently being done. Um, if you like the stream, like the stream. If you like the channel, sub to the channel. Um, check out the description.
My Discord community is linked there.
You should join it. Um, you get pinged there when I go live and you can stay connected with everyone else. It's very nice. Um, there's a bunch of other goodies down there. You should add me on those or don't. It's up to you. Uh, I'm going to go I'm going to go eat some more food now. Uh, take care y'all. Take it easy and I will see you all tomorrow.
Related Videos
LBF101 Creating an XML Changelog
liquibase7511
3K views•2026-06-15
Alta Labs Cloud Dashboard Real time Network & Xnet Insights!
ShinyTechThings
158 views•2026-06-17
Wait... Group Policy Not Applying? Check This First!
keeplearning_iT
144 views•2026-06-15
Leetcode Weekly Contest 506 | Life's boring these days
Pudeesht
2K views•2026-06-14
microJAM: MAKING A MICRO GAME FOR A GAME JAM IN CLOJURESCRIPT AND TOTALLY NOT C
janetacarr
156 views•2026-06-18
Partitioning vs Bucketing vs Clustering: How to Make Queries 100x Faster
thedataandaiguy
194 views•2026-06-16
Design Claude Code Like a Senior Engineer
hayk.simonyan
344 views•2026-06-19
Linus Torvalds: AI Won’t Replace Understanding Code
SavvyNik
140 views•2026-06-19











