Mehdi noted in https://reviews.llvm.org/D144391 that given the low cost of keeping the old `fold` method signature working and the difficulty of writing a `FoldAdaptor` oneself, it'd be nice to keep the support for the sake of Ops written manually in C++.
This patch therefore partially reverts the removal of the old `fold` method by still allowing the old signature to be used. The active use of it is still discouraged and ODS will always generate the new method using `FoldAdaptor`s.
I'd also like to note that the previous ought to have broken some manually defined `fold` methods in-tree that are defined here: 23bcd6b862/mlir/include/mlir/Dialect/Affine/IR/AffineOps.h (L245) It seems like these are not part of the regressions tests however...
Differential Revision: https://reviews.llvm.org/D144591
12 lines
358 B
MLIR
12 lines
358 B
MLIR
// RUN: mlir-opt %s -canonicalize -split-input-file | FileCheck %s
|
|
|
|
func.func @test() -> i32 {
|
|
%c5 = "test.constant"() {value = 5 : i32} : () -> i32
|
|
%res = "test.manual_cpp_op_with_fold"(%c5) : (i32) -> i32
|
|
return %res : i32
|
|
}
|
|
|
|
// CHECK-LABEL: func.func @test
|
|
// CHECK-NEXT: %[[C:.*]] = "test.constant"() {value = 5 : i32}
|
|
// CHECK-NEXT: return %[[C]]
|