[RFC] Poison semantics for MLIR

Any progress on it?
If not, I’d like to propose this poison op definition:

def PoisonOp : Arith_Op<"poison", [Pure]> {
  let summary = "A poison value is a result of an erroneous operation.";
  let description = [{
    In order to facilitate speculative execution, many instructions do not
    invoke immediate undefined behavior when provided with illegal operands,
    and return a poison value instead.
  }];

  let results = (outs AnyType:$result);

  let assemblyFormat = "attr-dict `:` type($result)";
}

(without the freeze for now)
Important: Op will go into arith dialect, but I specifically choose return type to be AnyType. In a lot of our control flow transformations (including CFG-to-SCF) we need to create “dummy” values of arbitrary type (see example in my previous post).

If this definition is ok, I can make a patch with this op and translation to LLVM::PoisonOp

1 Like