[PATCH] D149586: [Coverity] Fix unchecked return value, NFC

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 07:33:40 PDT 2023


pengfei created this revision.
pengfei added a reviewer: ThomasRaoux.
Herald added a subscriber: hiraditya.
Herald added a project: All.
pengfei requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149586

Files:
  llvm/lib/CodeGen/EarlyIfConversion.cpp


Index: llvm/lib/CodeGen/EarlyIfConversion.cpp
===================================================================
--- llvm/lib/CodeGen/EarlyIfConversion.cpp
+++ llvm/lib/CodeGen/EarlyIfConversion.cpp
@@ -344,7 +344,8 @@
 void SSAIfConv::PredicateBlock(MachineBasicBlock *MBB, bool ReversePredicate) {
   auto Condition = Cond;
   if (ReversePredicate)
-    TII->reverseBranchCondition(Condition);
+    assert(!TII->reverseBranchCondition(Condition) &&
+           "Reverse predicate is not supported");
   // Terminators don't need to be predicated as they will be removed.
   for (MachineBasicBlock::iterator I = MBB->begin(),
                                    E = MBB->getFirstTerminator();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149586.518437.patch
Type: text/x-patch
Size: 695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230501/9ccd892e/attachment.bin>


More information about the llvm-commits mailing list