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

hfinkel at anl.gov hfinkel at anl.gov
Wed Mar 11 10:51:20 PDT 2015


================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:272
@@ -168,3 +271,3 @@
     if (isBasisFor(*Basis, C)) {
       C.Basis = &(*Basis);
       break;
----------------
jingyue wrote:
> hfinkel wrote:
> > If Basis.Basis != nullptr, do we want to set C.Basis to that?
> > 
> Yes. In that case, C.Ins can still be rewritten with respect to Basis.Ins. For example, 
> ```
> ... &a[s]; // Basis. Assume this is the first memory reference to a, so Basis.Basis == nullptr. 
> ... &a[s * 2]; // C. We still want to rewrite C to Basis + s.
> ```
Okay, please do. That form should enhance ILP.

================
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);
----------------
jingyue wrote:
> hfinkel wrote:
> > Use range-based for.
> I may be missing something, but I don't see any API of BasicBlock that returns an iterator_range. 
> http://llvm.org/docs/doxygen/html/classllvm_1_1BasicBlock.html
Don't need one. You can use a range-based for loop with any object that has a begin()/end().

  for (auto &i : *B)
    allocateCandidateAndFindBasis(&I);

or something like that.

http://reviews.llvm.org/D7459

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






More information about the llvm-commits mailing list