forked from OSchip/llvm-project
More graceful failure when verifying llvm.noalias.
PiperOrigin-RevId: 237081778
This commit is contained in:
parent
1d87b62afe
commit
32943f5783
|
@ -96,8 +96,9 @@ bool LLVMDialect::verifyFunctionArgAttribute(const Function *func,
|
||||||
unsigned argIdx,
|
unsigned argIdx,
|
||||||
NamedAttribute argAttr) {
|
NamedAttribute argAttr) {
|
||||||
// Check that llvm.noalias is a boolean attribute.
|
// Check that llvm.noalias is a boolean attribute.
|
||||||
if (argAttr.first == StringRef("llvm.noalias"))
|
if (argAttr.first == "llvm.noalias" && !argAttr.second.isa<BoolAttr>())
|
||||||
return (!argAttr.second.isa<BoolAttr>());
|
return func->emitError(
|
||||||
|
"llvm.noalias argument attribute of non boolean type");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"() : () -> ()
|
||||||
|
}
|
Loading…
Reference in New Issue