From 717d361fd0a1e8a5216b5c81b2993f0dfd342ef3 Mon Sep 17 00:00:00 2001 From: Rafael Ravedutti Lucio Machado <rafael.r.ravedutti@fau.de> Date: Fri, 15 Jan 2021 19:19:20 +0100 Subject: [PATCH] Do not include access indexes in the variants Signed-off-by: Rafael Ravedutti Lucio Machado <rafael.r.ravedutti@fau.de> --- transformations/LICM.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/transformations/LICM.py b/transformations/LICM.py index e6e86fd..ffa3327 100644 --- a/transformations/LICM.py +++ b/transformations/LICM.py @@ -37,6 +37,18 @@ class SetBlockVariants(Mutator): ast_node.block = self.mutate(ast_node.block) return ast_node + def mutate_BinOp(self, ast_node): + # For property accesses, we only want to include the property name, and not + # the index that is also present in the expression + ast_node.lhs = self.mutate(ast_node.lhs) + return ast_node + + def mutate_ArrayAccess(self, ast_node): + # For array accesses, we only want to include the array name, and not + # the index that is also present in the access node + ast_node.array = self.mutate(ast_node.array) + return ast_node + def mutate_Array(self, ast_node): return self.push_variant(ast_node) @@ -155,7 +167,7 @@ class LICM(Mutator): last_loop = self.loops[-1] #print(f"variants = {last_loop.block.variants}, terminals = {ast_node.bin_op.terminals}") if not last_loop.block.variants.intersection(ast_node.bin_op.terminals): - print(f'lifting {ast_node.bin_op.id()}') + #print(f'lifting {ast_node.bin_op.id()}') self.lifts[id(last_loop)].append(ast_node) return None -- GitLab