[PATCH] D42090: [DAGCombiner] Add a DAG combine to turn a splat build_vector where the splat elemnt is a bitcast from a vector type into a concat_vector

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 17 12:49:53 PST 2018


spatel added inline comments.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14953
+  if (SDValue Splat = cast<BuildVectorSDNode>(N)->getSplatValue()) {
+    if (Splat.getOpcode() == ISD::BITCAST) {
+      EVT SrcVT = Splat.getOperand(0).getValueType();
----------------
craig.topper wrote:
> spatel wrote:
> > Might want to use 'peekThroughBitcast' here...although that reminds me that I still need to figure out if we can remove the loop in there yet.
> I thought about that, but I would have to still verify that at least one bitcast had existed. My assumption is that if there were multiple bitcasts, they would be combined and cause this user to get re-evaluated right?
You can't have a build vector of vectors, so I think there has to be a bitcast in order for the isVector() to match.

Multiple bitcasts should get folded, but last time I removed the loop from 'peekThroughBitcasts', I saw regressions. I guess this a consequence of not running to fix-point...you're never quite sure what will get combined. :)

Either way is ok here I think.


https://reviews.llvm.org/D42090





More information about the llvm-commits mailing list