diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp index 8eee4a0b0c0d..777036bc3b37 100644 --- a/clang/lib/CodeGen/CGExprCXX.cpp +++ b/clang/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/clang/test/CodeGenCXX/arm.cpp b/clang/test/CodeGenCXX/arm.cpp index 672ca0100788..8d74d003c3d6 100644 --- a/clang/test/CodeGenCXX/arm.cpp +++ b/clang/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]]