Skip to content

Commit fb66809

Browse files
committed
Fail gracefully. Report match failure.
1 parent d01c2bf commit fb66809

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mlir/lib/Conversion/XeVMToLLVM/XeVMToLLVM.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,8 @@ class MemfenceToOCLPattern : public OpConversionPattern<MemfenceOp> {
423423
break;
424424
default:
425425
// GENERIC is not supported in OpenCL
426-
llvm_unreachable("Fence only supports global and shared address spaces.");
426+
return rewriter.notifyMatchFailure(
427+
op, "Fence only supports global and shared address spaces.");
427428
}
428429
switch (op.getScope()) {
429430
case xevm::MemScope::WORKGROUP:
@@ -434,7 +435,8 @@ class MemfenceToOCLPattern : public OpConversionPattern<MemfenceOp> {
434435
break;
435436
default:
436437
// CLUSTER and SYSTEM are not supported in OpenCL
437-
llvm_unreachable("unsupported xevm::MemoryScope");
438+
return rewriter.notifyMatchFailure(
439+
op, "Fence only supports workgroup and device memory scopes.");
438440
}
439441
Type i32Type = rewriter.getI32Type();
440442
Value acqRel = rewriter.create<LLVM::ConstantOp>(loc, i32Type, 4);

0 commit comments

Comments
 (0)