[llvm-bugs] [Bug 42738] New: IPSCCP produces wrong code when passing structs

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 24 05:50:53 PDT 2019


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

            Bug ID: 42738
           Summary: IPSCCP produces wrong code when passing structs
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: jeroen.dobbelaere at synopsys.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22279
  --> https://bugs.llvm.org/attachment.cgi?id=22279&action=edit
test_works.ll

IPSCCP produces wrong code when passing structs (with constants). 

(For the complete files, see the attachments; The only difference is the
absence of 'i32 %dummy0, i32 %dummmy1' arguments for '@f') 

test_works.ll:
  define internal i32 @f((i32 %dummy0, i32 %dummy1, %struct.S %s.coerce) #0 {
     ....
     ret i32 123
  }

  define dso_local i32 @main() #0 {
    %call = call i32 @f(%struct.S { i64 100 })
    call void @do_report(i32 undef, i32 undef, i32 %call)
    ret i32 0
  }

'opt -S -o - --ipsccp test_works.ll' results in:
  define dso_local i32 @main() #0 {
    %call = call i32 @f(i32 undef, i32 undef, %struct.S { i64 100 })
    call void @do_report(i32 123)
    ret i32 0
  }

  define internal i32 @f(i32 %dummy0, i32 %dummy1, %struct.S %s.coerce) #0 {
    ...
    ret i32 undef
  }

test_fails.ll:
  define internal i32 @f(%struct.S %s.coerce) #0 {
     ....
     ret i32 123
  }

  define dso_local i32 @main() #0 {
    %call = call i32 @f(%struct.S { i64 100 })
    call void @do_report(i32 %call)
    ret i32 0
  }


'opt -S -o - --ipsccp test_fails.ll' results in:
  define dso_local i32 @main() #0 {
    %call = call i32 @f(%struct.S { i64 100 })
    call void @do_report(i32 %call)   ; NOTE THE DIFFERENCE HERE
    ret i32 0
  }

  define internal i32 @f(i32 %dummy0, i32 %dummy1, %struct.S %s.coerce) #0 {
    ...
    ret i32 undef
  }

-- 
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/20190724/8fda6918/attachment.html>


More information about the llvm-bugs mailing list