summaryrefslogtreecommitdiffstats
path: root/mlir/test/lib
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-12-23 14:45:01 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-12-23 16:36:53 -0800
commite62a69561fb9d7b1013d2853da68d79a7907fead (patch)
tree0dd059094cbfb8d904513abcdc1fbe8cfa89bb09 /mlir/test/lib
parent5d5bd2e1da29d976cb125dbb3cd097a5e42b2be4 (diff)
downloadbcm5719-llvm-e62a69561fb9d7b1013d2853da68d79a7907fead.tar.gz
bcm5719-llvm-e62a69561fb9d7b1013d2853da68d79a7907fead.zip
NFC: Replace ValuePtr with Value and remove it now that Value is value-typed.
ValuePtr was a temporary typedef during the transition to a value-typed Value. PiperOrigin-RevId: 286945714
Diffstat (limited to 'mlir/test/lib')
-rw-r--r--mlir/test/lib/TestDialect/TestDialect.cpp8
-rw-r--r--mlir/test/lib/TestDialect/TestOps.td2
-rw-r--r--mlir/test/lib/TestDialect/TestPatterns.cpp33
-rw-r--r--mlir/test/lib/Transforms/TestLoopMapping.cpp2
-rw-r--r--mlir/test/lib/Transforms/TestVectorizationUtils.cpp2
5 files changed, 23 insertions, 24 deletions
diff --git a/mlir/test/lib/TestDialect/TestDialect.cpp b/mlir/test/lib/TestDialect/TestDialect.cpp
index 976a1976f01..21cf69ec1fa 100644
--- a/mlir/test/lib/TestDialect/TestDialect.cpp
+++ b/mlir/test/lib/TestDialect/TestDialect.cpp
@@ -91,7 +91,7 @@ struct TestInlinerInterface : public DialectInlinerInterface {
/// Handle the given inlined terminator by replacing it with a new operation
/// as necessary.
void handleTerminator(Operation *op,
- ArrayRef<ValuePtr> valuesToRepl) const final {
+ ArrayRef<Value> valuesToRepl) const final {
// Only handle "test.return" here.
auto returnOp = dyn_cast<TestReturnOp>(op);
if (!returnOp)
@@ -108,7 +108,7 @@ struct TestInlinerInterface : public DialectInlinerInterface {
/// operation that takes 'input' as the only operand, and produces a single
/// result of 'resultType'. If a conversion can not be generated, nullptr
/// should be returned.
- Operation *materializeCallConversion(OpBuilder &builder, ValuePtr input,
+ Operation *materializeCallConversion(OpBuilder &builder, Value input,
Type resultType,
Location conversionLoc) const final {
// Only allow conversion for i16/i32 types.
@@ -222,7 +222,7 @@ static ParseResult parseWrappingRegionOp(OpAsmParser &parser,
// Create a return terminator in the inner region, pass as operand to the
// terminator the returned values from the wrapped operation.
- SmallVector<ValuePtr, 8> return_operands(wrapped_op->getResults());
+ SmallVector<Value, 8> return_operands(wrapped_op->getResults());
OpBuilder builder(parser.getBuilder().getContext());
builder.setInsertionPointToEnd(&block);
builder.create<TestReturnOp>(wrapped_op->getLoc(), return_operands);
@@ -288,7 +288,7 @@ OpFoldResult TestOpWithRegionFold::fold(ArrayRef<Attribute> operands) {
LogicalResult TestOpWithVariadicResultsAndFolder::fold(
ArrayRef<Attribute> operands, SmallVectorImpl<OpFoldResult> &results) {
- for (ValuePtr input : this->operands()) {
+ for (Value input : this->operands()) {
results.push_back(input);
}
return success();
diff --git a/mlir/test/lib/TestDialect/TestOps.td b/mlir/test/lib/TestDialect/TestOps.td
index a8709ddca27..dacb796de18 100644
--- a/mlir/test/lib/TestDialect/TestOps.td
+++ b/mlir/test/lib/TestDialect/TestOps.td
@@ -635,7 +635,7 @@ def OpSymbolBindingB : TEST_Op<"symbol_binding_b", []> {
let builders = [
OpBuilder<
- "Builder *builder, OperationState &state, ValuePtr operand",
+ "Builder *builder, OperationState &state, Value operand",
[{
state.types.assign({builder->getIntegerType(32)});
state.addOperands({operand});
diff --git a/mlir/test/lib/TestDialect/TestPatterns.cpp b/mlir/test/lib/TestDialect/TestPatterns.cpp
index b886097202d..929c4a941a2 100644
--- a/mlir/test/lib/TestDialect/TestPatterns.cpp
+++ b/mlir/test/lib/TestDialect/TestPatterns.cpp
@@ -13,12 +13,11 @@
using namespace mlir;
// Native function for testing NativeCodeCall
-static ValuePtr chooseOperand(ValuePtr input1, ValuePtr input2,
- BoolAttr choice) {
+static Value chooseOperand(Value input1, Value input2, BoolAttr choice) {
return choice.getValue() ? input1 : input2;
}
-static void createOpI(PatternRewriter &rewriter, ValuePtr input) {
+static void createOpI(PatternRewriter &rewriter, Value input) {
rewriter.create<OpI>(rewriter.getUnknownLoc(), input);
}
@@ -65,7 +64,7 @@ struct ReturnTypeOpMatch : public RewritePattern {
PatternMatchResult matchAndRewrite(Operation *op,
PatternRewriter &rewriter) const final {
if (auto retTypeFn = dyn_cast<InferTypeOpInterface>(op)) {
- SmallVector<ValuePtr, 4> values(op->getOperands());
+ SmallVector<Value, 4> values(op->getOperands());
SmallVector<Type, 2> inferedReturnTypes;
if (failed(retTypeFn.inferReturnTypes(op->getLoc(), values,
op->getAttrs(), op->getRegions(),
@@ -124,7 +123,7 @@ struct TestRegionRewriteBlockMovement : public ConversionPattern {
: ConversionPattern("test.region", 1, ctx) {}
PatternMatchResult
- matchAndRewrite(Operation *op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
// Inline this region into the parent region.
auto &parentRegion = *op->getParentRegion();
@@ -157,7 +156,7 @@ struct TestRegionRewriteUndo : public RewritePattern {
// Add an explicitly illegal operation to ensure the conversion fails.
rewriter.create<ILLegalOpF>(op->getLoc(), rewriter.getIntegerType(32));
- rewriter.create<TestValidOp>(op->getLoc(), ArrayRef<ValuePtr>());
+ rewriter.create<TestValidOp>(op->getLoc(), ArrayRef<Value>());
// Drop this operation.
rewriter.eraseOp(op);
@@ -174,7 +173,7 @@ struct TestDropOpSignatureConversion : public ConversionPattern {
: ConversionPattern("test.drop_region_op", 1, ctx), converter(converter) {
}
PatternMatchResult
- matchAndRewrite(Operation *op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
Region &region = op->getRegion(0);
Block *entry = &region.front();
@@ -200,7 +199,7 @@ struct TestPassthroughInvalidOp : public ConversionPattern {
TestPassthroughInvalidOp(MLIRContext *ctx)
: ConversionPattern("test.invalid", 1, ctx) {}
PatternMatchResult
- matchAndRewrite(Operation *op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
rewriter.replaceOpWithNewOp<TestValidOp>(op, llvm::None, operands,
llvm::None);
@@ -212,7 +211,7 @@ struct TestSplitReturnType : public ConversionPattern {
TestSplitReturnType(MLIRContext *ctx)
: ConversionPattern("test.return", 1, ctx) {}
PatternMatchResult
- matchAndRewrite(Operation *op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
// Check for a return of F32.
if (op->getNumOperands() != 1 || !op->getOperand(0)->getType().isF32())
@@ -237,7 +236,7 @@ struct TestChangeProducerTypeI32ToF32 : public ConversionPattern {
TestChangeProducerTypeI32ToF32(MLIRContext *ctx)
: ConversionPattern("test.type_producer", 1, ctx) {}
PatternMatchResult
- matchAndRewrite(Operation *op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
// If the type is I32, change the type to F32.
if (!(*op->result_type_begin()).isInteger(32))
@@ -250,7 +249,7 @@ struct TestChangeProducerTypeF32ToF64 : public ConversionPattern {
TestChangeProducerTypeF32ToF64(MLIRContext *ctx)
: ConversionPattern("test.type_producer", 1, ctx) {}
PatternMatchResult
- matchAndRewrite(Operation *op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
// If the type is F32, change the type to F64.
if (!(*op->result_type_begin()).isF32())
@@ -263,7 +262,7 @@ struct TestChangeProducerTypeF32ToInvalid : public ConversionPattern {
TestChangeProducerTypeF32ToInvalid(MLIRContext *ctx)
: ConversionPattern("test.type_producer", 10, ctx) {}
PatternMatchResult
- matchAndRewrite(Operation *op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
// Always convert to B16, even though it is not a legal type. This tests
// that values are unmapped correctly.
@@ -275,7 +274,7 @@ struct TestUpdateConsumerType : public ConversionPattern {
TestUpdateConsumerType(MLIRContext *ctx)
: ConversionPattern("test.type_consumer", 1, ctx) {}
PatternMatchResult
- matchAndRewrite(Operation *op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(Operation *op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const final {
// Verify that the incoming operand has been successfully remapped to F64.
if (!operands[0]->getType().isF64())
@@ -336,7 +335,7 @@ struct TestTypeConverter : public TypeConverter {
/// Override the hook to materialize a conversion. This is necessary because
/// we generate 1->N type mappings.
Operation *materializeConversion(PatternRewriter &rewriter, Type resultType,
- ArrayRef<ValuePtr> inputs,
+ ArrayRef<Value> inputs,
Location loc) override {
return rewriter.create<TestCastOp>(loc, resultType, inputs);
}
@@ -459,13 +458,13 @@ struct OneVResOneVOperandOp1Converter
using OpConversionPattern<OneVResOneVOperandOp1>::OpConversionPattern;
PatternMatchResult
- matchAndRewrite(OneVResOneVOperandOp1 op, ArrayRef<ValuePtr> operands,
+ matchAndRewrite(OneVResOneVOperandOp1 op, ArrayRef<Value> operands,
ConversionPatternRewriter &rewriter) const override {
auto origOps = op.getOperands();
assert(std::distance(origOps.begin(), origOps.end()) == 1 &&
"One operand expected");
- ValuePtr origOp = *origOps.begin();
- SmallVector<ValuePtr, 2> remappedOperands;
+ Value origOp = *origOps.begin();
+ SmallVector<Value, 2> remappedOperands;
// Replicate the remapped original operand twice. Note that we don't used
// the remapped 'operand' since the goal is testing 'getRemappedValue'.
remappedOperands.push_back(rewriter.getRemappedValue(origOp));
diff --git a/mlir/test/lib/Transforms/TestLoopMapping.cpp b/mlir/test/lib/Transforms/TestLoopMapping.cpp
index 5b1394d5996..86e5713eb03 100644
--- a/mlir/test/lib/Transforms/TestLoopMapping.cpp
+++ b/mlir/test/lib/Transforms/TestLoopMapping.cpp
@@ -32,7 +32,7 @@ public:
// SSA values for the transformation are created out of thin air by
// unregistered "new_processor_id_and_range" operations. This is enough to
// emulate mapping conditions.
- SmallVector<ValuePtr, 8> processorIds, numProcessors;
+ SmallVector<Value, 8> processorIds, numProcessors;
func.walk([&processorIds, &numProcessors](Operation *op) {
if (op->getName().getStringRef() != "new_processor_id_and_range")
return;
diff --git a/mlir/test/lib/Transforms/TestVectorizationUtils.cpp b/mlir/test/lib/Transforms/TestVectorizationUtils.cpp
index e131f4803ef..6f4d948e55f 100644
--- a/mlir/test/lib/Transforms/TestVectorizationUtils.cpp
+++ b/mlir/test/lib/Transforms/TestVectorizationUtils.cpp
@@ -236,7 +236,7 @@ void VectorizerTestPass::testNormalizeMaps() {
for (auto m : matches) {
auto app = cast<AffineApplyOp>(m.getMatchedOperation());
OpBuilder b(m.getMatchedOperation());
- SmallVector<ValuePtr, 8> operands(app.getOperands());
+ SmallVector<Value, 8> operands(app.getOperands());
makeComposedAffineApply(b, app.getLoc(), app.getAffineMap(), operands);
}
}
OpenPOWER on IntegriCloud