[llvm] r210806 - X86: stifle GCC warning

Saleem Abdulrasool compnerd at compnerd.org
Thu Jun 12 10:56:19 PDT 2014


Author: compnerd
Date: Thu Jun 12 12:56:18 2014
New Revision: 210806

URL: http://llvm.org/viewvc/llvm-project?rev=210806&view=rev
Log:
X86: stifle GCC warning

lib/Target/X86/X86TargetTransformInfo.cpp: In member function ‘virtual unsigned int {anonymous}::X86TTI::getIntImmCost(unsigned int, unsigned int, const llvm::APInt&, llvm::Type*) const’:
lib/Target/X86/X86TargetTransformInfo.cpp:920:60: warning: enumeral and non-enumeral type in conditional expression [enabled by default]

This seems like an unhelpful warning, but there doesnt seem to be a controlling
flag, so add an explicit cast to silence the warning.

Modified:
    llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp

Modified: llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=210806&r1=210805&r2=210806&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp Thu Jun 12 12:56:18 2014
@@ -917,7 +917,9 @@ unsigned X86TTI::getIntImmCost(unsigned
   if (Idx == ImmIdx) {
     unsigned NumConstants = (BitSize + 63) / 64;
     unsigned Cost = X86TTI::getIntImmCost(Imm, Ty);
-    return (Cost <= NumConstants * TCC_Basic) ? TCC_Free : Cost;
+    return (Cost <= NumConstants * TCC_Basic)
+      ? static_cast<unsigned>(TCC_Free)
+      : Cost;
   }
 
   return X86TTI::getIntImmCost(Imm, Ty);





More information about the llvm-commits mailing list