[PATCH] D17176: [CodeGen] Add getBuildVector and getSplatBuildVector helpers.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 11 17:06:46 PST 2016


RKSimon added a comment.

Very useful!


================
Comment at: include/llvm/CodeGen/SelectionDAG.h:588
@@ +587,3 @@
+  /// The operands must have the same type as VT's element type.
+  SDValue getBuildVector(SDLoc DL, EVT VT, ArrayRef<SDValue> Ops) {
+    assert(VT.getVectorNumElements() == Ops.size() &&
----------------
Please try to consistent with the DL / VT arg order with other DAG node creators - most seem to be VT and then DL.

================
Comment at: include/llvm/CodeGen/SelectionDAG.h:592
@@ +591,3 @@
+    return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
+  }
+
----------------
It'd be great if you could add extra tests here - for instance all Ops must be the same valuetype (if float they must match VT.getScalarType() - if integer they can be greater than or equal to the number scalar bits).

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:4539
@@ -4540,1 +4538,3 @@
+    return DAG.getNode(ISD::BUILD_VECTOR,
+        dl, ResultVT, makeArrayRef(Vec->op_begin() + IdxVal, ElemsPerChunk));
 
----------------
Why not updated to DAG.getBuildVector?


http://reviews.llvm.org/D17176





More information about the llvm-commits mailing list