[PATCH] D13655: DAGCombiner: Combine extract_vector_elt from build_vector

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 14:36:55 PDT 2015


arsenm added inline comments.

================
Comment at: include/llvm/Target/TargetLowering.h:1723
@@ -1722,1 +1722,3 @@
 
+  // Return true if it is profitable to use a scalar input to a BUILD_VECTOR
+  // even if the vector itself has multiple uses.
----------------
RKSimon wrote:
> By 'use' do you just mean 'directly access' or do you foresee other possibilities?
Yes, directly access the input value. I had a hard time picking a name for this. Other options are something like isExtractVectorEltAsCheapAsScalarCopy

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:11893
@@ +11892,3 @@
+       TLI.aggressivelyPreferBuildVectorSources(VT))) {
+    return InVec.getOperand(ConstEltNo->getZExtValue());
+  }
----------------
RKSimon wrote:
> You may need to confirm that the operand value type is the same as the BUILD_VECTOR scalar value type - implicit truncation may be occurring.
Is this really supposed to be allowed? I would consider mismatched vector element and destination vector types to be a bug. The comment in getConstant made me very unhappy


http://reviews.llvm.org/D13655





More information about the llvm-commits mailing list