1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -jump-threading -jump-threading-threshold=3 -S -verify | FileCheck %s
4 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-unknown-linux-gnu"
7 @a = global i32 0, align 4
9 ; Show that freeze is not counted when comparing the cost with the threshold
10 define void @foo(i32 %cond1, i32 %cond2) {
13 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp eq i32 [[COND1:%.*]], 0
14 ; CHECK-NEXT: br i1 [[TOBOOL]], label [[BB_COND2_THREAD:%.*]], label [[BB_COND2:%.*]]
16 ; CHECK-NEXT: call void @f1()
17 ; CHECK-NEXT: [[COND2_FR:%.*]] = freeze i32 [[COND2:%.*]]
18 ; CHECK-NEXT: [[X:%.*]] = add i32 [[COND2_FR]], 1
19 ; CHECK-NEXT: [[TOBOOL1:%.*]] = icmp eq i32 [[X]], 0
20 ; CHECK-NEXT: br i1 [[TOBOOL1]], label [[BB_F4:%.*]], label [[BB_F2:%.*]]
21 ; CHECK: bb.cond2.thread:
22 ; CHECK-NEXT: [[COND2_FR2:%.*]] = freeze i32 [[COND2]]
23 ; CHECK-NEXT: [[X3:%.*]] = add i32 [[COND2_FR2]], 1
24 ; CHECK-NEXT: [[TOBOOL14:%.*]] = icmp eq i32 [[X3]], 0
25 ; CHECK-NEXT: br i1 [[TOBOOL14]], label [[BB_F3:%.*]], label [[BB_F2]]
27 ; CHECK-NEXT: call void @f2()
28 ; CHECK-NEXT: br label [[EXIT:%.*]]
30 ; CHECK-NEXT: call void @f3()
31 ; CHECK-NEXT: br label [[EXIT]]
33 ; CHECK-NEXT: [[PTR5:%.*]] = phi i32* [ null, [[BB_COND2]] ]
34 ; CHECK-NEXT: call void @f4()
35 ; CHECK-NEXT: br label [[EXIT]]
37 ; CHECK-NEXT: ret void
40 %tobool = icmp eq i32 %cond1, 0
41 br i1 %tobool, label %bb.cond2, label %bb.f1
48 %ptr = phi i32* [ null, %bb.f1 ], [ @a, %entry ]
49 %cond2.fr = freeze i32 %cond2
50 %x = add i32 %cond2.fr, 1
51 %tobool1 = icmp eq i32 %x, 0
52 br i1 %tobool1, label %bb.file, label %bb.f2
59 %cmp = icmp eq i32* %ptr, null
60 br i1 %cmp, label %bb.f4, label %bb.f3