Skip to content

Commit 70ed93e

Browse files
committed
Apply clang-tidy fixes for readability-identifier-naming in PolynomialApproximation.cpp (NFC)
1 parent bb6119e commit 70ed93e

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

mlir/lib/Dialect/Math/Transforms/PolynomialApproximation.cpp

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,8 @@ AtanApproximation::matchAndRewrite(math::AtanOp op,
325325
p = builder.create<arith::MulFOp>(x, p);
326326

327327
// Remap the solution for over [0.0, 1.0] to [0.0, inf]
328-
auto half_pi = broadcast(builder, f32Cst(builder, 1.57079632679f), shape);
329-
Value sub = builder.create<arith::SubFOp>(half_pi, p);
328+
auto halfPi = broadcast(builder, f32Cst(builder, 1.57079632679f), shape);
329+
Value sub = builder.create<arith::SubFOp>(halfPi, p);
330330
Value select = builder.create<SelectOp>(compare, p, sub);
331331

332332
// Correct for signing of the input.
@@ -366,40 +366,38 @@ Atan2Approximation::matchAndRewrite(math::Atan2Op op,
366366
// Determine what the atan would be for a 180 degree rotation.
367367
auto zero = broadcast(builder, f32Cst(builder, 0.0f), shape);
368368
auto pi = broadcast(builder, f32Cst(builder, 3.14159265359f), shape);
369-
auto add_pi = builder.create<arith::AddFOp>(atan, pi);
370-
auto sub_pi = builder.create<arith::SubFOp>(atan, pi);
371-
auto atan_gt =
369+
auto addPi = builder.create<arith::AddFOp>(atan, pi);
370+
auto subPi = builder.create<arith::SubFOp>(atan, pi);
371+
auto atanGt =
372372
builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, atan, zero);
373-
auto flipped_atan = builder.create<SelectOp>(atan_gt, sub_pi, add_pi);
373+
auto flippedAtan = builder.create<SelectOp>(atanGt, subPi, addPi);
374374

375375
// Determine whether to directly use atan or use the 180 degree flip
376-
auto x_gt = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, x, zero);
377-
Value result = builder.create<SelectOp>(x_gt, atan, flipped_atan);
376+
auto xGt = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, x, zero);
377+
Value result = builder.create<SelectOp>(xGt, atan, flippedAtan);
378378

379379
// Handle x = 0, y > 0
380-
Value x_zero =
380+
Value xZero =
381381
builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ, x, zero);
382-
Value y_gt =
383-
builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, y, zero);
384-
Value is_half_pi = builder.create<arith::AndIOp>(x_zero, y_gt);
385-
auto half_pi = broadcast(builder, f32Cst(builder, 1.57079632679f), shape);
386-
result = builder.create<SelectOp>(is_half_pi, half_pi, result);
382+
Value yGt = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OGT, y, zero);
383+
Value isHalfPi = builder.create<arith::AndIOp>(xZero, yGt);
384+
auto halfPi = broadcast(builder, f32Cst(builder, 1.57079632679f), shape);
385+
result = builder.create<SelectOp>(isHalfPi, halfPi, result);
387386

388387
// Handle x = 0, y < 0
389-
Value y_lt =
390-
builder.create<arith::CmpFOp>(arith::CmpFPredicate::OLT, y, zero);
391-
Value is_negative_half_pi_pi = builder.create<arith::AndIOp>(x_zero, y_lt);
392-
auto negative_half_pi_pi =
388+
Value yLt = builder.create<arith::CmpFOp>(arith::CmpFPredicate::OLT, y, zero);
389+
Value isNegativeHalfPiPi = builder.create<arith::AndIOp>(xZero, yLt);
390+
auto negativeHalfPiPi =
393391
broadcast(builder, f32Cst(builder, -1.57079632679), shape);
394-
result = builder.create<SelectOp>(is_negative_half_pi_pi, negative_half_pi_pi,
395-
result);
392+
result =
393+
builder.create<SelectOp>(isNegativeHalfPiPi, negativeHalfPiPi, result);
396394

397395
// Handle x = 0, y = 0;
398-
Value y_zero =
396+
Value yZero =
399397
builder.create<arith::CmpFOp>(arith::CmpFPredicate::OEQ, y, zero);
400-
Value is_nan = builder.create<arith::AndIOp>(x_zero, y_zero);
401-
Value cst_nan = broadcast(builder, f32FromBits(builder, 0x7fc00000), shape);
402-
result = builder.create<SelectOp>(is_nan, cst_nan, result);
398+
Value isNan = builder.create<arith::AndIOp>(xZero, yZero);
399+
Value cstNan = broadcast(builder, f32FromBits(builder, 0x7fc00000), shape);
400+
result = builder.create<SelectOp>(isNan, cstNan, result);
403401

404402
rewriter.replaceOp(op, result);
405403
return success();

0 commit comments

Comments
 (0)