David Majnemer | 0c80e2e | 2016-04-27 19:36:38 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -codegenprepare < %s | FileCheck %s |
| 2 | target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" |
| 3 | target triple = "x86_64-pc-windows-msvc" |
| 4 | |
| 5 | @rtti = external global i8 |
| 6 | |
| 7 | define void @test1() personality i32 (...)* @__CxxFrameHandler3 { |
| 8 | entry: |
| 9 | %e = alloca i8 |
| 10 | %tmpcast = bitcast i8* %e to i16* |
| 11 | invoke void @_CxxThrowException(i8* null, i8* null) |
| 12 | to label %catchret.dest unwind label %catch.dispatch |
| 13 | |
| 14 | catch.dispatch: ; preds = %entry |
| 15 | %0 = catchswitch within none [label %catch] unwind to caller |
| 16 | |
| 17 | catch: ; preds = %catch.dispatch |
| 18 | %1 = catchpad within %0 [i8* @rtti, i32 0, i16* %tmpcast] |
| 19 | catchret from %1 to label %catchret.dest |
| 20 | |
| 21 | catchret.dest: ; preds = %catch |
| 22 | ret void |
| 23 | } |
| 24 | ; CHECK-LABEL: define void @test1( |
| 25 | ; CHECK: %[[alloca:.*]] = alloca i8 |
| 26 | ; CHECK-NEXT: %[[bc:.*]] = bitcast i8* %[[alloca]] to i16* |
| 27 | |
| 28 | ; CHECK: catchpad within {{.*}} [i8* @rtti, i32 0, i16* %[[bc]]] |
| 29 | |
| 30 | declare void @_CxxThrowException(i8*, i8*) |
| 31 | |
| 32 | declare i32 @__CxxFrameHandler3(...) |