]> granicus.if.org Git - clang/commitdiff
Last part of PR3254: use the same alignment computation in Sema and
authorEli Friedman <eli.friedman@gmail.com>
Sun, 22 Feb 2009 03:23:43 +0000 (03:23 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Sun, 22 Feb 2009 03:23:43 +0000 (03:23 +0000)
CodeGen.  I'm not sure whether this actually makes any visible
difference, but it's better to be consistent anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65259 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDecl.cpp

index ea69a66b055ded4cb59a78ceeab505f1b67239d3..0ca2ad351c9a9bc94fa36633bf98855dcec125c9 100644 (file)
@@ -172,10 +172,7 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) {
       const llvm::Type *LTy = ConvertType(Ty);
       llvm::AllocaInst *Alloc =
         CreateTempAlloca(LTy, CGM.getMangledName(&D));
-      unsigned align = getContext().getTypeAlign(Ty);
-      if (const AlignedAttr* AA = D.getAttr<AlignedAttr>())
-        align = std::max(align, AA->getAlignment());
-      Alloc->setAlignment(align >> 3);
+      Alloc->setAlignment(getContext().getDeclAlignInBytes(&D));
       DeclPtr = Alloc;
     } else {
       // Targets that don't support recursion emit locals as globals.