[X86] Don't invert NewCC variable while processing the jcc/setcc/cmovcc instructions...
authorCraig Topper <craig.topper@intel.com>
Thu, 23 Nov 2017 19:25:45 +0000 (19:25 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 23 Nov 2017 19:25:45 +0000 (19:25 +0000)
commit40a1edc30787340350de0c4d5a008a266ec6b06d
tree964156397280e7f2c5891902171244f61bb5ad73
parentf31b0b850bb03bf53c9fd60c929bcf7462554526
[X86] Don't invert NewCC variable while processing the jcc/setcc/cmovcc instructions in optimizeCompareInstr.

The NewCC variable is calculated outside of the loop that processes jcc/setcc/cmovcc instructions. If we invert it during the loop it can cause an incorrect value to be used by a later iteration. Instead only read it during the loop and use a new variable to store the possibly inverted value.

Fixes PR35399.

llvm-svn: 318934
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/pr35399.ll [new file with mode: 0644]