[PATCH] D13595: [SCEV][LV] Add SCEV Predicates and use them to re-implement stride versioning
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 26 11:39:27 PDT 2015
sanjoy added inline comments.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:9396
@@ +9395,3 @@
+ if (auto *I = dyn_cast<Instruction>(V))
+ return I->getParent() == Loc->getParent() ? I : nullptr;
+ return nullptr;
----------------
I know I'm bikeshedding a lot on this, but I think a better utility would be
```
BasicBlock *getValueParent(Value *V) {
if (I = dyn_cast<Instruction>(V))
return I->getParent();
return nullptr;
}
```
then where you call `getFirstInst` you could instead do
```
if (!FirstInst && getValueParent(C) == Loc)
FirstInst = cast<Instruction>(C);
```
I think that will be clearer and almost as concise -- reading `getFirstInst(A,B,C)` does not really tell me anything about what it is supposed to do, especially since one of the parameters is named `FirstInst`.
http://reviews.llvm.org/D13595
More information about the llvm-commits
mailing list