diff options
author | Sebastian Pop <spop@nvidia.com> | 2025-01-29 22:53:24 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-29 22:53:24 -0600 |
commit | 4b2d6157744ca7693e6e904bd53d435df1ff6ee8 (patch) | |
tree | c6c89d613f4f923d8219b8049926c0da5b8ad359 /llvm/lib/Analysis/DependenceAnalysis.cpp | |
parent | c4a019747c98ad9326a675d3cb5a70311ba170a2 (diff) | |
download | llvm-4b2d6157744ca7693e6e904bd53d435df1ff6ee8.zip llvm-4b2d6157744ca7693e6e904bd53d435df1ff6ee8.tar.gz llvm-4b2d6157744ca7693e6e904bd53d435df1ff6ee8.tar.bz2 |
[DA] use alias analysis cross iteration mode (#116628)
This patch fixes two bugs:
https://github.com/llvm/llvm-project/issues/41488
https://github.com/llvm/llvm-project/issues/53942
The dependence analysis assumes that the base address of array accesses
is invariant across loop iterations. In both bugs the base address
evolves following loop iterations: the base address flip-flops between
two different memory objects.
The patch uses the cross iteration mode of alias analysis to disambiguate the
base objects.
Diffstat (limited to 'llvm/lib/Analysis/DependenceAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/DependenceAnalysis.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp index 440af7c..6ce2875 100644 --- a/llvm/lib/Analysis/DependenceAnalysis.cpp +++ b/llvm/lib/Analysis/DependenceAnalysis.cpp @@ -723,7 +723,10 @@ static AliasResult underlyingObjectsAlias(AAResults *AA, MemoryLocation::getBeforeOrAfter(LocA.Ptr, LocA.AATags); MemoryLocation LocBS = MemoryLocation::getBeforeOrAfter(LocB.Ptr, LocB.AATags); - if (AA->isNoAlias(LocAS, LocBS)) + BatchAAResults BAA(*AA); + BAA.enableCrossIterationMode(); + + if (BAA.isNoAlias(LocAS, LocBS)) return AliasResult::NoAlias; // Check the underlying objects are the same @@ -744,7 +747,6 @@ static AliasResult underlyingObjectsAlias(AAResults *AA, return AliasResult::NoAlias; } - // Returns true if the load or store can be analyzed. Atomic and volatile // operations have properties which this analysis does not understand. static |