[llvm] [AMDGPU] Update PromoteAlloca to handle GEPs with variable offset. (PR #122342)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 30 20:54:23 PST 2025


================
@@ -459,6 +422,36 @@ static Value *GEPToVectorIndex(GetElementPtrInst *GEP, AllocaInst *Alloca,
   return ConstantInt::get(GEP->getContext(), Quot);
 }
 
+// Function to check if a Value is an operand of a GetElementPtrInst.
+static bool isValueInGEP(GetElementPtrInst *GEP, Value *ValueToCheck) {
----------------
arsenm wrote:

This still feels like too specific of a check, and the same form of pattern could arise from other instructions. It would be better to detect it as part of the transformation 

https://github.com/llvm/llvm-project/pull/122342


More information about the llvm-commits mailing list