[NVPTX] Emit .pragma "nounroll" for loops marked with nounroll
authorJingyue Wu <jingyue@google.com>
Sun, 1 Feb 2015 02:27:45 +0000 (02:27 +0000)
committerJingyue Wu <jingyue@google.com>
Sun, 1 Feb 2015 02:27:45 +0000 (02:27 +0000)
commitf15b696b79e4be288e46aa513e3b91481b0bef2f
tree7d33427e646b0fc51070049f297d5817bc4ec70d
parent58e57f1604ec72d2b73a66e3b6d93327f4c73f85
[NVPTX] Emit .pragma "nounroll" for loops marked with nounroll

Summary:
CUDA driver can unroll loops when jit-compiling PTX. To prevent CUDA
driver from unrolling a loop marked with llvm.loop.unroll.disable is not
unrolled by CUDA driver, we need to emit .pragma "nounroll" at the
header of that loop.

This patch also extracts getting unroll metadata from loop ID metadata
into a shared helper function.

Test Plan: test/CodeGen/NVPTX/nounroll.ll

Reviewers: eliben, meheff, jholewinski

Reviewed By: jholewinski

Subscribers: jholewinski, llvm-commits

Differential Revision: http://reviews.llvm.org/D7041

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227703 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/CodeGen/AsmPrinter.h
include/llvm/Transforms/Utils/UnrollLoop.h
lib/Target/NVPTX/NVPTXAsmPrinter.cpp
lib/Target/NVPTX/NVPTXAsmPrinter.h
lib/Transforms/Scalar/LoopUnrollPass.cpp
lib/Transforms/Utils/LoopUnroll.cpp
test/CodeGen/NVPTX/nounroll.ll [new file with mode: 0644]