Skip to content

Commit 79e668f

Browse files
committed
[InstCombine] Fix funnel shift bailout in demanded bits simplification
We shouldn't simply return here -- we still need to compute the known bits and fall through to generic handling. This fixes a -instcombine-verify-known-bits violation in funnel.ll.
1 parent d38c8a7 commit 79e668f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,10 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
638638
if (auto Opt = convertOrOfShiftsToFunnelShift(*Inst)) {
639639
auto [IID, FShiftArgs] = *Opt;
640640
if ((IID == Intrinsic::fshl || IID == Intrinsic::fshr) &&
641-
FShiftArgs[0] == FShiftArgs[1])
642-
return nullptr;
641+
FShiftArgs[0] == FShiftArgs[1]) {
642+
computeKnownBits(I, Known, Depth, CxtI);
643+
break;
644+
}
643645
}
644646
}
645647
}
@@ -718,8 +720,10 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
718720
if (auto Opt = convertOrOfShiftsToFunnelShift(*Inst)) {
719721
auto [IID, FShiftArgs] = *Opt;
720722
if ((IID == Intrinsic::fshl || IID == Intrinsic::fshr) &&
721-
FShiftArgs[0] == FShiftArgs[1])
722-
return nullptr;
723+
FShiftArgs[0] == FShiftArgs[1]) {
724+
computeKnownBits(I, Known, Depth, CxtI);
725+
break;
726+
}
723727
}
724728
}
725729
}

0 commit comments

Comments
 (0)