[LLVMbugs] [Bug 14320] New: SROA increases stack usage when used with ASan

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Nov 12 02:05:48 PST 2012


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

             Bug #: 14320
           Summary: SROA increases stack usage when used with ASan
           Product: new-bugs
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: samsonov at google.com
                CC: chandlerc at gmail.com, kcc at google.com,
                    llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat sroa.cc 
void f(volatile int *arg) {}

int main() {
  volatile int b[20] = {0, 1};
  f(b);
}
$ clang++ -O2 -fsanitize=address sroa.cc -S -emit-llvm -mllvm -print-after-all
-o sroa.ll 2>log.ll
$ cat sroa.ll
<...>
define i32 @main() nounwind uwtable address_safety {
  %MyAlloca = alloca [288 x i8], align 32
  %1 = ptrtoint [288 x i8]* %MyAlloca to i64
  %2 = add i64 %1, 32
  %3 = inttoptr i64 %2 to i32*  <---------- int
  %4 = add i64 %1, 96
  %5 = inttoptr i64 %4 to i32*  <---------- int
  %6 = add i64 %1, 160
  %7 = inttoptr i64 %6 to [18 x i32]* <---- int[18]
  %8 = inttoptr i64 %1 to i64*

Looks like SROA changes this:
  %b = alloca [20 x i32], align 16
to this:
  %b.sroa.0 = alloca i32, align 16
  %b.sroa.1 = alloca i32
  %b.sroa.2 = alloca [18 x i32], align 8
and ASan inserts large redzones between this fake "different" local variables.

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