[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 16:22:09 PDT 2020


nickdesaulniers updated this revision to Diff 255527.
nickdesaulniers added a comment.

- touch fewer lines as per Bill


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
@@ -267,10 +267,7 @@
   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 !CI->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.255527.patch
Type: text/x-patch
Size: 1164 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200406/ab3fe1fe/attachment-0001.bin>


More information about the llvm-commits mailing list