This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Preserve FMF for powi simplifications.
ClosedPublic

Authored by vdmitrie on Jan 26 2021, 9:52 AM.

Diff Detail

Event Timeline

vdmitrie created this revision.Jan 26 2021, 9:52 AM
vdmitrie requested review of this revision.Jan 26 2021, 9:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 26 2021, 9:52 AM
vdmitrie updated this revision to Diff 319358.Jan 26 2021, 11:11 AM
spatel accepted this revision.Jan 26 2021, 11:21 AM

LGTM

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
887

It would be another patch, but if you're looking at powi code, it would be nice to update this with something like:

match(II->getArgOperand, m_APInt(ExponentC))

That would allow us to also match vector powi calls in addition to the current scalar calls.

This revision is now accepted and ready to land.Jan 26 2021, 11:21 AM
vdmitrie added inline comments.Jan 26 2021, 1:06 PM
llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
887

Thank you Sanjay for review. Regarding your suggestion, according to LangRef the exponent argument is always scalar for powi. So that would probably be just a cosmetic change as existing code handles vector types for "base" argument.

This revision was landed with ongoing or failed builds.Jan 26 2021, 1:53 PM
This revision was automatically updated to reflect the committed changes.