This is an archive of the discontinued LLVM Phabricator instance.

[Flang] Use appropriate casting in getExtentFromTriplet to allow nullptr
AbandonedPublic

Authored by kiranchandramohan on Jul 7 2022, 1:56 AM.

Details

Summary

Use dyn_cast_or_null in place of dyn_cast to allow the defining op to be
a nullptr in getExtentFromTriplet.
A testcase which crashes without this change is provided.

Diff Detail

Event Timeline

Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
Herald added a subscriber: mehdi_amini. · View Herald Transcript
kiranchandramohan requested review of this revision.Jul 7 2022, 1:56 AM
peixin added inline comments.Jul 7 2022, 2:00 AM
flang/lib/Optimizer/Builder/FIRBuilder.cpp
1238

You may should rebase on current main. This has been fixed by @clementval . https://github.com/llvm/llvm-project/blob/519d7876cbee5a5d3cd40d41525cd45e44fb07a8/flang/lib/Optimizer/Builder/FIRBuilder.cpp#L1237-L1241

dyn_cast_or_null looks better than isa_and_nonnull.

kiranchandramohan abandoned this revision.Jul 7 2022, 2:20 AM

Ahh. I haven't rebased. Thanks @clementval @peixin. I will close.