Re: Remove redundant calls to deterministic functions

2024-11-18 Thread Richard Biener
On Mon, 18 Nov 2024, Jan Hubicka wrote: > > I don't think we handle > > > > mem = foo (); > > Hmm, we can't > struct val {int a,b;}; > > [[gnu::noinline]] > struct val dup(int *a) > { > a[0]=a[1]; > struct val ret; > ret.a = a[2]; > ret.b = a[3]; > retur

Remove redundant calls to deterministic functions

2024-11-18 Thread Jan Hubicka
Last year I made modref to track which functions are deterministic - i.e. they produce same effects given same inputs (including memory) and which functions have no side effects (which includes infinite loops, trapping etc.). deterministic functions can be CSEed just as looping pure/const. These a

Re: Remove redundant calls to deterministic functions

2024-11-18 Thread Jan Hubicka
> I don't think we handle > > mem = foo (); Hmm, we can't struct val {int a,b;}; [[gnu::noinline]] struct val dup(int *a) { a[0]=a[1]; struct val ret; ret.a = a[2]; ret.b = a[3]; return ret; } int test (int *b) { struct val ret = dup (b);

Re: Remove redundant calls to deterministic functions

2024-11-18 Thread Richard Biener
On Sun, 17 Nov 2024, Jan Hubicka wrote: > Last year I made modref to track which functions are deterministic - i.e. they > produce same effects given same inputs (including memory) and which functions > have no side effects (which includes infinite loops, trapping etc.). > > deterministic functio