This is an archive of the discontinued LLVM Phabricator instance.

[LLVM][Support/ADT] Add assert for isPresent to dyn_cast.
ClosedPublic

Authored by bzcheeseman on Sep 2 2022, 11:44 AM.

Details

Summary

This change adds an assert to dyn_cast that the value passed-in is present. In the past, this relied on the isa_impl assertion (which still works in many cases) but which we can tighten up for a better QoI.

The PointerUnion change is because it seems like (based on the call sites) the semantics of the member dyn_cast are actually dyn_cast_if_present.

Diff Detail

Event Timeline

bzcheeseman created this revision.Sep 2 2022, 11:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2022, 11:44 AM
bzcheeseman requested review of this revision.Sep 2 2022, 11:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2022, 11:44 AM
bzcheeseman edited the summary of this revision. (Show Details)Sep 2 2022, 11:45 AM
bzcheeseman added reviewers: reames, lattner, rriddle.
bzcheeseman edited the summary of this revision. (Show Details)
rriddle accepted this revision.Sep 6 2022, 1:06 PM

Nice!

This revision is now accepted and ready to land.Sep 6 2022, 1:06 PM