Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / fcheck-new.cpp
blobd5800cc73bb9adfc96bd55f6743c0d632876a7c4
1 // NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
2 // RUN: %clang_cc1 -fcheck-new -triple x86_64-linux-gnu -disable-O0-optnone \
3 // RUN: -emit-llvm -o - %s | FileCheck %s
5 struct A { A(); };
7 // CHECK-LABEL: @_Z5test0v(
8 // CHECK-NEXT: entry:
9 // CHECK-NEXT: [[CALL:%.*]] = call noalias noundef ptr @_Znwm(i64 noundef 1) #[[ATTR3:[0-9]+]]
10 // CHECK-NEXT: [[NEW_ISNULL:%.*]] = icmp eq ptr [[CALL]], null
11 // CHECK-NEXT: br i1 [[NEW_ISNULL]], label [[NEW_CONT:%.*]], label [[NEW_NOTNULL:%.*]]
12 // CHECK: new.notnull:
13 // CHECK-NEXT: call void @_ZN1AC1Ev(ptr noundef nonnull align 1 dereferenceable(1) [[CALL]])
14 // CHECK-NEXT: br label [[NEW_CONT]]
15 // CHECK: new.cont:
16 // CHECK-NEXT: [[TMP0:%.*]] = phi ptr [ [[CALL]], [[NEW_NOTNULL]] ], [ null, [[ENTRY:%.*]] ]
17 // CHECK-NEXT: ret ptr [[TMP0]]
19 A *test0() {
20 return new A();
23 // CHECK-LABEL: @_Z5test1v(
24 // CHECK-NEXT: entry:
25 // CHECK-NEXT: [[CALL:%.*]] = call noalias noundef ptr @_Znwm(i64 noundef 4) #[[ATTR3]]
26 // CHECK-NEXT: ret ptr [[CALL]]
28 int *test1() {
29 return new int;