Updates LLVM usage to match
[0fc1aa22ee6a](https://github.com/llvm/llvm-project/commit/0fc1aa22ee6a)

PiperOrigin-RevId: 339239851
This commit is contained in:
Thomas Joerg 2020-10-27 06:55:28 -07:00 committed by TensorFlow MLIR Team
parent b7aa01dbe0
commit 7363748bae
19 changed files with 33 additions and 32 deletions

View File

@ -1,2 +1,2 @@
26750a1264b3df114a1efae7cde6f0784206b2ce 0fc1aa22ee6ac337a5d51fa5666c9cd61da61b07

View File

@ -49,7 +49,7 @@ struct ChloLegalizeToHloPass
chlo::PopulateLegalizeChloToHloPatterns(&getContext(), &conversionPatterns); chlo::PopulateLegalizeChloToHloPatterns(&getContext(), &conversionPatterns);
if (failed(applyPartialConversion(getFunction(), conversionTarget, if (failed(applyPartialConversion(getFunction(), conversionTarget,
conversionPatterns))) { std::move(conversionPatterns)))) {
return signalPassFailure(); return signalPassFailure();
} }
} }

View File

@ -555,7 +555,8 @@ struct HloLegalizeToLhlo
&context, converter, patterns); &context, converter, patterns);
populateShapeStructuralTypeConversionsAndLegality(&context, converter, populateShapeStructuralTypeConversionsAndLegality(&context, converter,
patterns, target); patterns, target);
if (failed(applyPartialConversion(getOperation(), target, patterns))) if (failed(applyPartialConversion(getOperation(), target,
std::move(patterns))))
signalPassFailure(); signalPassFailure();
} }

View File

@ -17,8 +17,8 @@ limitations under the License.
#include "mlir-hlo/Dialect/mhlo/transforms/passes.h" #include "mlir-hlo/Dialect/mhlo/transforms/passes.h"
#include "mlir-hlo/Dialect/mhlo/transforms/rewriters.h" #include "mlir-hlo/Dialect/mhlo/transforms/rewriters.h"
#include "mlir/IR/Function.h" #include "mlir/IR/Function.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir { namespace mlir {
@ -133,7 +133,7 @@ struct LegalizeGatherToTorchIndexSelectPass
void runOnFunction() override { void runOnFunction() override {
OwningRewritePatternList patterns; OwningRewritePatternList patterns;
PopulateGatherToTorchIndexSelectPatterns(&getContext(), &patterns); PopulateGatherToTorchIndexSelectPatterns(&getContext(), &patterns);
applyPatternsAndFoldGreedily(getFunction(), patterns); applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
} }
}; };
} // namespace } // namespace

View File

@ -893,7 +893,7 @@ struct LhloLegalizeToLinalgPass
auto func = getFunction(); auto func = getFunction();
populateLHLOToLinalgConversionPattern(func.getContext(), &patterns); populateLHLOToLinalgConversionPattern(func.getContext(), &patterns);
if (failed(applyPartialConversion(func, target, patterns, nullptr))) { if (failed(applyPartialConversion(func, target, std::move(patterns)))) {
signalPassFailure(); signalPassFailure();
} }
} }
@ -912,7 +912,7 @@ struct HloLegalizeToLinalgPass
auto func = getFunction(); auto func = getFunction();
mhlo::populateHLOToLinalgConversionPattern(func.getContext(), &patterns); mhlo::populateHLOToLinalgConversionPattern(func.getContext(), &patterns);
if (failed(applyPartialConversion(func, target, patterns, nullptr))) { if (failed(applyPartialConversion(func, target, std::move(patterns)))) {
signalPassFailure(); signalPassFailure();
} }
} }

View File

