From f409c45eff095cbedd58557a2e2c21ff2ed7c00b Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Fri, 7 Jun 2019 18:07:06 +0000 Subject: [PATCH] [DAGCombine] Use APInt::extractBits in "sub-splat" constant mask detection. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@362820 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index f78f775017a..696de2c575d 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -5005,10 +5005,10 @@ SDValue DAGCombiner::visitAND(SDNode *N) { // Make sure that variable 'Constant' is only set if 'SplatBitSize' is a // multiple of 'BitWidth'. Otherwise, we could propagate a wrong value. - if (SplatBitSize % BitWidth == 0) { + if ((SplatBitSize % BitWidth) == 0) { Constant = APInt::getAllOnesValue(BitWidth); - for (unsigned i = 0, n = SplatBitSize/BitWidth; i < n; ++i) - Constant &= SplatValue.lshr(i*BitWidth).zextOrTrunc(BitWidth); + for (unsigned i = 0, n = (SplatBitSize / BitWidth); i < n; ++i) + Constant &= SplatValue.extractBits(BitWidth, i * BitWidth); } } } -- 2.50.1