1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=mergeicmps < %s | FileCheck %s
4 target triple = "x86_64-unknown-linux-gnu"
6 @c = external global i32, align 4
11 ; CHECK-NEXT: [[G:%.*]] = alloca [8 x i64], align 16
12 ; CHECK-NEXT: [[V1:%.*]] = load i64, ptr [[G]], align 8
13 ; CHECK-NEXT: [[V2:%.*]] = load i64, ptr [[G]], align 8
14 ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i64 [[V1]], [[V2]]
15 ; CHECK-NEXT: br label [[SPLIT:%.*]]
17 ; CHECK-NEXT: [[X:%.*]] = load volatile i32, ptr @c, align 4
18 ; CHECK-NEXT: br i1 [[CMP]], label [[IF:%.*]], label [[EXIT:%.*]]
20 ; CHECK-NEXT: [[TOBOOL:%.*]] = icmp ne i32 [[X]], 0
21 ; CHECK-NEXT: br label [[EXIT]]
23 ; CHECK-NEXT: [[P:%.*]] = phi i1 [ false, [[SPLIT]] ], [ [[TOBOOL]], [[IF]] ]
24 ; CHECK-NEXT: ret i1 [[P]]
27 %g = alloca [8 x i64], align 16
28 %v1 = load i64, ptr %g, align 8
29 %v2 = load i64, ptr %g, align 8
30 %cmp = icmp eq i64 %v1, %v2
34 %x = load volatile i32, ptr @c, align 4
35 br i1 %cmp, label %if, label %exit
38 %tobool = icmp ne i32 %x, 0
42 %p = phi i1 [ false, %split ], [ %tobool, %if ]