[llvm] r348348 - [TargetLowering] SimplifyDemandedVectorElts - don't alter DemandedElts mask

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 5 02:37:45 PST 2018


Author: rksimon
Date: Wed Dec  5 02:37:45 2018
New Revision: 348348

URL: http://llvm.org/viewvc/llvm-project?rev=348348&view=rev
Log:
[TargetLowering] SimplifyDemandedVectorElts - don't alter DemandedElts mask

Fix potential issue with the ISD::INSERT_VECTOR_ELT case tweaking the DemandedElts mask instead of using a local copy - so later uses of the mask use the tweaked version.....

Noticed while investigating adding zero/undef folding to SimplifyDemandedVectorElts and the altered DemandedElts mask was causing mismatches.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp?rev=348348&r1=348347&r2=348348&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/TargetLowering.cpp Wed Dec  5 02:37:45 2018
@@ -1614,9 +1614,10 @@ bool TargetLowering::SimplifyDemandedVec
       unsigned Idx = CIdx->getZExtValue();
       if (!DemandedElts[Idx])
         return TLO.CombineTo(Op, Vec);
-      DemandedElts.clearBit(Idx);
 
-      if (SimplifyDemandedVectorElts(Vec, DemandedElts, KnownUndef,
+      APInt DemandedVecElts(DemandedElts);
+      DemandedVecElts.clearBit(Idx);
+      if (SimplifyDemandedVectorElts(Vec, DemandedVecElts, KnownUndef,
                                      KnownZero, TLO, Depth + 1))
         return true;
 




More information about the llvm-commits mailing list