[Mlir-commits] [mlir] [mlir][intrange] Use `nsw`, `nuw` flags in inference (PR #92642)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sun May 19 02:36:08 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 7b4dfec8936f54145297fd2f14bf95a2b8c95f5f 5f2b4ea0b1f16182453b6035a7c332a78f7671bf -- mlir/include/mlir/Interfaces/Utils/InferIntRangeCommon.h mlir/lib/Dialect/Arith/IR/InferIntRangeInterfaceImpls.cpp mlir/lib/Dialect/Index/IR/InferIntRangeInterfaceImpls.cpp mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp mlir/test/lib/Dialect/Test/TestOpDefs.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp b/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp
index 4e42d8e5d7..ddf30b8b93 100644
--- a/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp
+++ b/mlir/lib/Interfaces/Utils/InferIntRangeCommon.cpp
@@ -184,20 +184,17 @@ mlir::intrange::inferAdd(ArrayRef<ConstantIntRanges> argRanges,
bool saturateUnsigned = any(ovfFlags & OverflowFlags::Nuw);
bool saturateSigned = any(ovfFlags & OverflowFlags::Nsw);
- ConstArithFn uadd = [saturateUnsigned](const APInt &a,
- const APInt &b) -> std::optional<APInt> {
+ ConstArithFn uadd =
+ [saturateUnsigned](const APInt &a,
+ const APInt &b) -> std::optional<APInt> {
bool overflowed = false;
- APInt result = saturateUnsigned
- ? a.uadd_sat(b)
- : a.uadd_ov(b, overflowed);
+ APInt result = saturateUnsigned ? a.uadd_sat(b) : a.uadd_ov(b, overflowed);
return overflowed ? std::optional<APInt>() : result;
};
ConstArithFn sadd = [saturateSigned](const APInt &a,
- const APInt &b) -> std::optional<APInt> {
+ const APInt &b) -> std::optional<APInt> {
bool overflowed = false;
- APInt result = saturateSigned
- ? a.sadd_sat(b)
- : a.sadd_ov(b, overflowed);
+ APInt result = saturateSigned ? a.sadd_sat(b) : a.sadd_ov(b, overflowed);
return overflowed ? std::optional<APInt>() : result;
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/92642
More information about the Mlir-commits
mailing list