val_lt_val guard causes AWLF failure
Bugzilla Link | 989 |
Created on | Jul 06, 2012 18:54 |
Version | svn |
OS | Linux |
Architecture | PC |
Extended Description
This is a day-0 problem with guards, affecting those guards having two arguments. As an example, this AWLF unit test: use Array: {iota,sum}; int[*] id(int[*] y) { return(y); } int main() { N = _max_SxS_( 1, id(20)); ZZ = with { ([1] <= iv=[i] <= .) { temp = iota( i); offset = _sub_SxS_( i, 1); el = _sel_VxA_( [offset], temp); } : el; } : genarray( [ N], 42); ZZZ = sum(ZZ); z = _sub_SxS_(ZZZ, 213); return(z); } If compiled with: sac2c ~/sac/testsuite/optimizations/awlf/selInWL.sac -doawlf -nowlf -bopt:uglf this fails to AWLF the iota() out of existence, because we have, essentially: offset = i - 1; p, offset' = val_lt_val( offset, i); This can not be rewritten a la CTZ, because the guard result must be PRF_ARG1, so we must not tinker with offset. We can, however, rewrite it as: p = offset < i; offset' = guard( offset, all(p)); I'll put it on my list to write a traversal for this, unless someone is keen to do it first.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information