PTX: Fix case where printed alignment could be 0
authorJustin Holewinski <justin.holewinski@gmail.com>
Tue, 27 Sep 2011 19:25:49 +0000 (19:25 +0000)
committerJustin Holewinski <justin.holewinski@gmail.com>
Tue, 27 Sep 2011 19:25:49 +0000 (19:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140624 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PTX/PTXAsmPrinter.cpp

index cd82d568b388bca0c29a35b5afdc0945cc77bbf2..c1a002c2441f29fc6f23bd4e9b8f763a8d1206e8 100644 (file)
@@ -480,7 +480,7 @@ void PTXAsmPrinter::EmitVariableDeclaration(const GlobalVariable *gv) {
   unsigned alignment = gv->getAlignment();
   if (alignment != 0) {
     decl += ".align ";
-    decl += utostr(Log2_32(gv->getAlignment()));
+    decl += utostr(std::max(1U, Log2_32(gv->getAlignment())));
     decl += " ";
   }