[llvm] r263278 - [PGO] Skip value profile instrumentation of inline asm
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 11 10:57:48 PST 2016
Author: vedantk
Date: Fri Mar 11 12:57:48 2016
New Revision: 263278
URL: http://llvm.org/viewvc/llvm-project?rev=263278&view=rev
Log:
[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.
Added:
llvm/trunk/test/Transforms/PGOProfile/inlineasm.ll
Modified:
llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=263278&r1=263277&r2=263278&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Fri Mar 11 12:57:48 2016
@@ -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);
}
Added: llvm/trunk/test/Transforms/PGOProfile/inlineasm.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PGOProfile/inlineasm.ll?rev=263278&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/PGOProfile/inlineasm.ll (added)
+++ llvm/trunk/test/Transforms/PGOProfile/inlineasm.ll Fri Mar 11 12:57:48 2016
@@ -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 }
More information about the llvm-commits
mailing list