[PATCH] D11621: AMDGPU/SI: Mark SMRD instructions as rematerializable

Tom Stellard thomas.stellard at amd.com
Wed Jul 29 18:59:20 PDT 2015


tstellarAMD created this revision.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.

This greatly reduces the amount of SGPR spilling.

http://reviews.llvm.org/D11621

Files:
  lib/Target/AMDGPU/SIInstrInfo.cpp
  lib/Target/AMDGPU/SIInstructions.td

Index: lib/Target/AMDGPU/SIInstructions.td
===================================================================
--- lib/Target/AMDGPU/SIInstructions.td
+++ lib/Target/AMDGPU/SIInstructions.td
@@ -57,7 +57,7 @@
 // SMRD Instructions
 //===----------------------------------------------------------------------===//
 
-let mayLoad = 1 in {
+let mayLoad = 1, isReMaterializable = 1 in {
 
 // We are using the SGPR_32 and not the SReg_32 register class for 32-bit
 // SMRD instructions, because the SGPR_32 register class does not include M0
Index: lib/Target/AMDGPU/SIInstrInfo.cpp
===================================================================
--- lib/Target/AMDGPU/SIInstrInfo.cpp
+++ lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -76,6 +76,9 @@
 
 bool SIInstrInfo::isReallyTriviallyReMaterializable(const MachineInstr *MI,
                                                     AliasAnalysis *AA) const {
+  if (isSMRD(MI->getOpcode()))
+    return true;
+
   // TODO: The generic check fails for VALU instructions that should be
   // rematerializable due to implicit reads of exec. We really want all of the
   // generic logic for this except for this.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D11621.30980.patch
Type: text/x-patch
Size: 1151 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150730/8495e010/attachment.bin>


More information about the llvm-commits mailing list