[LLVMbugs] [Bug 11707] New: Clang producing pointless alloca for vector literal

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 4 14:38:11 PST 2012


http://llvm.org/bugs/show_bug.cgi?id=11707

             Bug #: 11707
           Summary: Clang producing pointless alloca for vector literal
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


While working on another bug, I noticed that we're compiling stuff like this
(from test/CodeGen/alignment.c):

typedef float __attribute__((vector_size(16), aligned(4))) packedfloat4;

void test2(packedfloat4 *p) {
  *p = (packedfloat4) { 3.2f, 2.3f, 0.1f, 0.0f };
}

into:

define void @test2(<4 x float>* %p) nounwind uwtable ssp {
entry:
  %p.addr = alloca <4 x float>*, align 8
  %.compoundliteral = alloca <4 x float>, align 4
  store <4 x float>* %p, <4 x float>** %p.addr, align 8
  store <4 x float> <float 0x40099999A0000000, float 0x4002666660000000, float
0x3FB99999A0000000, float 0.000000e+00>, <4 x float>* %.compoundliteral
  %0 = load <4 x float>* %.compoundliteral
  %1 = load <4 x float>** %p.addr, align 8
  store <4 x float> %0, <4 x float>* %1, align 4
  ret void
}

There is no reason for the ".compoundliteral" alloca.  We should be able to
evaluate the expression as a ConstantVector r-value.

-- 
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