'nsw' in smaddl leads to poison
katrinafyi opened this issue · 1 comments
katrinafyi commented
For an instruction like 200c229b smaddl x0, w1, w2, x3, the LLVM IR has "nsw" flags:
// ...
%mul.i.i = mul nsw i64 %conv.i31.i, %conv.i29.i
%add.i.i = add nsw i64 %mul.i.i, %8
store i64 %add.i.i, ptr %X0, align 8
For mul, this is fine as both operands are 32-bit, but the addition can easily overflow. For example, w1 = w2 = 1 and x3 = MAX_INT will cause a poison value to be returned.
thug-shaker commented