Add the LLVM IR unreachable instruction to the LLVMIR dialect.

http://llvm.org/docs/LangRef.html#unreachable-instruction

Closes tensorflow/mlir#64

PiperOrigin-RevId: 262301557
This commit is contained in:
Eric Schweitz 2019-08-08 01:05:26 -07:00 committed by A. Unique TensorFlower
parent f56494f537
commit 881b238d7e
2 changed files with 9 additions and 0 deletions

View File

@ -300,6 +300,11 @@ def LLVM_ReturnOp : LLVM_TerminatorOp<"return", []> {
let parser = [{ return parseReturnOp(parser, result); }];
let printer = [{ printReturnOp(p, *this); }];
}
def LLVM_UnreachableOp : LLVM_TerminatorOp<"unreachable", []> {
string llvmBuilder = [{ builder.CreateUnreachable(); }];
let parser = [{ return success(); }];
let printer = [{ *p << getOperationName(); }];
}
// Pseudo-operations (do not appear in LLVM IR but necessary for the dialect to
// work correctly).

View File

@ -825,3 +825,7 @@ func @stringconstant() -> !llvm<"i8*"> {
llvm.return %1 : !llvm<"i8*">
}
func @noreach() {
// CHECK: unreachable
llvm.unreachable
}