[PATCH] Assume GetElementPtr offsets to be inbounds

Johannes Doerfert doerfert at cs.uni-saarland.de
Mon Nov 24 19:48:49 PST 2014


Some minor commments, otherwise LGTM

================
Comment at: include/polly/ScopInfo.h:476
@@ +475,3 @@
+  /// time at least one iteration of the outer loop is executed. Hence, we
+  /// assume:
+  ///
----------------
What about n > 10 and m > 1? Shouldn't that be a violation too?

================
Comment at: lib/Analysis/ScopInfo.cpp:850
@@ -849,1 +849,3 @@
 
+void ScopStmt::deriveAssumptionsFromGEP(GetElementPtrInst *Inst) {
+  int Dimension = 0;
----------------
I would rename Inst to GEP or GEPInst or sth. to make the type clear.

================
Comment at: lib/Analysis/ScopInfo.cpp:856
@@ +855,3 @@
+
+  if (auto *PtrTy = dyn_cast<PointerType>(Ty)) {
+    Dimension = 1;
----------------
Theoretically, we could make this a while and increment the dimension, however I don't think it will ever matter.
However, stripping of structs might be worthwile?

================
Comment at: lib/Analysis/ScopInfo.cpp:867
@@ +866,3 @@
+
+    const SCEV *Expr = Parent.getSE()->getSCEV(Inst->getOperand(1 + Dimension));
+
----------------
1 + Dimension is Operand!

================
Comment at: lib/Analysis/ScopInfo.cpp:869
@@ +868,3 @@
+
+    if (isAffineExpr(&Parent.getRegion(), Expr, *Parent.getSE())) {
+      isl_pw_aff *AccessOffset = SCEVAffinator::getPwAff(this, Expr);
----------------
Please move Parent.getSE() before the loop

http://reviews.llvm.org/D6369






More information about the llvm-commits mailing list