[mlir] add missing pessimistic setting

This is updated on https://reviews.llvm.org/D127139, to mark op with region as pessimistic.

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D131480
This commit is contained in:
Jacques Pienaar 2022-08-17 15:08:37 -07:00
parent d20e632853
commit 052669e71a
2 changed files with 19 additions and 2 deletions

View File

@ -38,8 +38,10 @@ void SparseConstantPropagation::visitOperation(
// guarantee that folding will be out-of-place. We don't allow in-place
// folds as the desire here is for simulated execution, and not general
// folding.
if (op->getNumRegions())
if (op->getNumRegions()) {
markAllPessimisticFixpoint(results);
return;
}
SmallVector<Attribute, 8> constantOperands;
constantOperands.reserve(op->getNumOperands());

View File

@ -218,7 +218,7 @@ func.func @simple_produced_operand() -> (i32, i32) {
}
// CHECK-LABEL: inplace_fold
func.func @inplace_fold(%arg: i1) -> (i32) {
func.func @inplace_fold() -> (i32) {
%0 = "test.op_in_place_fold_success"() : () -> i1
%1 = arith.constant 5 : i32
cf.cond_br %0, ^a, ^b
@ -231,3 +231,18 @@ func.func @inplace_fold(%arg: i1) -> (i32) {
^b:
return %1 : i32
}
// CHECK-LABEL: op_with_region
func.func @op_with_region() -> (i32) {
%0 = "test.op_with_region"() ({}) : () -> i1
%1 = arith.constant 5 : i32
cf.cond_br %0, ^a, ^b
^a:
// CHECK-NOT: addi
%3 = arith.addi %1, %1 : i32
return %3 : i32
^b:
return %1 : i32
}