mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-06 03:08:43 +00:00
[CallSite Removal] a CallBase is never an IndirectCall for isInlineAsm
Summary: Thanks to Bill Wendling (void) for the report and steps to reproduce. It looks like this was missed during r350508's cleanup of the CallSite split into CallBase, CallInst, and CallBrInst. This was exposed by running pgo on a callbr, which was creating a ptrtoint to the inline asm thinking it was an indirect call. The relevant callchain looks like: IndirectCallPromotionPlugin::run() -> PGOIndirectCallVisitor::findIndirectCalls() -> PGOIndirectCallVisitor::visitCallBase() -> CallBase::isIndirectCall() Reviewers: void, chandlerc Reviewed By: void Subscribers: hiraditya, llvm-commits, craig.topper, srhines Tags: #llvm Differential Revision: https://reviews.llvm.org/D77600
This commit is contained in:
parent
bf5535fee3
commit
7b37d7f7bc
@ -267,10 +267,7 @@ bool CallBase::isIndirectCall() const {
|
||||
const Value *V = getCalledValue();
|
||||
if (isa<Function>(V) || isa<Constant>(V))
|
||||
return false;
|
||||
if (const CallInst *CI = dyn_cast<CallInst>(this))
|
||||
if (CI->isInlineAsm())
|
||||
return false;
|
||||
return true;
|
||||
return !isInlineAsm();
|
||||
}
|
||||
|
||||
/// Tests if this call site must be tail call optimized. Only a CallInst can
|
||||
|
17
test/Transforms/PGOProfile/callbr.ll
Normal file
17
test/Transforms/PGOProfile/callbr.ll
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user