[PATCH] D77600: [CallSite Removal] a CallBase is never an IndirectCall for isInlineAsm

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 15:49:16 PDT 2020


nickdesaulniers updated this revision to Diff 255518.
nickdesaulniers added a comment.
This revision is now accepted and ready to land.

- simplify function


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77600/new/

https://reviews.llvm.org/D77600

Files:
  llvm/lib/IR/Instructions.cpp
  llvm/test/Transforms/PGOProfile/callbr.ll


Index: llvm/test/Transforms/PGOProfile/callbr.ll
===================================================================
--- /dev/null
+++ 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
+}
Index: llvm/lib/IR/Instructions.cpp
===================================================================
--- llvm/lib/IR/Instructions.cpp
+++ llvm/lib/IR/Instructions.cpp
@@ -265,12 +265,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 !(isa<Function>(V) || isa<Constant>(V) || isInlineAsm());
 }
 
 /// Tests if this call site must be tail call optimized. Only a CallInst can


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77600.255518.patch
Type: text/x-patch
Size: 1245 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200406/4c394c43/attachment.bin>


More information about the llvm-commits mailing list