[llvm-bugs] [Bug 40455] New: CodeExtractor miscompiles invokes with uses outside of the extraction region

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 24 19:52:02 PST 2019


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

            Bug ID: 40455
           Summary: CodeExtractor miscompiles invokes with uses outside of
                    the extraction region
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: vsk at apple.com
                CC: llvm-bugs at lists.llvm.org

The pattern that triggers the miscompile is:

```
extract1:
  %call = invoke i8* @foo(...)
    to label %outside-extraction-region unwind label %extract2

extract2:
  landingpad i8 cleanup
  ret void

outside-extraction-region:
  call void @use(i8* %call)
  ret void
```

When CodeExtractor extracts the blocks extract{1,2}, it sees that %call is used
outside of the extraction region. So it extracts the invoke and stores its
result in an in-out param ("%call.out"). But the store is placed in
%outside-extraction-region, i.e., in the wrong function.

To fix this, exit stubs need to be created before stores to outputs occur.
Then, the store to the in-out param can be placed in the exit stub where it
belongs.

-- 
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/20190125/9d8ace90/attachment.html>


More information about the llvm-bugs mailing list