| 1 |
// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness=this -o - | FileCheck %s --implicit-check-not=fake.use |
| 2 |
// Check that we generate a fake_use call with the 'this' pointer as argument, |
| 3 |
// and no other fake uses. |
| 4 |
// The call should appear after the call to bar(). |
| 5 |
|
| 6 |
void bar(); |
| 7 |
|
| 8 |
class C |
| 9 |
{ |
| 10 |
public: |
| 11 |
bool test(int p); |
| 12 |
C(int v): v(v) {} |
| 13 |
|
| 14 |
private: |
| 15 |
int v; |
| 16 |
}; |
| 17 |
|
| 18 |
bool C::test(int p) |
| 19 |
{ |
| 20 |
// CHECK-LABEL: define{{.*}}_ZN1C4testEi(ptr{{[^,]*}} %this, i32{{.*}} %p) |
| 21 |
// CHECK: %this.addr = alloca ptr |
| 22 |
// CHECK: store ptr %this, ptr %this.addr |
| 23 |
int res = p - v; |
| 24 |
|
| 25 |
bar(); |
| 26 |
// CHECK: call{{.*}}bar |
| 27 |
|
| 28 |
return res != 0; |
| 29 |
// CHECK: [[FAKE_USE:%.+]] = load ptr, ptr %this.addr |
| 30 |
// CHECK-NEXT: call void (...) @llvm.fake.use(ptr{{.*}} [[FAKE_USE]]) |
| 31 |
// CHECK-NEXT: ret |
| 32 |
} |
| 33 |
|
| 34 |
// CHECK: declare void @llvm.fake.use |