[PATCH] [SLSR] handle candidate form &B[i * S]
Jingyue Wu
jingyue at google.com
Wed Mar 11 10:41:11 PDT 2015
================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:259
@@ +258,3 @@
+ // non-free computation.
+ if (TTI && isCompletelyFoldable(GEP, TTI, DL))
+ return;
----------------
hfinkel wrote:
> We always have TTI, you don't need to check for it.
Thanks. I missed this one.
================
Comment at: lib/Transforms/Scalar/StraightLineStrengthReduce.cpp:272
@@ -168,3 +271,3 @@
if (isBasisFor(*Basis, C)) {
C.Basis = &(*Basis);
break;
----------------
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.
```
================
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);
----------------
hfinkel wrote:
> This can be just:
>
> unsigned AS = Basis.Ins->getType()->getPointerAddressSpace();
Thanks!
================
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);
----------------
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
http://reviews.llvm.org/D7459
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list