[PATCH] D139319: ValueTracking: Teach isKnownNeverInfinity about llvm.log*
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 10:16:13 PST 2022
arsenm planned changes to this revision.
arsenm added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:3844
+ return isKnownNeverInfinity(Inst->getOperand(0), TLI, Depth + 1) &&
+ cannotBeOrderedLessThanZeroImpl(Inst->getOperand(0), TLI,
+ /*SignBitOnly=*/false, Depth + 1);
----------------
spatel wrote:
> Don't we need to check that the input is non-zero to guard against log(0) --> -inf?
>
> This should not fold?
>
>
> ```
> define i1 @isKnownNeverNegInfinity_log(double %x) {
> %a = call ninf double @llvm.sqrt.f64(double %x) ; could be 0.0
> %e = call double @llvm.log.f64(double %a) ; log(0.0) --> -inf
> %r = fcmp une double %e, 0xfff0000000000000
> ret i1 %r
> }
>
> ```
>
Yes, I was thinking cannotBeOrderedLessThanZeroImpl would catch it but we're missing the known-never-0 API. I want to merge all of these into one knownFPClass API which would help catch this
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D139319/new/
https://reviews.llvm.org/D139319
More information about the llvm-commits
mailing list