[llvm] 47a9cd0 - [AMDGPU] Remove constexpr from getNumUserSGPRForField/getMaxNumPreloadedSGPRs to appease older gcc builds

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 13 04:20:23 PDT 2023


Author: Simon Pilgrim
Date: 2023-09-13T12:19:28+01:00
New Revision: 47a9cd03435342f179a0df9daa1b918d33b03354

URL: https://github.com/llvm/llvm-project/commit/47a9cd03435342f179a0df9daa1b918d33b03354
DIFF: https://github.com/llvm/llvm-project/commit/47a9cd03435342f179a0df9daa1b918d33b03354.diff

LOG: [AMDGPU] Remove constexpr from getNumUserSGPRForField/getMaxNumPreloadedSGPRs to appease older gcc builds

Older versions of gcc wouldn't accept the constexpr getNumUserSGPRForField (introduced in D159439 / 343be5132e2831d85) as it couldn't treat the llvm_unreachable call as constexpr

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
    llvm/lib/Target/AMDGPU/GCNSubtarget.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
index c62ee841902c4d6..cc179c85c818426 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSubtarget.cpp
@@ -771,7 +771,7 @@ unsigned GCNSubtarget::getMaxNumSGPRs(const MachineFunction &MF) const {
                             getReservedNumSGPRs(MF));
 }
 
-static constexpr unsigned getMaxNumPreloadedSGPRs() {
+static unsigned getMaxNumPreloadedSGPRs() {
   using USI = GCNUserSGPRUsageInfo;
   // Max number of user SGPRs
   const unsigned MaxUserSGPRs =

diff  --git a/llvm/lib/Target/AMDGPU/GCNSubtarget.h b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
index 0a4c4d62c6a875f..b595682c488d89d 100644
--- a/llvm/lib/Target/AMDGPU/GCNSubtarget.h
+++ b/llvm/lib/Target/AMDGPU/GCNSubtarget.h
@@ -1409,7 +1409,7 @@ class GCNUserSGPRUsageInfo {
   };
 
   // Returns the size in number of SGPRs for preload user SGPR field.
-  static constexpr unsigned getNumUserSGPRForField(UserSGPRID ID) {
+  static unsigned getNumUserSGPRForField(UserSGPRID ID) {
     switch (ID) {
     case ImplicitBufferPtrID:
       return 2;


        


More information about the llvm-commits mailing list