[llvm] 351a4b2 - [AMDGPU] Simplify alias stripping to use utility function

Joseph Huber via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 08:12:00 PDT 2024


Author: Joseph Huber
Date: 2024-07-17T10:11:53-05:00
New Revision: 351a4b27da7dfe2ec6ae3400bd681eae1fb5180f

URL: https://github.com/llvm/llvm-project/commit/351a4b27da7dfe2ec6ae3400bd681eae1fb5180f
DIFF: https://github.com/llvm/llvm-project/commit/351a4b27da7dfe2ec6ae3400bd681eae1fb5180f.diff

LOG: [AMDGPU] Simplify alias stripping to use utility function

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
index 3bf72d1a5d40a..146649a7e2d54 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -65,10 +65,7 @@ static const Function *getCalleeFunction(const MachineOperand &Op) {
     assert(Op.getImm() == 0);
     return nullptr;
   }
-  const GlobalValue *GV = Op.getGlobal();
-  while (auto *GA = dyn_cast<GlobalAlias>(GV))
-    GV = cast<GlobalValue>(GA->getOperand(0));
-  return cast<Function>(GV);
+  return cast<Function>(Op.getGlobal()->stripPointerCastsAndAliases());
 }
 
 static bool hasAnyNonFlatUseOfReg(const MachineRegisterInfo &MRI,


        


More information about the llvm-commits mailing list