forked from OSchip/llvm-project
Make sure we or together the overflow flags of the multiply and add, so the
check is triggered appropriately. Reported on cfe-dev. llvm-svn: 129231
This commit is contained in:
parent
96d2507e79
commit
db42a3e876
|
@ -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,
|
||||
|
|
|
@ -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]]
|
||||
|
|
Loading…
Reference in New Issue