[PATCH] D43810: [SCEV] Smart range calculation for SCEVUnknown Phis

Sanjoy Das via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 28 00:54:03 PST 2018


sanjoy accepted this revision.
sanjoy added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: include/llvm/Analysis/ScalarEvolution.h:1102
 
+  // Mark SCEVUnknown Phis currently being processed by getRangeRef.
+  SmallPtrSet<const SCEVUnknown *, 6> PendingPhiRanges;
----------------
Triple slash to be consistent.


================
Comment at: include/llvm/Analysis/ScalarEvolution.h:1103
+  // Mark SCEVUnknown Phis currently being processed by getRangeRef.
+  SmallPtrSet<const SCEVUnknown *, 6> PendingPhiRanges;
+
----------------
Might want to make this a set of `PHINode` to make what we store here obvious in the type system.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:5537
+        ConstantRange RangeFromOps(BitWidth, /*isFullSet=*/false);
+        for (int i = 0, e = Phi->getNumOperands(); i < e; ++i) {
+          auto OpRange = getRangeRef(getSCEV(Phi->getOperand(i)), SignHint);
----------------
Can this be a range for?


================
Comment at: lib/Analysis/ScalarEvolution.cpp:5545
+        ConservativeResult = ConservativeResult.intersectWith(RangeFromOps);
+        PendingPhiRanges.erase(U);
+      }
----------------
assert that deletion was successful.


https://reviews.llvm.org/D43810





More information about the llvm-commits mailing list