[cfe-commits] r51676 - in /cfe/trunk: lib/CodeGen/CodeGenModule.cpp test/CodeGen/var-align.c

Steve Naroff snaroff at apple.com
Thu May 29 12:31:12 PDT 2008


Eli,

fyi...I am seeing the following failure now...

******************** TEST 'CodeGen/var-align.c' FAILED!  
********************
Command:
  clang -emit-llvm CodeGen/var-align.c -o - | grep "align 16" | count 2
Incorrect Output:
count: expected 2 lines and got        1.
******************** TEST 'CodeGen/var-align.c' FAILED!  
********************

snaroff

On May 29, 2008, at 4:10 AM, Eli Friedman wrote:

> Author: efriedma
> Date: Thu May 29 06:10:27 2008
> New Revision: 51676
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51676&view=rev
> Log:
> Add CodeGen support for alignment on globals, both for unusual natural
> alignment and alignment attributes.
>
>
> Added:
>    cfe/trunk/test/CodeGen/var-align.c
> Modified:
>    cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=51676&r1=51675&r2=51676&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu May 29 06:10:27 2008
> @@ -477,6 +477,12 @@
>          "Initializer codegen type mismatch!");
>   GV->setInitializer(Init);
>
> +  unsigned Align = Context.getTypeAlign(D->getType());
> +  if (const AlignedAttr* AA = D->getAttr<AlignedAttr>()) {
> +    Align = std::max(Align, AA->getAlignment());
> +  }
> +  GV->setAlignment(Align / 8);
> +
>   if (const VisibilityAttr *attr = D->getAttr<VisibilityAttr>())
>     setVisibility(GV, attr->getVisibility());
>   // FIXME: else handle -fvisibility
>
> Added: cfe/trunk/test/CodeGen/var-align.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/var-align.c?rev=51676&view=auto
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- cfe/trunk/test/CodeGen/var-align.c (added)
> +++ cfe/trunk/test/CodeGen/var-align.c Thu May 29 06:10:27 2008
> @@ -0,0 +1,4 @@
> +// RUN: clang -emit-llvm %s -o - | grep "align 16" | count 2
> +
> +__attribute((aligned(16))) float a[128];
> +union {int a[4]; __attribute((aligned(16))) float b[4];} u;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list