Skip to content

Conversation

@artagnon
Copy link
Contributor

To match DependenceAnalysis' handling of unordered loads/stores, permit exactly this condition in LoopInterchange.

To match DependenceAnalysis' handling of unordered loads/stores, permit
exactly this condition in LoopInterchange.
@llvmbot
Copy link
Member

llvmbot commented Jun 27, 2025

@llvm/pr-subscribers-llvm-transforms

Author: Ramkumar Ramachandra (artagnon)

Changes

To match DependenceAnalysis' handling of unordered loads/stores, permit exactly this condition in LoopInterchange.


Full diff: https://github.com/llvm/llvm-project/pull/146143.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Scalar/LoopInterchange.cpp (+2-2)
diff --git a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
index 9e3b4b82cc454..4d6efb051a773 100644
--- a/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopInterchange.cpp
@@ -141,11 +141,11 @@ static bool populateDependencyMatrix(CharMatrix &DepMatrix, unsigned Level,
       if (!isa<Instruction>(I))
         return false;
       if (auto *Ld = dyn_cast<LoadInst>(&I)) {
-        if (!Ld->isSimple())
+        if (!Ld->isUnordered())
           return false;
         MemInstr.push_back(&I);
       } else if (auto *St = dyn_cast<StoreInst>(&I)) {
-        if (!St->isSimple())
+        if (!St->isUnordered())
           return false;
         MemInstr.push_back(&I);
       }

Copy link
Contributor

@kasuga-fj kasuga-fj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add tests?

Also, IIUIC, isSimple imposes a strictly stronger condition than isUnordered. If the opposite were true (i.e., if DA required a stronger restriction than isSimple), this change would make perfectly sense to me. However, that is not the case here. So, it might be meaningful to call isSimple instead of isUnordered here (I feel like there's not a particularly strong reason, but I'm not entirely sure).

@sjoerdmeijer
Copy link
Collaborator

Also, IIUIC, isSimple imposes a strictly stronger condition than isUnordered. If the opposite were true (i.e., if DA required a stronger restriction than isSimple), this change would make perfectly sense to me. However, that is not the case here. So, it might be meaningful to call isSimple instead of isUnordered here (I feel like there's not a particularly strong reason, but I'm not entirely sure).

This is my understanding too. So, my question is what this patch is achieving?

@artagnon artagnon closed this Jun 30, 2025
@artagnon artagnon deleted the li-ldst-unordered branch June 30, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants