On Thu, Jul 10, 2014 at 05:12:53PM +0200, Richard Biener wrote: > The following makes sure we fold the reads from string constants > created from folding memcpy (&foo, &string_cst[0], ...) to > eventually create similar code as if that memcpy folding wasn't > done (move-by-pieces). > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > Comments? > > (yeah, those native_encode_expr improvement would be really nice, > eventually for a slightly different interface, native_encode_expr_part)
Don't think you need a new function for that, just add an optional argument to native_encode_expr, and propagate it to native_encode_string, which would if the new bool arg is true not do: if (total_bytes > len) return 0; but if total_bytes > len set total_bytes to len instead. Or, isn't your code only handling STRING_CSTs and nothing else? Then perhaps just export native_encode_string too and add the optional argument to that. Jakub