<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - MSVC: "A single unwind edge may only enter one EH pad""
   href="https://llvm.org/bugs/show_bug.cgi?id=27568">27568</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>MSVC: "A single unwind edge may only enter one EH pad"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Interprocedural Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>alex@crichton.co
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following IR will fail to compile when compiled with `opt foo.ll -S
-argpromotion`


```
; ModuleID = 'tmp.ll'
target triple = "x86_64-pc-windows-msvc"

%FOO = type { %BAR, i32 }
%BAR = type { i32* }

define void @foo() personality i32 (...)* @__CxxFrameHandler3 {
entry-block:
  %foo = alloca %FOO
  %slot1 = getelementptr %FOO, %FOO* %foo, i64 0, i32 0
  %slot2 = getelementptr %FOO, %FOO* %foo, i64 0, i32 1
  invoke fastcc void @thunk(i32* %slot2)
          to label %good1 unwind label %bad1

good1:                                            ; preds = %entry-block
  ret void

bad1:                                             ; preds = %entry-block
  %pad1 = cleanuppad within none []
  invoke fastcc void @bar(%BAR* %slot1) [ "funclet"(token %pad1) ]
          to label %good2 unwind label %bad2

good2:                                            ; preds = %bad1
  cleanupret from %pad1 unwind to caller

bad2:                                             ; preds = %bad1
  %pad2 = cleanuppad within %pad1 []
  %ptr1 = getelementptr %BAR, %BAR* %slot1, i64 0, i32 0
  %ptr2 = load i32*, i32** %ptr1
  call void @thunk(i32* %ptr2) [ "funclet"(token %pad2) ]
  cleanupret from %pad2 unwind to caller
}

define internal void @bar(%BAR*) {
entry-block:
  %1 = getelementptr %BAR, %BAR* %0, i32 0, i32 0
  %2 = load i32*, i32** %1
  call void @thunk(i32* %2)
  ret void
}

declare void @thunk(i32*)

declare i32 @__CxxFrameHandler3(...)
```


This is heavily reduced down from a test case in Rust, but I can try to get
more context if necessary as well, so please just let me know if any more is
needed!</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>