[LLVMbugs] [Bug 10514] New: ConstantMerge ignores alignment, needed because of SSE use

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 27 10:42:35 PDT 2011


           Summary: ConstantMerge ignores alignment, needed because of SSE
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rdivacky at freebsd.org
                CC: llvmbugs at cs.uiuc.edu

on amd64 with SSE enabled, if it doesnt crash for you try to make the "Test1"
string longer (ie. "Test12" etc.):

pes ~$ cat llvm-align.c
#if 0

peter at daintree[10:28AM]~-1051> cc -O1 -o bar bar.c
peter at daintree[10:28AM]~-1052> ./bar
Test1 foo1bar2foo3bar

peter at daintree[10:28AM]~-1053> cc -O2 -o bar bar.c
peter at daintree[10:28AM]~-1054> ./bar              
Test1 foo1bar2foo3bar
zsh: bus error (core dumped)  ./bar

If you look at assembler output, with -O1, the constant string appears
twice. One has .align 16 constraint, due to SSE use, the other does not.

With -O2, both strings are merged, and the alignment constraint is lost.

int foo(int a)
        char id[] = "foo1bar2foo3bar";
        id[0] += a; 
        for (a = 0; id[a] != 0; a++)
        return a;

int main(void)
        printf("Test1 %s\n", "foo1bar2foo3bar");
        return foo(1);
        return 0;

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list