More graceful failure when verifying llvm.noalias.

PiperOrigin-RevId: 237081778
This commit is contained in:
Dimitrios Vytiniotis 2019-03-06 11:05:43 -08:00 committed by jpienaar
parent 1d87b62afe
commit 32943f5783
2 changed files with 9 additions and 2 deletions

View File

@ -96,8 +96,9 @@ bool LLVMDialect::verifyFunctionArgAttribute(const Function *func,
unsigned argIdx,
NamedAttribute argAttr) {
// Check that llvm.noalias is a boolean attribute.
if (argAttr.first == StringRef("llvm.noalias"))
return (!argAttr.second.isa<BoolAttr>());
if (argAttr.first == "llvm.noalias" && !argAttr.second.isa<BoolAttr>())
return func->emitError(
"llvm.noalias argument attribute of non boolean type");
return false;
}

View File

@ -0,0 +1,6 @@
// RUN: mlir-opt %s -verify
// expected-error@+1{{llvm.noalias argument attribute of non boolean type}}
func @invalid_noalias(%arg0: !llvm<"i32"> {llvm.noalias: 3}) {
"llvm.return"() : () -> ()
}