1 ; RUN: opt -S -passes=gvn-hoist < %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 define void @test1(i1 %a, ptr %d) {
7 %0 = load ptr, ptr %d, align 8
8 br i1 %a, label %if.then, label %if.else
10 if.then: ; preds = %entry
13 if.else: ; preds = %entry
16 if.end: ; preds = %if.else, %if.then
17 %c.0 = phi i1 [ 1, %if.then ], [ 0, %if.else ]
18 br i1 %c.0, label %if.then2, label %if.else3
20 if.then2: ; preds = %if.end
21 store i1 %c.0, ptr %0, align 4
24 if.else3: ; preds = %if.end
25 store i1 %c.0, ptr %0, align 4
28 if.end6: ; preds = %if.else3, %if.then2
32 ; CHECK-LABEL: define void @test1(
33 ; CHECK: %[[load:.*]] = load ptr, ptr %d, align 8
34 ; CHECK: %[[phi:.*]] = phi i1 [ true, {{.*}} ], [ false, {{.*}} ]
36 ; CHECK: store i1 %[[phi]], ptr %[[load]], align 4
38 ; Check that store instructions are hoisted.