-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[LAA] Keep pointer checks on partial analysis #139719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
john-brawn-arm
merged 9 commits into
llvm:main
from
john-brawn-arm:loop_access_analysis_partial_result
Jun 4, 2025
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
babdff1
[LoopAccessAnalysis] Keep pointer checks on partial analysis
john-brawn-arm 6dc3239
Add extra line to LoopAccessInfo::print when we generate some but not…
john-brawn-arm 686b462
Merge branch 'main' into loop_access_analysis_partial_result
john-brawn-arm d78421a
Add HasCompletePtrRtChecking
john-brawn-arm be7173d
Merge branch 'main' into loop_access_analysis_partial_result
john-brawn-arm 5da2cc9
Merge branch 'main' into HEAD
john-brawn-arm a77c6f9
Add an option to control whether partial results are allowed
john-brawn-arm 32dcdac
Adjust based on review comments.
john-brawn-arm 2b02a5b
Add an extra comment
john-brawn-arm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -529,8 +529,10 @@ void RuntimePointerChecking::groupChecks( | |
// equivalence class, the iteration order is deterministic. | ||
for (auto M : DepCands.members(Access)) { | ||
auto PointerI = PositionMap.find(M.getPointer()); | ||
assert(PointerI != PositionMap.end() && | ||
"pointer in equivalence class not found in PositionMap"); | ||
// If we can't find the pointer in PositionMap that means we can't | ||
// generate a memcheck for it. | ||
if (PointerI == PositionMap.end()) | ||
continue; | ||
for (unsigned Pointer : PointerI->second) { | ||
bool Merged = false; | ||
// Mark this pointer as seen. | ||
|
@@ -682,7 +684,9 @@ class AccessAnalysis { | |
/// non-intersection. | ||
/// | ||
/// Returns true if we need no check or if we do and we can generate them | ||
/// (i.e. the pointers have computable bounds). | ||
/// (i.e. the pointers have computable bounds). A return value of false means | ||
/// we couldn't analyze and generate runtime checks for all pointers in the | ||
/// loop, but we will have checks for those pointers we could analyze. | ||
bool canCheckPtrAtRT(RuntimePointerChecking &RtCheck, ScalarEvolution *SE, | ||
Loop *TheLoop, | ||
const DenseMap<Value *, const SCEV *> &Strides, | ||
|
@@ -1273,7 +1277,6 @@ bool AccessAnalysis::canCheckPtrAtRT( | |
/*Assume=*/true)) { | ||
CanDoAliasSetRT = false; | ||
UncomputablePtr = Access.getPointer(); | ||
break; | ||
} | ||
} | ||
} | ||
|
@@ -1313,7 +1316,7 @@ bool AccessAnalysis::canCheckPtrAtRT( | |
} | ||
} | ||
|
||
if (MayNeedRTCheck && CanDoRT) | ||
if (MayNeedRTCheck) | ||
artagnon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
RtCheck.generateChecks(DepCands, IsDepCheckNeeded); | ||
|
||
LLVM_DEBUG(dbgs() << "LAA: We need to do " << RtCheck.getNumberOfChecks() | ||
|
@@ -1323,11 +1326,7 @@ bool AccessAnalysis::canCheckPtrAtRT( | |
// are needed. This can happen when all pointers point to the same underlying | ||
// object for example. | ||
RtCheck.Need = CanDoRT ? RtCheck.getNumberOfChecks() != 0 : MayNeedRTCheck; | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stray newline strip? |
||
bool CanDoRTIfNeeded = !RtCheck.Need || CanDoRT; | ||
if (!CanDoRTIfNeeded) | ||
RtCheck.reset(); | ||
return CanDoRTIfNeeded; | ||
return !RtCheck.Need || CanDoRT; | ||
} | ||
|
||
void AccessAnalysis::processMemAccesses() { | ||
|
307 changes: 254 additions & 53 deletions
307
llvm/test/Analysis/LoopAccessAnalysis/forked-pointers.ll
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... if \p AllowPartial is set?