[llvm] r213878 - X86: silence sign comparison warning
Saleem Abdulrasool
compnerd at compnerd.org
Thu Jul 24 10:12:07 PDT 2014
Author: compnerd
Date: Thu Jul 24 12:12:06 2014
New Revision: 213878
URL: http://llvm.org/viewvc/llvm-project?rev=213878&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=213878&r1=213877&r2=213878&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Jul 24 12:12:06 2014
@@ -9069,7 +9069,9 @@ static SDValue getINSERTPS(ShuffleVector
// 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<int>(DestIndex) == Mask[DestIndex] % 4) {
From = V2;
To = V1;
DestIndex =
More information about the llvm-commits
mailing list