diff --git a/loopy/target/c/__init__.py b/loopy/target/c/__init__.py index e4835a3638b43619f9b93f45958382218b701642..7cc53d84038d1a10836fc28ecc5bc74a9e4fb209 100644 --- a/loopy/target/c/__init__.py +++ b/loopy/target/c/__init__.py @@ -486,6 +486,8 @@ class CASTBuilder(ASTBuilderBase): * product(si for si in idi.shape)) ecm = self.get_expression_to_code_mapper(codegen_state) + from loopy.symbolic import ConstantFoldingMapper + cfm = ConstantFoldingMapper() for bs_name, bs_sizes in sorted(six.iteritems(base_storage_sizes)): bs_var_decl = Value("char", bs_name) @@ -494,6 +496,7 @@ class CASTBuilder(ASTBuilderBase): bs_var_decl, single_valued(base_storage_to_scope[bs_name])) # FIXME: Could try to use isl knowledge to simplify max. + bs_sizes = tuple(cfm.evaluate(s) for s in bs_sizes) if all(isinstance(bs, int) for bs in bs_sizes): bs_size_max = max(bs_sizes) else: