[llvm] r257923 - Codegen: [PPC] Silence false-positive initialization warning. NFC

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 15 11:20:06 PST 2016


Author: iteratee
Date: Fri Jan 15 13:20:06 2016
New Revision: 257923

URL: http://llvm.org/viewvc/llvm-project?rev=257923&view=rev
Log:
Codegen: [PPC] Silence false-positive initialization warning. NFC

Some compilers don't do exhaustive switch checking. For those compilers,
add an initialization to prevent un-initialized variable warnings from
firing. For compilers with exhaustive switch checking, we still get a
guarantee that the switch is exhaustive, and hence the initializations
are redundant, and a non-functional change.

Modified:
    llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp

Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp?rev=257923&r1=257922&r2=257923&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.cpp Fri Jan 15 13:20:06 2016
@@ -746,8 +746,8 @@ void PPCInstrInfo::insertSelect(MachineB
   unsigned OpCode = Is64Bit ? PPC::ISEL8 : PPC::ISEL;
   auto SelectPred = static_cast<PPC::Predicate>(Cond[0].getImm());
 
-  unsigned SubIdx;
-  bool SwapOps;
+  unsigned SubIdx = 0;
+  bool SwapOps = false;
   switch (SelectPred) {
   case PPC::PRED_EQ:
   case PPC::PRED_EQ_MINUS:




More information about the llvm-commits mailing list