[PATCH] D34077: DAGCombine: Combine BUILD_VECTOR to TRUNCATE

Elena Demikhovsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 1 23:53:11 PDT 2017


delena added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14272
+  // Proceed only if the stride and the types can be matched to a truncate.
+  if ((Stride == 1 || !isPowerOf2_32(Stride)) ||
+      (ExtractedFromVec.getValueType().getVectorNumElements() !=
----------------
I'd check (Stride < 2), I don't know what isPowerOf2_32() thinks about 0.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14296
+  Res = DAG.getNode(ISD::TRUNCATE, SDLoc(N), TruncVT, Res);
+  if (VT.isFloatingPoint())
+    Res = DAG.getBitcast(VT, Res);
----------------
you can just call for getBitcast(VT, Res), the "getBitcast() has the "if" inside".


https://reviews.llvm.org/D34077





More information about the llvm-commits mailing list