This is an archive of the discontinued LLVM Phabricator instance.

[TLI][AMDGPU] AMDPAL does not have tan function
ClosedPublic

Authored by tpr on Sep 10 2019, 9:12 AM.

Details

Summary

The LLPC frontend for AMDPAL OS type does not have a tan library
function, so disable instcombine generating it. We are only just coming
across this issue in LLPC as we start setting fast math flags.

Change-Id: I02f907d3e64832117ea9800e9f9285282856e5df

Diff Detail

Repository
rL LLVM

Event Timeline

tpr created this revision.Sep 10 2019, 9:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 10 2019, 9:12 AM
arsenm added a subscriber: arsenm.Sep 10 2019, 9:22 AM
arsenm added inline comments.
lib/Analysis/TargetLibraryInfo.cpp
117–118 ↗(On Diff #219558)

This isn't a frontend specific property. Nothing has a library in the sense this means

tpr marked an inline comment as done.Sep 10 2019, 9:33 AM
tpr added inline comments.
lib/Analysis/TargetLibraryInfo.cpp
117–118 ↗(On Diff #219558)

Well, in other respects, we're treating "PAL" as an OS, even though it clearly isn't. And it's a property of a real OS what functions the library has, right?

What alternative suggestion do you have to fix it up so that other amdgcn users can do this sin/cos->tan optimization but PAL can't? Should our frontend manually adjust the TLI?

Or should we disable it for all amdgcn users, given that there isn't actually a tan instruction?

arsenm added inline comments.Sep 10 2019, 9:37 AM
lib/Analysis/TargetLibraryInfo.cpp
117–118 ↗(On Diff #219558)

We should just really loop through and setUnavailable on all TLI functions for amdgcn

tpr updated this revision to Diff 219581.Sep 10 2019, 12:05 PM

V2: Disable all library functions, not just tan.

tpr marked 2 inline comments as done.Sep 10 2019, 12:06 PM
arsenm accepted this revision.Sep 10 2019, 12:13 PM

LGTM

This revision is now accepted and ready to land.Sep 10 2019, 12:13 PM
This revision was automatically updated to reflect the committed changes.