diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-12-17 20:41:09 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-12-17 20:41:09 +0000 |
| commit | 312c0ed19cc5276a17bacf2120097bec4515b0f1 (patch) | |
| tree | e6e4a4163840b73ba54bb0d3b70ee4899e4b7434 /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
| parent | b1c73532ee8997fe5dfbeb7d223027bdf99758a0 (diff) | |
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
| -rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index a8dbb66c4a9f..0894560fd078 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -347,7 +347,12 @@ void RuntimePointerChecking::tryToCreateDiffCheck( auto *SinkStartAR = cast<SCEVAddRecExpr>(SinkStartInt); const Loop *StartARLoop = SrcStartAR->getLoop(); if (StartARLoop == SinkStartAR->getLoop() && - StartARLoop == InnerLoop->getParentLoop()) { + StartARLoop == InnerLoop->getParentLoop() && + // If the diff check would already be loop invariant (due to the + // recurrences being the same), then we prefer to keep the diff checks + // because they are cheaper. + SrcStartAR->getStepRecurrence(*SE) != + SinkStartAR->getStepRecurrence(*SE)) { LLVM_DEBUG(dbgs() << "LAA: Not creating diff runtime check, since these " "cannot be hoisted out of the outer loop\n"); CanUseDiffCheck = false; @@ -661,7 +666,7 @@ public: /// Register a load and whether it is only read from. void addLoad(MemoryLocation &Loc, Type *AccessTy, bool IsReadOnly) { Value *Ptr = const_cast<Value*>(Loc.Ptr); - AST.add(Ptr, LocationSize::beforeOrAfterPointer(), Loc.AATags); + AST.add(Loc.getWithNewSize(LocationSize::beforeOrAfterPointer())); Accesses[MemAccessInfo(Ptr, false)].insert(AccessTy); if (IsReadOnly) ReadOnlyPtr.insert(Ptr); @@ -670,7 +675,7 @@ public: /// Register a store. void addStore(MemoryLocation &Loc, Type *AccessTy) { Value *Ptr = const_cast<Value*>(Loc.Ptr); - AST.add(Ptr, LocationSize::beforeOrAfterPointer(), Loc.AATags); + AST.add(Loc.getWithNewSize(LocationSize::beforeOrAfterPointer())); Accesses[MemAccessInfo(Ptr, true)].insert(AccessTy); } |
