diff options
| author | Scott Linder <scott@scottlinder.com> | 2018-10-31 18:54:06 +0000 | 
|---|---|---|
| committer | Scott Linder <scott@scottlinder.com> | 2018-10-31 18:54:06 +0000 | 
| commit | c6c627253db6b273dd995771e7af17c53858eaba (patch) | |
| tree | 0bf7409b44ebdf69c4d2d6b4972514ac0ecef5d9 /llvm/lib/Target/AMDGPU | |
| parent | 7c7cac05ed936fad0cefc888d2f30ceb47291ff5 (diff) | |
| download | bcm5719-llvm-c6c627253db6b273dd995771e7af17c53858eaba.tar.gz bcm5719-llvm-c6c627253db6b273dd995771e7af17c53858eaba.zip  | |
[AMDGPU] Remove FeatureVGPRSpilling
This feature is only relevant to shaders, and is no longer used. When disabled,
lowering of reserved registers for shaders causes a compiler crash.
Remove the feature and add a test for compilation of shaders at OptNone.
Differential Revision: https://reviews.llvm.org/D53829
llvm-svn: 345763
Diffstat (limited to 'llvm/lib/Target/AMDGPU')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPU.td | 6 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h | 3 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIInstrInfo.cpp | 19 | ||||
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp | 15 | 
6 files changed, 8 insertions, 48 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPU.td b/llvm/lib/Target/AMDGPU/AMDGPU.td index 54b6c8a7882..ec351356f79 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPU.td +++ b/llvm/lib/Target/AMDGPU/AMDGPU.td @@ -327,12 +327,6 @@ def FeatureEnableHugePrivateBuffer : SubtargetFeature<    "Enable private/scratch buffer sizes greater than 128 GB"  >; -def FeatureVGPRSpilling : SubtargetFeature<"vgpr-spilling", -  "EnableVGPRSpilling", -  "true", -  "Enable spilling of VGPRs to scratch memory" ->; -  def FeatureDumpCode : SubtargetFeature <"DumpCode",    "DumpCode",    "true", diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp index 7448dd71004..d07c0516c27 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp @@ -1008,7 +1008,6 @@ static unsigned getRsrcReg(CallingConv::ID CallConv) {  void AMDGPUAsmPrinter::EmitProgramInfoSI(const MachineFunction &MF,                                           const SIProgramInfo &CurrentProgramInfo) { -  const GCNSubtarget &STM = MF.getSubtarget<GCNSubtarget>();    const SIMachineFunctionInfo *MFI = MF.getInfo<SIMachineFunctionInfo>();    unsigned RsrcReg = getRsrcReg(MF.getFunction().getCallingConv()); @@ -1029,10 +1028,9 @@ void AMDGPUAsmPrinter::EmitProgramInfoSI(const MachineFunction &MF,      OutStreamer->EmitIntValue(RsrcReg, 4);      OutStreamer->EmitIntValue(S_00B028_VGPRS(CurrentProgramInfo.VGPRBlocks) |                                S_00B028_SGPRS(CurrentProgramInfo.SGPRBlocks), 4); -    if (STM.isVGPRSpillingEnabled(MF.getFunction())) { -      OutStreamer->EmitIntValue(R_0286E8_SPI_TMPRING_SIZE, 4); -      OutStreamer->EmitIntValue(S_0286E8_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4); -    } +    OutStreamer->EmitIntValue(R_0286E8_SPI_TMPRING_SIZE, 4); +    OutStreamer->EmitIntValue( +        S_0286E8_WAVESIZE(CurrentProgramInfo.ScratchBlocks), 4);    }    if (MF.getFunction().getCallingConv() == CallingConv::AMDGPU_PS) { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp index d34834329b5..9a7e6918d41 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp @@ -171,7 +171,6 @@ GCNSubtarget::GCNSubtarget(const Triple &TT, StringRef GPU, StringRef FS,      DebuggerEmitPrologue(false),      EnableHugePrivateBuffer(false), -    EnableVGPRSpilling(false),      EnableLoadStoreOpt(false),      EnableUnsafeDSOffsetFolding(false),      EnableSIScheduler(false), @@ -480,10 +479,6 @@ void GCNSubtarget::overrideSchedPolicy(MachineSchedPolicy &Policy,      Policy.ShouldTrackLaneMasks = true;  } -bool GCNSubtarget::isVGPRSpillingEnabled(const Function& F) const { -  return EnableVGPRSpilling || !AMDGPU::isShader(F.getCallingConv()); -} -  unsigned GCNSubtarget::getOccupancyWithNumSGPRs(unsigned SGPRs) const {    if (getGeneration() >= AMDGPUSubtarget::VOLCANIC_ISLANDS) {      if (SGPRs <= 80) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h index 681ab3a2750..162305ddee2 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h +++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.h @@ -322,7 +322,6 @@ protected:    // Used as options.    bool EnableHugePrivateBuffer; -  bool EnableVGPRSpilling;    bool EnableLoadStoreOpt;    bool EnableUnsafeDSOffsetFolding;    bool EnableSIScheduler; @@ -748,8 +747,6 @@ public:    void overrideSchedPolicy(MachineSchedPolicy &Policy,                             unsigned NumRegionInstrs) const override; -  bool isVGPRSpillingEnabled(const Function &F) const; -    unsigned getMaxNumUserSGPRs() const {      return 16;    } diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp index d0d8576ade3..4dd06df1233 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -908,16 +908,6 @@ void SIInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,      return;    } -  if (!ST.isVGPRSpillingEnabled(MF->getFunction())) { -    LLVMContext &Ctx = MF->getFunction().getContext(); -    Ctx.emitError("SIInstrInfo::storeRegToStackSlot - Do not know how to" -                  " spill register"); -    BuildMI(MBB, MI, DL, get(AMDGPU::KILL)) -      .addReg(SrcReg); - -    return; -  } -    assert(RI.hasVGPRs(RC) && "Only VGPR spilling expected");    unsigned Opcode = getVGPRSpillSaveOpcode(SpillSize); @@ -1010,15 +1000,6 @@ void SIInstrInfo::loadRegFromStackSlot(MachineBasicBlock &MBB,      return;    } -  if (!ST.isVGPRSpillingEnabled(MF->getFunction())) { -    LLVMContext &Ctx = MF->getFunction().getContext(); -    Ctx.emitError("SIInstrInfo::loadRegFromStackSlot - Do not know how to" -                  " restore register"); -    BuildMI(MBB, MI, DL, get(AMDGPU::IMPLICIT_DEF), DestReg); - -    return; -  } -    assert(RI.hasVGPRs(RC) && "Only VGPR spilling expected");    unsigned Opcode = getVGPRSpillRestoreOpcode(SpillSize); diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp index ee1ff85523a..181cc41bd5f 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp @@ -117,7 +117,6 @@ SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)    }    const MachineFrameInfo &FrameInfo = MF.getFrameInfo(); -  bool MaySpill = ST.isVGPRSpillingEnabled(F);    bool HasStackObjects = FrameInfo.hasStackObjects();    if (isEntryFunction()) { @@ -126,21 +125,18 @@ SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)      if (WorkItemIDZ)        WorkItemIDY = true; -    if (HasStackObjects || MaySpill) { -      PrivateSegmentWaveByteOffset = true; +    PrivateSegmentWaveByteOffset = true;      // HS and GS always have the scratch wave offset in SGPR5 on GFX9.      if (ST.getGeneration() >= AMDGPUSubtarget::GFX9 &&          (CC == CallingConv::AMDGPU_HS || CC == CallingConv::AMDGPU_GS)) -      ArgInfo.PrivateSegmentWaveByteOffset -        = ArgDescriptor::createRegister(AMDGPU::SGPR5); -    } +      ArgInfo.PrivateSegmentWaveByteOffset = +          ArgDescriptor::createRegister(AMDGPU::SGPR5);    }    bool isAmdHsaOrMesa = ST.isAmdHsaOrMesa(F);    if (isAmdHsaOrMesa) { -    if (HasStackObjects || MaySpill) -      PrivateSegmentBuffer = true; +    PrivateSegmentBuffer = true;      if (F.hasFnAttribute("amdgpu-dispatch-ptr"))        DispatchPtr = true; @@ -151,8 +147,7 @@ SIMachineFunctionInfo::SIMachineFunctionInfo(const MachineFunction &MF)      if (F.hasFnAttribute("amdgpu-dispatch-id"))        DispatchID = true;    } else if (ST.isMesaGfxShader(F)) { -    if (HasStackObjects || MaySpill) -      ImplicitBufferPtr = true; +    ImplicitBufferPtr = true;    }    if (F.hasFnAttribute("amdgpu-kernarg-segment-ptr"))  | 

