This is an archive of the discontinued LLVM Phabricator instance.

ValueTracking: Add computeKnownExponentRange
AcceptedPublic

Authored by arsenm on Aug 7 2023, 6:22 AM.

Details

Summary

Perform basic floating-point range analysis for the exponent.

I was looking into handling multiply by a constant to perform denorm
scaling to match the current ldexp handling in computeKnownFPClass,
and went a bit overboard on generalizing the helper function for it.

I also find these fltSemantics getters incredibly annoying and think
the struct definition should just be public (along with all the
definitions for it).

Diff Detail

Event Timeline

arsenm created this revision.Aug 7 2023, 6:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2023, 6:22 AM
arsenm requested review of this revision.Aug 7 2023, 6:22 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 7 2023, 6:22 AM
Herald added subscribers: wangpc, wdng. · View Herald Transcript
goldstein.w.n added inline comments.
llvm/lib/Analysis/ValueTracking.cpp
4271

Should this be intersectWith?

4343

On the note of TODOs, would also add one for bitcast as something like logicOp + bitcast isn't that uncommon.

arsenm added inline comments.Wed, Dec 6, 8:14 PM
llvm/lib/Analysis/ValueTracking.cpp
4271

It can be either operand, so it's a union? The possible set needs to expand

4343

Casts that produces an FP value seems pretty uncommon?

RKSimon accepted this revision.Thu, Dec 7, 2:23 AM

LGTM with some style cleanup minors

llvm/include/llvm/Analysis/ValueTracking.h
253

(style) assertion messages

283

(style) assertion message

llvm/lib/Analysis/ValueTracking.cpp
4228

auto *

4251

auto*

4284

auto *

4324

auto *

This revision is now accepted and ready to land.Thu, Dec 7, 2:23 AM