[llvm-bugs] [Bug 51846] New: Sink: moves calls that may not return

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 14 02:56:12 PDT 2021


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

            Bug ID: 51846
           Summary: Sink: moves calls that may not return
           Product: libraries
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Keywords: miscompilation
          Severity: normal
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: nunoplopes at sapo.pt
                CC: changpeng.fang at amd.com, florian_hahn at apple.com,
                    hongtao.yu at outlook.com, i at maskray.me,
                    llvm-bugs at lists.llvm.org

Test: Transforms/Sink/call.ll

Transformation only valid if willreturn & nounwind attributes are present.


define i32 @test_sink_no_stores(i1 %z) {
%0:
  %l = call i32 @f_load_global() nowrite nofree
  br i1 %z, label %true, label %false

%false:
  ret i32 0

%true:
  ret i32 %l
}
=>
define i32 @test_sink_no_stores(i1 %z) {
%0:
  br i1 %z, label %true, label %false

%false:
  ret i32 0

%true:
  %l = call i32 @f_load_global() nowrite nofree
  ret i32 %l
}
Transformation doesn't verify!
ERROR: Source is more defined than target

Example:
i1 %z = undef

Source:
i32 %l = UB triggered!

SOURCE MEMORY STATE
===================
NON-LOCAL BLOCKS:
Block 0 >       size: 0 align: 1        alloc type: 0
Block 1 >       size: 0 align: 1

Target:
UB triggered on br

-- 
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/20210914/d9d73022/attachment.html>


More information about the llvm-bugs mailing list