Skip to content

PDL type and operands CSE behavior is missing side effects #53863

Closed
@nicolasvasilache

Description

@nicolasvasilache
module @patterns {
  pdl.pattern : benefit(1) {
    %0 = pdl.type
    %1 = pdl.type
    %2 = pdl.operand : %0
    %3 = pdl.operand : %1
    %4 = operation "foo"(%2, %3 : !pdl.value, !pdl.value)  -> (%1 : !pdl.type)
    pdl.rewrite %4 {
      pdl.erase %4
    }
  }
}

cse's to

module @patterns {
  pdl.pattern : benefit(1) {
    %0 = type
    %1 = operand : %0
    %2 = operation "foo"(%1, %1 : !pdl.value, !pdl.value)  -> (%0 : !pdl.type)
    rewrite %2 {
      erase %2
    }
  }
}

which forces the match into filtering only ops "foo" with operands of the same type.

Adding side effects to, at least, ops that implicitly captures from the environment should help.

Metadata

Metadata

Assignees

Labels

mlir:coreMLIR Core Infrastructure

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions