This makes ignoring a result explicit by the user, and helps to prevent accidental errors with dropped results. Marking LogicalResult as no discard was always the intention from the beginning, but got lost along the way. Differential Revision: https://reviews.llvm.org/D95841
40 lines
1.4 KiB
C++
40 lines
1.4 KiB
C++
//===- TestGLSLCanonicalization.cpp - Pass to test GLSL-specific pattterns ===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "mlir/Dialect/SPIRV/IR/SPIRVGLSLCanonicalization.h"
|
|
#include "mlir/Dialect/SPIRV/IR/SPIRVModule.h"
|
|
#include "mlir/Pass/Pass.h"
|
|
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
|
|
|
|
using namespace mlir;
|
|
|
|
namespace {
|
|
class TestGLSLCanonicalizationPass
|
|
: public PassWrapper<TestGLSLCanonicalizationPass,
|
|
OperationPass<mlir::ModuleOp>> {
|
|
public:
|
|
TestGLSLCanonicalizationPass() = default;
|
|
TestGLSLCanonicalizationPass(const TestGLSLCanonicalizationPass &) {}
|
|
void runOnOperation() override;
|
|
};
|
|
} // namespace
|
|
|
|
void TestGLSLCanonicalizationPass::runOnOperation() {
|
|
OwningRewritePatternList patterns;
|
|
spirv::populateSPIRVGLSLCanonicalizationPatterns(patterns, &getContext());
|
|
(void)applyPatternsAndFoldGreedily(getOperation(), std::move(patterns));
|
|
}
|
|
|
|
namespace mlir {
|
|
void registerTestSpirvGLSLCanonicalizationPass() {
|
|
PassRegistration<TestGLSLCanonicalizationPass> registration(
|
|
"test-spirv-glsl-canonicalization",
|
|
"Tests SPIR-V canonicalization patterns for GLSL extension.");
|
|
}
|
|
} // namespace mlir
|