-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[flang][NFC] AliasAnalysis: Use Indirect not Unknown for LoadOp #127845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[flang][NFC] AliasAnalysis: Use Indirect not Unknown for LoadOp #127845
Conversation
As mentioned at <llvm#126156 (comment)>: PR llvm#126156 causes AliasAnalysis::getSource to sometimes return SourceKind::Unknown when it used to return SourceKind::Indirect for a LoadOp. This patch restores that part of the old behavior. It should not affect user-visible behavior because AliasAnalysis::alias treats SourceKind::Unknown and SourceKind::Indirect equivalently, but it does improve debugging output.
@llvm/pr-subscribers-flang-fir-hlfir Author: Joel E. Denny (jdenny-ornl) ChangesAs mentioned at Full diff: https://github.com/llvm/llvm-project/pull/127845.diff 1 Files Affected:
diff --git a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
index 70fa18ad65b9b..d881b630d33d9 100644
--- a/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
+++ b/flang/lib/Optimizer/Analysis/AliasAnalysis.cpp
@@ -641,14 +641,13 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v,
} else if (isDummyArgument(def)) {
defOp = nullptr;
v = def;
+ } else {
+ type = SourceKind::Indirect;
}
-
- breakFromLoop = true;
- return;
+ } else {
+ // No further tracking for addresses loaded from memory for now.
+ type = SourceKind::Indirect;
}
-
- // No further tracking for addresses loaded from memory for now.
- type = SourceKind::Indirect;
breakFromLoop = true;
})
.Case<fir::AddrOfOp>([&](auto op) {
|
@Renaud-K If you're about to land a patch to rewrite all this and fix this issue anyway, feel free to ignore this PR. Otherwise, I thought it could be helpful in the meantime. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the fix.
Thanks. Do you know why the windows bot is failing to build? It reports:
|
hard to tell without a windows compiler which I am not setup to run. It is like it is missing a curly brace or something. But I don't think we need the second else clause. We can let the code fall through this part. Of course we would have to return in the then clause. Basically I would troubleshoot with smaller diffs. |
I think you're suggesting to remove |
Sorry, I replied above before I saw your comment's edit. I'm not set up for windows compilation either. I'm surprised that different compilers have different ideas about whether breakFromLoop is declared. I'll try to figure this out tomorrow. |
✅ With the latest revision this PR passed the C/C++ code formatter. |
As mentioned at #126156 (comment): PR #126156 causes AliasAnalysis::getSource to sometimes return SourceKind::Unknown when it used to return SourceKind::Indirect for a LoadOp. This patch restores that part of the old behavior. It should not affect user-visible behavior because AliasAnalysis::alias treats SourceKind::Unknown and SourceKind::Indirect equivalently, but it does improve debugging output.