35 lines · cpp
1// RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness=this -o - | FileCheck %s --implicit-check-not=fake.use2// 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 6void bar();7 8class C9{10public:11 bool test(int p);12 C(int v): v(v) {}13 14private:15 int v;16};17 18bool C::test(int p)19{20// CHECK-LABEL: define{{.*}}_ZN1C4testEi(ptr{{[^,]*}} %this, i32{{.*}} %p)21// CHECK: %this.addr = alloca ptr22// CHECK: store ptr %this, ptr %this.addr23 int res = p - v;24 25 bar();26// CHECK: call{{.*}}bar27 28 return res != 0;29// CHECK: [[FAKE_USE:%.+]] = load ptr, ptr %this.addr30// CHECK-NEXT: call void (...) @llvm.fake.use(ptr{{.*}} [[FAKE_USE]])31// CHECK-NEXT: ret32}33 34// CHECK: declare void @llvm.fake.use35