UESD in SAACYC swaps arguments, but forgets to swap function type.
|
|
Bugzilla Link |
545 |
Created on |
Aug 06, 2009 21:06 |
Resolution |
FIXED |
Resolved on |
Jan 23, 2014 14:44 |
Version |
1.00beta |
OS |
Linux |
Architecture |
PC |
Extended Description
The following is a clip from a diff of -b11:saacyc:dl:2 and
:uesd:2 in sac/testsuite/optimizations/constantfolding:
sac2c SCSprf_sub.sac -v4 -noprfunr
gives these two lines (and several others of the same ilk).
< _al_762 = _add_SxV_( _esd_760, _al_761);
---
> _al_762 = _sub_SxV_( _al_761, _mse_593__cf_448_idx);
Note that the type of _al_761 has apparently changed from
V to S. No, it hasn't - the N_prf is wrong.
The failure mode from this is unpleasant:
Propagating constants and variables ...
TRAVERSE ERROR: node of type N_typedef found where N_avis was expected!
The problem appears to lie in TogglePrf or its callers:
When an N_prf is mapped to its complementary function (e.g.,
add->sub, mul->div), UESD once properly renamed the
primitive when it swapped argument order. This can be seen,
sort of, in -r11895. The UESD rewrite appears to have lost
this, and it is fairly surprising that it works at all.
Perhaps ESD has the same bug, and if nobody blinks in the interim,
the damage gets undone?