[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [LLVMbugs] [Bug 13246] New: LLVM doesn't optimize away allocas whose address is passed to only "noca
From:       bugzilla-daemon () llvm ! org
Date:       2012-06-30 21:13:30
Message-ID: bug-13246-206 () http ! llvm ! org/bugs/
[Download RAW message or body]

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

             Bug #: 13246
           Summary: LLVM doesn't optimize away allocas whose address is
                    passed to only "nocapture" parameters
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Core LLVM classes
        AssignedTo: unassignedbugs@nondot.org
        ReportedBy: schaub.johannes@googlemail.com
                CC: llvmbugs@cs.uiuc.edu
    Classification: Unclassified


LLVM ("opt -std-compile-opts") doesn't optimize this

declare void @negate(i32* nocapture, i32* nocapture);
declare void @print(i32* nocapture)

define void @f() {
entry:
  %a = alloca i32
  %b = alloca i32
  %c = alloca i32

  call void @negate(i32* %a, i32* %b)

  %d = load i32* %b
  store i32 %d, i32* %c

  call void @print(i32* %c)
  ret void
}

To this:

declare void @negate(i32* nocapture, i32* nocapture);
declare void @print(i32* nocapture)

define void @f() {
entry:
  %a = alloca i32
  %b = alloca i32

  call void @negate(i32* %a, i32* %b)

  call void @print(i32* %b)
  ret void
}

The load and store to "c" occured as output from a code generator that relied
on LLVM to optimize this code.

-- 
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.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic