Home | History | Annotate | Download | only in InstCombine
      1 ; RUN: opt -instcombine -S < %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-msvc18.0.0"
      4 
      5 %struct.B = type { i64, i64 }
      6 
      7 define void @test1(%struct.B* %p) personality i32 (...)* @__CxxFrameHandler3 {
      8 invoke.cont:
      9   %0 = bitcast %struct.B* %p to <2 x i64>*
     10   %1 = load <2 x i64>, <2 x i64>* %0, align 8
     11   %2 = extractelement <2 x i64> %1, i32 0
     12   invoke void @throw()
     13           to label %unreachable unwind label %catch.dispatch
     14 
     15 catch.dispatch:                                   ; preds = %invoke.cont
     16   %cs = catchswitch within none [label %invoke.cont1] unwind label %ehcleanup
     17 
     18 invoke.cont1:                                     ; preds = %catch.dispatch
     19   %catch = catchpad within %cs [i8* null, i32 64, i8* null]
     20   invoke void @throw() [ "funclet"(token %catch) ]
     21           to label %unreachable unwind label %ehcleanup
     22 
     23 ehcleanup:                                        ; preds = %invoke.cont1, %catch.dispatch
     24   %phi = phi i64 [ %2, %catch.dispatch ], [ 9, %invoke.cont1 ]
     25   %cleanup = cleanuppad within none []
     26   call void @release(i64 %phi) [ "funclet"(token %cleanup) ]
     27   cleanupret from %cleanup unwind to caller
     28 
     29 unreachable:                                      ; preds = %invoke.cont1, %invoke.cont
     30   unreachable
     31 }
     32 
     33 ; CHECK-LABEL: define void @test1(
     34 ; CHECK: %[[bc:.*]] = bitcast %struct.B* %p to <2 x i64>*
     35 ; CHECK: %[[ld:.*]] = load <2 x i64>, <2 x i64>* %[[bc]], align 8
     36 ; CHECK: %[[ee:.*]] = extractelement <2 x i64> %[[ld]], i32 0
     37 
     38 ; CHECK: %[[phi:.*]] = phi i64 [ %[[ee]], {{.*}} ], [ 9, {{.*}} ]
     39 ; CHECK: call void @release(i64 %[[phi]])
     40 
     41 declare i32 @__CxxFrameHandler3(...)
     42 
     43 declare void @throw()
     44 
     45 declare void @release(i64)
     46