[mlir] Use value_or (NFC)

This commit is contained in:
Kazu Hirata 2022-07-25 23:00:56 -07:00
parent 620ca754e3
commit 2789c4f51c
2 changed files with 2 additions and 3 deletions

View File

@ -205,8 +205,7 @@ struct AllocaOpLowering : public AllocLikeOpLLVMLowering {
auto elementPtrType = this->getElementPtrType(allocaOp.getType());
auto allocatedElementPtr = rewriter.create<LLVM::AllocaOp>(
loc, elementPtrType, sizeBytes,
allocaOp.getAlignment() ? *allocaOp.getAlignment() : 0);
loc, elementPtrType, sizeBytes, allocaOp.getAlignment().value_or(0));
return std::make_tuple(allocatedElementPtr, allocatedElementPtr);
}

View File

@ -426,7 +426,7 @@ struct NVGPUAsyncWaitLowering
matchAndRewrite(nvgpu::DeviceAsyncWaitOp op, OpAdaptor adaptor,
ConversionPatternRewriter &rewriter) const override {
// If numGroup is not present pick 0 as a conservative correct value.
int32_t numGroups = adaptor.getNumGroups() ? *adaptor.getNumGroups() : 0;
int32_t numGroups = adaptor.getNumGroups().value_or(0);
rewriter.create<NVVM::CpAsyncWaitGroupOp>(op.getLoc(), numGroups);
rewriter.eraseOp(op);
return success();