This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Teach isKnownNeverInfinity about llvm.log*
AbandonedPublic

Authored by arsenm on Dec 5 2022, 5:37 AM.

Diff Detail

Event Timeline

arsenm created this revision.Dec 5 2022, 5:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 5:37 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
arsenm requested review of this revision.Dec 5 2022, 5:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 5 2022, 5:37 AM
Herald added a subscriber: wdng. · View Herald Transcript
spatel added inline comments.Dec 9 2022, 6:13 AM
llvm/lib/Analysis/ValueTracking.cpp
3844

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
}
arsenm planned changes to this revision.Dec 20 2022, 10:16 AM
arsenm added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
3844

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

arsenm abandoned this revision.Apr 25 2023, 4:02 AM

Obsoleted between D148549 and D147942