Skip to content

Commit

Permalink
[Clang][CodeGen][NFC] Add (broken) test case for GH67937
Browse files Browse the repository at this point in the history
This adds a test case for yet unfixed #67937
  • Loading branch information
mizvekov committed Oct 4, 2023
1 parent 6280e23 commit 0fb1ad5
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions clang/test/CodeGenCXX/strict-vtable-pointers-GH67937.cpp
Original file line number Diff line number Diff line change
@@ -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@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@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@XZ"(ptr {{.*}} %3, i32 noundef 0) #2

0 comments on commit 0fb1ad5

Please sign in to comment.