[cfe-commits] r88909 - /cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Duncan Sands baldrick at free.fr
Mon Nov 16 05:11:21 PST 2009


Author: baldrick
Date: Mon Nov 16 07:11:21 2009
New Revision: 88909

URL: http://llvm.org/viewvc/llvm-project?rev=88909&view=rev
Log:
Pass a value for the isSigned parameter of CreateIntCast, rather than
passing the name (an exotic way of specifying that the result is signed!).

Modified:
    cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=88909&r1=88908&r2=88909&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon Nov 16 07:11:21 2009
@@ -121,7 +121,8 @@
     const llvm::Type *ResultType = ConvertType(E->getType());
     Value *Result = Builder.CreateCall(F, ArgValue, "tmp");
     if (Result->getType() != ResultType)
-      Result = Builder.CreateIntCast(Result, ResultType, "cast");
+      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
+                                     "cast");
     return RValue::get(Result);
   }
   case Builtin::BI__builtin_clz:
@@ -135,7 +136,8 @@
     const llvm::Type *ResultType = ConvertType(E->getType());
     Value *Result = Builder.CreateCall(F, ArgValue, "tmp");
     if (Result->getType() != ResultType)
-      Result = Builder.CreateIntCast(Result, ResultType, "cast");
+      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
+                                     "cast");
     return RValue::get(Result);
   }
   case Builtin::BI__builtin_ffs:
@@ -154,7 +156,8 @@
     Value *IsZero = Builder.CreateICmpEQ(ArgValue, Zero, "iszero");
     Value *Result = Builder.CreateSelect(IsZero, Zero, Tmp, "ffs");
     if (Result->getType() != ResultType)
-      Result = Builder.CreateIntCast(Result, ResultType, "cast");
+      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
+                                     "cast");
     return RValue::get(Result);
   }
   case Builtin::BI__builtin_parity:
@@ -171,7 +174,8 @@
     Value *Result = Builder.CreateAnd(Tmp, llvm::ConstantInt::get(ArgType, 1),
                                       "tmp");
     if (Result->getType() != ResultType)
-      Result = Builder.CreateIntCast(Result, ResultType, "cast");
+      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
+                                     "cast");
     return RValue::get(Result);
   }
   case Builtin::BI__builtin_popcount:
@@ -185,7 +189,8 @@
     const llvm::Type *ResultType = ConvertType(E->getType());
     Value *Result = Builder.CreateCall(F, ArgValue, "tmp");
     if (Result->getType() != ResultType)
-      Result = Builder.CreateIntCast(Result, ResultType, "cast");
+      Result = Builder.CreateIntCast(Result, ResultType, /*isSigned*/true,
+                                     "cast");
     return RValue::get(Result);
   }
   case Builtin::BI__builtin_expect:





More information about the cfe-commits mailing list