This is an archive of the discontinued LLVM Phabricator instance.

Minimal refactor of TargetTransformInfoImpl.h to avoid Clang Static Analyser's core.CallAndMessage (NFC)
ClosedPublic

Authored by markus on May 2 2022, 2:21 AM.

Details

Summary

Don't expose OpTy way earlier than needed and we don't have the problem of having to assign nullptr if we are looking at the wrong type of instruction.

Diff Detail

Event Timeline

markus created this revision.May 2 2022, 2:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 2:21 AM
markus requested review of this revision.May 2 2022, 2:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2022, 2:21 AM
bjope added a subscriber: bjope.May 2 2022, 2:38 AM
bjope accepted this revision.May 3 2022, 1:12 AM

LGTM!

This seem to help out avoiding complaints from clangsa that the OpTy passed on to getCastInstrCost could be a nullptr (implementations of getCastInstrCost doesn't seem to check that the Src/Dst Type pointers are non-null. One could perhaps question the API (if those pointers must not be null then I guess one could have passed the Type arguments by reference instead of passing the pointer). This patch in itself seem good anyway.

This revision is now accepted and ready to land.May 3 2022, 1:12 AM
This revision was landed with ongoing or failed builds.May 3 2022, 1:47 AM
This revision was automatically updated to reflect the committed changes.