[llvm] 3716125 - [SCEV] Reuse Accum variable when handling GEP flags
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue May 2 02:03:59 PDT 2023
Author: Nikita Popov
Date: 2023-05-02T11:03:38+02:00
New Revision: 371612500afa4ffcdd411f585a427edb5cd037f7
URL: https://github.com/llvm/llvm-project/commit/371612500afa4ffcdd411f585a427edb5cd037f7
DIFF: https://github.com/llvm/llvm-project/commit/371612500afa4ffcdd411f585a427edb5cd037f7.diff
LOG: [SCEV] Reuse Accum variable when handling GEP flags
The GEP minus the base pointer (which is the pre-inc addrec) is
exactly the Accum value that was already calculated.
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 306090f3eb11c..ba3a6092b62cc 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -5838,9 +5838,7 @@ const SCEV *ScalarEvolution::createAddRecFromPHI(PHINode *PN) {
// indices form a positive value.
if (GEP->isInBounds() && GEP->getOperand(0) == PN) {
Flags = setFlags(Flags, SCEV::FlagNW);
-
- const SCEV *Ptr = getSCEV(GEP->getPointerOperand());
- if (isKnownPositive(getMinusSCEV(getSCEV(GEP), Ptr)))
+ if (isKnownPositive(Accum))
Flags = setFlags(Flags, SCEV::FlagNUW);
}
More information about the llvm-commits
mailing list