diff options
author | Xiang1 Zhang <xiang1.zhang@intel.com> | 2022-07-01 08:59:04 +0800 |
---|---|---|
committer | Xiang1 Zhang <xiang1.zhang@intel.com> | 2022-07-01 08:59:04 +0800 |
commit | 64f44a90efb70dd5853e870a6f2c38e2f47ff890 (patch) | |
tree | 3e2f6d3cef627dabd234d077a9189cb91d25350f /llvm/lib/Support/APInt.cpp | |
parent | 5fe5aa284efed1ee1492e1f266351b35f0a8bb69 (diff) | |
download | llvm-64f44a90efb70dd5853e870a6f2c38e2f47ff890.zip llvm-64f44a90efb70dd5853e870a6f2c38e2f47ff890.tar.gz llvm-64f44a90efb70dd5853e870a6f2c38e2f47ff890.tar.bz2 |
Revert "[ISel] Match all bits when merge undef(s) for DAG combine"
This reverts commit 5fe5aa284efed1ee1492e1f266351b35f0a8bb69.
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r-- | llvm/lib/Support/APInt.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
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; |