This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Turn pow libcalls into powr
ClosedPublic

Authored by arsenm on Aug 25 2023, 4:20 PM.

Details

Reviewers
rampitec
foad
Group Reviewers
Restricted Project
Summary

powr is just pow with the assumption that x >= 0, otherwise nan. This
fires at least 6 times in luxmark

Diff Detail

Event Timeline

arsenm created this revision.Aug 25 2023, 4:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 4:20 PM
arsenm requested review of this revision.Aug 25 2023, 4:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 4:20 PM
Herald added a subscriber: wdng. · View Herald Transcript
rampitec added inline comments.Aug 25 2023, 5:09 PM
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
855

Can you check the value before inserting declaration? Just to avoid unused declarations. Plus the way it is now you may return false when you have actually modified the module.

arsenm updated this revision to Diff 553941.Aug 28 2023, 8:03 AM

Fix not hitting the other edge case folds

llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
855

Nothing else in the pass bothers trying to avoid declarations, globaldce is going to run after anyway. Plus it's quite possibly more expensive to do the recursive value check than to just insert and delete the unused declaration later

rampitec accepted this revision.Aug 28 2023, 10:31 AM
This revision is now accepted and ready to land.Aug 28 2023, 10:31 AM