[LLVMbugs] [Bug 4722] New: GVN doesn't look through select for alloca

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Aug 14 17:47:50 PDT 2009


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

           Summary: GVN doesn't look through select for alloca
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Scalar Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu


This probably isn't GVN's fault directly. Somebody isn't peering through select
when checking whether a given value really is a select or not. This means we
miss this optimization:

%struct.X = type { i32 }

define void @_Z1fb(i1 %b) nounwind {
entry:
  %x1 = alloca %struct.X, align 8
  %x2 = alloca %struct.X, align 8
  %iftmp.0.0 = select i1 %b, %struct.X* %x2, %struct.X* %x1
  %tmp1 = getelementptr %struct.X* %iftmp.0.0, i64 0, i32 0
  %tmp2 = load i32* %tmp1, align 8
  %tmp3 = add i32 %tmp2, 1
  store i32 %tmp3, i32* %tmp1, align 8
  ret void
}

We need to make sure we limit the depth of any such search though, because it
can grow N^2 easily.


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