From 64f44a90efb70dd5853e870a6f2c38e2f47ff890 Mon Sep 17 00:00:00 2001 From: Xiang1 Zhang Date: Fri, 1 Jul 2022 08:59:04 +0800 Subject: Revert "[ISel] Match all bits when merge undef(s) for DAG combine" This reverts commit 5fe5aa284efed1ee1492e1f266351b35f0a8bb69. --- llvm/lib/Support/APInt.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'llvm/lib/Support/APInt.cpp') diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index f74178b..acc68fe 100644 --- a/llvm/lib/Support/APInt.cpp +++ b/llvm/lib/Support/APInt.cpp @@ -2968,8 +2968,7 @@ llvm::APIntOps::GetMostSignificantDifferentBit(const APInt &A, const APInt &B) { return A.getBitWidth() - ((A ^ B).countLeadingZeros() + 1); } -APInt llvm::APIntOps::ScaleBitMask(const APInt &A, unsigned NewBitWidth, - bool MatchAllBits) { +APInt llvm::APIntOps::ScaleBitMask(const APInt &A, unsigned NewBitWidth) { unsigned OldBitWidth = A.getBitWidth(); assert((((OldBitWidth % NewBitWidth) == 0) || ((NewBitWidth % OldBitWidth) == 0)) && @@ -2993,16 +2992,11 @@ APInt llvm::APIntOps::ScaleBitMask(const APInt &A, unsigned NewBitWidth, if (A[i]) NewA.setBits(i * Scale, (i + 1) * Scale); } else { + // Merge bits - if any old bit is set, then set scale equivalent new bit. unsigned Scale = OldBitWidth / NewBitWidth; - for (unsigned i = 0; i != NewBitWidth; ++i) { - if (MatchAllBits) { - if (A.extractBits(Scale, i * Scale).isAllOnes()) - NewA.setBit(i); - } else { - if (!A.extractBits(Scale, i * Scale).isZero()) - NewA.setBit(i); - } - } + for (unsigned i = 0; i != NewBitWidth; ++i) + if (!A.extractBits(Scale, i * Scale).isZero()) + NewA.setBit(i); } return NewA; -- cgit v1.1