[LLVMbugs] [Bug 15128] New: Incorrect alignment of llvm.memset for constructor initializing

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jan 30 14:27:43 PST 2013


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

             Bug #: 15128
           Summary: Incorrect alignment of llvm.memset for constructor
                    initializing
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: weimingz at codeaurora.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9954
  --> http://llvm.org/bugs/attachment.cgi?id=9954
test case

Given the .cpp code (see attachment), clang emits the following code snippet:

define linkonce_odr %struct.testnode* @_ZN8testnodeC2Ev(%struct.testnode*
%this) unnamed_addr align 2 {
  %1 = alloca %struct.testnode*, align 4
  store %struct.testnode* %this, %struct.testnode** %1, align 4
  %2 = load %struct.testnode** %1
  %3 = getelementptr inbounds %struct.testnode* %2, i32 0, i32 0
  %4 = bitcast %struct.alignedstruct* %3 to i8*
  call void @llvm.memset.p0i8.i32(i8* %4, i8 0, i32 16, i32 16, i1 false) ==>
it sets 128-byte alignment, which can't be guaranteed
  %5 = call %struct.alignedstruct*
@_ZN13alignedstructIPvEC1Ev(%struct.alignedstruct* %3)
  ret %struct.testnode* %2
}

Command:
clang++ -S -c -emit-llvm -march=armv7-a -mfloat-abi=softfp -mfpu=neon
-std=c++11 -stdlib=libc++ -o test.ll test.cpp

In void CodeGenFunction::EmitNullInitialization(), it gets Align of 16.

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