[llvm] [ConstraintElim] Decompose shl nsw for signed predicates (PR #76961)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 4 09:02:20 PST 2024
================
@@ -517,6 +517,17 @@ static Decomposition decompose(Value *V,
return Result;
}
+ // shl nsw x, shift is mul nsw x, (1<<shift),
+ // with the exception of shift == bw-1.
+ if (match(V, m_NSWShl(m_Value(Op0), m_ConstantInt(CI)))) {
+ uint64_t Shift = CI->getValue().getLimitedValue();
+ if (Shift < Ty->getIntegerBitWidth() - 1 && Shift < 64) {
----------------
nikic wrote:
Yeah, this check is actually redundant. I'll replace it with an assert.
https://github.com/llvm/llvm-project/pull/76961
More information about the llvm-commits
mailing list