47 lines · plain
1; RUN: opt -passes="default<O0>" -S < %s | FileCheck -check-prefix=INSTRUMENT %s2; RUN: opt -passes="default<O1>" -S < %s | FileCheck -check-prefix=INSTRUMENT %s3; RUN: opt -passes="thinlto-pre-link<O0>" -S < %s | FileCheck -check-prefix=INSTRUMENT %s4; RUN: opt -passes="thinlto-pre-link<O2>" -S < %s | FileCheck -check-prefix=INSTRUMENT %s5; RUN: opt -passes="thinlto<O0>" -S < %s | FileCheck -check-prefix=NOINSTRUMENT %s6; RUN: opt -passes="thinlto<O2>" -S < %s | FileCheck -check-prefix=NOINSTRUMENT %s7; RUN: opt -passes="lto<O0>" -S < %s | FileCheck -check-prefix=NOINSTRUMENT %s8; RUN: opt -passes="lto<O2>" -S < %s | FileCheck -check-prefix=NOINSTRUMENT %s9 10; Pre-inline instrumentation should be inserted, but not by LTO/ThinLTO passes.11 12target triple = "x86_64-unknown-linux"13 14define void @leaf_function() #0 {15entry:16 ret void17; INSTRUMENT-LABEL: entry:18; INSTRUMENT-NEXT: %0 ={{.*}} call ptr @llvm.returnaddress(i32 0)19; INSTRUMENT-NEXT: {{.* call void @__cyg_profile_func_enter\(ptr( nonnull)? @leaf_function, ptr %0\)}}20; NOINSTRUMENT-NOT: {{.*}} call void @__cyg_profile_func_enter21; INSTRUMENT: {{.*}} call void @__cyg_profile_func_exit22; INSTRUMENT-NEXT: ret void23; NOINSTRUMENT-NOT: {{.*}} call void @__cyg_profile_func_exit24; NOINSTRUMENT-LABEL: entry:25; NOINSTRUMENT-NEXT: ret void26}27 28 29define void @root_function() #1 {30entry:31 call void @leaf_function()32 ret void33; INSTRUMENT-LABEL: entry:34; INSTRUMENT-NEXT: %0 ={{.*}} call ptr @llvm.returnaddress(i32 0)35; INSTRUMENT-NEXT: {{.*}} call void @__cyg_profile_func_enter(ptr{{( nonnull)?}} @root_function, ptr %0)36; INSTRUMENT: {{.*}} call void @__cyg_profile_func_enter37; INSTRUMENT: {{.*}} call void @__cyg_profile_func_exit38; INSTRUMENT: {{.*}} call void @__cyg_profile_func_exit39; INSTRUMENT-NEXT: ret void40; NOINSTRUMENT-LABEL: entry:41; NOINSTRUMENT: ret void42; NOINSTRUMENT-NOT: {{.*}} call void @__cyg_profile_func_exit43}44 45attributes #0 = { alwaysinline "instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit" }46attributes #1 = { "instrument-function-entry"="__cyg_profile_func_enter" "instrument-function-exit"="__cyg_profile_func_exit" }47