-
Notifications
You must be signed in to change notification settings - Fork 15k
[LoopCacheAnalysis] Drop incorrect nowrap flags from addrec #164796
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
Conversation
|
@llvm/pr-subscribers-llvm-analysis Author: Ryotaro Kasuga (kasuga-fj) ChangesThis patch stops propagating nowrap flags unconditionally. In the modified part, when we have an addrec Full diff: https://github.com/llvm/llvm-project/pull/164796.diff 1 Files Affected:
diff --git a/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
index 050c32707596a..424a7fe3721bb 100644
--- a/llvm/lib/Analysis/LoopCacheAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
@@ -436,10 +436,9 @@ bool IndexedReference::delinearize(const LoopInfo &LI) {
const SCEV *StepRec = AccessFnAR ? AccessFnAR->getStepRecurrence(SE) : nullptr;
if (StepRec && SE.isKnownNegative(StepRec))
- AccessFn = SE.getAddRecExpr(AccessFnAR->getStart(),
- SE.getNegativeSCEV(StepRec),
- AccessFnAR->getLoop(),
- AccessFnAR->getNoWrapFlags());
+ AccessFn = SE.getAddRecExpr(
+ AccessFnAR->getStart(), SE.getNegativeSCEV(StepRec),
+ AccessFnAR->getLoop(), SCEV::NoWrapFlags::FlagAnyWrap);
const SCEV *Div = SE.getUDivExactExpr(AccessFn, ElemSize);
Subscripts.push_back(Div);
Sizes.push_back(ElemSize);
|
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.
LGTM, but this change does not look NFC to me?
Yes, you're right, this is not NFC. Thanks. |
) This patch stops propagating nowrap flags unconditionally. In the modified part, when we have an addrec `{%a,+,%b}` where `%b` is known to be negative, we create a new addrec `{%a,+,(-1 * %b)}`. When creating it, the nowrap flags are transferred from the original addrec to the new one without any checks, which is generally incorrect. Since the nowrap property is not essential for this analysis, it would be better to drop it to avoid potential bugs.
) This patch stops propagating nowrap flags unconditionally. In the modified part, when we have an addrec `{%a,+,%b}` where `%b` is known to be negative, we create a new addrec `{%a,+,(-1 * %b)}`. When creating it, the nowrap flags are transferred from the original addrec to the new one without any checks, which is generally incorrect. Since the nowrap property is not essential for this analysis, it would be better to drop it to avoid potential bugs.
) This patch stops propagating nowrap flags unconditionally. In the modified part, when we have an addrec `{%a,+,%b}` where `%b` is known to be negative, we create a new addrec `{%a,+,(-1 * %b)}`. When creating it, the nowrap flags are transferred from the original addrec to the new one without any checks, which is generally incorrect. Since the nowrap property is not essential for this analysis, it would be better to drop it to avoid potential bugs.
This patch stops propagating nowrap flags unconditionally. In the modified part, when we have an addrec
{%a,+,%b}where%bis known to be negative, we create a new addrec{%a,+,(-1 * %b)}. When creating it, the nowrap flags are transferred from the original addrec to the new one without any checks, which is generally incorrect. Since the nowrap property is not essential for this analysis, it would be better to drop it to avoid potential bugs.