IVE misses case when vector IV is an N_arg in condfun
Extended Description
Created an attachment (id=749)
source code to reproduce fault
[I think the condfun part is not important here.]
In the following, if iv1 and iv2 are scalars, IVE
works properly. If they are vectors (as below), IVE
fails to convert the vect2offset into an idxs2offset.
use Array:{sel};
int[*] id( int[*] y)
{ return(y);
}
int main()
{
v1 = id([1,0,3]);
v2 = id([4,5,6]);
iv1 = id([1]);
iv2 = id([2]);
z = _eq_SxS_( 2, id(2)) ? v1[ iv1] : v2[iv2];
return(z);
}
IVERASprf is probably the culprit. iv does not have an SSAASSIGN,
because it's an N_arg, so it does not call ReplaceByIdx2Offset.
I think what we could do here is the following:
For the N_arg case, if iv is AKS, we could build an N_array
of the iv elements, forming iv'. That would make IVERASprf happy,
because iv' would have an SSAASSIGN of an N_array, at which
point ReplaceByIdx2Offset would be able to do the replace.
This is slowing things down a bit, here and there!
In particular, stdlib where() gets nailed by it.