From: Saleem Abdulrasool Date: Thu, 24 Jul 2014 17:12:06 +0000 (+0000) Subject: X86: silence sign comparison warning X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=9a050915f91b1da787ab07b870c72f3cd3c710ae X86: silence sign comparison warning GCC 4.8 detected a signed compare [-Wsign-compare]. Add a cast for the destination index. Add an assert to catch a potential overflow however unlikely it may be. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213878 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index 06a61cbba64..6a01044a996 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -9069,7 +9069,9 @@ static SDValue getINSERTPS(ShuffleVectorSDNode *SVOp, SDLoc &dl, // should assume we're changing V2's element's place and behave // accordingly. int FromV2 = std::count_if(Mask.begin(), Mask.end(), FromV2Predicate); - if (FromV1 == FromV2 && DestIndex == Mask[DestIndex] % 4) { + assert(DestIndex <= INT32_MAX && "truncated destination index"); + if (FromV1 == FromV2 && + static_cast(DestIndex) == Mask[DestIndex] % 4) { From = V2; To = V1; DestIndex =