Skip to content

'nsw' in smaddl leads to poison #656

@katrinafyi

Description

@katrinafyi

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions