summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp2
-rw-r--r--llvm/test/Transforms/PGOProfile/inlineasm.ll16
2 files changed, 17 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
index 4884a499019..787f098869f 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
@@ -334,7 +334,7 @@ struct PGOIndirectCallSiteVisitor
void visitCallInst(CallInst &I) {
CallSite CS(&I);
- if (CS.getCalledFunction() || !CS.getCalledValue())
+ if (CS.getCalledFunction() || !CS.getCalledValue() || I.isInlineAsm())
return;
IndirectCallInsts.push_back(&I);
}
diff --git a/llvm/test/Transforms/PGOProfile/inlineasm.ll b/llvm/test/Transforms/PGOProfile/inlineasm.ll
new file mode 100644
index 00000000000..70b9c081d10
--- /dev/null
+++ b/llvm/test/Transforms/PGOProfile/inlineasm.ll
@@ -0,0 +1,16 @@
+; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s
+
+target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-apple-macosx10.12.0"
+
+define i32 @main() {
+entry:
+; CHECK: call void @llvm.instrprof.increment
+; CHECK-NOT: ptrtoint void (i8*)* asm sideeffect
+; CHECK-NOT: call void @llvm.instrprof.value.profile
+; CHECK: tail call void asm sideeffect
+ tail call void asm sideeffect "", "imr,~{memory},~{dirflag},~{fpsr},~{flags}"(i8* undef) #0
+ ret i32 0
+}
+
+attributes #0 = { nounwind }
OpenPOWER on IntegriCloud