1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt -S -passes=mergeicmps < %s | FileCheck %s 3 4; This does not use a GEP for the zero-offset comparison and requires a 5; split for other work. 6 7target triple = "x86_64-grtev4-linux-gnu" 8 9declare void @other_work() 10 11define i1 @test(ptr dereferenceable(2) %arg, ptr dereferenceable(2) %arg1) { 12; CHECK-LABEL: @test( 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:%.*]] 18; CHECK: join: 19; CHECK-NEXT: ret i1 [[TMP0]] 20; 21entry: 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 29 30if: 31 %arg.val = load i8, ptr %arg 32 %arg1.val = load i8, ptr %arg1 33 %cmp = icmp eq i8 %arg.val, %arg1.val 34 br label %join 35 36join: 37 %phi = phi i1 [ false, %entry ], [ %cmp, %if ] 38 ret i1 %phi 39} 40