When performing a derived-to-base cast that we know will not change the offset, we don't need to null check the input pointer. Fixes PR5965.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94942 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenCXX/derived-to-base.cpp b/test/CodeGenCXX/derived-to-base.cpp
index 79aeea7..e44fdc5 100644
--- a/test/CodeGenCXX/derived-to-base.cpp
+++ b/test/CodeGenCXX/derived-to-base.cpp
@@ -21,3 +21,16 @@
// CHECK: ret %struct.B*
return static_cast<B*>(a);
}
+
+// PR5965
+namespace PR5965 {
+
+// CHECK: define %struct.A* @_ZN6PR59651fEP1B(%struct.B* %b) nounwind
+A *f(B* b) {
+ // CHECK-NOT: br label
+ // CHECK: ret %struct.A*
+ return b;
+}
+
+}
+