Skip to content

Commit 44349a7

Browse files
committed
Refactor clamp function names
1 parent 18c4a2e commit 44349a7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mlir/lib/Dialect/Tosa/Transforms/TosaFoldConstantClamp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,16 @@ struct TosaFoldConstantClamp : public OpRewritePattern<ClampOp> {
5454
auto resultingIntType = cast<IntegerType>(resultType.getElementType());
5555

5656
// Lambda to perform the clamp
57-
auto clampUpper = [&extLowerBound, &extUpperBound,
58-
&comparisonWidth](const APInt &val, IntegerType type) {
57+
auto clampFun = [&extLowerBound, &extUpperBound,
58+
&comparisonWidth](const APInt &val, IntegerType type) {
5959
auto clampedUpper =
6060
llvm::APIntOps::smin(val.sext(comparisonWidth), extUpperBound);
6161
auto fullyClamped = llvm::APIntOps::smax(clampedUpper, extLowerBound);
6262
assert(type.getWidth() >= fullyClamped.getSignificantBits());
6363
return fullyClamped.trunc(type.getWidth());
6464
};
6565
auto newTensor = applyElementWise<APInt, APInt, IntegerType>(
66-
inputValues, clampUpper, resultingIntType);
66+
inputValues, clampFun, resultingIntType);
6767

6868
return newTensor;
6969
}
@@ -85,8 +85,8 @@ struct TosaFoldConstantClamp : public OpRewritePattern<ClampOp> {
8585

8686
// Ensure that the value is larger than the lower bound and smaller than the
8787
// upper bound
88-
auto clampLower = [&lowerBound, &upperBound,
89-
&comparisonSem](APFloat val, FloatType type) {
88+
auto clampFun = [&lowerBound, &upperBound, &comparisonSem](APFloat val,
89+
FloatType type) {
9090
if (val.isNaN()) {
9191
return APFloat::getNaN(type.getFloatSemantics());
9292
}
@@ -97,7 +97,7 @@ struct TosaFoldConstantClamp : public OpRewritePattern<ClampOp> {
9797
return fullyClamped;
9898
};
9999
auto newTensor = applyElementWise<APFloat, APFloat, FloatType>(
100-
inputValues, clampLower, resultingFloatType);
100+
inputValues, clampFun, resultingFloatType);
101101

102102
return newTensor;
103103
}

0 commit comments

Comments
 (0)