diff options
author | John McCall <rjmccall@apple.com> | 2010-08-05 18:11:10 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-08-05 18:11:10 +0000 |
commit | 3bd94d6d1e8879f072f92e341f2c557ac91ab853 (patch) | |
tree | 28ade284e00d7856deb8bf5d37b6d2ab4baa4fd7 /lib/CodeGen/CGExprScalar.cpp | |
parent | 0600918d1418c2eac2c96491637946206009c4de (diff) |
Argument evaluation order is not guaranteed. Split these out to force an order.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110354 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | lib/CodeGen/CGExprScalar.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp index 8d28b2485f..08d340ef7b 100644 --- a/lib/CodeGen/CGExprScalar.cpp +++ b/lib/CodeGen/CGExprScalar.cpp @@ -1576,12 +1576,13 @@ Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) { llvm::PointerType::getUnqual(handlerTy)); handlerFunction = Builder.CreateLoad(handlerFunction); - llvm::Value *handlerResult = Builder.CreateCall4(handlerFunction, - Builder.CreateSExt(Ops.LHS, CGF.Int64Ty), - Builder.CreateSExt(Ops.RHS, CGF.Int64Ty), - llvm::ConstantInt::get(llvm::Type::getInt8Ty(VMContext), OpID), - llvm::ConstantInt::get(llvm::Type::getInt8Ty(VMContext), - cast<llvm::IntegerType>(opTy)->getBitWidth())); + llvm::Value *lhs = Builder.CreateSExt(Ops.LHS, CGF.Int64Ty); + llvm::Value *rhs = Builder.CreateSExt(Ops.RHS, CGF.Int64Ty); + + llvm::Value *handlerResult = + Builder.CreateCall4(handlerFunction, lhs, rhs, + Builder.getInt8(OpID), + Builder.getInt8(cast<llvm::IntegerType>(opTy)->getBitWidth())); handlerResult = Builder.CreateTrunc(handlerResult, opTy); |