Conversation

Replying to
E.g. void compute(int init) { int a[100]; f(a,100,init); // compute a[] from init int b[100]; g(a,b,100); // compute b[] from a[] // a is no longer referenced after this, so c can use a's storage int c[100]; g(b,c,100); // compute c[] from b[] }
1
Basically I want to be lazy and leave this to the lower level compiler (C compiler, or LLVM), and I do not want to generate my own local buffer management code. So essentially, my generated code is SSA at the buffer level, where low level compiler would figure out buffer re-use.
1
I understand that this is not easy to optimize for structures that are not the same size, but in my use case they would be. Mostly just fixed size arrays.
1
TIL LLVM does "stack coloring"
Quote Tweet
Thought: LLVM has a late stack coloring pass that detects non-interfering ranges of the stack based on liveness ranges to save stack space. What if it could detect two stack slots "bridged" by a memcpy and assigned them the same slot, and then delete the memcpy?
Show this thread