[PATCH] D139319: ValueTracking: Teach isKnownNeverInfinity about llvm.log*
    Sanjay Patel via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Dec  9 06:13:28 PST 2022
    
    
  
spatel 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);
----------------
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
}
```
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139319/new/
https://reviews.llvm.org/D139319
    
    
More information about the llvm-commits
mailing list