mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-18 18:42:46 +02:00
[IR] Add GEPOperator::indices() (NFC)
In order to mirror the GetElementPtrInst::indices() API. Wanted to use this in the IRForTarget code, and was surprised to find that it didn't exist yet.
This commit is contained in:
parent
86ce446efa
commit
103545107e
@ -488,6 +488,14 @@ public:
|
||||
inline op_iterator idx_end() { return op_end(); }
|
||||
inline const_op_iterator idx_end() const { return op_end(); }
|
||||
|
||||
inline iterator_range<op_iterator> indices() {
|
||||
return make_range(idx_begin(), idx_end());
|
||||
}
|
||||
|
||||
inline iterator_range<const_op_iterator> indices() const {
|
||||
return make_range(idx_begin(), idx_end());
|
||||
}
|
||||
|
||||
Value *getPointerOperand() {
|
||||
return getOperand(0);
|
||||
}
|
||||
@ -544,7 +552,7 @@ public:
|
||||
}
|
||||
|
||||
unsigned countNonConstantIndices() const {
|
||||
return count_if(make_range(idx_begin(), idx_end()), [](const Use& use) {
|
||||
return count_if(indices(), [](const Use& use) {
|
||||
return !isa<ConstantInt>(*use);
|
||||
});
|
||||
}
|
||||
|
@ -5732,8 +5732,8 @@ const SCEV *ScalarEvolution::createNodeForGEP(GEPOperator *GEP) {
|
||||
return getUnknown(GEP);
|
||||
|
||||
SmallVector<const SCEV *, 4> IndexExprs;
|
||||
for (auto Index = GEP->idx_begin(); Index != GEP->idx_end(); ++Index)
|
||||
IndexExprs.push_back(getSCEV(*Index));
|
||||
for (Value *Index : GEP->indices())
|
||||
IndexExprs.push_back(getSCEV(Index));
|
||||
return getGEPExpr(GEP, IndexExprs);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user