@ -21,8 +21,8 @@ limitations under the License.
#include "mlir-hlo/Dialect/mhlo/transforms/rewriters.h" #include "mlir-hlo/Dialect/mhlo/transforms/rewriters.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Function.h" #include "mlir/IR/Function.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir { namespace mlir {
namespace { namespace {
@ -201,7 +201,7 @@ void PopulateMhloToStdPatterns(OwningRewritePatternList *patterns,
void LegalizeToStandardPass::runOnFunction() { void LegalizeToStandardPass::runOnFunction() {
OwningRewritePatternList patterns; OwningRewritePatternList patterns;
mlir::mhlo::PopulateMhloToStdPatterns(&patterns, &getContext()); mlir::mhlo::PopulateMhloToStdPatterns(&patterns, &getContext());
applyPatternsAndFoldGreedily(getFunction(), patterns); applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
} }
} // end namespace mhlo } // end namespace mhlo

View File

@ -20,8 +20,8 @@ limitations under the License.
#include "mlir-hlo/Dialect/mhlo/transforms/rewriters.h" #include "mlir-hlo/Dialect/mhlo/transforms/rewriters.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Function.h" #include "mlir/IR/Function.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir { namespace mlir {
namespace mhlo { namespace mhlo {
@ -259,7 +259,7 @@ struct LegalizeTrigonometricToApproximationPass
void runOnFunction() override { void runOnFunction() override {
OwningRewritePatternList patterns; OwningRewritePatternList patterns;
PopulateTrigonometricToApproximationPatterns(&getContext(), &patterns); PopulateTrigonometricToApproximationPatterns(&getContext(), &patterns);
applyPatternsAndFoldGreedily(getFunction(), patterns); applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
} }
}; };

View File

@ -27,6 +27,7 @@ limitations under the License.
#include "mlir/Interfaces/ViewLikeInterface.h" #include "mlir/Interfaces/ViewLikeInterface.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/FoldUtils.h" #include "mlir/Transforms/FoldUtils.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir { namespace mlir {
namespace lmhlo { namespace lmhlo {
@ -111,7 +112,7 @@ class LhloFuseLinalgPass
} }
}); });
auto patterns = linalg::getLinalgTilingCanonicalizationPatterns(ctx); auto patterns = linalg::getLinalgTilingCanonicalizationPatterns(ctx);
applyPatternsAndFoldGreedily(func, patterns); applyPatternsAndFoldGreedily(func, std::move(patterns));
// Fuse producers of tiled linalg ops. // Fuse producers of tiled linalg ops.
llvm::SmallDenseSet<Operation*> erase_set; llvm::SmallDenseSet<Operation*> erase_set;
@ -132,7 +133,7 @@ class LhloFuseLinalgPass
} }
auto patterns = linalg::getLinalgTilingCanonicalizationPatterns(ctx); auto patterns = linalg::getLinalgTilingCanonicalizationPatterns(ctx);
applyPatternsAndFoldGreedily(func, patterns); applyPatternsAndFoldGreedily(func, std::move(patterns));
} }
for (auto* e : erase_set) e->erase(); for (auto* e : erase_set) e->erase();
} }

View File

@ -19,12 +19,10 @@ limitations under the License.
#include "mlir-hlo/Dialect/mhlo/transforms/map_lmhlo_to_scalar_op.h" #include "mlir-hlo/Dialect/mhlo/transforms/map_lmhlo_to_scalar_op.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h" #include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Location.h" #include "mlir/IR/Location.h"
#include "mlir/IR/MLIRContext.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StandardTypes.h" #include "mlir/IR/StandardTypes.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir { namespace mlir {
namespace lmhlo { namespace lmhlo {
@ -160,7 +158,7 @@ struct LhloLegalizeToAffinePass
OwningRewritePatternList patterns; OwningRewritePatternList patterns;
auto func = getFunction(); auto func = getFunction();
populateLHLOToAffineConversionPattern(func.getContext(), &patterns); populateLHLOToAffineConversionPattern(func.getContext(), &patterns);
applyPatternsAndFoldGreedily(func, patterns); applyPatternsAndFoldGreedily(func, std::move(patterns));
} }
}; };

View File

