Requires constant size to be allocated
After inlining we may got code like this:
int main(void) {
char *ptr = malloc(80* sizeof(char)); // SIZE strcpy(ptr, "test"); puts(ptr); free(ptr);
}
if SIZE < threshold (currently 256)
-> create something like "char ptr[size]"
Fires 30+ in MultiSource benchmark.
Tests would be added later, after an initial discussion.
This still doesn't really do what you want: opt -instcombine -instcombine will ignore the limit (and we effectively do that in a lot of places). Maybe you could solve that by moving the transform into its own pass? Not sure; I'll think about it over the weekend and get back to you.