Index: polly/lib/CodeGen/IslNodeBuilder.cpp =================================================================== --- polly/lib/CodeGen/IslNodeBuilder.cpp +++ polly/lib/CodeGen/IslNodeBuilder.cpp @@ -148,19 +148,9 @@ /// Return true if a return value of Predicate is true for the value represented /// by passed isl_ast_expr_int. -static bool checkIslAstExprInt(__isl_take isl_ast_expr *Expr, - isl_bool (*Predicate)(__isl_keep isl_val *)) { - if (isl_ast_expr_get_type(Expr) != isl_ast_expr_int) { - isl_ast_expr_free(Expr); +static bool checkIslAstExprInt(isl::ast_expr Expr, long val) { + if (!Expr.isa() || !Expr.val().eq(val)) return false; - } - auto ExprVal = isl_ast_expr_get_val(Expr); - isl_ast_expr_free(Expr); - if (Predicate(ExprVal) != isl_bool_true) { - isl_val_free(ExprVal); - return false; - } - isl_val_free(ExprVal); return true; } @@ -187,10 +177,10 @@ } isl::ast_expr Init = For.init(); - if (!checkIslAstExprInt(Init.release(), isl_val_is_zero)) + if (!checkIslAstExprInt(Init, 0)) return -1; isl::ast_expr Inc = For.inc(); - if (!checkIslAstExprInt(Inc.release(), isl_val_is_one)) + if (!checkIslAstExprInt(Inc, 1)) return -1; CmpInst::Predicate Predicate; isl::ast_expr UB = getUpperBound(For, Predicate);