aboutsummaryrefslogtreecommitdiff
path: root/polly
diff options
context:
space:
mode:
authorBruno De Fraine <brunodf@synopsys.com>2024-01-17 15:59:13 +0100
committerGitHub <noreply@github.com>2024-01-17 15:59:13 +0100
commit656bf13004d62b8f8360d8d496bb1e6e08407c22 (patch)
tree0899192a30b33a8a79b28127fdbe3dd619ccc52d /polly
parent8fb685fb7ea165f2bc27a3f19b1cffc3f5a4b329 (diff)
downloadllvm-656bf13004d62b8f8360d8d496bb1e6e08407c22.zip
llvm-656bf13004d62b8f8360d8d496bb1e6e08407c22.tar.gz
llvm-656bf13004d62b8f8360d8d496bb1e6e08407c22.tar.bz2
[AST] Don't merge memory locations in AliasSetTracker (#65731)
This changes the AliasSetTracker to track memory locations instead of pointers in its alias sets. The motivation for this is outlined in an RFC posted on LLVM discourse: https://discourse.llvm.org/t/rfc-dont-merge-memory-locations-in-aliassettracker/73336 In the data structures of the AST implementation, I made the choice to replace the linked list of `PointerRec` entries (that had to go anyway) with a simple flat vector of `MemoryLocation` objects, but for the `AliasSet` objects referenced from a lookup table, I retained the mechanism of a linked list, reference counting, forwarding, etc. The data structures could be revised in a follow-up change.
Diffstat (limited to 'polly')
-rw-r--r--polly/lib/Analysis/ScopBuilder.cpp4
-rw-r--r--polly/lib/Analysis/ScopDetection.cpp6
-rw-r--r--polly/lib/Analysis/ScopDetectionDiagnostic.cpp3
3 files changed, 7 insertions, 6 deletions
diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp
index 0af0f69..c62cb2a 100644
--- a/polly/lib/Analysis/ScopBuilder.cpp
+++ b/polly/lib/Analysis/ScopBuilder.cpp
@@ -3255,8 +3255,8 @@ ScopBuilder::buildAliasGroupsForAccesses() {
if (AS.isMustAlias() || AS.isForwardingAliasSet())
continue;
AliasGroupTy AG;
- for (auto &PR : AS)
- AG.push_back(PtrToAcc[PR.getValue()]);
+ for (const Value *Ptr : AS.getPointers())
+ AG.push_back(PtrToAcc[const_cast<Value *>(Ptr)]);
if (AG.size() < 2)
continue;
AliasGroups.push_back(std::move(AG));
diff --git a/polly/lib/Analysis/ScopDetection.cpp b/polly/lib/Analysis/ScopDetection.cpp
index db1f844..938d3f1 100644
--- a/polly/lib/Analysis/ScopDetection.cpp
+++ b/polly/lib/Analysis/ScopDetection.cpp
@@ -1149,6 +1149,8 @@ bool ScopDetection::isValidAccess(Instruction *Inst, const SCEV *AF,
// sure the base pointer is not an instruction defined inside the scop.
// However, we can ignore loads that will be hoisted.
+ auto ASPointers = AS.getPointers();
+
InvariantLoadsSetTy VariantLS, InvariantLS;
// In order to detect loads which are dependent on other invariant loads
// as invariant, we use fixed-point iteration method here i.e we iterate
@@ -1158,8 +1160,8 @@ bool ScopDetection::isValidAccess(Instruction *Inst, const SCEV *AF,
const unsigned int VariantSize = VariantLS.size(),
InvariantSize = InvariantLS.size();
- for (const auto &Ptr : AS) {
- Instruction *Inst = dyn_cast<Instruction>(Ptr.getValue());
+ for (const Value *Ptr : ASPointers) {
+ Instruction *Inst = dyn_cast<Instruction>(const_cast<Value *>(Ptr));
if (Inst && Context.CurRegion.contains(Inst)) {
auto *Load = dyn_cast<LoadInst>(Inst);
if (Load && InvariantLS.count(Load))
diff --git a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
index 0bac2cf..364e21a 100644
--- a/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
+++ b/polly/lib/Analysis/ScopDetectionDiagnostic.cpp
@@ -638,8 +638,7 @@ bool ReportNonSimpleMemoryAccess::classof(const RejectReason *RR) {
ReportAlias::ReportAlias(Instruction *Inst, AliasSet &AS)
: RejectReason(RejectReasonKind::Alias), Inst(Inst) {
- for (const auto &I : AS)
- Pointers.push_back(I.getValue());
+ append_range(Pointers, AS.getPointers());
}
std::string ReportAlias::formatInvalidAlias(std::string Prefix,