aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopVersioning.cpp
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2020-09-22 15:34:45 +0300
committerRoman Lebedev <lebedev.ri@gmail.com>2020-09-22 21:37:29 +0300
commitba5afe5588ded61052c8727dbcb0407b5de4410c (patch)
tree12af1a838b4832d4842240ee336a8e02b99db7fd /llvm/lib/Transforms/Utils/LoopVersioning.cpp
parent2ed9c4c70bbb36fa12d48a73abc2d89c0af80060 (diff)
downloadllvm-ba5afe5588ded61052c8727dbcb0407b5de4410c.zip
llvm-ba5afe5588ded61052c8727dbcb0407b5de4410c.tar.gz
llvm-ba5afe5588ded61052c8727dbcb0407b5de4410c.tar.bz2
[NFC][CVP] processUDivOrURem(): refactor to use ConstantRange::getActiveBits()
As an exhaustive test shows, this logic is fully identical to the old implementation, with exception of the case where both of the operands had empty ranges: ``` TEST_F(ConstantRangeTest, CVP_UDiv) { unsigned Bits = 4; EnumerateConstantRanges(Bits, [&](const ConstantRange &CR0) { if(CR0.isEmptySet()) return; EnumerateConstantRanges(Bits, [&](const ConstantRange &CR1) { if(CR0.isEmptySet()) return; unsigned MaxActiveBits = 0; for (const ConstantRange &CR : {CR0, CR1}) MaxActiveBits = std::max(MaxActiveBits, CR.getActiveBits()); ConstantRange OperandRange(Bits, /*isFullSet=*/false); for (const ConstantRange &CR : {CR0, CR1}) OperandRange = OperandRange.unionWith(CR); unsigned NewWidth = OperandRange.getUnsignedMax().getActiveBits(); EXPECT_EQ(MaxActiveBits, NewWidth) << CR0 << " " << CR1; }); }); } ```
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopVersioning.cpp')
0 files changed, 0 insertions, 0 deletions