[Mlir-commits] [mlir] b87531c - [mlir] Fix getTypes() support for result ranges.
River Riddle
llvmlistbot at llvm.org
Mon Apr 20 17:20:11 PDT 2020
Author: River Riddle
Date: 2020-04-20T17:18:42-07:00
New Revision: b87531ca68717bf4ee0b512cb6bc6e53eedcdbce
URL: https://github.com/llvm/llvm-project/commit/b87531ca68717bf4ee0b512cb6bc6e53eedcdbce
DIFF: https://github.com/llvm/llvm-project/commit/b87531ca68717bf4ee0b512cb6bc6e53eedcdbce.diff
LOG: [mlir] Fix getTypes() support for result ranges.
Added:
Modified:
mlir/lib/IR/OperationSupport.cpp
mlir/test/lib/Transforms/TestInlining.cpp
Removed:
################################################################################
diff --git a/mlir/lib/IR/OperationSupport.cpp b/mlir/lib/IR/OperationSupport.cpp
index 1b5f78ce1fe4..9994a4f03379 100644
--- a/mlir/lib/IR/OperationSupport.cpp
+++ b/mlir/lib/IR/OperationSupport.cpp
@@ -151,7 +151,7 @@ TypeRange::TypeRange(ArrayRef<Value> values)
TypeRange::TypeRange(ValueRange values) : TypeRange(OwnerT(), values.size()) {
detail::ValueRangeOwner owner = values.begin().getBase();
if (auto *op = reinterpret_cast<Operation *>(owner.ptr.dyn_cast<void *>()))
- this->base = &op->getResultTypes()[owner.startIndex];
+ this->base = op->getResultTypes().drop_front(owner.startIndex).data();
else if (auto *operand = owner.ptr.dyn_cast<OpOperand *>())
this->base = operand;
else
@@ -195,7 +195,7 @@ ResultRange::ResultRange(Operation *op)
: ResultRange(op, /*startIndex=*/0, op->getNumResults()) {}
ArrayRef<Type> ResultRange::getTypes() const {
- return getBase()->getResultTypes();
+ return getBase()->getResultTypes().slice(getStartIndex(), size());
}
/// See `llvm::indexed_accessor_range` for details.
diff --git a/mlir/test/lib/Transforms/TestInlining.cpp b/mlir/test/lib/Transforms/TestInlining.cpp
index 4fd5372fdcd3..e361d346c271 100644
--- a/mlir/test/lib/Transforms/TestInlining.cpp
+++ b/mlir/test/lib/Transforms/TestInlining.cpp
@@ -45,7 +45,7 @@ struct Inliner : public PassWrapper<Inliner, FunctionPass> {
// region if there is more than one use.
if (failed(inlineRegion(
interface, &callee.body(), caller, caller.getArgOperands(),
- SmallVector<Value, 8>(caller.getResults()), caller.getLoc(),
+ caller.getResults(), caller.getLoc(),
/*shouldCloneInlinedRegion=*/!callee.getResult().hasOneUse())))
continue;
More information about the Mlir-commits
mailing list