brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1022 B · 1d78871 Raw
30 lines · cpp
1// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -o %t-1.ll %s2// RUN: FileCheck --check-prefix=ALL -check-prefix SANE --input-file=%t-1.ll %s3// RUN: %clang_cc1 -triple i686-pc-linux-gnu -emit-llvm -fno-assume-sane-operator-new -o %t-2.ll %s4// RUN: FileCheck --check-prefix=ALL -check-prefix SANENOT --input-file=%t-2.ll %s5 6class teste {7  int A;8public:9  teste() : A(2) {}10};11 12void f1() {13  // ALL: declare noundef nonnull ptr @_Znwj(14  new teste();15}16 17// operator new should check for overflow in multiply.18void *f2(long N) {19  return new int[N];20 21  // ALL:      [[UWO:%.*]] = call {{.*}} @llvm.umul.with.overflow22  // ALL-NEXT: [[OVER:%.*]] = extractvalue {{.*}} [[UWO]], 123  // ALL-NEXT: [[SUM:%.*]] = extractvalue {{.*}} [[UWO]], 024  // ALL-NEXT: [[RESULT:%.*]] = select i1 [[OVER]], i32 -1, i32 [[SUM]]25  // SANE-NEXT: call noalias noundef nonnull ptr @_Znaj(i32 noundef [[RESULT]])26  // SANENOT-NEXT: call noundef nonnull ptr @_Znaj(i32 noundef [[RESULT]])27}28 29// ALL: declare noundef nonnull ptr @_Znaj(30