Skip to content

Commit 9766410

Browse files
authored
[flang][NFC] AliasAnalysis: Use Indirect not Unknown for LoadOp (llvm#127845)
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.
1 parent 386a45c commit 9766410

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

flang/lib/Optimizer/Analysis/AliasAnalysis.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -641,14 +641,18 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v,
641641
} else if (isDummyArgument(def)) {
642642
defOp = nullptr;
643643
v = def;
644+
} else {
645+
type = SourceKind::Indirect;
644646
}
645-
647+
// TODO: This assignment is redundant but somehow works around an
648+
// apparent MSVC bug reporting "undeclared identifier" at the next
649+
// "breakFromLoop = true;". See
650+
// <https://github.com/llvm/llvm-project/pull/127845#issuecomment-2669829610>.
646651
breakFromLoop = true;
647-
return;
652+
} else {
653+
// No further tracking for addresses loaded from memory for now.
654+
type = SourceKind::Indirect;
648655
}
649-
650-
// No further tracking for addresses loaded from memory for now.
651-
type = SourceKind::Indirect;
652656
breakFromLoop = true;
653657
})
654658
.Case<fir::AddrOfOp>([&](auto op) {

0 commit comments

Comments
 (0)