[llvm] r370320 - LegalizeSetCCCondCode - Reduce scope of NeedSwap to fix cppcheck warning. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 29 03:11:34 PDT 2019
Author: rksimon
Date: Thu Aug 29 03:11:34 2019
New Revision: 370320
URL: http://llvm.org/viewvc/llvm-project?rev=370320&view=rev
Log:
LegalizeSetCCCondCode - Reduce scope of NeedSwap to fix cppcheck warning. NFCI.
No need for this to be defined outside the only switch case its used in.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=370320&r1=370319&r2=370320&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Aug 29 03:11:34 2019
@@ -1627,7 +1627,6 @@ bool SelectionDAGLegalize::LegalizeSetCC
MVT OpVT = LHS.getSimpleValueType();
ISD::CondCode CCCode = cast<CondCodeSDNode>(CC)->get();
NeedInvert = false;
- bool NeedSwap = false;
switch (TLI.getCondCodeAction(CCCode, OpVT)) {
default: llvm_unreachable("Unknown condition code action!");
case TargetLowering::Legal:
@@ -1641,6 +1640,7 @@ bool SelectionDAGLegalize::LegalizeSetCC
return true;
}
// Swapping operands didn't work. Try inverting the condition.
+ bool NeedSwap = false;
InvCC = getSetCCInverse(CCCode, OpVT.isInteger());
if (!TLI.isCondCodeLegalOrCustom(InvCC, OpVT)) {
// If inverting the condition is not enough, try swapping operands
More information about the llvm-commits
mailing list