HomePhabricator

[MLIR] Introduce utility to hoist affine if/else conditions

Authored by bondhugula on Apr 10 2020, 4:42 AM.

Description

[MLIR] Introduce utility to hoist affine if/else conditions

This revision introduces a utility to unswitch affine.for/parallel loops
by hoisting affine.if operations past surrounding affine.for/parallel.
The hoisting works for both perfect/imperfect nests and in the presence
of else blocks. The hoisting is currently to as outermost a level as
possible. Uses a test pass to test the utility.
Add convenience method Operation::getParentWithTrait<Trait>.

Depends on D77487.

Differential Revision: https://reviews.llvm.org/D77870