NVVMIntrRange adds !range metadata to calls of NVVM intrinsics
that return values within known limited range.
This allows LLVM to generate better code for indexing arrays
based on tid/ctaid which is a frequently used pattern in CUDA code.
Paths
| Differential D20644
[NVPTX] Added NVVMIntrRange pass ClosedPublic Authored by tra on May 25 2016, 2:10 PM.
Details Summary NVVMIntrRange adds !range metadata to calls of NVVM intrinsics This allows LLVM to generate better code for indexing arrays
Diff Detail Event Timelinetra updated this object. Comment Actions \o/
Comment Actions Have you considered letting Clang (instead of a late-stage IR pass) add these ranges? These ranges are useful for some target-independent IR passes, e.g. those using ValueTracking (D4150).
Comment Actions
This pass runs at the very beginning of optimization pipeline. Justin created hook for early target-specific passes in D18616.
tra edited edge metadata. tra marked 2 inline comments as done. Comment ActionsAddressed Justin's comments. This revision is now accepted and ready to land.May 25 2016, 3:31 PM Comment Actions
I'm happy if you want to do it in a separate patch, but we should definitely add testing of important intrinsics like these, one way or another. LGTM aside from the apparent integer overflow.
tra edited edge metadata. Comment ActionsUse uint64_t to pass range limits so we don't risk overflow on the way to ConstantInt::get(). tra added inline comments.
Closed by commit rL270872: [NVPTX] Added NVVMIntrRange pass (authored by tra). · Explain WhyMay 26 2016, 10:09 AM This revision was automatically updated to reflect the committed changes. tra marked an inline comment as done.
Revision Contents
Diff 58511 lib/Target/NVPTX/CMakeLists.txt
lib/Target/NVPTX/NVPTX.h
lib/Target/NVPTX/NVPTXTargetMachine.cpp
lib/Target/NVPTX/NVVMIntrRange.cpp
test/CodeGen/NVPTX/intrinsic-old.ll
|
I have no idea if this is the right way to pass this information to the pass. Seems reasonable to me, though.