By the current lowering, the parentheses operation results
in generation of NoReassocOp inside the ElementalOp (i.e.
the result of NoReassocOp is the one yielded by the ElementalOp).
This does not make much sense, because there is no reordering
opportunity for YieldElementOp operand-result. HLFIR seems to be more
clear when NoReassocOp is applied to the result of ElementalOp.
Moreover, with this representation the elemental inlining
is not trying to do illegal inlining, e.g.:
module mod
contains
elemental subroutine sub(a,b)
integer ,intent(out) :: a
integer,intent(in) :: b
a = b
end subroutine
end
use mod
integer array1(3,2),expected(3,2)
data array1(:,1)/1,2,3/,array1(:,2)/-1,-2,-3/
expected = array1(3:1:-1,2:1:-1)
call sub(array1,(array1(3:1:-1,2:1:-1)))
if (any(array1/=expected)) then
print *, 'Fail'
else
print *, 'OK'
end if
end