68 lines · plain
1; RUN: opt -S -passes=consthoist -consthoist-with-block-frequency=false < %s | FileCheck %s2; RUN: opt -S -passes=consthoist -consthoist-with-block-frequency=true < %s | FileCheck --check-prefix=BFIHOIST %s3 4target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"5target triple = "x86_64-pc-windows-msvc"6 7; CHECK-LABEL: define i32 @main8; CHECK: %tobool = icmp eq i32 %argc, 09; CHECK-NEXT: bitcast i64 9209618997431186100 to i6410; CHECK-NEXT: br i1 %tobool11 12; BFIHOIST-LABEL: define i32 @main13; BFIHOIST: then:14; BFIHOIST: %[[CONST1:.*]] = bitcast i64 9209618997431186100 to i6415; BFIHOIST: %add = add i64 %call4, %[[CONST1]]16; BFIHOIST: br label %endif17; BFIHOIST: else:18; BFIHOIST: %[[CONST2:.*]] = bitcast i64 9209618997431186100 to i6419; BFIHOIST: %add6 = add i64 %call5, %[[CONST2]]20; BFIHOIST: br label %endif21 22; Function Attrs: norecurse23define i32 @main(i32 %argc, ptr nocapture readnone %argv) local_unnamed_addr personality ptr @__CxxFrameHandler3 {24 %call = tail call i64 @fn(i64 0)25 %call1 = tail call i64 @fn(i64 1)26 %tobool = icmp eq i32 %argc, 027 br i1 %tobool, label %2, label %128 29; <label>:1: ; preds = %030 %call2 = invoke i64 @fn(i64 %call)31 to label %6 unwind label %catch.dispatch32 33; <label>:2: ; preds = %034 %call3 = invoke i64 @fn(i64 %call1)35 to label %6 unwind label %catch.dispatch36 37catch.dispatch: ; preds = %2, %138 %z.0 = phi i64 [ %call, %1 ], [ %call1, %2 ]39 %3 = catchswitch within none [label %4] unwind to caller40 41; <label>:4: ; preds = %catch.dispatch42 %5 = catchpad within %3 [ptr null, i32 64, ptr null]43 br i1 %tobool, label %then, label %else44 45then:46 %call4 = tail call i64 @fn(i64 %z.0) [ "funclet"(token %5) ]47 %add = add i64 %call4, 920961899743118610048 br label %endif49 50else:51 %call5 = tail call i64 @fn(i64 0) [ "funclet"(token %5) ]52 %add6 = add i64 %call5, 920961899743118610053 br label %endif54 55endif:56 %v = phi i64 [ %add, %then ], [ %add6, %else ]57 %call7 = tail call i64 @fn(i64 %v) [ "funclet"(token %5) ]58 %call8 = tail call i64 @fn(i64 %call7) [ "funclet"(token %5) ]59 catchret from %5 to label %660 61; <label>:6: ; preds = %1, %2, %462 ret i32 063}64 65declare i64 @fn(i64) local_unnamed_addr66 67declare i32 @__CxxFrameHandler3(...)68