[PATCH] D18358: AMDGPU: Account for globals in AMDGPUPromoteAlloca pass

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 10:44:58 PDT 2016


arsenm added inline comments.

================
Comment at: lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:128-129
@@ -127,4 +127,4 @@
 
     for (Use &U : GV.uses()) {
-      Instruction *Use = dyn_cast<Instruction>(U);
+      Instruction *Use = dyn_cast<Instruction>(U.getUser());
       if (!Use)
----------------
You probably want to use GV.users() instead

================
Comment at: lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp:133
@@ -132,3 +132,3 @@
 
-      if (Use->getParent()->getParent() == &F)
+      if (Use->getParent()->getParent() == &F){
         LocalMemAvailable -=
----------------
Missing space before {

================
Comment at: test/CodeGen/AMDGPU/promote-alloca-globals.ll:1
@@ +1,2 @@
+; RUN: opt -S -mtriple=amdgcn-unknown-unknown -amdgpu-promote-alloca < %s | FileCheck %s
+
----------------
You should also include an llc run line and check for the final LDS usage

================
Comment at: test/CodeGen/AMDGPU/promote-alloca-globals.ll:3
@@ +2,3 @@
+
+; CHECK: alloca [5 x i32]
+
----------------
This should be after a CHECK-LABEL for the function name and moved down to the function

================
Comment at: test/CodeGen/AMDGPU/promote-alloca-globals.ll:9-11
@@ +8,5 @@
+entry:
+  %stack = alloca [5 x i32], align 4
+  %0 = load i32, i32 addrspace(1)* %in, align 4
+  %arrayidx1 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 %0
+  store i32 4, i32* %arrayidx1, align 4
----------------
Can you run opt -instnamer on the test

================
Comment at: test/CodeGen/AMDGPU/promote-alloca-globals.ll:24
@@ +23,3 @@
+  store i32 %3, i32 addrspace(1)* %arrayidx13
+  %v = getelementptr inbounds [1500 x [5 x i32]], [1500 x [5 x i32]] addrspace(3)* @promote_alloca_size_1500.stack, i32 0, i32 0
+  ret void
----------------
This GEP isn't used? 


http://reviews.llvm.org/D18358





More information about the llvm-commits mailing list