diff --git a/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp b/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp --- a/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXRegisterInfo.cpp @@ -107,6 +107,14 @@ BitVector NVPTXRegisterInfo::getReservedRegs(const MachineFunction &MF) const { BitVector Reserved(getNumRegs()); + for (unsigned Reg = NVPTX::ENVREG0; Reg <= NVPTX::ENVREG31; ++Reg) { + markSuperRegs(Reserved, Reg); + } + markSuperRegs(Reserved, NVPTX::VRFrame32); + markSuperRegs(Reserved, NVPTX::VRFrameLocal32); + markSuperRegs(Reserved, NVPTX::VRFrame64); + markSuperRegs(Reserved, NVPTX::VRFrameLocal64); + markSuperRegs(Reserved, NVPTX::VRDepot); return Reserved; } diff --git a/llvm/test/CodeGen/NVPTX/envreg.ll b/llvm/test/CodeGen/NVPTX/envreg.ll --- a/llvm/test/CodeGen/NVPTX/envreg.ll +++ b/llvm/test/CodeGen/NVPTX/envreg.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -march=nvptx -mcpu=sm_20 | FileCheck %s +; RUN: llc < %s -march=nvptx -mcpu=sm_20 -verify-machineinstrs | FileCheck %s declare i32 @llvm.nvvm.read.ptx.sreg.envreg0()