leonardchan created this revision.
leonardchan added a reviewer: phosek.
leonardchan added a project: clang.

After c7bcd431d9c4bfeb631a3599f1d628603e6351d6 
<https://reviews.llvm.org/rGc7bcd431d9c4bfeb631a3599f1d628603e6351d6>, this 
test started failing when running with the new pass manager. One of the CHECKs 
in this file checks how the vtable is loaded for a void cast, which involves 
taking 2 bitcasts from the pointer to the original object. The order of these 
bitcasts changes under the new PM. The order doesn't matter, so this relaxes 
the CHECKs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82802

Files:
  clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp


Index: clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
===================================================================
--- clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
+++ clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
@@ -35,13 +35,13 @@
 // CHECK-NEXT:   [[isnull:%[0-9]+]] = icmp eq %class.B* %b, null
 // CHECK-NEXT:   br i1 [[isnull]], label %[[dynamic_cast_end:[a-z0-9._]+]], 
label %[[dynamic_cast_notnull:[a-z0-9._]+]]
 // CHECK:      [[dynamic_cast_notnull]]:
-// CHECK-NEXT:   [[b2:%[0-9]+]] = bitcast %class.B* %b to i32**
-// CHECK-NEXT:   [[vtable:%[a-z0-9]+]] = load i32*, i32** [[b2]], align 8
-// CHECK-NEXT:   [[offset_ptr:%.+]] = getelementptr inbounds i32, i32* 
[[vtable]], i64 -2
-// CHECK-NEXT:   [[offset_to_top:%.+]] = load i32, i32* [[offset_ptr]], align 4
-// CHECK-NEXT:   [[b:%[0-9]+]] = bitcast %class.B* %b to i8*
-// CHECK-NEXT:   [[offset_to_top2:%.+]] = sext i32 [[offset_to_top]] to i64
-// CHECK-NEXT:   [[casted:%.+]] = getelementptr inbounds i8, i8* [[b]], i64 
[[offset_to_top2]]
+// CHECK-DAG:    [[b2:%[0-9]+]] = bitcast %class.B* %b to i32**
+// CHECK-DAG:    [[vtable:%[a-z0-9]+]] = load i32*, i32** [[b2]], align 8
+// CHECK-DAG:    [[offset_ptr:%.+]] = getelementptr inbounds i32, i32* 
[[vtable]], i64 -2
+// CHECK-DAG:    [[offset_to_top:%.+]] = load i32, i32* [[offset_ptr]], align 4
+// CHECK-DAG:    [[b:%[0-9]+]] = bitcast %class.B* %b to i8*
+// CHECK-DAG:    [[offset_to_top2:%.+]] = sext i32 [[offset_to_top]] to i64
+// CHECK-DAG:    [[casted:%.+]] = getelementptr inbounds i8, i8* [[b]], i64 
[[offset_to_top2]]
 // CHECK-NEXT:   br label %[[dynamic_cast_end]]
 // CHECK:      [[dynamic_cast_end]]:
 // CHECK-NEXT:   [[res:%[0-9]+]] = phi i8* [ [[casted]], 
%[[dynamic_cast_notnull]] ], [ null, %entry ]


Index: clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
===================================================================
--- clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
+++ clang/test/CodeGenCXX/RelativeVTablesABI/dynamic-cast.cpp
@@ -35,13 +35,13 @@
 // CHECK-NEXT:   [[isnull:%[0-9]+]] = icmp eq %class.B* %b, null
 // CHECK-NEXT:   br i1 [[isnull]], label %[[dynamic_cast_end:[a-z0-9._]+]], label %[[dynamic_cast_notnull:[a-z0-9._]+]]
 // CHECK:      [[dynamic_cast_notnull]]:
-// CHECK-NEXT:   [[b2:%[0-9]+]] = bitcast %class.B* %b to i32**
-// CHECK-NEXT:   [[vtable:%[a-z0-9]+]] = load i32*, i32** [[b2]], align 8
-// CHECK-NEXT:   [[offset_ptr:%.+]] = getelementptr inbounds i32, i32* [[vtable]], i64 -2
-// CHECK-NEXT:   [[offset_to_top:%.+]] = load i32, i32* [[offset_ptr]], align 4
-// CHECK-NEXT:   [[b:%[0-9]+]] = bitcast %class.B* %b to i8*
-// CHECK-NEXT:   [[offset_to_top2:%.+]] = sext i32 [[offset_to_top]] to i64
-// CHECK-NEXT:   [[casted:%.+]] = getelementptr inbounds i8, i8* [[b]], i64 [[offset_to_top2]]
+// CHECK-DAG:    [[b2:%[0-9]+]] = bitcast %class.B* %b to i32**
+// CHECK-DAG:    [[vtable:%[a-z0-9]+]] = load i32*, i32** [[b2]], align 8
+// CHECK-DAG:    [[offset_ptr:%.+]] = getelementptr inbounds i32, i32* [[vtable]], i64 -2
+// CHECK-DAG:    [[offset_to_top:%.+]] = load i32, i32* [[offset_ptr]], align 4
+// CHECK-DAG:    [[b:%[0-9]+]] = bitcast %class.B* %b to i8*
+// CHECK-DAG:    [[offset_to_top2:%.+]] = sext i32 [[offset_to_top]] to i64
+// CHECK-DAG:    [[casted:%.+]] = getelementptr inbounds i8, i8* [[b]], i64 [[offset_to_top2]]
 // CHECK-NEXT:   br label %[[dynamic_cast_end]]
 // CHECK:      [[dynamic_cast_end]]:
 // CHECK-NEXT:   [[res:%[0-9]+]] = phi i8* [ [[casted]], %[[dynamic_cast_notnull]] ], [ null, %entry ]
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to