[clang] 0fb1ad5 - [Clang][CodeGen][NFC] Add (broken) test case for GH67937

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 4 13:36:32 PDT 2023


Author: Matheus Izvekov
Date: 2023-10-04T22:36:20+02:00
New Revision: 0fb1ad564e59a7259b81b7828fca272c762d30f5

URL: https://github.com/llvm/llvm-project/commit/0fb1ad564e59a7259b81b7828fca272c762d30f5
DIFF: https://github.com/llvm/llvm-project/commit/0fb1ad564e59a7259b81b7828fca272c762d30f5.diff

LOG: [Clang][CodeGen][NFC] Add (broken) test case for GH67937

This adds a test case for yet unfixed https://github.com/llvm/llvm-project/issues/67937

Added: 
    clang/test/CodeGenCXX/strict-vtable-pointers-GH67937.cpp

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/clang/test/CodeGenCXX/strict-vtable-pointers-GH67937.cpp b/clang/test/CodeGenCXX/strict-vtable-pointers-GH67937.cpp
new file mode 100644
index 000000000000000..6fb1e68c288b181
--- /dev/null
+++ b/clang/test/CodeGenCXX/strict-vtable-pointers-GH67937.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-pc-windows-msvc -fstrict-vtable-pointers -disable-llvm-passes -disable-llvm-verifier -O1 -emit-llvm -o %t.ll
+// RUN: FileCheck %s < %t.ll
+// RUN: not llvm-as < %t.ll -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-VERIFIER
+
+struct A {
+  virtual ~A();
+};
+struct B : virtual A {};
+class C : B {};
+C foo;
+
+// FIXME: This is not supposed to generate invalid IR!
+// CHECK-VERIFIER: Instruction does not dominate all uses!
+// CHECK-VERIFIER-NEXT: %1 = call ptr @llvm.launder.invariant.group.p0(ptr %this1)
+// CHECK-VERIFIER-NEXT: %3 = call ptr @llvm.launder.invariant.group.p0(ptr %1)
+
+// CHECK-LABEL: define {{.*}} @"??0C@@QEAA at XZ"(ptr {{.*}} %this, i32 {{.*}} %is_most_derived)
+// CHECK: ctor.init_vbases:
+// CHECK-NEXT: %0 = getelementptr inbounds i8, ptr %this1, i64 0
+// CHECK-NEXT: store ptr @"??_8C@@7B@", ptr %0
+// CHECK-NEXT: %1 = call ptr @llvm.launder.invariant.group.p0(ptr %this1)
+// CHECK-NEXT: %2 = getelementptr inbounds i8, ptr %1, i64 8
+// CHECK-NEXT: %call = call noundef ptr @"??0A@@QEAA at XZ"(ptr {{.*}} %2) #2
+// CHECK-NEXT: br label %ctor.skip_vbases
+// CHECK-EMPTY:
+// CHECK-NEXT: ctor.skip_vbases:
+// FIXME: Should be using '%this1' instead of %1 below.
+// CHECK-NEXT: %3 = call ptr @llvm.launder.invariant.group.p0(ptr %1)
+// CHECK-NEXT: %call3 = call noundef ptr @"??0B@@QEAA at XZ"(ptr {{.*}} %3, i32 noundef 0) #2


        


More information about the cfe-commits mailing list