From a7b115b392bcd0268a894ffe43b72a39d0094b62 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 13 Dec 2018 15:44:26 +0000 Subject: [DAGCombiner] after simplifying demanded elements of vector operand of extract, revisit the extract Differential Revision: https://reviews.llvm.org/D55655 llvm-svn: 349051 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen') diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 7768d12c75c..b364b1baea7 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -15698,8 +15698,13 @@ SDValue DAGCombiner::visitEXTRACT_VECTOR_ELT(SDNode *N) { if (CstElt->getAPIntValue().ult(VT.getVectorNumElements())) DemandedElts.setBit(CstElt->getZExtValue()); } - if (SimplifyDemandedVectorElts(InVec, DemandedElts, true)) + if (SimplifyDemandedVectorElts(InVec, DemandedElts, true)) { + // We simplified the operands of this extract element, but if this extract + // is still alive, visit it again to ensure that it is folded properly. + if (!N->use_empty()) + AddToWorklist(N); return SDValue(N, 0); + } } bool BCNumEltsChanged = false; -- cgit v1.2.3