This is an archive of the discontinued LLVM Phabricator instance.

[mlir] Require explicit casts when using TypedValue
ClosedPublic

Authored by rkayaith on Jan 29 2023, 4:25 PM.

Details

Summary

Currently TypedValue can be constructed directly from Value, hiding
errors that could be caught at compile time. For example the following
will compile, but crash/assert at runtime:

void foo(TypedValue<IntegerType>);
void bar(TypedValue<FloatType> v) {
  foo(v);
}

This change removes the constructors and replaces them with explicit
llvm casts.

Depends on D142852

Diff Detail

Event Timeline

rkayaith created this revision.Jan 29 2023, 4:25 PM
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a reviewer: aartbik. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
rkayaith updated this revision to Diff 493165.Jan 29 2023, 5:19 PM
rkayaith retitled this revision from [mlir] Require explicit casts when using TypeValue to [mlir] Require explicit casts when using TypedValue.

Fix toy tutorial

rkayaith published this revision for review.Jan 29 2023, 8:12 PM
rkayaith added reviewers: mehdi_amini, Tyker.
rriddle accepted this revision.Jan 30 2023, 10:54 PM
This revision is now accepted and ready to land.Jan 30 2023, 10:54 PM
This revision was automatically updated to reflect the committed changes.