This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Handle fptrunc_round in computeKnownFPClass
ClosedPublic

Authored by arsenm on Apr 17 2023, 10:30 AM.

Diff Detail

Event Timeline

arsenm created this revision.Apr 17 2023, 10:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 17 2023, 10:30 AM
arsenm requested review of this revision.Apr 17 2023, 10:30 AM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
Herald added a subscriber: wdng. · View Herald Transcript
foad accepted this revision.Apr 18 2023, 2:13 AM
foad added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
4078

I think there might be subtle bugs lurking in the way you pass InterestedClasses into recursive calls. E.g if InterestedClasses was fcQNan here, and the recursive call returned fcNone, you would conclude the operand is not nan - but in reality it could still be snan.

If I'm right that that's a bug then you could fix this case by passing fcNan into the recursive call.

Anyway this is pre-existing.

This revision is now accepted and ready to land.Apr 18 2023, 2:13 AM
arsenm added inline comments.Apr 18 2023, 4:53 AM
llvm/lib/Analysis/ValueTracking.cpp
4078

InterestedClasses shouldn't be an issue, it's only used for early exiting as it's a compile time hint. The nan propagation could be better, I started introducing a helper for this in D148599

foad added inline comments.Apr 18 2023, 5:25 AM
llvm/lib/Analysis/ValueTracking.cpp
4078

OK, if we always return conservatively correct info the for the un-interested-classes then I guess there's no bug.