[PATCH] D37073: [WebAssembly] FastISel : Bail to SelectionDAG for constexpr calls

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 12:54:52 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL311693: [WebAssembly] FastISel : Bail to SelectionDAG for constexpr calls (authored by jgravelle).

Repository:
  rL LLVM

https://reviews.llvm.org/D37073

Files:
  llvm/trunk/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
  llvm/trunk/test/CodeGen/WebAssembly/call.ll


Index: llvm/trunk/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
===================================================================
--- llvm/trunk/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
+++ llvm/trunk/lib/Target/WebAssembly/WebAssemblyFastISel.cpp
@@ -700,9 +700,12 @@
   if (Func && Func->isIntrinsic())
     return false;
 
+  bool IsDirect = Func != nullptr;
+  if (!IsDirect && isa<ConstantExpr>(Call->getCalledValue()))
+    return false;
+
   FunctionType *FuncTy = Call->getFunctionType();
   unsigned Opc;
-  bool IsDirect = Func != nullptr;
   bool IsVoid = FuncTy->getReturnType()->isVoidTy();
   unsigned ResultReg;
   if (IsVoid) {
Index: llvm/trunk/test/CodeGen/WebAssembly/call.ll
===================================================================
--- llvm/trunk/test/CodeGen/WebAssembly/call.ll
+++ llvm/trunk/test/CodeGen/WebAssembly/call.ll
@@ -150,6 +150,27 @@
   ret void
 }
 
+; CHECK-LABEL: call_constexpr:
+; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 2{{$}}
+; CHECK-NEXT: i32.const $push[[L1:[0-9]+]]=, 3{{$}}
+; CHECK-NEXT: call vararg_func at FUNCTION, $pop[[L0]], $pop[[L1]]{{$}}
+; CHECK-NEXT: call other_void_nullary at FUNCTION{{$}}
+; CHECK-NEXT: call void_nullary at FUNCTION{{$}}
+; CHECK-NEXT: return{{$}}
+declare void @vararg_func(...)
+declare void @other_void_nullary()
+define void @call_constexpr() {
+bb0:
+  call void bitcast (void (...)* @vararg_func to void (i32, i32)*)(i32 2, i32 3)
+  br label %bb1
+bb1:
+  call void select (i1 0, void ()* @void_nullary, void ()* @other_void_nullary)()
+  br label %bb2
+bb2:
+  call void inttoptr (i32 ptrtoint (void ()* @void_nullary to i32) to void ()*)()
+  ret void
+}
+
 ; TODO: test the following:
 ;  - More argument combinations.
 ;  - Tail call.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D37073.112595.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170824/5280483c/attachment.bin>


More information about the llvm-commits mailing list