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

Build Status
Buildable 258155

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
4313

Should this be intersectWith?

4385

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
4313

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

4385

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
229

(style) assertion messages

259

(style) assertion message

llvm/lib/Analysis/ValueTracking.cpp
4270

auto *

4293

auto*

4326

auto *

4366

auto *

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