This is an archive of the discontinued LLVM Phabricator instance.

[Coverity] Fix unchecked return value, NFC
ClosedPublic

Authored by pengfei on May 1 2023, 7:33 AM.

Details

Summary

The ReversePredicate should have made sure the reverse predicate is
supported by target, but the check comes from early function and might
be invalid by any mistake. So it's better to double confirm it here.

Diff Detail

Event Timeline

pengfei created this revision.May 1 2023, 7:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2023, 7:33 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
pengfei requested review of this revision.May 1 2023, 7:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 1 2023, 7:33 AM
barannikov88 requested changes to this revision.May 1 2023, 8:21 AM
barannikov88 added a subscriber: barannikov88.
barannikov88 added inline comments.
llvm/lib/CodeGen/EarlyIfConversion.cpp
348

This is wrong. Assert will be removed in release mode, along with the call.

This revision now requires changes to proceed.May 1 2023, 8:21 AM
pengfei updated this revision to Diff 518622.May 1 2023, 7:23 PM
pengfei marked an inline comment as done.

Address review comment.

llvm/lib/CodeGen/EarlyIfConversion.cpp
348

Good catch, thanks!

barannikov88 accepted this revision.May 1 2023, 8:07 PM
This revision is now accepted and ready to land.May 1 2023, 8:07 PM

BTW it may be worth annotating this method (and maybe others) with [[nodiscard]].

BTW it may be worth annotating this method (and maybe others) with [[nodiscard]].

Thanks for the suggestion! That sounds a good idea to me, but I took a look at current LLVM code base and didn't find an instance that using [[nodiscard]] on virtual functions. A simply googling pointed me a discussion about GCC bug.
No sure if it is the reason that we haven't used it. Anyway, let's not do it for now.

This revision was automatically updated to reflect the committed changes.