[llvm-commits] [llvm] r140535 - in /llvm/trunk: lib/Target/PTX/PTXAsmPrinter.cpp test/CodeGen/PTX/stack-object.ll

Justin Holewinski justin.holewinski at gmail.com
Mon Sep 26 09:20:34 PDT 2011


Author: jholewinski
Date: Mon Sep 26 11:20:34 2011
New Revision: 140535

URL: http://llvm.org/viewvc/llvm-project?rev=140535&view=rev
Log:
PTX: Fix some lingering issues with stack allocation

Added:
    llvm/trunk/test/CodeGen/PTX/stack-object.ll
Modified:
    llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp?rev=140535&r1=140534&r2=140535&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PTX/PTXAsmPrinter.cpp Mon Sep 26 11:20:34 2011
@@ -297,7 +297,9 @@
   for (unsigned i = 0, e = FrameInfo->getNumObjects(); i != e; ++i) {
     DEBUG(dbgs() << "Size of object: " << FrameInfo->getObjectSize(i) << "\n");
     if (FrameInfo->getObjectSize(i) > 0) {
-      std::string def = "\t.local .b";
+      std::string def = "\t.local .align ";
+      def += utostr(FrameInfo->getObjectAlignment(i));
+      def += " .b";
       def += utostr(FrameInfo->getObjectSize(i)*8); // Convert to bits
       def += " __local";
       def += utostr(i);

Added: llvm/trunk/test/CodeGen/PTX/stack-object.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PTX/stack-object.ll?rev=140535&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/PTX/stack-object.ll (added)
+++ llvm/trunk/test/CodeGen/PTX/stack-object.ll Mon Sep 26 11:20:34 2011
@@ -0,0 +1,10 @@
+; RUN: llc < %s -march=ptx32 -mattr=sm20 | FileCheck %s
+
+define ptx_device float @stack1(float %a) {
+  ; CHECK: .local .b32 __local0;
+  %a.2 = alloca float
+  ; CHECK: st.local.f32 [__local0], %f0
+  store float %a, float* %a.2
+  %a.3 = load float* %a.2
+  ret float %a.3
+}





More information about the llvm-commits mailing list