@ -184,7 +184,7 @@ struct LhloLegalizeToGpuPass
target.addIllegalOp<ReduceOp>(); target.addIllegalOp<ReduceOp>();
auto func = getFunction(); auto func = getFunction();
patterns.insert<LhloReduceToGPULaunchConverter>(func.getContext()); patterns.insert<LhloReduceToGPULaunchConverter>(func.getContext());
if (failed(applyPartialConversion(func, target, patterns))) { if (failed(applyPartialConversion(func, target, std::move(patterns)))) {
signalPassFailure(); signalPassFailure();
} }
} }

View File

@ -47,7 +47,7 @@ class TestLhloToLLVMPass
target.addLegalOp<ModuleOp, ModuleTerminatorOp>(); target.addLegalOp<ModuleOp, ModuleTerminatorOp>();
target.addIllegalDialect<LmhloDialect>(); target.addIllegalDialect<LmhloDialect>();
if (failed(applyFullConversion(m, target, patterns))) { if (failed(applyFullConversion(m, target, std::move(patterns)))) {
signalPassFailure(); signalPassFailure();
} }
} }

View File

@ -713,7 +713,7 @@ struct LhloLegalizeToParallelLoopsPass
target.addIllegalOp<lmhlo::ReduceOp, lmhlo::ReduceWindowOp, target.addIllegalOp<lmhlo::ReduceOp, lmhlo::ReduceWindowOp,
lmhlo::SelectAndScatterOp>(); lmhlo::SelectAndScatterOp>();
if (failed(applyPartialConversion(func, target, patterns))) { if (failed(applyPartialConversion(func, target, std::move(patterns)))) {
signalPassFailure(); signalPassFailure();
} }
} }

View File

@ -29,11 +29,11 @@ limitations under the License.
#include "mlir/IR/Attributes.h" #include "mlir/IR/Attributes.h"
#include "mlir/IR/MLIRContext.h" #include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Operation.h" #include "mlir/IR/Operation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h" #include "mlir/IR/TypeUtilities.h"
#include "mlir/IR/Types.h" #include "mlir/IR/Types.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Pass/PassRegistry.h" #include "mlir/Pass/PassRegistry.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
using mlir::FunctionPass; using mlir::FunctionPass;
using mlir::OwningRewritePatternList; using mlir::OwningRewritePatternList;
@ -70,7 +70,7 @@ void LowerComplexPass::runOnFunction() {
OwningRewritePatternList patterns; OwningRewritePatternList patterns;
mlir::mhlo::PopulateComplexLoweringPatterns(&getContext(), &patterns); mlir::mhlo::PopulateComplexLoweringPatterns(&getContext(), &patterns);
applyPatternsAndFoldGreedily(getFunction(), patterns); applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
} }
std::unique_ptr<FunctionPass> mlir::mhlo::createLowerComplexPass() { std::unique_ptr<FunctionPass> mlir::mhlo::createLowerComplexPass() {

View File

@ -25,10 +25,10 @@ limitations under the License.
#include "mlir/IR/Function.h" #include "mlir/IR/Function.h"
#include "mlir/IR/Location.h" #include "mlir/IR/Location.h"
#include "mlir/IR/Operation.h" #include "mlir/IR/Operation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/StandardTypes.h" #include "mlir/IR/StandardTypes.h"
#include "mlir/IR/TypeUtilities.h" #include "mlir/IR/TypeUtilities.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
using mlir::DenseIntElementsAttr; using mlir::DenseIntElementsAttr;
using mlir::ElementsAttr; using mlir::ElementsAttr;
@ -182,7 +182,7 @@ struct LegalizeGeneralDotPass
void runOnFunction() override { void runOnFunction() override {
OwningRewritePatternList patterns; OwningRewritePatternList patterns;
mlir::mhlo::PopulateGeneralDotOpLoweringPatterns(&patterns, &getContext()); mlir::mhlo::PopulateGeneralDotOpLoweringPatterns(&patterns, &getContext());
applyPatternsAndFoldGreedily(getFunction(), patterns); applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
} }
}; };

View File

