[InstCombine] decomposeSimpleLinearExpr should bail out on negative operands.
InstCombine tries to rewrite %prod = mul nsw i64 %X, Scale %acc = add nsw i64 %prod, Offset %0 = alloca i8, i64 %acc, align 4 %1 = bitcast i8* %0 to i32* Use ( %1 ) into %prod = mul nsw i64 %X, Scale/4 %acc = add nsw i64 %prod, Offset/4 %0 = alloca i32, i64 %acc, align 4 Use (%0) But it assumes Scale is unsigned, and performs an unsigned division. So we should bail out if Scale cannot be interpreted as an unsigned safely. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D126546
Loading
Please sign in to comment