This is an archive of the discontinued LLVM Phabricator instance.

Fix inlining multi-block callees with type conversion.
ClosedPublic

Authored by silvas on Apr 17 2020, 8:07 PM.

Details

Summary

The previous code result a mismatch between block argument types and
predecessor successor args when a type conversion was needed in a
multiblock case. It was assuming the replaced result types matched the
region result types.

Also, slighly improve the debug output from the inliner and add a
debug counter.

Diff Detail

Event Timeline

silvas created this revision.Apr 17 2020, 8:07 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2020, 8:07 PM
rriddle added inline comments.Apr 17 2020, 8:14 PM
mlir/test/Transforms/inlining.mlir
134

Please add check lines to this test.

silvas updated this revision to Diff 258471.Apr 17 2020, 8:15 PM

Actually test stuff in test case.

Thanks for fixing this!

mlir/lib/Transforms/Inliner.cpp
30

This should be camelCase as it defines a variable.

mlir/lib/Transforms/Utils/InliningUtils.cpp
132

Can you use TypeRange here instead? resultsToReplace should also be updated to ValueRange.

250

If you update the input types to ValueRange/TypeRange, you can just do resultsToReplace.getTypes().

mehdi_amini added inline comments.Apr 17 2020, 9:17 PM
mlir/lib/Transforms/Inliner.cpp
31

Wouldn't this add a static global initializer?

silvas updated this revision to Diff 258837.Apr 20 2020, 1:56 PM
silvas marked 3 inline comments as done.
  • Switch to ValueRange/TypeRange
  • Remove DEBUG_COUNTER :/
rriddle accepted this revision.Apr 20 2020, 3:37 PM
mlir/include/mlir/Transforms/InliningUtils.h
18

Can you use forward declarations instead?

mlir/lib/Transforms/Inliner.cpp
24

This is now unused?

28

These are now unused?

This revision is now accepted and ready to land.Apr 20 2020, 3:37 PM
silvas updated this revision to Diff 258862.Apr 20 2020, 4:06 PM
silvas marked 4 inline comments as done.

Address feedback

This revision was automatically updated to reflect the committed changes.