This is an archive of the discontinued LLVM Phabricator instance.

[mlir][LLVM] Add `BitcastStores` type-consistency pattern
ClosedPublic

Authored by zero9178 on Jul 6 2023, 2:27 AM.

Details

Summary

Current patterns attempt to immediately create type-consistent stores by bitcasting the value to the type-hint leading to needless code duplication.

This patch extracts that case into its own pattern, allowing other patterns to create type-inconsistent stores and have subsequent pattern applications turn it into a type-consistent store.

Diff Detail

Event Timeline

zero9178 created this revision.Jul 6 2023, 2:27 AM
Herald added a reviewer: dcaballe. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
zero9178 requested review of this revision.Jul 6 2023, 2:27 AM
gysit added inline comments.Jul 6 2023, 4:41 AM
mlir/include/mlir/Dialect/LLVMIR/Transforms/TypeConsistency.h
72

nit: contradicts

mlir/test/Dialect/LLVMIR/type-consistency.mlir
419

Can you maybe add one test case that exercises the bitcast pattern in isolation so that it is exercised independent of the other patterns?

zero9178 updated this revision to Diff 538035.Jul 7 2023, 2:10 AM
zero9178 marked an inline comment as done.

Address review comments

zero9178 marked an inline comment as done.Jul 7 2023, 2:10 AM
gysit accepted this revision.Jul 9 2023, 8:46 AM

LGTM!

This revision is now accepted and ready to land.Jul 9 2023, 8:46 AM