Page MenuHomePhabricator

[MLIR][Shape] Add constant folding to `shape.rank`
ClosedPublic

Authored by frgossen on Thu, Jun 18, 2:48 AM.

Details

Summary

Add constant folding for the shape.rank operation of the shape dialect.

Depends On D82028

Diff Detail

Event Timeline

frgossen created this revision.Thu, Jun 18, 2:48 AM
Herald added a reviewer: silvas. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
silvas accepted this revision.Thu, Jun 18, 9:42 AM

LGTM modulo renaming of op (discussed in the dependent patch)

mlir/lib/Dialect/Shape/IR/Shape.cpp
450

nit: I think llvm::size from STLHelpers.h could make this a bit shorter.

silvas added inline comments.Thu, Jun 18, 9:43 AM
mlir/test/Dialect/Shape/canonicalize.mlir
453

nit: this test doesn't seem to be testing any new functionality that isn't covered by other tests, so it can be omitted.

rriddle added inline comments.Thu, Jun 18, 10:08 AM
mlir/lib/Dialect/Shape/IR/Shape.cpp
450

Alternatively, shape.getNumElements()?

frgossen updated this revision to Diff 272049.Fri, Jun 19, 6:41 AM
frgossen marked 4 inline comments as done.

Rename, address comments

mlir/lib/Dialect/Shape/IR/Shape.cpp
450

Thanks, didn't see that function.

frgossen retitled this revision from [MLIR][Shape] Add constant folding to `shape.get_shape` to [MLIR][Shape] Add constant folding to `shape.rank` .Fri, Jun 19, 6:42 AM
frgossen edited the summary of this revision. (Show Details)
frgossen retitled this revision from [MLIR][Shape] Add constant folding to `shape.rank` to [MLIR][Shape] Add constant folding to `shape.rank`.Fri, Jun 19, 7:09 AM
frgossen edited the summary of this revision. (Show Details)
pifon2a accepted this revision.Fri, Jun 19, 9:28 AM
jpienaar accepted this revision.Tue, Jun 23, 2:08 PM
This revision is now accepted and ready to land.Tue, Jun 23, 2:08 PM
This revision was automatically updated to reflect the committed changes.