[PATCH] Fold EXTRACT_VECTOR_ELT(BUILD_VECTOR(Elt[0], ...), CstX ) -> Elt[CstX]
Mehdi AMINI
mehdi.amini at apple.com
Thu Apr 23 15:42:34 PDT 2015
Thanks for the review. I'll wait for you to have time to fix the ARM64 failure ;)
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:11004
@@ +11003,3 @@
+ // Fold EXTRACT_VECTOR_ELT(BUILD_VECTOR(Elt[0], ...), CstX ) -> Elt[CstX]
+ if (InVec.getOpcode() == ISD::BUILD_VECTOR && ConstEltNo) {
+ auto Elt = InVec.getOperand(N->getConstantOperandVal(1));
----------------
ab wrote:
> Would it make sense to check that the BUILD_VECTOR .hasOneUse()?
>
Good question, I can imagine cases where I don't want to this check but I'm not sure I see a lot of cases where it would be beneficial?
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:11010
@@ +11009,3 @@
+ // when folding this case.
+ if(Elt.getValueType() == NVT)
+ return Elt;
----------------
ab wrote:
> space before (
grahh clang-format :(
================
Comment at: test/CodeGen/R600/ds_read2.ll:220-221
@@ -223,1 +219,4 @@
+; SI: ds_read2_b32
+; SI-NOT: ds_read_b32
+; SI-NOT: ds_read_b32
; SI: s_endpgm
----------------
ab wrote:
> A single -NOT is enough
Of course! Thanks.
http://reviews.llvm.org/D9094
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list