On Wed, Jul 05, 2017 at 01:19:27PM +0300, Maxim Ostapenko wrote: > But won't we need to replace all alloca uses manually in this case? E.g. to > change str.1_18 value to _27? > > str.1_18 = __builtin_alloca_with_align (_16, 256); > *str.1_18[index_19(D)] ={v} 49; > > to > > _26 = __builtin_alloca_with_align (_25, 256); > _27 = _26 + 32; > __builtin___asan_alloca_poison (_27, _16); > last_alloca_addr.4_32 = _26; > str.1_18 = _27; > *str.1_18[index_19(D)] ={v} 49;
You could do that, e.g. using replace_uses_by. Or you could save the lhs from the old __builtin_alloca*, gimple_call_set_lhs to a new SSA_NAME, use that in the following stmt and use the old lhs as the lhs of that. If needed update SSA_NAME_DEF_STMT (lhs) if the functions don't do it for you (but I think they should). Anyway, this is not a strong requirement, the most important is to fix the comments, then move the replace_call_with_value call, the rest is just try if it works and if it doesn't, keep what you have. Jakub