13401f970SJuneyoung Lee; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 23401f970SJuneyoung Lee; RUN: opt < %s -jump-threading -jump-threading-threshold=3 -S -verify | FileCheck %s 33401f970SJuneyoung Lee 43401f970SJuneyoung Leetarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 53401f970SJuneyoung Leetarget triple = "x86_64-unknown-linux-gnu" 63401f970SJuneyoung Lee 73401f970SJuneyoung Lee@a = global i32 0, align 4 83401f970SJuneyoung Lee 9*e0d99e9aSJuneyoung Lee; Show that freeze is not counted when comparing the cost with the threshold 103401f970SJuneyoung Leedefine void @foo(i32 %cond1, i32 %cond2) { 113401f970SJuneyoung Lee; CHECK-LABEL: @foo( 123401f970SJuneyoung Lee; CHECK-NEXT: entry: 133401f970SJuneyoung Lee; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[COND1:%.*]], 0 14*e0d99e9aSJuneyoung Lee; CHECK-NEXT: br i1 [[TOBOOL]], label [[BB_COND2_THREAD:%.*]], label [[BB_COND2:%.*]] 153401f970SJuneyoung Lee; CHECK: bb.cond2: 16*e0d99e9aSJuneyoung Lee; CHECK-NEXT: call void @f1() 173401f970SJuneyoung Lee; CHECK-NEXT: [[COND2_FR:%.*]] = freeze i32 [[COND2:%.*]] 183401f970SJuneyoung Lee; CHECK-NEXT: [[X:%.*]] = add i32 [[COND2_FR]], 1 193401f970SJuneyoung Lee; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[X]], 0 20*e0d99e9aSJuneyoung Lee; CHECK-NEXT: br i1 [[TOBOOL1]], label [[BB_F4:%.*]], label [[BB_F2:%.*]] 21*e0d99e9aSJuneyoung Lee; CHECK: bb.cond2.thread: 22*e0d99e9aSJuneyoung Lee; CHECK-NEXT: [[COND2_FR2:%.*]] = freeze i32 [[COND2]] 23*e0d99e9aSJuneyoung Lee; CHECK-NEXT: [[X3:%.*]] = add i32 [[COND2_FR2]], 1 24*e0d99e9aSJuneyoung Lee; CHECK-NEXT: [[TOBOOL14:%.*]] = icmp eq i32 [[X3]], 0 25*e0d99e9aSJuneyoung Lee; CHECK-NEXT: br i1 [[TOBOOL14]], label [[BB_F3:%.*]], label [[BB_F2]] 263401f970SJuneyoung Lee; CHECK: bb.f2: 273401f970SJuneyoung Lee; CHECK-NEXT: call void @f2() 283401f970SJuneyoung Lee; CHECK-NEXT: br label [[EXIT:%.*]] 293401f970SJuneyoung Lee; CHECK: bb.f3: 303401f970SJuneyoung Lee; CHECK-NEXT: call void @f3() 313401f970SJuneyoung Lee; CHECK-NEXT: br label [[EXIT]] 323401f970SJuneyoung Lee; CHECK: bb.f4: 33*e0d99e9aSJuneyoung Lee; CHECK-NEXT: [[PTR5:%.*]] = phi i32* [ null, [[BB_COND2]] ] 343401f970SJuneyoung Lee; CHECK-NEXT: call void @f4() 353401f970SJuneyoung Lee; CHECK-NEXT: br label [[EXIT]] 363401f970SJuneyoung Lee; CHECK: exit: 373401f970SJuneyoung Lee; CHECK-NEXT: ret void 383401f970SJuneyoung Lee; 393401f970SJuneyoung Leeentry: 403401f970SJuneyoung Lee %tobool = icmp eq i32 %cond1, 0 413401f970SJuneyoung Lee br i1 %tobool, label %bb.cond2, label %bb.f1 423401f970SJuneyoung Lee 433401f970SJuneyoung Leebb.f1: 443401f970SJuneyoung Lee call void @f1() 453401f970SJuneyoung Lee br label %bb.cond2 463401f970SJuneyoung Lee 473401f970SJuneyoung Leebb.cond2: 483401f970SJuneyoung Lee %ptr = phi i32* [ null, %bb.f1 ], [ @a, %entry ] 493401f970SJuneyoung Lee %cond2.fr = freeze i32 %cond2 503401f970SJuneyoung Lee %x = add i32 %cond2.fr, 1 513401f970SJuneyoung Lee %tobool1 = icmp eq i32 %x, 0 523401f970SJuneyoung Lee br i1 %tobool1, label %bb.file, label %bb.f2 533401f970SJuneyoung Lee 543401f970SJuneyoung Leebb.f2: 553401f970SJuneyoung Lee call void @f2() 563401f970SJuneyoung Lee br label %exit 573401f970SJuneyoung Lee 583401f970SJuneyoung Leebb.file: 593401f970SJuneyoung Lee %cmp = icmp eq i32* %ptr, null 603401f970SJuneyoung Lee br i1 %cmp, label %bb.f4, label %bb.f3 613401f970SJuneyoung Lee 623401f970SJuneyoung Leebb.f3: 633401f970SJuneyoung Lee call void @f3() 643401f970SJuneyoung Lee br label %exit 653401f970SJuneyoung Lee 663401f970SJuneyoung Leebb.f4: 673401f970SJuneyoung Lee call void @f4() 683401f970SJuneyoung Lee br label %exit 693401f970SJuneyoung Lee 703401f970SJuneyoung Leeexit: 713401f970SJuneyoung Lee ret void 723401f970SJuneyoung Lee} 733401f970SJuneyoung Lee 743401f970SJuneyoung Leedeclare void @f1() 753401f970SJuneyoung Lee 763401f970SJuneyoung Leedeclare void @f2() 773401f970SJuneyoung Lee 783401f970SJuneyoung Leedeclare void @f3() 793401f970SJuneyoung Lee 803401f970SJuneyoung Leedeclare void @f4() 81