diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -2253,7 +2253,7 @@ /// Return the define behavior context, or if not available, its approximation /// from all other contexts. isl::set getBestKnownDefinedBehaviorContext() const { - if (DefinedBehaviorContext) + if (!DefinedBehaviorContext.is_null()) return DefinedBehaviorContext; return Context.intersect_params(AssumedContext).subtract(InvalidContext); diff --git a/polly/lib/Analysis/DependenceInfo.cpp b/polly/lib/Analysis/DependenceInfo.cpp --- a/polly/lib/Analysis/DependenceInfo.cpp +++ b/polly/lib/Analysis/DependenceInfo.cpp @@ -658,7 +658,7 @@ assert(!StmtScat.is_null() && "Schedules that contain extension nodes require special handling."); - if (!ScheduleSpace) + if (ScheduleSpace.is_null()) ScheduleSpace = StmtScat.get_space().range(); Schedule = Schedule.add_map(StmtScat); diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -612,7 +612,7 @@ BasicBlock *BB = getRegionNodeBasicBlock(RN); isl::set &Domain = scop->getOrInitEmptyDomain(BB); - assert(Domain); + assert(!Domain.is_null()); // Under the union of all predecessor conditions we can reach this block. isl::set PredDom = getPredecessorDomainConstraints(BB, Domain); @@ -653,7 +653,7 @@ } isl::set Domain = scop->getOrInitEmptyDomain(BB); - assert(Domain && "Cannot propagate a nullptr"); + assert(!Domain.is_null() && "Cannot propagate a nullptr"); Loop *ExitBBLoop = getFirstNonBoxedLoopFor(ExitBB, LI, scop->getBoxedLoops()); @@ -664,7 +664,8 @@ // If the exit domain is not yet created we set it otherwise we "add" the // current domain. - ExitDomain = ExitDomain ? AdjustedDomain.unite(ExitDomain) : AdjustedDomain; + ExitDomain = + !ExitDomain.is_null() ? AdjustedDomain.unite(ExitDomain) : AdjustedDomain; // Initialize the invalid domain. InvalidDomainMap[ExitBB] = ExitDomain.empty(ExitDomain.get_space()); @@ -970,7 +971,7 @@ // successor block. isl::set &SuccDomain = scop->getOrInitEmptyDomain(SuccBB); - if (SuccDomain) { + if (!SuccDomain.is_null()) { SuccDomain = SuccDomain.unite(CondSet).coalesce(); } else { // Initialize the invalid domain. @@ -1013,7 +1014,7 @@ bool ContainsErrorBlock = containsErrorBlock(RN, scop->getRegion(), LI, DT); BasicBlock *BB = getRegionNodeBasicBlock(RN); isl::set &Domain = scop->getOrInitEmptyDomain(BB); - assert(Domain && "Cannot propagate a nullptr"); + assert(!Domain.is_null() && "Cannot propagate a nullptr"); isl::set InvalidDomain = InvalidDomainMap[BB]; @@ -1131,9 +1132,9 @@ // interpreted as the empty schedule. Can also return null if both schedules are // empty. static isl::schedule combineInSequence(isl::schedule Prev, isl::schedule Succ) { - if (!Prev) + if (Prev.is_null()) return Succ; - if (!Succ) + if (Succ.is_null()) return Prev; return Prev.sequence(Succ); @@ -1155,7 +1156,7 @@ // @returns A mapping from USet to its N-th dimension. static isl::multi_union_pw_aff mapToDimension(isl::union_set USet, int N) { assert(N >= 0); - assert(USet); + assert(!USet.is_null()); assert(!USet.is_empty()); auto Result = isl::union_pw_multi_aff::empty(USet.get_space()); @@ -1288,7 +1289,7 @@ ++LoopData; --Dimension; - if (Schedule) { + if (!Schedule.is_null()) { isl::union_set Domain = Schedule.get_domain(); isl::multi_union_pw_aff MUPA = mapToDimension(Domain, Dimension); Schedule = Schedule.insert_partial_schedule(MUPA); @@ -1305,7 +1306,7 @@ // It is easier to insert the marks here that do it retroactively. isl::id IslLoopId = createIslLoopAttr(scop->getIslCtx(), L); - if (IslLoopId) + if (!IslLoopId.is_null()) Schedule = Schedule.get_root() .get_child(0) .insert_mark(IslLoopId) @@ -2808,9 +2809,11 @@ for (ScopStmt &Stmt : *scop) { InvariantAccessesTy InvariantAccesses; - for (MemoryAccess *Access : Stmt) - if (isl::set NHCtx = getNonHoistableCtx(Access, Writes)) + for (MemoryAccess *Access : Stmt) { + isl::set NHCtx = getNonHoistableCtx(Access, Writes); + if (!NHCtx.is_null()) InvariantAccesses.push_back({Access, NHCtx}); + } // Transfer the memory access from the statement to the SCoP. for (auto InvMA : InvariantAccesses) @@ -3046,7 +3049,8 @@ if (!Values.count(AccInst)) continue; - if (isl::id ParamId = scop->getIdForParam(Parameter)) { + isl::id ParamId = scop->getIdForParam(Parameter); + if (!ParamId.is_null()) { int Dim = DomainCtx.find_dim_by_id(isl::dim::param, ParamId); if (Dim >= 0) DomainCtx = DomainCtx.eliminate(isl::dim::param, Dim, 1); @@ -3110,7 +3114,7 @@ // Unify the execution context of the class and this statement. isl::set IAClassDomainCtx = IAClass.ExecutionContext; - if (IAClassDomainCtx) + if (!IAClassDomainCtx.is_null()) IAClassDomainCtx = IAClassDomainCtx.unite(MACtx).coalesce(); else IAClassDomainCtx = MACtx; @@ -3337,7 +3341,7 @@ // enclose the accessed memory region by MinPMA and MaxPMA. The pointer // we test during code generation might now point after the end of the // allocated array but we will never dereference it anyway. - assert((!MaxPMA || MaxPMA.dim(isl::dim::out)) && + assert((MaxPMA.is_null() || MaxPMA.dim(isl::dim::out)) && "Assumed at least one output dimension"); Pos = MaxPMA.dim(isl::dim::out) - 1; @@ -3347,7 +3351,7 @@ LastDimAff = LastDimAff.add(OneAff); MaxPMA = MaxPMA.set_pw_aff(Pos, LastDimAff); - if (!MinPMA || !MaxPMA) + if (MinPMA.is_null() || MaxPMA.is_null()) return false; MinMaxAccesses.push_back(std::make_pair(MinPMA, MaxPMA)); diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -307,7 +307,7 @@ return; } - assert(DimensionSizesPw.size() > 0 && !DimensionSizesPw[0]); + assert(DimensionSizesPw.size() > 0 && DimensionSizesPw[0].is_null()); assert(!this->FAD); this->FAD = FAD; @@ -1068,7 +1068,7 @@ } void MemoryAccess::setNewAccessRelation(isl::map NewAccess) { - assert(NewAccess); + assert(!NewAccess.is_null()); #ifndef NDEBUG // Check domain space compatibility. @@ -1132,7 +1132,7 @@ if (Domain.is_empty()) return isl::map::from_aff(isl::aff(isl::local_space(getDomainSpace()))); auto Schedule = getParent()->getSchedule(); - if (!Schedule) + if (Schedule.is_null()) return {}; Schedule = Schedule.intersect_domain(isl::union_set(Domain)); if (Schedule.is_empty()) @@ -1281,14 +1281,14 @@ OS << "\t" << getBaseName() << "\n"; OS.indent(12) << "Domain :=\n"; - if (Domain) { + if (!Domain.is_null()) { OS.indent(16) << getDomainStr() << ";\n"; } else OS.indent(16) << "n/a\n"; OS.indent(12) << "Schedule :=\n"; - if (Domain) { + if (!Domain.is_null()) { OS.indent(16) << getScheduleStr() << ";\n"; } else OS.indent(16) << "n/a\n"; @@ -1584,7 +1584,7 @@ // TODO: actually need to check if it has a FAD, but for now this works. if (Array->getNumberOfDimensions() > 0) { isl::pw_aff PwAff = Array->getDimensionSizePw(0); - if (!PwAff) + if (PwAff.is_null()) continue; isl::id Id = PwAff.get_dim_id(isl::dim::param, 0); @@ -1784,7 +1784,7 @@ void Scop::removeStmtNotInDomainMap() { removeStmts([this](ScopStmt &Stmt) -> bool { isl::set Domain = DomainMap.lookup(Stmt.getEntryBlock()); - if (!Domain) + if (Domain.is_null()) return true; return Domain.is_empty(); }); @@ -1895,7 +1895,7 @@ std::string Scop::getContextStr() const { return getContext().to_str(); } std::string Scop::getAssumedContextStr() const { - assert(AssumedContext && "Assumed context not yet built"); + assert(!AssumedContext.is_null() && "Assumed context not yet built"); return AssumedContext.to_str(); } @@ -1950,7 +1950,7 @@ } isl::set Scop::getAssumedContext() const { - assert(AssumedContext && "Assumed context not yet built"); + assert(!AssumedContext.is_null() && "Assumed context not yet built"); return AssumedContext; } @@ -2134,7 +2134,7 @@ } void Scop::intersectDefinedBehavior(isl::set Set, AssumptionSign Sign) { - if (!DefinedBehaviorContext) + if (DefinedBehaviorContext.is_null()) return; if (Sign == AS_ASSUMPTION) @@ -2171,7 +2171,7 @@ OS.indent(4) << InvalidContext << "\n"; OS.indent(4) << "Defined Behavior Context:\n"; - if (DefinedBehaviorContext) + if (!DefinedBehaviorContext.is_null()) OS.indent(4) << DefinedBehaviorContext << "\n"; else OS.indent(4) << "\n"; @@ -2284,7 +2284,7 @@ // the SCoP and return a dummy value. This way we do not need to add error // handling code to all users of this function. auto PWAC = Affinator.getPwAff(E, BB, RecordedAssumptions); - if (PWAC.first) { + if (!PWAC.first.is_null()) { // TODO: We could use a heuristic and either use: // SCEVAffinator::takeNonNegativeAssumption // or diff --git a/polly/lib/CodeGen/IslAst.cpp b/polly/lib/CodeGen/IslAst.cpp --- a/polly/lib/CodeGen/IslAst.cpp +++ b/polly/lib/CodeGen/IslAst.cpp @@ -570,7 +570,7 @@ IslAstUserPayload *IslAstInfo::getNodePayload(const isl::ast_node &Node) { isl::id Id = Node.get_annotation(); - if (!Id) + if (Id.is_null()) return nullptr; IslAstUserPayload *Payload = (IslAstUserPayload *)Id.get_user(); return Payload; diff --git a/polly/lib/Exchange/JSONExporter.cpp b/polly/lib/Exchange/JSONExporter.cpp --- a/polly/lib/Exchange/JSONExporter.cpp +++ b/polly/lib/Exchange/JSONExporter.cpp @@ -219,7 +219,7 @@ JScop.getString("context").getValue().str()}; // Check whether the context was parsed successfully. - if (!NewContext) { + if (NewContext.is_null()) { errs() << "The context was not parsed successfully by ISL.\n"; return false; } diff --git a/polly/lib/External/isl/include/isl/isl-noexceptions.h b/polly/lib/External/isl/include/isl/isl-noexceptions.h --- a/polly/lib/External/isl/include/isl/isl-noexceptions.h +++ b/polly/lib/External/isl/include/isl/isl-noexceptions.h @@ -246,7 +246,6 @@ inline __isl_keep isl_aff *get() const; inline __isl_give isl_aff *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -349,7 +348,6 @@ inline __isl_keep isl_aff_list *get() const; inline __isl_give isl_aff_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -394,7 +392,6 @@ inline __isl_keep isl_ast_build *get() const; inline __isl_give isl_ast_build *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline ast_expr access_from(multi_pw_aff mpa) const; @@ -434,7 +431,6 @@ inline __isl_keep isl_ast_expr *get() const; inline __isl_give isl_ast_expr *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -492,7 +488,6 @@ inline __isl_keep isl_ast_expr_list *get() const; inline __isl_give isl_ast_expr_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -536,7 +531,6 @@ inline __isl_keep isl_ast_node *get() const; inline __isl_give isl_ast_node *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -586,7 +580,6 @@ inline __isl_keep isl_ast_node_list *get() const; inline __isl_give isl_ast_node_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -631,7 +624,6 @@ inline __isl_keep isl_basic_map *get() const; inline __isl_give isl_basic_map *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -764,7 +756,6 @@ inline __isl_keep isl_basic_map_list *get() const; inline __isl_give isl_basic_map_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -810,7 +801,6 @@ inline __isl_keep isl_basic_set *get() const; inline __isl_give isl_basic_set *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -914,7 +904,6 @@ inline __isl_keep isl_basic_set_list *get() const; inline __isl_give isl_basic_set_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -959,7 +948,6 @@ inline __isl_keep isl_constraint *get() const; inline __isl_give isl_constraint *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline void dump() const; @@ -1007,7 +995,6 @@ inline __isl_keep isl_constraint_list *get() const; inline __isl_give isl_constraint_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1051,7 +1038,6 @@ inline __isl_keep isl_fixed_box *get() const; inline __isl_give isl_fixed_box *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1085,7 +1071,6 @@ inline __isl_keep isl_id *get() const; inline __isl_give isl_id *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1118,7 +1103,6 @@ inline __isl_keep isl_id_list *get() const; inline __isl_give isl_id_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1162,7 +1146,6 @@ inline __isl_keep isl_id_to_ast_expr *get() const; inline __isl_give isl_id_to_ast_expr *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline void dump() const; @@ -1197,7 +1180,6 @@ inline __isl_keep isl_local_space *get() const; inline __isl_give isl_local_space *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline void dump() const; @@ -1251,7 +1233,6 @@ inline __isl_keep isl_map *get() const; inline __isl_give isl_map *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1465,7 +1446,6 @@ inline __isl_keep isl_map_list *get() const; inline __isl_give isl_map_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1509,7 +1489,6 @@ inline __isl_keep isl_mat *get() const; inline __isl_give isl_mat *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline void dump() const; @@ -1580,7 +1559,6 @@ inline __isl_keep isl_multi_aff *get() const; inline __isl_give isl_multi_aff *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1686,7 +1664,6 @@ inline __isl_keep isl_multi_id *get() const; inline __isl_give isl_multi_id *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1741,7 +1718,6 @@ inline __isl_keep isl_multi_pw_aff *get() const; inline __isl_give isl_multi_pw_aff *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1858,7 +1834,6 @@ inline __isl_keep isl_multi_union_pw_aff *get() const; inline __isl_give isl_multi_union_pw_aff *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -1954,7 +1929,6 @@ inline __isl_keep isl_multi_val *get() const; inline __isl_give isl_multi_val *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2037,7 +2011,6 @@ inline __isl_keep isl_point *get() const; inline __isl_give isl_point *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2076,7 +2049,6 @@ inline __isl_keep isl_pw_aff *get() const; inline __isl_give isl_pw_aff *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2197,7 +2169,6 @@ inline __isl_keep isl_pw_aff_list *get() const; inline __isl_give isl_pw_aff_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2252,7 +2223,6 @@ inline __isl_keep isl_pw_multi_aff *get() const; inline __isl_give isl_pw_multi_aff *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2358,7 +2328,6 @@ inline __isl_keep isl_pw_multi_aff_list *get() const; inline __isl_give isl_pw_multi_aff_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2403,7 +2372,6 @@ inline __isl_keep isl_pw_qpolynomial *get() const; inline __isl_give isl_pw_qpolynomial *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2482,7 +2450,6 @@ inline __isl_keep isl_pw_qpolynomial_fold_list *get() const; inline __isl_give isl_pw_qpolynomial_fold_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2511,7 +2478,6 @@ inline __isl_keep isl_pw_qpolynomial_list *get() const; inline __isl_give isl_pw_qpolynomial_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2555,7 +2521,6 @@ inline __isl_keep isl_qpolynomial *get() const; inline __isl_give isl_qpolynomial *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline void dump() const; @@ -2623,7 +2588,6 @@ inline __isl_keep isl_qpolynomial_list *get() const; inline __isl_give isl_qpolynomial_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2668,7 +2632,6 @@ inline __isl_keep isl_schedule *get() const; inline __isl_give isl_schedule *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2713,7 +2676,6 @@ inline __isl_keep isl_schedule_constraints *get() const; inline __isl_give isl_schedule_constraints *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2757,7 +2719,6 @@ inline __isl_keep isl_schedule_node *get() const; inline __isl_give isl_schedule_node *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -2850,7 +2811,6 @@ inline __isl_keep isl_set *get() const; inline __isl_give isl_set *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3032,7 +2992,6 @@ inline __isl_keep isl_set_list *get() const; inline __isl_give isl_set_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3079,7 +3038,6 @@ inline __isl_keep isl_space *get() const; inline __isl_give isl_space *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3182,7 +3140,6 @@ inline __isl_keep isl_term *get() const; inline __isl_give isl_term *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline isl_size dim(isl::dim type) const; @@ -3214,7 +3171,6 @@ inline __isl_keep isl_union_access_info *get() const; inline __isl_give isl_union_access_info *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; @@ -3248,7 +3204,6 @@ inline __isl_keep isl_union_flow *get() const; inline __isl_give isl_union_flow *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; @@ -3286,7 +3241,6 @@ inline __isl_keep isl_union_map *get() const; inline __isl_give isl_union_map *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3426,7 +3380,6 @@ inline __isl_keep isl_union_map_list *get() const; inline __isl_give isl_union_map_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3474,7 +3427,6 @@ inline __isl_keep isl_union_pw_aff *get() const; inline __isl_give isl_union_pw_aff *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3546,7 +3498,6 @@ inline __isl_keep isl_union_pw_aff_list *get() const; inline __isl_give isl_union_pw_aff_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3598,7 +3549,6 @@ inline __isl_keep isl_union_pw_multi_aff *get() const; inline __isl_give isl_union_pw_multi_aff *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3675,7 +3625,6 @@ inline __isl_keep isl_union_pw_multi_aff_list *get() const; inline __isl_give isl_union_pw_multi_aff_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3720,7 +3669,6 @@ inline __isl_keep isl_union_pw_qpolynomial *get() const; inline __isl_give isl_union_pw_qpolynomial *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; @@ -3790,7 +3738,6 @@ inline __isl_keep isl_union_set *get() const; inline __isl_give isl_union_set *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3880,7 +3827,6 @@ inline __isl_keep isl_union_set_list *get() const; inline __isl_give isl_union_set_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -3927,7 +3873,6 @@ inline __isl_keep isl_val *get() const; inline __isl_give isl_val *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -4010,7 +3955,6 @@ inline __isl_keep isl_val_list *get() const; inline __isl_give isl_val_list *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline std::string to_str() const; inline void dump() const; @@ -4054,7 +3998,6 @@ inline __isl_keep isl_vec *get() const; inline __isl_give isl_vec *release(); inline bool is_null() const; - inline explicit operator bool() const; inline ctx get_ctx() const; inline void dump() const; @@ -4149,9 +4092,6 @@ bool aff::is_null() const { return ptr == nullptr; } -aff::operator bool() const { - return !is_null(); -} ctx aff::get_ctx() const { @@ -4667,9 +4607,6 @@ bool aff_list::is_null() const { return ptr == nullptr; } -aff_list::operator bool() const { - return !is_null(); -} ctx aff_list::get_ctx() const { @@ -4843,9 +4780,6 @@ bool ast_build::is_null() const { return ptr == nullptr; } -ast_build::operator bool() const { - return !is_null(); -} ctx ast_build::get_ctx() const { @@ -4981,9 +4915,6 @@ bool ast_expr::is_null() const { return ptr == nullptr; } -ast_expr::operator bool() const { - return !is_null(); -} ctx ast_expr::get_ctx() const { @@ -5230,9 +5161,6 @@ bool ast_expr_list::is_null() const { return ptr == nullptr; } -ast_expr_list::operator bool() const { - return !is_null(); -} ctx ast_expr_list::get_ctx() const { @@ -5401,9 +5329,6 @@ bool ast_node::is_null() const { return ptr == nullptr; } -ast_node::operator bool() const { - return !is_null(); -} ctx ast_node::get_ctx() const { @@ -5602,9 +5527,6 @@ bool ast_node_list::is_null() const { return ptr == nullptr; } -ast_node_list::operator bool() const { - return !is_null(); -} ctx ast_node_list::get_ctx() const { @@ -5778,9 +5700,6 @@ bool basic_map::is_null() const { return ptr == nullptr; } -basic_map::operator bool() const { - return !is_null(); -} ctx basic_map::get_ctx() const { @@ -6485,9 +6404,6 @@ bool basic_map_list::is_null() const { return ptr == nullptr; } -basic_map_list::operator bool() const { - return !is_null(); -} ctx basic_map_list::get_ctx() const { @@ -6666,9 +6582,6 @@ bool basic_set::is_null() const { return ptr == nullptr; } -basic_set::operator bool() const { - return !is_null(); -} ctx basic_set::get_ctx() const { @@ -7207,9 +7120,6 @@ bool basic_set_list::is_null() const { return ptr == nullptr; } -basic_set_list::operator bool() const { - return !is_null(); -} ctx basic_set_list::get_ctx() const { @@ -7384,9 +7294,6 @@ bool constraint::is_null() const { return ptr == nullptr; } -constraint::operator bool() const { - return !is_null(); -} ctx constraint::get_ctx() const { @@ -7569,9 +7476,6 @@ bool constraint_list::is_null() const { return ptr == nullptr; } -constraint_list::operator bool() const { - return !is_null(); -} ctx constraint_list::get_ctx() const { @@ -7740,9 +7644,6 @@ bool fixed_box::is_null() const { return ptr == nullptr; } -fixed_box::operator bool() const { - return !is_null(); -} ctx fixed_box::get_ctx() const { @@ -7842,9 +7743,6 @@ bool id::is_null() const { return ptr == nullptr; } -id::operator bool() const { - return !is_null(); -} ctx id::get_ctx() const { @@ -7940,9 +7838,6 @@ bool id_list::is_null() const { return ptr == nullptr; } -id_list::operator bool() const { - return !is_null(); -} ctx id_list::get_ctx() const { @@ -8111,9 +8006,6 @@ bool id_to_ast_expr::is_null() const { return ptr == nullptr; } -id_to_ast_expr::operator bool() const { - return !is_null(); -} ctx id_to_ast_expr::get_ctx() const { @@ -8224,9 +8116,6 @@ bool local_space::is_null() const { return ptr == nullptr; } -local_space::operator bool() const { - return !is_null(); -} ctx local_space::get_ctx() const { @@ -8443,9 +8332,6 @@ bool map::is_null() const { return ptr == nullptr; } -map::operator bool() const { - return !is_null(); -} ctx map::get_ctx() const { @@ -9636,9 +9522,6 @@ bool map_list::is_null() const { return ptr == nullptr; } -map_list::operator bool() const { - return !is_null(); -} ctx map_list::get_ctx() const { @@ -9807,9 +9690,6 @@ bool mat::is_null() const { return ptr == nullptr; } -mat::operator bool() const { - return !is_null(); -} ctx mat::get_ctx() const { @@ -10126,9 +10006,6 @@ bool multi_aff::is_null() const { return ptr == nullptr; } -multi_aff::operator bool() const { - return !is_null(); -} ctx multi_aff::get_ctx() const { @@ -10660,9 +10537,6 @@ bool multi_id::is_null() const { return ptr == nullptr; } -multi_id::operator bool() const { - return !is_null(); -} ctx multi_id::get_ctx() const { @@ -10883,9 +10757,6 @@ bool multi_pw_aff::is_null() const { return ptr == nullptr; } -multi_pw_aff::operator bool() const { - return !is_null(); -} ctx multi_pw_aff::get_ctx() const { @@ -11480,9 +11351,6 @@ bool multi_union_pw_aff::is_null() const { return ptr == nullptr; } -multi_union_pw_aff::operator bool() const { - return !is_null(); -} ctx multi_union_pw_aff::get_ctx() const { @@ -11954,9 +11822,6 @@ bool multi_val::is_null() const { return ptr == nullptr; } -multi_val::operator bool() const { - return !is_null(); -} ctx multi_val::get_ctx() const { @@ -12351,9 +12216,6 @@ bool point::is_null() const { return ptr == nullptr; } -point::operator bool() const { - return !is_null(); -} ctx point::get_ctx() const { @@ -12480,9 +12342,6 @@ bool pw_aff::is_null() const { return ptr == nullptr; } -pw_aff::operator bool() const { - return !is_null(); -} ctx pw_aff::get_ctx() const { @@ -13114,9 +12973,6 @@ bool pw_aff_list::is_null() const { return ptr == nullptr; } -pw_aff_list::operator bool() const { - return !is_null(); -} ctx pw_aff_list::get_ctx() const { @@ -13348,9 +13204,6 @@ bool pw_multi_aff::is_null() const { return ptr == nullptr; } -pw_multi_aff::operator bool() const { - return !is_null(); -} ctx pw_multi_aff::get_ctx() const { @@ -13893,9 +13746,6 @@ bool pw_multi_aff_list::is_null() const { return ptr == nullptr; } -pw_multi_aff_list::operator bool() const { - return !is_null(); -} ctx pw_multi_aff_list::get_ctx() const { @@ -14069,9 +13919,6 @@ bool pw_qpolynomial::is_null() const { return ptr == nullptr; } -pw_qpolynomial::operator bool() const { - return !is_null(); -} ctx pw_qpolynomial::get_ctx() const { @@ -14450,9 +14297,6 @@ bool pw_qpolynomial_fold_list::is_null() const { return ptr == nullptr; } -pw_qpolynomial_fold_list::operator bool() const { - return !is_null(); -} ctx pw_qpolynomial_fold_list::get_ctx() const { @@ -14524,9 +14368,6 @@ bool pw_qpolynomial_list::is_null() const { return ptr == nullptr; } -pw_qpolynomial_list::operator bool() const { - return !is_null(); -} ctx pw_qpolynomial_list::get_ctx() const { @@ -14695,9 +14536,6 @@ bool qpolynomial::is_null() const { return ptr == nullptr; } -qpolynomial::operator bool() const { - return !is_null(); -} ctx qpolynomial::get_ctx() const { @@ -15015,9 +14853,6 @@ bool qpolynomial_list::is_null() const { return ptr == nullptr; } -qpolynomial_list::operator bool() const { - return !is_null(); -} ctx qpolynomial_list::get_ctx() const { @@ -15191,9 +15026,6 @@ bool schedule::is_null() const { return ptr == nullptr; } -schedule::operator bool() const { - return !is_null(); -} ctx schedule::get_ctx() const { @@ -15359,9 +15191,6 @@ bool schedule_constraints::is_null() const { return ptr == nullptr; } -schedule_constraints::operator bool() const { - return !is_null(); -} ctx schedule_constraints::get_ctx() const { @@ -15522,9 +15351,6 @@ bool schedule_node::is_null() const { return ptr == nullptr; } -schedule_node::operator bool() const { - return !is_null(); -} ctx schedule_node::get_ctx() const { @@ -15983,9 +15809,6 @@ bool set::is_null() const { return ptr == nullptr; } -set::operator bool() const { - return !is_null(); -} ctx set::get_ctx() const { @@ -16992,9 +16815,6 @@ bool set_list::is_null() const { return ptr == nullptr; } -set_list::operator bool() const { - return !is_null(); -} ctx set_list::get_ctx() const { @@ -17179,9 +16999,6 @@ bool space::is_null() const { return ptr == nullptr; } -space::operator bool() const { - return !is_null(); -} ctx space::get_ctx() const { @@ -17698,9 +17515,6 @@ bool term::is_null() const { return ptr == nullptr; } -term::operator bool() const { - return !is_null(); -} ctx term::get_ctx() const { @@ -17787,9 +17601,6 @@ bool union_access_info::is_null() const { return ptr == nullptr; } -union_access_info::operator bool() const { - return !is_null(); -} ctx union_access_info::get_ctx() const { @@ -17892,9 +17703,6 @@ bool union_flow::is_null() const { return ptr == nullptr; } -union_flow::operator bool() const { - return !is_null(); -} ctx union_flow::get_ctx() const { @@ -18017,9 +17825,6 @@ bool union_map::is_null() const { return ptr == nullptr; } -union_map::operator bool() const { - return !is_null(); -} ctx union_map::get_ctx() const { @@ -18764,9 +18569,6 @@ bool union_map_list::is_null() const { return ptr == nullptr; } -union_map_list::operator bool() const { - return !is_null(); -} ctx union_map_list::get_ctx() const { @@ -18955,9 +18757,6 @@ bool union_pw_aff::is_null() const { return ptr == nullptr; } -union_pw_aff::operator bool() const { - return !is_null(); -} ctx union_pw_aff::get_ctx() const { @@ -19294,9 +19093,6 @@ bool union_pw_aff_list::is_null() const { return ptr == nullptr; } -union_pw_aff_list::operator bool() const { - return !is_null(); -} ctx union_pw_aff_list::get_ctx() const { @@ -19505,9 +19301,6 @@ bool union_pw_multi_aff::is_null() const { return ptr == nullptr; } -union_pw_multi_aff::operator bool() const { - return !is_null(); -} ctx union_pw_multi_aff::get_ctx() const { @@ -19874,9 +19667,6 @@ bool union_pw_multi_aff_list::is_null() const { return ptr == nullptr; } -union_pw_multi_aff_list::operator bool() const { - return !is_null(); -} ctx union_pw_multi_aff_list::get_ctx() const { @@ -20050,9 +19840,6 @@ bool union_pw_qpolynomial::is_null() const { return ptr == nullptr; } -union_pw_qpolynomial::operator bool() const { - return !is_null(); -} ctx union_pw_qpolynomial::get_ctx() const { @@ -20375,9 +20162,6 @@ bool union_set::is_null() const { return ptr == nullptr; } -union_set::operator bool() const { - return !is_null(); -} ctx union_set::get_ctx() const { @@ -20830,9 +20614,6 @@ bool union_set_list::is_null() const { return ptr == nullptr; } -union_set_list::operator bool() const { - return !is_null(); -} ctx union_set_list::get_ctx() const { @@ -21017,9 +20798,6 @@ bool val::is_null() const { return ptr == nullptr; } -val::operator bool() const { - return !is_null(); -} ctx val::get_ctx() const { @@ -21414,9 +21192,6 @@ bool val_list::is_null() const { return ptr == nullptr; } -val_list::operator bool() const { - return !is_null(); -} ctx val_list::get_ctx() const { @@ -21585,9 +21360,6 @@ bool vec::is_null() const { return ptr == nullptr; } -vec::operator bool() const { - return !is_null(); -} ctx vec::get_ctx() const { diff --git a/polly/lib/Support/ISLTools.cpp b/polly/lib/Support/ISLTools.cpp --- a/polly/lib/Support/ISLTools.cpp +++ b/polly/lib/Support/ISLTools.cpp @@ -49,7 +49,7 @@ isl::basic_map makeTupleSwapBasicMap(isl::space FromSpace1, isl::space FromSpace2) { // Fast-path on out-of-quota. - if (!FromSpace1 || !FromSpace2) + if (FromSpace1.is_null() || FromSpace2.is_null()) return {}; assert(FromSpace1.is_set()); @@ -132,27 +132,29 @@ } isl::map polly::singleton(isl::union_map UMap, isl::space ExpectedSpace) { - if (!UMap) + if (UMap.is_null()) return {}; if (isl_union_map_n_map(UMap.get()) == 0) return isl::map::empty(ExpectedSpace); isl::map Result = isl::map::from_union_map(UMap); - assert(!Result || Result.get_space().has_equal_tuples(ExpectedSpace)); + assert(Result.is_null() || + Result.get_space().has_equal_tuples(ExpectedSpace)); return Result; } isl::set polly::singleton(isl::union_set USet, isl::space ExpectedSpace) { - if (!USet) + if (USet.is_null()) return {}; if (isl_union_set_n_set(USet.get()) == 0) return isl::set::empty(ExpectedSpace); isl::set Result(USet); - assert(!Result || Result.get_space().has_equal_tuples(ExpectedSpace)); + assert(Result.is_null() || + Result.get_space().has_equal_tuples(ExpectedSpace)); return Result; } @@ -160,7 +162,7 @@ isl_size polly::getNumScatterDims(const isl::union_map &Schedule) { isl_size Dims = 0; for (isl::map Map : Schedule.get_map_list()) { - if (!Map) + if (Map.is_null()) continue; Dims = std::max(Dims, Map.dim(isl::dim::out)); @@ -169,7 +171,7 @@ } isl::space polly::getScatterSpace(const isl::union_map &Schedule) { - if (!Schedule) + if (Schedule.is_null()) return {}; unsigned Dims = getNumScatterDims(Schedule); isl::space ScatterSpace = Schedule.get_space().set_from_params(); @@ -439,16 +441,16 @@ isl::space Space = Map.get_space(); isl::space DomainSpace = Space.domain(); - if (!DomainSpace) + if (DomainSpace.is_null()) return {}; unsigned DomainDims = DomainSpace.dim(isl::dim::set); isl::space RangeSpace = Space.range().unwrap(); isl::space Range1Space = RangeSpace.domain(); - if (!Range1Space) + if (Range1Space.is_null()) return {}; unsigned Range1Dims = Range1Space.dim(isl::dim::set); isl::space Range2Space = RangeSpace.range(); - if (!Range2Space) + if (Range2Space.is_null()) return {}; unsigned Range2Dims = Range2Space.dim(isl::dim::set); @@ -534,7 +536,7 @@ isl::val Result; isl::stat Stat = PwAff.foreach_piece( [=, &Result](isl::set Set, isl::aff Aff) -> isl::stat { - if (Result && Result.is_nan()) + if (!Result.is_null() && Result.is_nan()) return isl::stat::ok(); // TODO: If Min/Max, we can also determine a minimum/maximum value if @@ -545,7 +547,7 @@ } isl::val ThisVal = Aff.get_constant_val(); - if (!Result) { + if (Result.is_null()) { Result = ThisVal; return isl::stat::ok(); } @@ -595,7 +597,7 @@ /// dimensions are considered first. static int flatCompare(const isl::basic_set &A, const isl::basic_set &B) { // Quick bail-out on out-of-quota. - if (!A || !B) + if (A.is_null() || B.is_null()) return 0; unsigned ALen = A.dim(isl::dim::set); @@ -723,7 +725,7 @@ /// unwrapped before printing to again appear as a map. static void printSortedPolyhedra(isl::union_set USet, llvm::raw_ostream &OS, bool Simplify, bool IsMap) { - if (!USet) { + if (USet.is_null()) { OS << "\n"; return; } diff --git a/polly/lib/Support/SCEVAffinator.cpp b/polly/lib/Support/SCEVAffinator.cpp --- a/polly/lib/Support/SCEVAffinator.cpp +++ b/polly/lib/Support/SCEVAffinator.cpp @@ -197,7 +197,7 @@ auto Key = std::make_pair(Expr, BB); PWACtx PWAC = CachedExpressions[Key]; - if (PWAC.first) + if (!PWAC.first.is_null()) return PWAC; auto ConstantAndLeftOverPair = extractConstantFactor(Expr, SE); diff --git a/polly/lib/Transform/DeLICM.cpp b/polly/lib/Transform/DeLICM.cpp --- a/polly/lib/Transform/DeLICM.cpp +++ b/polly/lib/Transform/DeLICM.cpp @@ -239,15 +239,16 @@ void checkConsistency() const { #ifndef NDEBUG // Default-initialized object - if (!Occupied && !Unused && !Known && !Written) + if (Occupied.is_null() && Unused.is_null() && Known.is_null() && + Written.is_null()) return; - assert(Occupied || Unused); - assert(Known); - assert(Written); + assert(!Occupied.is_null() || !Unused.is_null()); + assert(!Known.is_null()); + assert(!Written.is_null()); // If not all fields are defined, we cannot derived the universe. - if (!Occupied || !Unused) + if (Occupied.is_null() || Unused.is_null()) return; assert(Occupied.is_disjoint(Unused)); @@ -272,16 +273,19 @@ } /// Return whether this object was not default-constructed. - bool isUsable() const { return (Occupied || Unused) && Known && Written; } + bool isUsable() const { + return (Occupied.is_null() || Unused.is_null()) && !Known.is_null() && + !Written.is_null(); + } /// Print the content of this object to @p OS. void print(llvm::raw_ostream &OS, unsigned Indent = 0) const { if (isUsable()) { - if (Occupied) + if (!Occupied.is_null()) OS.indent(Indent) << "Occupied: " << Occupied << "\n"; else OS.indent(Indent) << "Occupied: \n"; - if (Unused) + if (!Unused.is_null()) OS.indent(Indent) << "Unused: " << Unused << "\n"; else OS.indent(Indent) << "Unused: \n"; @@ -295,13 +299,13 @@ /// Combine two knowledges, this and @p That. void learnFrom(Knowledge That) { assert(!isConflicting(*this, That)); - assert(Unused && That.Occupied); + assert(!Unused.is_null() && !That.Occupied.is_null()); assert( - !That.Unused && + That.Unused.is_null() && "This function is only prepared to learn occupied elements from That"); - assert(!Occupied && "This function does not implement " - "`this->Occupied = " - "this->Occupied.unite(That.Occupied);`"); + assert(Occupied.is_null() && "This function does not implement " + "`this->Occupied = " + "this->Occupied.unite(That.Occupied);`"); Unused = Unused.subtract(That.Occupied); Known = Known.unite(That.Known); @@ -332,11 +336,11 @@ const Knowledge &Proposed, llvm::raw_ostream *OS = nullptr, unsigned Indent = 0) { - assert(Existing.Unused); - assert(Proposed.Occupied); + assert(!Existing.Unused.is_null()); + assert(!Proposed.Occupied.is_null()); #ifndef NDEBUG - if (Existing.Occupied && Proposed.Unused) { + if (!Existing.Occupied.is_null() && !Proposed.Unused.is_null()) { auto ExistingUniverse = Existing.Occupied.unite(Existing.Unused); auto ProposedUniverse = Proposed.Occupied.unite(Proposed.Unused); assert(ExistingUniverse.is_equal(ProposedUniverse) && @@ -867,7 +871,7 @@ // { DomainRead[] -> DomainWrite[] } auto PerPHIWrites = computePerPHI(SAI); - if (!PerPHIWrites) { + if (PerPHIWrites.is_null()) { LLVM_DEBUG( dbgs() << " Reject because cannot determine incoming values\n"); return false; @@ -1203,7 +1207,7 @@ } DeLICMAnalyzed++; - if (!EltUnused || !EltKnown || !EltWritten) { + if (EltUnused.is_null() || EltKnown.is_null() || EltWritten.is_null()) { assert(isl_ctx_last_error(IslCtx.get()) == isl_error_quota && "The only reason that these things have not been computed should " "be if the max-operations limit hit"); diff --git a/polly/lib/Transform/FlattenAlgo.cpp b/polly/lib/Transform/FlattenAlgo.cpp --- a/polly/lib/Transform/FlattenAlgo.cpp +++ b/polly/lib/Transform/FlattenAlgo.cpp @@ -48,7 +48,7 @@ /// Whether BMap's first out-dimension is not a constant. bool isVariableDim(const isl::basic_map &BMap) { auto FixedVal = BMap.plain_get_val_if_fixed(isl::dim::out, 0); - return !FixedVal || FixedVal.is_nan(); + return FixedVal.is_null() || FixedVal.is_nan(); } /// Whether Map's first out dimension is no constant nor piecewise constant. @@ -132,7 +132,7 @@ isl_size scheduleScatterDims(const isl::union_map &Schedule) { isl_size Dims = 0; for (isl::map Map : Schedule.get_map_list()) { - if (!Map) + if (Map.is_null()) continue; Dims = std::max(Dims, Map.dim(isl::dim::out)); @@ -285,7 +285,8 @@ LLVM_DEBUG(dbgs() << "Max bound:\n " << Max << "\n"); auto MaxVal = getConstant(Max, true, false); - if (!MinVal || !MaxVal || MinVal.is_nan() || MaxVal.is_nan()) { + if (MinVal.is_null() || MaxVal.is_null() || MinVal.is_nan() || + MaxVal.is_nan()) { LLVM_DEBUG(dbgs() << "Abort; dimension bounds could not be determined\n"); return {}; } @@ -328,20 +329,20 @@ if (!isVariableDim(Schedule)) { LLVM_DEBUG(dbgs() << "Fixed dimension; try sequence flattening\n"); auto NewScheduleSequence = tryFlattenSequence(Schedule); - if (NewScheduleSequence) + if (!NewScheduleSequence.is_null()) return NewScheduleSequence; } // Constant stride LLVM_DEBUG(dbgs() << "Try loop flattening\n"); auto NewScheduleLoop = tryFlattenLoop(Schedule); - if (NewScheduleLoop) + if (!NewScheduleLoop.is_null()) return NewScheduleLoop; // Try again without loop condition (may blow up the number of pieces!!) LLVM_DEBUG(dbgs() << "Try sequence flattening again\n"); auto NewScheduleSequence = tryFlattenSequence(Schedule); - if (NewScheduleSequence) + if (!NewScheduleSequence.is_null()) return NewScheduleSequence; // Cannot flatten diff --git a/polly/lib/Transform/ForwardOpTree.cpp b/polly/lib/Transform/ForwardOpTree.cpp --- a/polly/lib/Transform/ForwardOpTree.cpp +++ b/polly/lib/Transform/ForwardOpTree.cpp @@ -363,7 +363,7 @@ Translator = makeIdentityMap(Known.range(), false); } - if (!Known || !Translator || !NormalizeMap) { + if (Known.is_null() || Translator.is_null() || NormalizeMap.is_null()) { assert(isl_ctx_last_error(IslCtx.get()) == isl_error_quota); Known = {}; Translator = {}; @@ -525,7 +525,7 @@ isl::union_map Candidates = findSameContentElements(TranslatedExpectedVal); isl::map SameVal = singleLocation(Candidates, getDomainFor(TargetStmt)); - if (!SameVal) + if (SameVal.is_null()) return ForwardingAction::notApplicable(); LLVM_DEBUG(dbgs() << " expected values where " << TargetExpectedVal @@ -571,7 +571,7 @@ LLVM_DEBUG(dbgs() << " local translator is " << LocalTranslator << "\n"); - if (!LocalTranslator) + if (LocalTranslator.is_null()) return ForwardingAction::notApplicable(); } @@ -583,7 +583,7 @@ << Access << "\n"); (void)Access; - if (LocalTranslator) + if (!LocalTranslator.is_null()) Translator = Translator.add_map(LocalTranslator); NumKnownLoadsForwarded++; @@ -634,7 +634,7 @@ isl::map SameVal = singleLocation(Candidates, getDomainFor(TargetStmt)); simplify(SameVal); - if (!SameVal) + if (SameVal.is_null()) return ForwardingAction::notApplicable(); auto ExecAction = [this, TargetStmt, Inst, SameVal]() { diff --git a/polly/lib/Transform/ManualOptimizer.cpp b/polly/lib/Transform/ManualOptimizer.cpp --- a/polly/lib/Transform/ManualOptimizer.cpp +++ b/polly/lib/Transform/ManualOptimizer.cpp @@ -55,7 +55,7 @@ if (UnrollMode & TM_Disable) return {}; - assert(BandToUnroll); + assert(!BandToUnroll.is_null()); // TODO: Isl's codegen also supports unrolling by isl_ast_build via // isl_schedule_node_band_set_ast_build_options({ unroll[x] }) which would be // more efficient because the content duplication is delayed. However, the @@ -111,7 +111,7 @@ void visitBand(const isl::schedule_node &Band) { // Transform inner loops first (depth-first search). getBase().visitBand(Band); - if (Result) + if (!Result.is_null()) return; // Since it is (currently) not possible to have a BandAttr marker that is @@ -144,7 +144,7 @@ AttrName == "llvm.loop.unroll.count" || AttrName == "llvm.loop.unroll.full") { Result = applyLoopUnroll(LoopMD, Band); - if (Result) + if (!Result.is_null()) return; } @@ -154,7 +154,7 @@ } void visitNode(const isl::schedule_node &Other) { - if (Result) + if (!Result.is_null()) return; getBase().visitNode(Other); } @@ -167,7 +167,7 @@ while (true) { isl::schedule Result = SearchTransformVisitor::applyOneTransformation(Sched); - if (!Result) { + if (Result.is_null()) { // No (more) transformation has been found. break; } diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp --- a/polly/lib/Transform/ScheduleOptimizer.cpp +++ b/polly/lib/Transform/ScheduleOptimizer.cpp @@ -886,9 +886,9 @@ Map = Map.move_dims(FreeDim, 0, DimType, MinDim, 1); Map = Map.move_dims(DimType, MinDim, FreeDim, 1, 1); Map = Map.move_dims(DimType, MaxDim, FreeDim, 0, 1); - if (DimId) + if (!DimId.is_null()) Map = Map.set_tuple_id(DimType, DimId); - if (FreeDimId) + if (!FreeDimId.is_null()) Map = Map.set_tuple_id(FreeDim, FreeDimId); return Map; } @@ -1039,7 +1039,7 @@ int &Pos) { isl::union_map Dep = D->getDependences(Dependences::TYPE_RAW); isl::union_map Red = D->getDependences(Dependences::TYPE_RED); - if (Red) + if (!Red.is_null()) Dep = Dep.unite(Red); auto DomainSpace = Schedule.get_space().domain(); auto Space = DomainSpace.map_from_domain_and_range(DomainSpace); @@ -1611,7 +1611,7 @@ return Node; auto MapOldIndVar = getInductionVariablesSubstitution(Node, MicroKernelParams, MacroKernelParams); - if (!MapOldIndVar) + if (MapOldIndVar.is_null()) return Node; Node = markLoopVectorizerDisabled(Node.parent()).child(0); Node = isolateAndUnrollMatMulInnerLoops(Node, MicroKernelParams); @@ -1687,8 +1687,9 @@ // (e.g., #stride-one accesses) auto NewScheduleMap = NewSchedule.get_map(); auto OldSchedule = S.getSchedule(); - assert(OldSchedule && "Only IslScheduleOptimizer can insert extension nodes " - "that make Scop::getSchedule() return nullptr."); + assert(!OldSchedule.is_null() && + "Only IslScheduleOptimizer can insert extension nodes " + "that make Scop::getSchedule() return nullptr."); bool changed = !OldSchedule.is_equal(NewScheduleMap); return changed; } @@ -1746,7 +1747,7 @@ /// (tiling, pattern matching) static void walkScheduleTreeForStatistics(isl::schedule Schedule, int Version) { auto Root = Schedule.get_root(); - if (!Root) + if (Root.is_null()) return; isl_schedule_node_foreach_descendant_top_down( @@ -1814,7 +1815,7 @@ if (PragmaBasedOpts) { isl::schedule ManuallyTransformed = applyManualTransformations(&S, Schedule); - if (!ManuallyTransformed) { + if (ManuallyTransformed.is_null()) { LLVM_DEBUG(dbgs() << "Error during manual optimization\n"); return false; } @@ -1876,7 +1877,7 @@ isl::union_set Domain = S.getDomains(); - if (!Domain) + if (Domain.is_null()) return false; isl::union_map Validity = D.getDependences(ValidityKinds); @@ -1969,7 +1970,7 @@ // In cases the scheduler is not able to optimize the code, we just do not // touch the schedule. - if (!Schedule) + if (Schedule.is_null()) return false; // Apply post-rescheduling optimizations. @@ -2021,7 +2022,7 @@ OS << "Calculated schedule:\n"; - if (!LastSchedule) { + if (LastSchedule.is_null()) { OS << "n/a\n"; return; } diff --git a/polly/lib/Transform/ScheduleTreeTransform.cpp b/polly/lib/Transform/ScheduleTreeTransform.cpp --- a/polly/lib/Transform/ScheduleTreeTransform.cpp +++ b/polly/lib/Transform/ScheduleTreeTransform.cpp @@ -179,7 +179,7 @@ isl::union_map Extensions; isl::schedule Result = visit(Schedule.get_root(), Schedule.get_domain(), Extensions); - assert(Extensions && Extensions.is_empty()); + assert(!Extensions.is_null() && Extensions.is_empty()); return Result; } @@ -626,7 +626,7 @@ findOptionalNodeOperand(Attr->Metadata, LLVMLoopUnrollFollowupUnrolled); isl::id NewBandId = createGeneratedLoopAttr(Ctx, FollowupMD); - if (NewBandId) + if (!NewBandId.is_null()) NewLoop = insertMark(NewLoop, NewBandId); return NewLoop.get_schedule(); diff --git a/polly/lib/Transform/ZoneAlgo.cpp b/polly/lib/Transform/ZoneAlgo.cpp --- a/polly/lib/Transform/ZoneAlgo.cpp +++ b/polly/lib/Transform/ZoneAlgo.cpp @@ -459,7 +459,7 @@ // { Domain[] -> ValInst[] } isl::union_map WriteValInstance = getWrittenValue(MA, AccRel); - if (!WriteValInstance) + if (WriteValInstance.is_null()) WriteValInstance = makeUnknownForDomain(Stmt); // { Domain[] -> [Element[] -> Domain[]] } @@ -545,7 +545,7 @@ // bail out if we do not know. This in particular applies to undefined control // flow. isl::set DefinedContext = S->getDefinedBehaviorContext(); - if (!DefinedContext) + if (DefinedContext.is_null()) return {}; assert(SAI->isPHIKind()); @@ -630,7 +630,7 @@ auto UDomain = isl::union_set(Domain); auto UResult = getScatterFor(std::move(UDomain)); auto Result = singleton(std::move(UResult), std::move(ResultSpace)); - assert(!Result || Result.domain().is_equal(Domain) == isl_bool_true); + assert(Result.is_null() || Result.domain().is_equal(Domain) == isl_bool_true); return Result; } @@ -680,7 +680,7 @@ // { DefStmt[i] -> TargetStmt[i,j] } // // In practice, this should cover the majority of cases. - if (!Result && S->isOriginalSchedule() && + if (Result.is_null() && S->isOriginalSchedule() && isInsideLoop(DefStmt->getSurroundingLoop(), TargetStmt->getSurroundingLoop())) { isl::set DefDomain = getDomainFor(DefStmt); @@ -693,7 +693,7 @@ Result = Result.equate(isl::dim::in, i, isl::dim::out, i); } - if (!Result) { + if (Result.is_null()) { // { DomainDef[] -> DomainTarget[] } Result = computeUseToDefFlowDependency(TargetStmt, DefStmt).reverse(); simplify(Result); @@ -704,7 +704,7 @@ isl::map ZoneAlgorithm::getScalarReachingDefinition(ScopStmt *Stmt) { auto &Result = ScalarReachDefZone[Stmt]; - if (Result) + if (!Result.is_null()) return Result; auto Domain = getDomainFor(Stmt); @@ -1035,7 +1035,7 @@ // incoming value. Skip if we cannot determine PHI predecessors. // { PHIDomain[] -> IncomingDomain[] } isl::union_map PerPHI = computePerPHI(SAI); - if (!PerPHI) + if (PerPHI.is_null()) continue; // { PHIDomain[] -> PHIValInst[] } @@ -1084,7 +1084,7 @@ ComputedPHIs = AllPHIs; NormalizeMap = AllPHIMaps; - assert(!NormalizeMap || isNormalized(NormalizeMap)); + assert(NormalizeMap.is_null() || isNormalized(NormalizeMap)); } void ZoneAlgorithm::printAccesses(llvm::raw_ostream &OS, int Indent) const { diff --git a/polly/unittests/DeLICM/DeLICMTest.cpp b/polly/unittests/DeLICM/DeLICMTest.cpp --- a/polly/unittests/DeLICM/DeLICMTest.cpp +++ b/polly/unittests/DeLICM/DeLICMTest.cpp @@ -37,17 +37,17 @@ isl::union_set &Undef) { auto ParamSpace = Universe.get_space(); - if (Undef && !Occupied) { - assert(!Occupied); + if (!Undef.is_null() && Occupied.is_null()) { + assert(Occupied.is_null()); Occupied = Universe.subtract(Undef); } - if (OccupiedAndKnown) { - assert(!Known); + if (!OccupiedAndKnown.is_null()) { + assert(Known.is_null()); Known = isl::union_map::empty(ParamSpace); - if (!Occupied) + if (Occupied.is_null()) Occupied = OccupiedAndKnown.domain(); for (isl::map Map : OccupiedAndKnown.get_map_list()) { @@ -57,19 +57,19 @@ } } - if (!Undef) { - assert(Occupied); + if (Undef.is_null()) { + assert(!Occupied.is_null()); Undef = Universe.subtract(Occupied); } - if (!Known) { // By default, nothing is known. + if (Known.is_null()) { // By default, nothing is known. Known = isl::union_map::empty(ParamSpace); } // Conditions that must hold when returning. - assert(Occupied); - assert(Undef); - assert(Known); + assert(!Occupied.is_null()); + assert(!Undef.is_null()); + assert(!Known.is_null()); } typedef struct { @@ -97,17 +97,17 @@ isl::union_map ProposedWritten) { // Determine universe (set of all possible domains). auto Universe = isl::union_set::empty(isl::space::params_alloc(Ctx, 0)); - if (ExistingOccupiedAndKnown) + if (!ExistingOccupiedAndKnown.is_null()) Universe = Universe.unite(ExistingOccupiedAndKnown.domain()); - if (ExistingUnused) + if (!ExistingUnused.is_null()) Universe = Universe.unite(ExistingUnused); - if (ExistingWritten) + if (!ExistingWritten.is_null()) Universe = Universe.unite(ExistingWritten.domain()); - if (ProposedOccupiedAndKnown) + if (!ProposedOccupiedAndKnown.is_null()) Universe = Universe.unite(ProposedOccupiedAndKnown.domain()); - if (ProposedUnused) + if (!ProposedUnused.is_null()) Universe = Universe.unite(ProposedUnused); - if (ProposedWritten) + if (!ProposedWritten.is_null()) Universe = Universe.unite(ProposedWritten.domain()); Universe = unionSpace(Universe);