[llvm-bugs] [Bug 27568] New: MSVC: "A single unwind edge may only enter one EH pad"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 28 21:13:17 PDT 2016


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

            Bug ID: 27568
           Summary: MSVC: "A single unwind edge may only enter one EH pad"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Interprocedural Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: alex at crichton.co
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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!

-- 
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/20160429/559b2dbc/attachment.html>


More information about the llvm-bugs mailing list