diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-04-09 19:54:33 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-04-09 19:54:33 +0000 |
commit | 5536daa627b508299007b735a588bf4e88825bb3 (patch) | |
tree | a148a4a71dbcdee3627bbf0f0068044d4a1d95cd | |
parent | 067bbd0e11c71a33b51832532e836971be697699 (diff) |
Make sure we or together the overflow flags of the multiply and add, so the
check is triggered appropriately. Reported on cfe-dev.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129231 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 2 | ||||
-rw-r--r-- | test/CodeGenCXX/arm.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 8eee4a0b0c..777036bc3b 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -595,7 +595,7 @@ static llvm::Value *EmitCXXNewAllocSize(ASTContext &Context, Size = CGF.Builder.CreateExtractValue(AddRes, 0); llvm::Value *AddDidOverflow = CGF.Builder.CreateExtractValue(AddRes, 1); - DidOverflow = CGF.Builder.CreateAnd(DidOverflow, AddDidOverflow); + DidOverflow = CGF.Builder.CreateOr(DidOverflow, AddDidOverflow); } Size = CGF.Builder.CreateSelect(DidOverflow, diff --git a/test/CodeGenCXX/arm.cpp b/test/CodeGenCXX/arm.cpp index 672ca01007..8d74d003c3 100644 --- a/test/CodeGenCXX/arm.cpp +++ b/test/CodeGenCXX/arm.cpp @@ -117,7 +117,8 @@ namespace test3 { // CHECK: [[N:%.*]] = load i32* // CHECK: @llvm.umul.with.overflow.i32(i32 [[N]], i32 4) // CHECK: @llvm.uadd.with.overflow.i32(i32 {{.*}}, i32 8) - // CHECK: [[SZ:%.*]] = select + // CHECK: [[OR:%.*]] = or i1 + // CHECK: [[SZ:%.*]] = select i1 [[OR]] // CHECK: call noalias i8* @_Znam(i32 [[SZ]]) // CHECK: store i32 4 // CHECK: store i32 [[N]] |