> > Now afunc writes to __var_5_mma only indirectly so I think it is correct > > that > > we optimize the conditional out. > > > > Easy fix would be to add -fno-ipa-modref, but perhaps someone with > > better understanding of Fortran would help me to improve the testcase so > > the calls to matmul_r4 remains reachable? > > I think the two matmul_r4 cases were missed optimizations before so just > changing the expected number of calls to zero is the correct fix here. Indeed > we can now statically determine the matrices are not large and so only > keep the inline copy.
I have updated the matmul as follows. gcc/testsuite/ChangeLog: 2021-11-11 Jan Hubicka <hubi...@ucw.cz> * gfortran.dg/inline_matmul_17.f90: Fix template diff --git a/gcc/testsuite/gfortran.dg/inline_matmul_17.f90 b/gcc/testsuite/gfortran.dg/inline_matmul_17.f90 index d2ca8e2948a..cff4b6ce5e2 100644 --- a/gcc/testsuite/gfortran.dg/inline_matmul_17.f90 +++ b/gcc/testsuite/gfortran.dg/inline_matmul_17.f90 @@ -45,4 +45,4 @@ program main c = matmul(a, bfunc()) if (any(c-d /= 0)) STOP 6 end program main -! { dg-final { scan-tree-dump-times "matmul_r4" 2 "optimized" } } +! { dg-final { scan-tree-dump-not "matmul_r4" "optimized" } }