[llvm-bugs] [Bug 28533] New: IPSCCP doesn't propagate structs

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 12 17:18:07 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28533

            Bug ID: 28533
           Summary: IPSCCP doesn't propagate structs
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Testcase:

define internal { i32, i32 } @foo(i32 %A, i32 %B) {
        %X = add i32 %A, %B
        %Y = insertvalue { i32, i32 } undef, i32 %A, 0
        %Z = insertvalue { i32, i32 } %Y, i32 %X, 1
        ret { i32, i32 } %Z
}

define void @caller(i1 %C) {
        %S1 = call { i32, i32 } @foo(i32 1, i32 2)
        %X1 = extractvalue { i32, i32 } %S1, 0
        %S2 = call { i32, i32 } @foo(i32 3, i32 4)
        %X2 = extractvalue { i32, i32 } %S2, 0
        %Z  = add i32 %X1, %X2
        ret void
}


[davide at localhost build-clang]$ ./bin/opt ./bin/patatellomio.ll -S -ipsccp
; ModuleID = './bin/patatellomio.ll'
source_filename = "./bin/patatellomio.ll"

define internal { i32, i32 } @foo(i32 %A, i32 %B) {
  %X = add i32 %A, %B
  %Y = insertvalue { i32, i32 } undef, i32 %A, 0
  %Z = insertvalue { i32, i32 } %Y, i32 %X, 1
  ret { i32, i32 } %Z
}

define void @caller(i1 %C) {
  %S1 = call { i32, i32 } @foo(i32 1, i32 2)
  %X1 = extractvalue { i32, i32 } %S1, 0
  %S2 = call { i32, i32 } @foo(i32 3, i32 4)
  %X2 = extractvalue { i32, i32 } %S2, 0
  %Z = add i32 %X1, %X2
  ret void
}


define internal { i32, i32 } @foo(i32 %A, i32 %B) {
  %X = add i32 %A, %B
  %Y = insertvalue { i32, i32 } undef, i32 %A, 0
  %Z = insertvalue { i32, i32 } %Y, i32 %X, 1
  ret { i32, i32 } %Z
}

define void @caller(i1 %C) {
  %S1 = call { i32, i32 } @foo(i32 1, i32 2)
  %S2 = call { i32, i32 } @foo(i32 3, i32 4)
  %Z = add i32 1, 3
  ret void
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160713/0f13623e/attachment.html>


More information about the llvm-bugs mailing list