1 ; RUN: llc -o - -verify-machineinstrs %s | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 @data = external dso_local global [3 x i32], align 4
6 @store = external dso_local global i32, align 4
8 ; %else1 and %then2 end up lowering to identical blocks. These blocks should be
9 ; merged during tail-merging.
10 ; CHECK-LABEL: merge_identical_blocks
12 ; CHECK-NOT: movl $data+4
14 define void @merge_identical_blocks(i1 %a, i1 %b) {
18 if1: ; predfs = %entry
19 br i1 %a, label %else1, label %if2
22 %ptr.else1 = getelementptr inbounds [3 x i32], ptr @data, i64 0, i32 1
26 br i1 %b, label %then2, label %else2
29 %ptr.then2 = getelementptr inbounds [3 x i32], ptr @data, i64 0, i32 1
33 %ptr.else2 = getelementptr inbounds [3 x i32], ptr @data, i64 0, i32 2
36 phi_join: ; preds = %else1, %then2, %else2
37 %val.ptr = phi ptr [ %ptr.else1, %else1 ], [ %ptr.then2, %then2 ], [ %ptr.else2, %else2 ]
38 %val = load i32, ptr %val.ptr, align 4
39 store i32 %val, ptr @store, align 4