[PATCH] [AArch64] Build correct vector filled with undef nodes

Tim Northover t.p.northover at gmail.com
Mon Sep 1 05:28:49 PDT 2014


Hi David,

Thanks for working on this. Bet it was fun to track down! I've got a comment about the implementation...

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:486
@@ +485,3 @@
+// will cause the bug described in test/CodeGen/AArch64/aarch64_tree_tests.ll
+SDValue DAGCombiner::ReplaceUndefFromZeroOrOneVector(SDValue N, SDLoc DL) {
+  SmallVector<SDValue, 8> Ops;
----------------
I think this might be more useful as a generic getConstantSplat function in SelectionDAG (following the SelectionDAG::getConstant functions).

It wouldn't significantly complicate the use-sites, would simplify the implementation (don't need to care about bitcasts or weird promotion rules or anything) and I could see other cases where it could be used.

Something like (untested)

  SDValue getConstantSplat(uint64_t Val, SDLoc DL, EVT VT) {
    SmallVector<SDValue, 16> Ops(VT.getVectorNumElements(),
                                 getConstant(Val, VT.getVectorElementType()));
    return getNode(ISD::BUILD_VECTOR, DL, VT, Ops);
  }

http://reviews.llvm.org/D5139






More information about the llvm-commits mailing list