aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGBuiltin.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-23 06:53:34 +0000
committerChris Lattner <sabre@nondot.org>2008-07-23 06:53:34 +0000
commit9a847f598c4907a72b8593b364b9e6b94b086e75 (patch)
tree393fff8ed795ea958f41d7c4e82b3a4133f9eb16 /lib/CodeGen/CGBuiltin.cpp
parent6bc52112dbc54551bd8e215d95bba4791b2275f7 (diff)
don't depend on the result of CreateNeg to be a binop
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGBuiltin.cpp')
-rw-r--r--lib/CodeGen/CGBuiltin.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/CGBuiltin.cpp b/lib/CodeGen/CGBuiltin.cpp
index 9de5a5acd4..541a5664c8 100644
--- a/lib/CodeGen/CGBuiltin.cpp
+++ b/lib/CodeGen/CGBuiltin.cpp
@@ -103,10 +103,10 @@ RValue CodeGenFunction::EmitBuiltinExpr(unsigned BuiltinID, const CallExpr *E) {
case Builtin::BI__builtin_abs: {
Value *ArgValue = EmitScalarExpr(E->getArg(0));
- llvm::BinaryOperator *NegOp =
- Builder.CreateNeg(ArgValue, (ArgValue->getName() + "neg").c_str());
+ Value *NegOp = Builder.CreateNeg(ArgValue, "neg");
Value *CmpResult =
- Builder.CreateICmpSGE(ArgValue, NegOp->getOperand(0), "abscond");
+ Builder.CreateICmpSGE(ArgValue, Constant::getNullValue(ArgValue->getType()),
+ "abscond");
Value *Result =
Builder.CreateSelect(CmpResult, ArgValue, NegOp, "abs");