This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by frgossen on Jun 18 2020, 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.Jun 18 2020, 2:48 AM
Herald added a reviewer: silvas. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
silvas accepted this revision.Jun 18 2020, 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.Jun 18 2020, 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.Jun 18 2020, 10:08 AM
mlir/lib/Dialect/Shape/IR/Shape.cpp
450

Alternatively, shape.getNumElements()?

frgossen updated this revision to Diff 272049.Jun 19 2020, 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` .Jun 19 2020, 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`.Jun 19 2020, 7:09 AM
frgossen edited the summary of this revision. (Show Details)
pifon2a accepted this revision.Jun 19 2020, 9:28 AM
jpienaar accepted this revision.Jun 23 2020, 2:08 PM
This revision is now accepted and ready to land.Jun 23 2020, 2:08 PM
This revision was automatically updated to reflect the committed changes.