This is an archive of the discontinued LLVM Phabricator instance.

[NVPTX] Use ldg for explicitly invariant loads.
ClosedPublic

Authored by jlebar on Aug 12 2016, 4:52 PM.

Details

Summary

With this change (plus some changes to prevent !invariant from being
clobbered within llvm), clang will be able to model the __ldg CUDA
builtin as an invariant load, rather than as a target-specific llvm
intrinsic. This will let the optimizer play with these loads --
specifically, we should be able to vectorize them in the load-store
vectorizer.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 67941.Aug 12 2016, 4:52 PM
jlebar retitled this revision from to [NVPTX] Use ldg for explicitly invariant loads..
jlebar updated this object.
jlebar added a reviewer: tra.
tra accepted this revision.Aug 12 2016, 5:16 PM
tra edited edge metadata.

You may want to add a change for to make sure explicit invariant loads work within kernels, too.

llvm/test/CodeGen/NVPTX/ldg-invariant.ll
21–22 ↗(On Diff #67941)

You may want to add a test case for invariant load from non-global space.

This revision is now accepted and ready to land.Aug 12 2016, 5:16 PM
This revision was automatically updated to reflect the committed changes.