summaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
index b3eebee0d0d8..35425c5d0882 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
@@ -638,8 +638,10 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
if (auto Opt = convertOrOfShiftsToFunnelShift(*Inst)) {
auto [IID, FShiftArgs] = *Opt;
if ((IID == Intrinsic::fshl || IID == Intrinsic::fshr) &&
- FShiftArgs[0] == FShiftArgs[1])
- return nullptr;
+ FShiftArgs[0] == FShiftArgs[1]) {
+ computeKnownBits(I, Known, Depth, CxtI);
+ break;
+ }
}
}
}
@@ -718,8 +720,10 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
if (auto Opt = convertOrOfShiftsToFunnelShift(*Inst)) {
auto [IID, FShiftArgs] = *Opt;
if ((IID == Intrinsic::fshl || IID == Intrinsic::fshr) &&
- FShiftArgs[0] == FShiftArgs[1])
- return nullptr;
+ FShiftArgs[0] == FShiftArgs[1]) {
+ computeKnownBits(I, Known, Depth, CxtI);
+ break;
+ }
}
}
}
@@ -893,15 +897,6 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
computeKnownBits(I, Known, Depth, CxtI);
break;
}
- case Instruction::URem: {
- APInt AllOnes = APInt::getAllOnes(BitWidth);
- if (SimplifyDemandedBits(I, 0, AllOnes, LHSKnown, Depth + 1) ||
- SimplifyDemandedBits(I, 1, AllOnes, RHSKnown, Depth + 1))
- return I;
-
- Known = KnownBits::urem(LHSKnown, RHSKnown);
- break;
- }
case Instruction::Call: {
bool KnownBitsComputed = false;
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(I)) {