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

            Bug ID: 51668
           Summary: EarlyCSE incorrectly assumes that readonly functions
                    return
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedb...@nondot.org
          Reporter: nunoplo...@sapo.pt
                CC: alina.sbir...@gmail.com, florian_h...@apple.com,
                    gbe...@codeaurora.org, llvm-bugs@lists.llvm.org,
                    llvm-...@redking.me.uk

Test: Transforms/EarlyCSE/globalsaa-memoryssa.ll

define void @f3() {
  %call1 = call i16 @f1() nowrite nofree
  call void @f2()
  %call2 = call i16 @f1() nowrite nofree
  ret void
}
=>
define void @f3() {
  %call1 = call i16 @f1() nowrite nofree
  call void @f2()
  ret void
}

The second call to @f1() is incorrectly removed. We don't know if it exits, for
example. Function @f2 may change the state read by @f1 and thus the first call
may return and the second exit.
The optimization should be restricted to functions with the 'willreturn'
attribute.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to