diff options
author | Ryotaro Kasuga <kasuga.ryotaro@fujitsu.com> | 2025-07-17 21:11:37 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-17 21:11:37 +0900 |
commit | 2b3a410f5bc8358a9e8594331d70c9c5d59633d8 (patch) | |
tree | 185459b3b01374caa8abf8d766c7b1466634a06a /llvm/lib | |
parent | 60ae9c9c632dec978e71d1d3ab3c3d18eca16c77 (diff) | |
download | llvm-2b3a410f5bc8358a9e8594331d70c9c5d59633d8.zip llvm-2b3a410f5bc8358a9e8594331d70c9c5d59633d8.tar.gz llvm-2b3a410f5bc8358a9e8594331d70c9c5d59633d8.tar.bz2 |
[DA] Check element size when analyzing deps between same instruction (#148813)
DependenceAnalysis checks whether the given addresses are divisible by
the element size of corresponding load/store instructions. However, this
check was only executed when the two instructions (Src and Dst) are
different. We must also perform the same check when Src and Dst are the
same instruction.
Fix the test added in #147715.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Analysis/DependenceAnalysis.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp index 428342f..dd9a44b 100644 --- a/llvm/lib/Analysis/DependenceAnalysis.cpp +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp @@ -3670,14 +3670,12 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst, const SCEV *SrcEv = SE->getMinusSCEV(SrcSCEV, SrcBase); const SCEV *DstEv = SE->getMinusSCEV(DstSCEV, DstBase); - if (Src != Dst) { - // Check that memory access offsets are multiples of element sizes. - if (!SE->isKnownMultipleOf(SrcEv, EltSize, Assume) || - !SE->isKnownMultipleOf(DstEv, EltSize, Assume)) { - LLVM_DEBUG(dbgs() << "can't analyze SCEV with different offsets\n"); - return std::make_unique<Dependence>(Src, Dst, - SCEVUnionPredicate(Assume, *SE)); - } + // Check that memory access offsets are multiples of element sizes. + if (!SE->isKnownMultipleOf(SrcEv, EltSize, Assume) || + !SE->isKnownMultipleOf(DstEv, EltSize, Assume)) { + LLVM_DEBUG(dbgs() << "can't analyze SCEV with different offsets\n"); + return std::make_unique<Dependence>(Src, Dst, + SCEVUnionPredicate(Assume, *SE)); } if (!Assume.empty()) { |