Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 8108795

Browse files
author
Sven Verdoolaege
committed
codegen_llvm.cc: islIdToInt: use isl::aff::eval
This simplifies the code.
1 parent 9115eaf commit 8108795

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/core/polyhedral/codegen_llvm.cc

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,19 +92,11 @@ int64_t IslExprToSInt(isl::ast_expr e) {
9292

9393
int64_t islIdToInt(isl::ast_expr e, isl::set context) {
9494
CHECK(isl_ast_expr_get_type(e.get()) == isl_ast_expr_type::isl_ast_expr_id);
95-
CHECK_NE(-1, context.find_dim_by_id(isl::dim_type::param, e.get_id()));
96-
while (context.dim(isl::dim_type::param) > 1) {
97-
for (unsigned int d = 0; d < context.dim(isl::dim_type::param); ++d) {
98-
if (d == context.find_dim_by_id(isl::dim_type::param, e.get_id())) {
99-
continue;
100-
}
101-
context = context.remove_dims(isl::dim_type::param, d, 1);
102-
}
103-
}
95+
auto space = context.get_space();
96+
isl::aff param(isl::aff::param_on_domain_space(space, e.get_id()));
10497
auto p = context.sample_point();
105-
106-
auto val = toSInt(p.get_coordinate_val(isl::dim_type::param, 0));
107-
return val;
98+
CHECK(context.is_equal(p));
99+
return toSInt(param.eval(p));
108100
}
109101

110102
int64_t getTensorSize(isl::set context, const Halide::Expr& e) {

0 commit comments

Comments
 (0)