On Sat, Feb 08, 2020 at 04:58:51PM -0800, Linus Torvalds wrote: > > Anyway, your fixed patch looks good, and the numbers look lovely. I > don't see why there would sometimes be extra memory use, but the patch > feels like the right thing to do regardless. Yes, I'm quite happy with it so. Thank you for the suggestion. For the cases with extra memory consumption, I've investigated the most extreme one and it's quite interesting. The extra memory was used for basic blocks, instructions and pseudos, so more linearized code. I reduced it to: static inline int get_order(long size) { return __builtin_constant_p(size) ? 0 : 1; } int foo(void) { return get_order(0); } Sparse used to not recognized the size as a constant (I don't understand why but haven't investigated). Strangely, the builtin without the conditional gave the expected result. Now, with the patch doing the inlining during expansion, the size is correctly recognized as a constant, with or without the conditional. The extra linearized code comes from some complex expression that is now selected instead of a function call (while reducing, I had the vague impression that the expression should have expanded further but I haven't check that yet). -- Luc