[LLVMbugs] [Bug 4216] New: Consecutive small memory accesses not merged in a bigger access

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri May 15 04:50:46 PDT 2009


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

           Summary: Consecutive small memory accesses not merged in a bigger
                    access
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: code-quality
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: quickslyver at free.fr
                CC: llvmbugs at cs.uiuc.edu


struct control_reg
{
  int a:3;
  int b:2;
  int c:1;
  int d:4;
  int e:3;
  int f:3;
};

struct control_reg test_bitfield(struct control_reg c)
{
  c.a=2;
  c.d=3;
  c.f=4;
  return c;
}

--------------------
With clang -03 this give:
--------------------

define void @test_bitfield(%struct.control_reg* noalias nocapture sret
%agg.result, %struct.control_reg* nocapture byval %c) nounwind {
entry:
        %tmp = bitcast %struct.control_reg* %c to i32*          ; <i32*>
[#uses=2]
        %bf.prev.low = load i32* %tmp           ; <i32> [#uses=1]
        %bf.prev.lo.cleared10 = or i32 %bf.prev.low, 32962              ; <i32>
[#uses=1]
        %bf.new.lo11 = and i32 %bf.prev.lo.cleared10, -25350            ; <i32>
[#uses=1]
        store i32 %bf.new.lo11, i32* %tmp
        %c.0 = getelementptr %struct.control_reg* %c, i32 0, i32 0             
; <i8*> [#uses=1]
        %tmp20 = load i8* %c.0, align 4         ; <i8> [#uses=1]
        %c.1 = getelementptr %struct.control_reg* %c, i32 0, i32 1             
; <i8*> [#uses=1]
        %tmp21 = load i8* %c.1, align 1         ; <i8> [#uses=1]
        %c.2 = getelementptr %struct.control_reg* %c, i32 0, i32 2             
; <i8*> [#uses=1]
        %tmp22 = load i8* %c.2, align 2         ; <i8> [#uses=1]
        %c.3 = getelementptr %struct.control_reg* %c, i32 0, i32 3             
; <i8*> [#uses=1]
        %tmp23 = load i8* %c.3, align 1         ; <i8> [#uses=1]
        %agg.result.0 = getelementptr %struct.control_reg* %agg.result, i32 0,
i32 0            ; <i8*> [#uses=1]
        store i8 %tmp20, i8* %agg.result.0, align 4
        %agg.result.1 = getelementptr %struct.control_reg* %agg.result, i32 0,
i32 1            ; <i8*> [#uses=1]
        store i8 %tmp21, i8* %agg.result.1, align 1
        %agg.result.2 = getelementptr %struct.control_reg* %agg.result, i32 0,
i32 2            ; <i8*> [#uses=1]
        store i8 %tmp22, i8* %agg.result.2, align 2
        %agg.result.3 = getelementptr %struct.control_reg* %agg.result, i32 0,
i32 3            ; <i8*> [#uses=1]
        store i8 %tmp23, i8* %agg.result.3, align 1
        ret void
}

--------------
i8 load and store operations should be merged into i32 operations


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