1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=mergeicmps < %s | FileCheck %s
4 ; This does not use a GEP for the zero-offset comparison and requires a
5 ; split for other work.
7 target triple = "x86_64-grtev4-linux-gnu"
9 declare void @other_work()
11 define i1 @test(ptr dereferenceable(2) %arg, ptr dereferenceable(2) %arg1) {
13 ; CHECK-NEXT: "if+entry":
14 ; CHECK-NEXT: call void @other_work()
15 ; CHECK-NEXT: [[MEMCMP:%.*]] = call i32 @memcmp(ptr [[ARG:%.*]], ptr [[ARG1:%.*]], i64 2)
16 ; CHECK-NEXT: [[TMP0:%.*]] = icmp eq i32 [[MEMCMP]], 0
17 ; CHECK-NEXT: br label [[JOIN:%.*]]
19 ; CHECK-NEXT: ret i1 [[TMP0]]
22 call void @other_work()
23 %arg.off = getelementptr inbounds i8, ptr %arg, i64 1
24 %arg1.off = getelementptr inbounds i8, ptr %arg1, i64 1
25 %arg.off.val = load i8, ptr %arg.off
26 %arg1.off.val = load i8, ptr %arg1.off
27 %cmp.off = icmp eq i8 %arg.off.val, %arg1.off.val
28 br i1 %cmp.off, label %if, label %join
31 %arg.val = load i8, ptr %arg
32 %arg1.val = load i8, ptr %arg1
33 %cmp = icmp eq i8 %arg.val, %arg1.val
37 %phi = phi i1 [ false, %entry ], [ %cmp, %if ]