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

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 6 02:54:55 PDT 2016


RKSimon added inline comments.

================
Comment at: include/llvm/CodeGen/SelectionDAG.h:641
@@ +640,3 @@
+    return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
+  }
+
----------------
ab wrote:
> What do you think of moving the VerifySDNode checks here?
I'm happy for them to stay where they are as long as:

(a) there isn't any way that the asserts can be avoided depending on the manner in which BUILD_VECTOR is created.

(b) the assert is directly in line in the call stack with whatever created the BUILD_VECTOR in the first place - we used to have cases where only a much later assert would fire regarding the inconsistent valuetypes leaving us with no idea what generated the faulty BUILD_VECTOR in the first place.

================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3294-3299
@@ -3301,7 +3293,8 @@
           return Folded;
         SmallVector<SDValue, 4> Outputs;
+        llvm_unreachable("can't have vectors ops with scalar operands");
         // We may have a vector type but a scalar result. Create a splat.
         Outputs.resize(VT.getVectorNumElements(), Outputs.back());
         // Build a big vector out of the scalar elements we generated.
         return getNode(ISD::BUILD_VECTOR, SDLoc(), VT, Outputs);
       } else {
----------------
ab wrote:
> I think this block is unreachable: if two operands are constants, there's no way for this op to be vector.
> 
> If I didn't miss anything, I'll remove this separately.
LCOV agrees in that no tests ever hit it. 


http://reviews.llvm.org/D17176





More information about the llvm-commits mailing list