diff options
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/PGOProfile/do-not-instrument.ll | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h b/llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h index baf49c79f6d..71a8cb88632 100644 --- a/llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h +++ b/llvm/lib/Transforms/Instrumentation/IndirectCallSiteVisitor.h @@ -28,6 +28,8 @@ struct PGOIndirectCallSiteVisitor if (CI->isInlineAsm()) return; } + if (isa<Constant>(CS.getCalledValue())) + return; IndirectCallInsts.push_back(I); } }; diff --git a/llvm/test/Transforms/PGOProfile/do-not-instrument.ll b/llvm/test/Transforms/PGOProfile/do-not-instrument.ll index 98a3eec5d53..a42969ccc5b 100644 --- a/llvm/test/Transforms/PGOProfile/do-not-instrument.ll +++ b/llvm/test/Transforms/PGOProfile/do-not-instrument.ll @@ -14,4 +14,14 @@ entry: ret i32 0 } +define i32 @f2() { +entry: +; CHECK: call void @llvm.instrprof.increment +; CHECK-NOT: call void @llvm.instrprof.value.profile + call void (i32, ...) bitcast (void (...)* @foo to void (i32, ...)*)(i32 21) + ret i32 0 +} + +declare void @foo(...) #0 + attributes #0 = { nounwind } |