[LLVMbugs] [Bug 12260] New: Lowering struct copies to memcpy loses tons of useful TBAA info

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 12 22:33:55 PDT 2012


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

             Bug #: 12260
           Summary: Lowering struct copies to memcpy loses tons of useful
                    TBAA info
           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 investigating compile time performance, Daniel noticed that we were
getting terrible codegen around CharSourceRange, and I noticed that's because
copies of it were losing TBAA info.  This, in turn, is a much more general
issue.  Consider:

$  cat t2.cc 
struct foo {
  int x;
};

void test(foo &a, foo &b) {
  a = b; 
}
$ clang t2.cc -S -o - -emit-llvm
...
  call void @llvm.memcpy.p0i8.p0i8.i64(i8* %2, i8* %3, i64 4, i32 4, i1 false)


Yes, at -O3 we turn that into a load/store pair... but we still lost all TBAA
information, which seriously pessimises GVN and friends for simple value types.
 llvm-gcc used to have a heuristic to lower simple struct copies as a series of
scalar loads and stores - Clang should too.

This is also vaguely related to PR11946 in the case of SourceCharRange, since
it has internal padding.

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