[llvm-branch-commits] [llvm] [LoopInterchange] Take base pointer into account in profitability check (PR #193477)
Sjoerd Meijer via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed May 20 06:51:53 PDT 2026
================
@@ -1643,11 +1643,14 @@ int LoopInterchangeProfitability::getInstrOrderCost() {
//
// then it is a bad order.
if (SE->isKnownPredicate(ICmpInst::ICMP_SLT, InnerStep, OuterStep))
- GoodOrder++;
+ GoodBasePtrs.insert(BasePtr);
else if (SE->isKnownPredicate(ICmpInst::ICMP_SLT, OuterStep, InnerStep))
- BadOrder++;
+ BadBasePtrs.insert(BasePtr);
----------------
sjoerdmeijer wrote:
Ah yeah, of course, I see now, makes sense and adding to a set is an elegant way to avoid counting the same base pointer multiple times
One last nit: it would be good to add a little comment here that we are deduplicating the base pointers.
https://github.com/llvm/llvm-project/pull/193477
More information about the llvm-branch-commits
mailing list