From: Nick Lewycky Date: Wed, 4 Jun 2014 07:45:54 +0000 (+0000) Subject: Fix a use of uninitialized value. OldCC is set when IsCmpZero || IsSwapped and read... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7270890505fc357826a822fb64c240a5889048d4;p=oota-llvm.git Fix a use of uninitialized value. OldCC is set when IsCmpZero || IsSwapped and read when ShouldUpdateCC || IsSwapped, and ShouldUpdateCC is independent. Fixes PR19932, but no test since I wasn't able to get any symptoms to appear, not even with valgrind and the testcase from the PR. It's clear what happened from inspection of the code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210168 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index 6993577d19c..a0ee1ee57be 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -3741,7 +3741,7 @@ optimizeCompareInstr(MachineInstr *CmpInstr, unsigned SrcReg, unsigned SrcReg2, continue; // EFLAGS is used by this instruction. - X86::CondCode OldCC; + X86::CondCode OldCC = X86::COND_INVALID; bool OpcIsSET = false; if (IsCmpZero || IsSwapped) { // We decode the condition code from opcode.