1*de9b0ddeSStephen Tozer // RUN: %clang_cc1 %s -triple x86_64-unknown-linux-gnu -emit-llvm -fextend-variable-liveness=this -o - | FileCheck %s --implicit-check-not=fake.use 24424c44cSWolfgang Pieb // Check that we generate a fake_use call with the 'this' pointer as argument, 34424c44cSWolfgang Pieb // and no other fake uses. 44424c44cSWolfgang Pieb // The call should appear after the call to bar(). 54424c44cSWolfgang Pieb 64424c44cSWolfgang Pieb void bar(); 74424c44cSWolfgang Pieb 84424c44cSWolfgang Pieb class C 94424c44cSWolfgang Pieb { 104424c44cSWolfgang Pieb public: 114424c44cSWolfgang Pieb bool test(int p); 124424c44cSWolfgang Pieb C(int v): v(v) {} 134424c44cSWolfgang Pieb 144424c44cSWolfgang Pieb private: 154424c44cSWolfgang Pieb int v; 164424c44cSWolfgang Pieb }; 174424c44cSWolfgang Pieb 184424c44cSWolfgang Pieb bool C::test(int p) 194424c44cSWolfgang Pieb { 204424c44cSWolfgang Pieb // CHECK-LABEL: define{{.*}}_ZN1C4testEi(ptr{{[^,]*}} %this, i32{{.*}} %p) 214424c44cSWolfgang Pieb // CHECK: %this.addr = alloca ptr 224424c44cSWolfgang Pieb // CHECK: store ptr %this, ptr %this.addr 234424c44cSWolfgang Pieb int res = p - v; 244424c44cSWolfgang Pieb 254424c44cSWolfgang Pieb bar(); 264424c44cSWolfgang Pieb // CHECK: call{{.*}}bar 274424c44cSWolfgang Pieb 284424c44cSWolfgang Pieb return res != 0; 294424c44cSWolfgang Pieb // CHECK: [[FAKE_USE:%.+]] = load ptr, ptr %this.addr 304424c44cSWolfgang Pieb // CHECK-NEXT: call void (...) @llvm.fake.use(ptr{{.*}} [[FAKE_USE]]) 314424c44cSWolfgang Pieb // CHECK-NEXT: ret 324424c44cSWolfgang Pieb } 334424c44cSWolfgang Pieb 344424c44cSWolfgang Pieb // CHECK: declare void @llvm.fake.use 35