[PATCH] D57117: GlobalISel: Add helper to LLT to get a scalar or vector

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 23 13:33:48 PST 2019


arsenm created this revision.
arsenm added reviewers: dsanders, aemerson, paquette, aditya_nandakumar, volkan.
Herald added subscribers: kristof.beyls, rovka, wdng.

https://reviews.llvm.org/D57117

Files:
  include/llvm/Support/LowLevelTypeImpl.h


Index: include/llvm/Support/LowLevelTypeImpl.h
===================================================================
--- include/llvm/Support/LowLevelTypeImpl.h
+++ include/llvm/Support/LowLevelTypeImpl.h
@@ -70,6 +70,10 @@
                ScalarTy.isPointer() ? ScalarTy.getAddressSpace() : 0};
   }
 
+  static LLT scalarOrVector(uint16_t NumElements, LLT ScalarTy) {
+    return NumElements == 1 ? ScalarTy : LLT::vector(NumElements, ScalarTy);
+  }
+
   explicit LLT(bool isPointer, bool isVector, uint16_t NumElements,
                unsigned SizeInBits, unsigned AddressSpace) {
     init(isPointer, isVector, NumElements, SizeInBits, AddressSpace);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57117.183167.patch
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190123/befd7bda/attachment.bin>


More information about the llvm-commits mailing list