[LLVMbugs] [Bug 11821] New: missed load widening opportunity

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 20 19:09:45 PST 2012


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

             Bug #: 11821
           Summary: missed load widening opportunity
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: kcc at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I was trying to figure out how to fix the AddressSanitizer false positive cause
by load widening. 
http://code.google.com/p/address-sanitizer/issues/detail?id=20

I noticed that the effect of GVN is rather unstable. 
The code "x[16] + x[21]" gets load-widened while "x[21] + x[16]" does not. 
Looks like in the first case the second load is recognized as a dependency of
the 
first load, and in second case -- not. 

clang r148551, linux 64-bit.


% cat gvn.c 
void init(char*);
int GVN1() {
  char x[22];
  init(x);
  return x[16] + x[21];
}
int GVN2() {
  char x[22];
  init(x);
  return x[21] + x[16];
}
% clang -O2 -S -emit-llvm -o - gvn.c 2>&1 | grep "define\|load"
define i32 @GVN1() nounwind uwtable {
  %1 = load i64* %0, align 16
define i32 @GVN2() nounwind uwtable {
  %0 = load i8* %arrayidx, align 1, !tbaa !0
  %1 = load i8* %arrayidx1, align 16, !tbaa !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