Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / derived-to-base.cpp
blobc8dbd5bf5cb05c4d6fd6d43bced4d053eac2d8c7
1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2 struct A {
3 void f();
5 int a;
6 };
8 struct B : A {
9 double b;
12 void f() {
13 B b;
15 b.f();
18 // CHECK: define{{.*}} ptr @_Z1fP1A(ptr noundef %a) [[NUW:#[0-9]+]]
19 B *f(A *a) {
20 // CHECK-NOT: br label
21 // CHECK: ret ptr
22 return static_cast<B*>(a);
25 // PR5965
26 namespace PR5965 {
28 // CHECK: define{{.*}} ptr @_ZN6PR59651fEP1B(ptr noundef %b) [[NUW]]
29 A *f(B* b) {
30 // CHECK-NOT: br label
31 // CHECK: ret ptr
32 return b;
37 // Don't crash on a derived-to-base conversion of an r-value
38 // aggregate.
39 namespace test3 {
40 struct A {};
41 struct B : A {};
43 void foo(A a);
44 void test() {
45 foo(B());
49 // CHECK: attributes [[NUW]] = { mustprogress noinline nounwind{{.*}} }