Records do not optimise away selection
Replacing a multi-operator with-loop with an equivalent records formulation leads to extreme performance degradation as sacprelude_d::sel
does not optimise to _idx_sel_
. Attached are the two versions, relevant sections after bopt
:
records.sac
double[*] _pinl_735__dss_679 { , NN } ;
double[*] _pinl_734__dss_678 { , NN } ;
double[*] _pinl_733__dss_677 { , NN } ;
...
_dss_579__flat_20_x, _dss_579__flat_20_y, _dss_579__flat_20_z = with /** FOLDABLE (all gen's const) **/
/** REFERENCED: 3 (total num refs) **/
{
/* Partn */
([ 0 ] <= iv=[_eat_147] (IDXS:_wlidx_1475__dss_579__flat_20_x) < [ 100000 ] genwidth [ 100000 ])
{
_pinl_733__dss_677 = sacprelude_d::sel( iv, _dss_578_px_x) ;
_pinl_734__dss_678 = sacprelude_d::sel( iv, _dss_578_px_y) ;
_pinl_735__dss_679 = sacprelude_d::sel( iv, _dss_578_px_z) ;
_pinl_729__dss_675__flat_84_x = _type_conv_( double, _pinl_733__dss_677);
_pinl_728__dss_675__flat_84_y = _type_conv_( double, _pinl_734__dss_678);
_pinl_727__dss_675__flat_84_z = _type_conv_( double, _pinl_735__dss_679);
_dss_582__flat_34_x, _dss_582__flat_34_y, _dss_582__flat_34_z = with /** FOLDABLE (all gen's const) **/
multioperator.sac
ax, ay, az = with /** FOLDABLE (all gen's const) **/
/** REFERENCED: 3 (total num refs) **/
{
/* Partn */
([ 0 ] <= iv=[_eat_71] (IDXS:_wlidx_2916_ax) < [ 100000 ] genwidth [ 100000 ])
{
_ivesli_2932 = _idxs2offset_( [ 100000 ], _eat_71);
_pinl_302__flat_405 = _idx_sel_( _ivesli_2932, pz);
_pinl_313__flat_405 = _idx_sel_( _ivesli_2932, py);
_pinl_324__flat_405 = _idx_sel_( _ivesli_2932, px);
x, y, z = with /** FOLDABLE (all gen's const) **/
It looks like the problem may be that the compiler cannot infer that double[*] _pinl_735__dss_679
is really double[.] _pinl_735__dss_679
.multioperator.opt