1 ; RUN: opt -S -gvn-hoist < %s | FileCheck %s
2 ; CHECK-LABEL: build_tree
5 ; Check that the load is not hoisted because the call can potentially
8 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
10 @heap = external global i32, align 4
12 define i32 @build_tree() unnamed_addr {
16 do.body: ; preds = %do.body, %entry
17 %tmp9 = load i32, i32* @heap, align 4
18 %cmp = call i1 @pqdownheap(i32 %tmp9)
19 br i1 %cmp, label %do.body, label %do.end
21 do.end: ; preds = %do.body
22 %tmp20 = load i32, i32* @heap, align 4
26 declare i1 @pqdownheap(i32)
28 @i = external hidden unnamed_addr global i32, align 4
29 @j = external hidden unnamed_addr global [573 x i32], align 4
30 @v = external global i1
35 ; Check that the load is not hoisted because the call can potentially
43 %a3 = load volatile i1, i1* @v
44 br i1 %a3, label %for.body, label %while.end
50 %tmp4 = load i32, i32* @i, align 4
57 %tmp9 = load i32, i32* getelementptr inbounds ([573 x i32], [573 x i32]* @j,
58 i32 0, i32 1), align 4
59 %tmp10 = load i32, i32* @i, align 4
61 %a1 = load volatile i1, i1* @v
62 br i1 %a1, label %do.body, label %do.end
65 %tmp20 = load i32, i32* getelementptr inbounds ([573 x i32], [573 x i32]* @j,
66 i32 0, i32 1), align 4