From c080f4b59666bb3d7012bea8c1d0d36d04c6a833 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Fri, 8 Aug 2014 04:03:37 +0200 Subject: [PATCH] Fix detection of SEF in assignments with vector/rot fields as LHS. --- lslopt/lsloptimizer.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lslopt/lsloptimizer.py b/lslopt/lsloptimizer.py index 605f51d..ee47bc3 100644 --- a/lslopt/lsloptimizer.py +++ b/lslopt/lsloptimizer.py @@ -485,8 +485,13 @@ class optimizer(renamer, deadcode): # We have a regular assignment either way now. Simplify the RHS. self.FoldTree(node['ch'], 1) - if child[1]['nt'] == 'IDENT' and child[1]['name'] == child[0]['name'] \ - and child[1]['scope'] == child[0]['scope']: + if child[0]['nt'] == child[1]['nt'] == 'IDENT' \ + and child[1]['name'] == child[0]['name'] \ + and child[1]['scope'] == child[0]['scope'] \ + or child[0]['nt'] == child[1]['nt'] == 'FLD' \ + and child[1]['ch'][0]['name'] == child[0]['ch'][0]['name'] \ + and child[1]['ch'][0]['scope'] == child[0]['ch'][0]['scope'] \ + and child[1]['fld'] == child[0]['fld']: node['SEF'] = True self.FoldStmt(parent, index) return