gemini-code-assist[bot] commented on code in PR #19567:
URL: https://github.com/apache/tvm/pull/19567#discussion_r3246517623
##########
src/target/llvm/intrin_rule_llvm.cc:
##########
@@ -200,7 +187,7 @@ TVM_REGISTER_OP("tirx.asin")
PrimExpr out_range = tirx::Or(x<lower, x> upper);
PrimExpr nan_const = make_const(x.dtype(),
std::numeric_limits<double>::quiet_NaN());
- return tirx::Select(out_range, nan_const, tirx::Select(use_lib,
lib_result, series));
+ return tirx::Select(out_range, nan_const, lib_result);
Review Comment:

The manual NaN guard `tirx::Select(out_range, nan_const, ...)` is redundant
when using `libm` externs like `asinf` or `acosf`, as these functions are
defined to return NaN for out-of-range inputs per IEEE 754 and standard C
library behavior. Removing the manual check would simplify the generated TIR
and LLVM IR without changing the resulting behavior.
```c
return lib_result;
```
##########
src/target/llvm/intrin_rule_llvm.cc:
##########
@@ -227,7 +206,7 @@ TVM_REGISTER_OP("tirx.acos")
PrimExpr out_range = tirx::Or(x<lower, x> upper);
PrimExpr nan_const = make_const(x.dtype(),
std::numeric_limits<double>::quiet_NaN());
- return tirx::Select(out_range, nan_const, tirx::Select(use_lib,
lib_result, formula_result));
+ return tirx::Select(out_range, nan_const, lib_result);
Review Comment:

Similar to `asin`, the manual NaN guard for `acos` is redundant because the
underlying `libm` call (`acosf`) already handles out-of-range values by
returning NaN. Simplifying this to return `lib_result` directly reduces
complexity in the legalized expression.
```c
return lib_result;
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]