diff options
author | Florian Hahn <flo@fhahn.com> | 2023-11-27 10:10:41 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2023-11-27 10:10:41 +0000 |
commit | 17139f38e55ec06b8546b9306e04e64d0408033a (patch) | |
tree | 52fdde023b1a2a0aefb177266e25e04a3c4ecd83 /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | 0e86d3ea9b93da273ee800a251dd60a44b85a320 (diff) | |
download | llvm-17139f38e55ec06b8546b9306e04e64d0408033a.zip llvm-17139f38e55ec06b8546b9306e04e64d0408033a.tar.gz llvm-17139f38e55ec06b8546b9306e04e64d0408033a.tar.bz2 |
[LAA] Check HasSameSize before couldPreventStoreLoadForward.
After 9645267, TypeByteSize is 0 if both access do not have the same
size (i.e. HasSameSize will be false). This can cause an infinite loop
in couldPreventStoreLoadForward, if HasSameSize is not checked first.
So check HasSameSize first instead of after
couldPreventStoreLoadForward. Checking HasSameSize first is also
cheaper.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 999af56..91f5eab0 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -2009,8 +2009,8 @@ MemoryDepChecker::Dependence::DepType MemoryDepChecker::isDependent( // couldPreventStoreLoadForward, even if it changed MinDepDistBytes, // since a forward dependency will allow vectorization using any width. if (IsTrueDataDependence && EnableForwardingConflictDetection && - (couldPreventStoreLoadForward(Val.abs().getZExtValue(), TypeByteSize) || - !HasSameSize)) { + (!HasSameSize || couldPreventStoreLoadForward(Val.abs().getZExtValue(), + TypeByteSize))) { LLVM_DEBUG(dbgs() << "LAA: Forward but may prevent st->ld forwarding\n"); return Dependence::ForwardButPreventsForwarding; } |