[LLVMbugs] [Bug 2558] New: Argpromotion does not handle first class aggregates

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jul 17 05:49:16 PDT 2008


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

           Summary: Argpromotion does not handle first class aggregates
           Product: libraries
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Interprocedural Optimizations
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: matthijs at stdin.nl
                CC: llvmbugs at cs.uiuc.edu


Argumentpromotion does not currently promote first-class structs and arrays.

A testcase is as follows:

; This testcase makes sure that argpromotion promotes first class aggregates
; properly.
; RUN: llvm-as < %s | opt -argpromotion | llvm-dis > %t
; (These grep lines were not tested)
; RUN: cat %t | grep {define.*@sum(i32 %.*, i32 %.*)}
; RUN: cat %t | grep {define.*@sum2(i32 %.*, i32 %.*)}

define internal i32 @sum({i32, i32} %A) {
  %B = extractvalue {i32, i32} %A, 0
  %C = extractvalue {i32, i32} %A, 0
  %D = add i32 %B, %C
  ret i32 %D
}

define internal i32 @sum2([2 x i32] %A) {
  %B = extractvalue {i32, i32} %A, 0
  %C = extractvalue {i32, i32} %A, 0
  %D = add i32 %B, %C
  ret i32 %D
}

define void @run(i32 %A, i32 %B) {
  %C = insertvalue {i32, i32} undef, i32 %A, 0
  %D = insertvalue {i32, i32} %C, i32 %B, 1
  %E = call i32 @sum({i32, i32} %D);
  %F = insertvalue [ 2 x i32 ] undef, i32 %A, 0
  %G = insertvalue [ 2 x i32 ] %F, i32 %B, 1
  %H = call i32 @sum({i32, i32} %D);
  ret void
}


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