[Polly][NFC] Convert IslNodeBuilder::preloadUnconditionally to isl++ (#192959)

This commit is contained in:
Michael Kruse 2026-04-20 13:38:50 +01:00 committed by GitHub
parent d964f2bbc6
commit d242dfc312
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 12 deletions

View file

@ -282,8 +282,8 @@ protected:
/// Preload the memory access at @p AccessRange with @p Build.
///
/// @returns The preloaded value casted to type @p Ty
Value *preloadUnconditionally(__isl_take isl_set *AccessRange,
isl_ast_build *Build, Instruction *AccInst);
Value *preloadUnconditionally(isl::set AccessRange, isl::ast_build Build,
Instruction *AccInst);
/// Preload the memory load access @p MA.
///

View file

@ -1057,14 +1057,13 @@ bool IslNodeBuilder::materializeParameters() {
return true;
}
Value *IslNodeBuilder::preloadUnconditionally(__isl_take isl_set *AccessRange,
isl_ast_build *Build,
Value *IslNodeBuilder::preloadUnconditionally(isl::set AccessRange,
isl::ast_build Build,
Instruction *AccInst) {
isl_pw_multi_aff *PWAccRel = isl_pw_multi_aff_from_set(AccessRange);
isl_ast_expr *Access =
isl_ast_build_access_from_pw_multi_aff(Build, PWAccRel);
auto *Address = isl_ast_expr_address_of(Access);
auto *AddressValue = ExprBuilder.create(Address);
isl::pw_multi_aff PWAccRel = isl::pw_multi_aff::from_set(AccessRange);
isl::ast_expr Access = Build.access_from(PWAccRel);
isl::ast_expr Address = Access.address_of();
Value *AddressValue = ExprBuilder.create(Address.release());
Value *PreloadVal;
// Correct the type as the SAI might have a different type than the user
@ -1102,7 +1101,7 @@ Value *IslNodeBuilder::preloadInvariantLoad(const MemoryAccess &MA,
Type *AccInstTy = AccInst->getType();
if (AlwaysExecuted)
return preloadUnconditionally(AccessRange.release(), Build.get(), AccInst);
return preloadUnconditionally(AccessRange, Build, AccInst);
if (!materializeParameters(Domain.get()))
return nullptr;
@ -1143,8 +1142,7 @@ Value *IslNodeBuilder::preloadInvariantLoad(const MemoryAccess &MA,
Builder.CreateBr(MergeBB);
Builder.SetInsertPoint(ExecBB, ExecBB->getTerminator()->getIterator());
Value *PreAccInst =
preloadUnconditionally(AccessRange.release(), Build.get(), AccInst);
Value *PreAccInst = preloadUnconditionally(AccessRange, Build, AccInst);
Builder.SetInsertPoint(MergeBB, MergeBB->getTerminator()->getIterator());
auto *MergePHI = Builder.CreatePHI(
AccInstTy, 2, "polly.preload." + AccInst->getName() + ".merge");

View file

@ -3299,6 +3299,7 @@ public:
inline isl::pw_multi_aff flat_range_product(const isl::pw_aff &pma2) const;
inline stat foreach_piece(const std::function<stat(isl::set, isl::multi_aff)> &fn) const;
static inline isl::pw_multi_aff from_map(isl::map map);
static inline isl::pw_multi_aff from_set(isl::set set);
inline isl::pw_multi_aff gist(isl::set set) const;
inline isl::union_pw_multi_aff gist(const isl::union_set &context) const;
inline isl::pw_multi_aff gist(const isl::basic_set &set) const;
@ -16378,6 +16379,12 @@ isl::pw_multi_aff pw_multi_aff::from_map(isl::map map)
return manage(res);
}
isl::pw_multi_aff pw_multi_aff::from_set(isl::set set)
{
auto res = isl_pw_multi_aff_from_set(set.release());
return manage(res);
}
isl::pw_multi_aff pw_multi_aff::gist(isl::set set) const
{
auto res = isl_pw_multi_aff_gist(copy(), set.release());