1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 19:23:23 +01:00

[PGO] Skip value profile instrumentation of inline asm

Value profile instrumentation treats inline asm calls like they are
indirect calls. This causes problems when the 'Callee' is passed to a
ptrtoint cast -- the verifier rightly claims that this is bogus and
crashes opt.

llvm-svn: 263278
This commit is contained in:
Vedant Kumar 2016-03-11 18:57:48 +00:00
parent e1affa2f8c
commit bf7c40f75a
2 changed files with 17 additions and 1 deletions

View File

@ -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);
}

View File

@ -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 }