[llvm] [AMDGPU] prevent shrinking udiv/urem if operands exceed smax_bitwidth (PR #116733)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 06:16:03 PST 2024
================
@@ -1193,6 +1193,17 @@ int AMDGPUCodeGenPrepareImpl::getDivNumBits(BinaryOperator &I, Value *Num,
Value *Den, unsigned AtLeast,
bool IsSigned) const {
const DataLayout &DL = Mod->getDataLayout();
+ if (!IsSigned) {
+ KnownBits Known = computeKnownBits(Num, DL, 0, AC, &I);
+ // We know all bits are used for division for Operand > smax_bitwidth
----------------
choikwa wrote:
I had meant smax_bitwidth to be signed max of bit width which corresponds to that of Num/Den. Will reword it as such. The operand range that's handled incorrectly is [SignedMax, UnsignedMax].
https://github.com/llvm/llvm-project/pull/116733
More information about the llvm-commits
mailing list