@ -42,7 +42,7 @@ struct TestMaterializeBroadcastsPass
PopulateMaterializeBroadcastsPatterns(&getContext(), &conversionPatterns); PopulateMaterializeBroadcastsPatterns(&getContext(), &conversionPatterns);
if (failed(applyPartialConversion(getFunction(), conversionTarget, if (failed(applyPartialConversion(getFunction(), conversionTarget,
conversionPatterns))) { std::move(conversionPatterns)))) {
return signalPassFailure(); return signalPassFailure();
} }
} }

View File

@ -19,9 +19,9 @@ limitations under the License.
#include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/MLIRContext.h" #include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Operation.h" #include "mlir/IR/Operation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h" #include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
using mlir::FunctionPass; using mlir::FunctionPass;
using mlir::PassWrapper; using mlir::PassWrapper;
@ -42,7 +42,7 @@ void OptimizeMhloPass::runOnFunction() {
mlir::OwningRewritePatternList patterns; mlir::OwningRewritePatternList patterns;
mlir::mhlo::PopulateOptimizeMHLOPatterns(&getContext(), &patterns); mlir::mhlo::PopulateOptimizeMHLOPatterns(&getContext(), &patterns);
applyPatternsAndFoldGreedily(getFunction(), patterns); applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
} }
std::unique_ptr<mlir::FunctionPass> mlir::mhlo::createOptimizeMhloPass() { std::unique_ptr<mlir::FunctionPass> mlir::mhlo::createOptimizeMhloPass() {

View File

@ -17,9 +17,9 @@ limitations under the License.
#include "mlir/IR/Identifier.h" #include "mlir/IR/Identifier.h"
#include "mlir/IR/MLIRContext.h" #include "mlir/IR/MLIRContext.h"
#include "mlir/IR/OperationSupport.h" #include "mlir/IR/OperationSupport.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Interfaces/InferTypeOpInterface.h" #include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir { namespace mlir {
namespace mhlo { namespace mhlo {
@ -87,7 +87,7 @@ struct TestInferShapedTypeMethodsPass
OwningRewritePatternList patterns; OwningRewritePatternList patterns;
patterns.insert<ReifyReturnTypeShapesPattern>(&getContext()); patterns.insert<ReifyReturnTypeShapesPattern>(&getContext());
patterns.insert<InferReturnTypeComponentsPattern>(&getContext()); patterns.insert<InferReturnTypeComponentsPattern>(&getContext());
applyPatternsAndFoldGreedily(getFunction(), patterns); applyPatternsAndFoldGreedily(getFunction(), std::move(patterns));
} }
}; };

View File

@ -154,7 +154,8 @@ struct TransformUnrankedHloPass
PopulateTransformUnrankedHloPatterns(&ctx, &patterns); PopulateTransformUnrankedHloPatterns(&ctx, &patterns);
// Apply transformation. // Apply transformation.
if (failed(applyPartialConversion(getFunction(), target, patterns))) if (failed(
applyPartialConversion(getFunction(), target, std::move(patterns))))
return signalPassFailure(); return signalPassFailure();
} }
}; };

View File

@ -18,9 +18,9 @@ limitations under the License.
#include "mlir/Dialect/StandardOps/IR/Ops.h" #include "mlir/Dialect/StandardOps/IR/Ops.h"
#include "mlir/IR/MLIRContext.h" #include "mlir/IR/MLIRContext.h"
#include "mlir/IR/Operation.h" #include "mlir/IR/Operation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Pass/Pass.h" #include "mlir/Pass/Pass.h"
#include "mlir/Transforms/DialectConversion.h" #include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
namespace mlir { namespace mlir {
namespace mhlo { namespace mhlo {
@ -32,7 +32,7 @@ struct TestUnfuseBatchNormPass
void runOnOperation() override { void runOnOperation() override {
OwningRewritePatternList patterns; OwningRewritePatternList patterns;
PopulateUnfuseBatchNormPatterns(&getContext(), &patterns); PopulateUnfuseBatchNormPatterns(&getContext(), &patterns);
applyPatternsAndFoldGreedily(getOperation(), patterns); applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
} }
}; };