40 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=mergeicmps < %s | FileCheck %s3 4; This does not use a GEP for the zero-offset comparison and requires a5; 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]], 017; 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 124 %arg1.off = getelementptr inbounds i8, ptr %arg1, i64 125 %arg.off.val = load i8, ptr %arg.off26 %arg1.off.val = load i8, ptr %arg1.off27 %cmp.off = icmp eq i8 %arg.off.val, %arg1.off.val28 br i1 %cmp.off, label %if, label %join29 30if:31 %arg.val = load i8, ptr %arg32 %arg1.val = load i8, ptr %arg133 %cmp = icmp eq i8 %arg.val, %arg1.val34 br label %join35 36join:37 %phi = phi i1 [ false, %entry ], [ %cmp, %if ]38 ret i1 %phi39}40