Add a `getUsedValuesDefinedAbove()` overload that takes an `Operation` pointer (NFC)

This is a convenient utility around the existing `getUsedValuesDefinedAbove()`
that take two regions.

PiperOrigin-RevId: 266686854
This commit is contained in:
Mehdi Amini 2019-09-01 16:31:40 -07:00 committed by A. Unique TensorFlower
parent 8ce2274d0d
commit ce702fc8da
2 changed files with 11 additions and 0 deletions

View File

@ -45,6 +45,11 @@ void replaceAllUsesInRegionWith(Value *orig, Value *replacement,
void getUsedValuesDefinedAbove(Region &region, Region &limit,
llvm::SetVector<Value *> &values);
/// Fill `values` with a list of values used within any of the regions provided
/// but defined in one of the ancestors.
void getUsedValuesDefinedAbove(llvm::MutableArrayRef<Region> regions,
llvm::SetVector<Value *> &values);
} // namespace mlir
#endif // MLIR_TRANSFORMS_REGIONUTILS_H_

View File

@ -53,3 +53,9 @@ void mlir::getUsedValuesDefinedAbove(Region &region, Region &limit,
values.insert(operand);
});
}
void mlir::getUsedValuesDefinedAbove(llvm::MutableArrayRef<Region> regions,
llvm::SetVector<Value *> &values) {
for (Region &region : regions)
getUsedValuesDefinedAbove(region, region, values);
}