[PATCH] D23176: [LoopVectorizer] Fixed a bug in memory conflict run-time check

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 16:25:32 PDT 2016


anemet added inline comments.

================
Comment at: ../lib/Analysis/LoopAccessAnalysis.cpp:199
@@ +198,3 @@
+      Ptr->getType()->getPointerElementType()->getScalarSizeInBits() / 8;
+    const SCEV *Touched = SE->getConstant(ScEnd->getType(), EltSize);
+    ScEnd = SE->getAddExpr(ScEnd, Touched);
----------------
Touched is way too loose, how about EltSizeSCEV or something.

I also like Ayal's idea about the comment talking about mentioning misaligned here.

You also need to change the comment in the LAA.h:

    /// Holds the pointer value at the end of the loop.
    const SCEV *End;

This should say something about a holding a pointer one past the last byte of the last element accessed.

================
Comment at: ../lib/Analysis/LoopAccessAnalysis.cpp:1882-1884
@@ -1866,5 +1881,5 @@
 
-    Value *Cmp0 = ChkBuilder.CreateICmpULE(Start0, End1, "bound0");
+    Value *Cmp0 = ChkBuilder.CreateICmpULT(Start0, End1, "bound0");
     FirstInst = getFirstInst(FirstInst, Cmp0, Loc);
-    Value *Cmp1 = ChkBuilder.CreateICmpULE(Start1, End0, "bound1");
+    Value *Cmp1 = ChkBuilder.CreateICmpULT(Start1, End0, "bound1");
     FirstInst = getFirstInst(FirstInst, Cmp1, Loc);
----------------
Can you please include the formula in a comment here?

================
Comment at: ../test/Analysis/LoopAccessAnalysis/memcheck-off-by-one-error.ll:3
@@ +2,3 @@
+
+; This test verifies run-time boundary check of memory accesses.
+; The original loop:
----------------
Elaborate more how exactly this was failing before.  You could for example explain it in terms of the actual pointer values you were debugging with.


Repository:
  rL LLVM

https://reviews.llvm.org/D23176





More information about the llvm-commits mailing list