зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
6bc52112db
Коммит
9a847f598c
|
@ -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");
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче