|
| 1 | +; RUN: opt -S -consthoist < %s | FileCheck %s |
| 2 | + |
| 3 | +; FIXME: The catchpad doesn't even use the constant, so a better fix would be to |
| 4 | +; insert the bitcast in the catchpad block. |
| 5 | + |
| 6 | +target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128" |
| 7 | +target triple = "x86_64-pc-windows-msvc" |
| 8 | + |
| 9 | +; CHECK-LABEL: define i32 @main |
| 10 | +; CHECK: %tobool = icmp eq i32 %argc, 0 |
| 11 | +; CHECK-NEXT: bitcast i64 9209618997431186100 to i64 |
| 12 | +; CHECK-NEXT: br i1 %tobool |
| 13 | + |
| 14 | +; Function Attrs: norecurse |
| 15 | +define i32 @main(i32 %argc, i8** nocapture readnone %argv) local_unnamed_addr #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) { |
| 16 | + %call = tail call i64 @fn(i64 0) |
| 17 | + %call1 = tail call i64 @fn(i64 1) |
| 18 | + %tobool = icmp eq i32 %argc, 0 |
| 19 | + br i1 %tobool, label %2, label %1 |
| 20 | + |
| 21 | +; <label>:1: ; preds = %0 |
| 22 | + %call2 = invoke i64 @fn(i64 %call) |
| 23 | + to label %6 unwind label %catch.dispatch |
| 24 | + |
| 25 | +; <label>:2: ; preds = %0 |
| 26 | + %call3 = invoke i64 @fn(i64 %call1) |
| 27 | + to label %6 unwind label %catch.dispatch |
| 28 | + |
| 29 | +catch.dispatch: ; preds = %2, %1 |
| 30 | + %z.0 = phi i64 [ %call, %1 ], [ %call1, %2 ] |
| 31 | + %3 = catchswitch within none [label %4] unwind to caller |
| 32 | + |
| 33 | +; <label>:4: ; preds = %catch.dispatch |
| 34 | + %5 = catchpad within %3 [i8* null, i32 64, i8* null] |
| 35 | + br i1 %tobool, label %then, label %else |
| 36 | + |
| 37 | +then: |
| 38 | + %call4 = tail call i64 @fn(i64 %z.0) [ "funclet"(token %5) ] |
| 39 | + %add = add i64 %call4, 9209618997431186100 |
| 40 | + br label %endif |
| 41 | + |
| 42 | +else: |
| 43 | + %call5 = tail call i64 @fn(i64 0) [ "funclet"(token %5) ] |
| 44 | + %add6 = add i64 %call5, 9209618997431186100 |
| 45 | + br label %endif |
| 46 | + |
| 47 | +endif: |
| 48 | + %v = phi i64 [ %add, %then ], [ %add6, %else ] |
| 49 | + %call7 = tail call i64 @fn(i64 %v) [ "funclet"(token %5) ] |
| 50 | + %call8 = tail call i64 @fn(i64 %call7) [ "funclet"(token %5) ] |
| 51 | + catchret from %5 to label %6 |
| 52 | + |
| 53 | +; <label>:6: ; preds = %1, %2, %4 |
| 54 | + ret i32 0 |
| 55 | +} |
| 56 | + |
| 57 | +declare i64 @fn(i64) local_unnamed_addr #1 |
| 58 | + |
| 59 | +declare i32 @__CxxFrameHandler3(...) |
| 60 | + |
| 61 | +attributes #0 = { norecurse "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 62 | +attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" } |
0 commit comments