diff options
| author | Phoebe Wang <phoebe.wang@intel.com> | 2023-05-01 22:24:24 +0800 |
|---|---|---|
| committer | Phoebe Wang <phoebe.wang@intel.com> | 2023-05-02 13:43:28 +0800 |
| commit | c2dd36cd398ae7e1685476adcb0653caaa028d27 (patch) | |
| tree | f324e0e13b0b4071d97d5a7fc1472df2fe554e17 /llvm/lib/CodeGen/EarlyIfConversion.cpp | |
| parent | bd08f1bfb51206f71223e627be47dd88039fc021 (diff) | |
[Coverity] Fix unchecked return value, NFC
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.
Differential Revision: https://reviews.llvm.org/D149586
Diffstat (limited to 'llvm/lib/CodeGen/EarlyIfConversion.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/EarlyIfConversion.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/EarlyIfConversion.cpp b/llvm/lib/CodeGen/EarlyIfConversion.cpp index a0dfff727059..86c3d96b1bf0 100644 --- a/llvm/lib/CodeGen/EarlyIfConversion.cpp +++ b/llvm/lib/CodeGen/EarlyIfConversion.cpp @@ -343,8 +343,11 @@ bool SSAIfConv::canPredicateInstrs(MachineBasicBlock *MBB) { // Apply predicate to all instructions in the machine block. void SSAIfConv::PredicateBlock(MachineBasicBlock *MBB, bool ReversePredicate) { auto Condition = Cond; - if (ReversePredicate) - TII->reverseBranchCondition(Condition); + if (ReversePredicate) { + bool CanRevCond = !TII->reverseBranchCondition(Condition); + assert(CanRevCond && "Reversed predicate is not supported"); + (void)CanRevCond; + } // Terminators don't need to be predicated as they will be removed. for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->getFirstTerminator(); |
