[Mlir-commits] [mlir] 2789c4f - [mlir] Use value_or (NFC)
Kazu Hirata
llvmlistbot at llvm.org
Mon Jul 25 23:01:11 PDT 2022
Author: Kazu Hirata
Date: 2022-07-25T23:00:56-07:00
New Revision: 2789c4f51c5b4693509a3c3220a0abb7ff242922
URL: https://github.com/llvm/llvm-project/commit/2789c4f51c5b4693509a3c3220a0abb7ff242922
DIFF: https://github.com/llvm/llvm-project/commit/2789c4f51c5b4693509a3c3220a0abb7ff242922.diff
LOG: [mlir] Use value_or (NFC)
Added:
Modified:
mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
index 8ae0c3cdee71b..884931770fdee 100644
--- a/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
+++ b/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp
@@ -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);
}
diff --git a/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp b/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
index f980e52c3965b..682a0d403c550 100644
--- a/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
+++ b/mlir/lib/Conversion/NVGPUToNVVM/NVGPUToNVVM.cpp
@@ -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();
More information about the Mlir-commits
mailing list