[PATCH] [SLSR] handle candidate form &B[i * S]

hfinkel at anl.gov hfinkel at anl.gov
Wed Mar 11 00:05:22 PDT 2015


================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:259
@@ +258,3 @@
+    // non-free computation.
+    if (TTI && isCompletelyFoldable(GEP, TTI, DL))
+      return;
----------------
We always have TTI, you don't need to check for it.

================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:272
@@ -168,3 +271,3 @@
     if (isBasisFor(*Basis, C)) {
       C.Basis = &(*Basis);
       break;
----------------
If Basis.Basis != nullptr, do we want to set C.Basis to that?


================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:461
@@ +460,3 @@
+      Type *IntPtrTy = DL->getIntPtrType(C.Ins->getType());
+      // We prefer bumping with GEP because GEPs keep more pointer information.
+      if (BumpWithUglyGEP) {
----------------
Either remove this comment, or say that we use i8* GEPs, instead of inttoptr/ptrtoint because the latter interferes with pointer-aliasing analysis.


================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:465
@@ +464,3 @@
+        unsigned AS =
+            cast<PointerType>(Basis.Ins->getType())->getAddressSpace();
+        Type *CharTy = Type::getInt8PtrTy(Basis.Ins->getContext(), AS);
----------------
This can be just:

  unsigned AS = Basis.Ins->getType()->getPointerAddressSpace();

================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:503
@@ -251,3 +502,3 @@
     BasicBlock *B = node->getBlock();
     for (auto I = B->begin(); I != B->end(); ++I) {
       allocateCandidateAndFindBasis(I);
----------------
Use range-based for.

================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:358
@@ +357,3 @@
+    const SCEV *Base = SE->getMinusSCEV(GEPExpr, LocalOffset);
+    for (unsigned Stripped = 0; Stripped < 2; ++Stripped) {
+      // At least, Idx = Idx *s 1.
----------------
jingyue wrote:
> hfinkel wrote:
> > I don't understand this loop, could you please add a comment explaining it. What changes between the two iterations, and why two?
> Let me know whether this comment helps. 
Yes, that's better.

http://reviews.llvm.org/D7459

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list