This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Remove hardcoded address space value from AMDGPULibFunc
ClosedPublic

Authored by yaxunl on Nov 3 2017, 1:22 PM.

Details

Summary

AMDGPULibFunc hardcodes address space values of the old address space mapping,
which causes invalid addrspacecast instructions and undefined functions in
APPSDK sample MonteCarloAsianDP.

This patch fixes that.

Diff Detail

Repository
rL LLVM

Event Timeline

yaxunl created this revision.Nov 3 2017, 1:22 PM
rampitec added inline comments.Nov 3 2017, 2:10 PM
lib/Target/AMDGPU/AMDGPULibFunc.cpp
463 ↗(On Diff #121534)

Why not to mask argument inside getAddrSpaceFromEPtrKind?

598 ↗(On Diff #121534)

It changes meaning of the function signature. This shall be fine as long as library matches the expectations. Does it match?

yaxunl added inline comments.Nov 3 2017, 7:47 PM
lib/Target/AMDGPU/AMDGPULibFunc.cpp
598 ↗(On Diff #121534)

If there is no U3AS, the address space value is 0. This is true for both the old and the new address space mapping. The library uses the same address space mapping as the runtime, so it is always consistent.

yaxunl updated this revision to Diff 121581.Nov 3 2017, 8:26 PM

Revised by Stas' comments.

rampitec accepted this revision.Nov 3 2017, 9:02 PM

LGTM

This revision is now accepted and ready to land.Nov 3 2017, 9:02 PM
This revision was automatically updated to reflect the committed changes.