[PATCH] D73137: [mlir] Swap use of to_vector() with lookupValues() in LLVMIRIntrinsicGen

Marcello Maggioni via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 21 13:28:52 PST 2020


kariddi created this revision.
kariddi added reviewers: rriddle, andydavis1, antiagainst, nicolasvasilache, ftynse.
Herald added subscribers: llvm-commits, liufengdb, lucyrfox, mgester, arpith-jacob, shauheen, burmako, jpienaar, mehdi_amini, jdoerfert.
Herald added a project: LLVM.

llvm::to_vector() accepts a Range value and not the pair of arguments
we are currently passing. Also we probably want the lowered LLVM
values in the vector, while operand_begin()/operand_end() on MLIR ops
returns MLIR types. lookupValues() seems the correct way to collect
such values.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73137

Files:
  mlir/test/mlir-tblgen/llvm-intrinsics.td
  mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp


Index: mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp
===================================================================
--- mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp
+++ mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp
@@ -181,9 +181,9 @@
   if (overloadedRes.any() || overloadedOps.any())
     os << "\n  ";
   os << "});\n";
-  os << "    auto operands = llvm::to_vector<8, Value *>(\n";
-  os << "        opInst.operand_begin(), opInst.operand_end());\n";
-  os << "    " << (intr.getNumResults() > 0 ? "$res = " : "")
+  os << "    auto operands =\n";
+  os << "        lookupValues(opInst.getOperands());\n";
+  os << "  " << (intr.getNumResults() > 0 ? "$res = " : "")
      << "builder.CreateCall(fn, operands);\n";
   os << "  ";
 }
Index: mlir/test/mlir-tblgen/llvm-intrinsics.td
===================================================================
--- mlir/test/mlir-tblgen/llvm-intrinsics.td
+++ mlir/test/mlir-tblgen/llvm-intrinsics.td
@@ -21,6 +21,7 @@
 // CHECK:        module, llvm::Intrinsic::is_constant, {
 // CHECK:        opInst.getOperand(0).getType().cast<LLVM::LLVMType>().getUnderlyingType(),
 // CHECK: });
+// CHECK:        lookupValues(opInst.getOperands());
 
 //---------------------------------------------------------------------------//
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73137.239422.patch
Type: text/x-patch
Size: 1272 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200121/729bd384/attachment.bin>


More information about the llvm-commits mailing list