diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -267,10 +267,7 @@ const Value *V = getCalledValue(); if (isa(V) || isa(V)) return false; - if (const CallInst *CI = dyn_cast(this)) - if (CI->isInlineAsm()) - return false; - return true; + return !isInlineAsm(); } /// Tests if this call site must be tail call optimized. Only a CallInst can diff --git a/llvm/test/Transforms/PGOProfile/callbr.ll b/llvm/test/Transforms/PGOProfile/callbr.ll new file mode 100644 --- /dev/null +++ b/llvm/test/Transforms/PGOProfile/callbr.ll @@ -0,0 +1,17 @@ +; RUN: opt -pgo-instr-gen -S 2>&1 < %s | FileCheck %s + +define i32 @a() { +entry: +; CHECK-NOT: ptrtoint void (i8*)* asm sideeffect +; CHECK: callbr void asm sideeffect + %retval = alloca i32, align 4 + callbr void asm sideeffect "", "X,~{dirflag},~{fpsr},~{flags}"(i8* blockaddress(@a, %b)) #1 + to label %asm.fallthrough [label %b] + +asm.fallthrough: + br label %b + +b: + %0 = load i32, i32* %retval, align 4 + ret i32 %0 +}