1 ; RUN: opt -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S < %s | FileCheck %s
3 ; This load is safe to speculate, as it's from a safe offset
9 define void @yes(i1 %c) nounwind {
11 %a = alloca [4 x ptr], align 8
12 %__a.addr = getelementptr [4 x ptr], ptr %a, i64 0, i64 3
13 call void @frob(ptr %__a.addr)
14 br i1 %c, label %if.then, label %if.end
16 if.then: ; preds = %entry
19 if.end: ; preds = %entry
20 %tmp5 = load ptr, ptr %__a.addr, align 8
23 return: ; preds = %if.end, %if.then
24 %storemerge = phi ptr [ undef, %if.then ], [ %tmp5, %if.end ]
31 define void @no0(i1 %c) nounwind {
33 %a = alloca [4 x ptr], align 8
34 %__a.addr = getelementptr [4 x ptr], ptr %a, i64 0, i64 4
35 call void @frob(ptr %__a.addr)
36 br i1 %c, label %if.then, label %if.end
38 if.then: ; preds = %entry
41 if.end: ; preds = %entry
42 %tmp5 = load ptr, ptr %__a.addr, align 8
45 return: ; preds = %if.end, %if.then
46 %storemerge = phi ptr [ undef, %if.then ], [ %tmp5, %if.end ]
53 define void @no1(i1 %c, i64 %n) nounwind {
55 %a = alloca [4 x ptr], align 8
56 %__a.addr = getelementptr [4 x ptr], ptr %a, i64 0, i64 %n
57 call void @frob(ptr %__a.addr)
58 br i1 %c, label %if.then, label %if.end
60 if.then: ; preds = %entry
63 if.end: ; preds = %entry
64 %tmp5 = load ptr, ptr %__a.addr, align 8
67 return: ; preds = %if.end, %if.then
68 %storemerge = phi ptr [ undef, %if.then ], [ %tmp5, %if.end ]
75 define void @no2(i1 %c, i64 %n) nounwind {
77 %a = alloca [4 x ptr], align 8
78 %__a.addr = getelementptr [4 x ptr], ptr %a, i64 1, i64 0
79 call void @frob(ptr %__a.addr)
80 br i1 %c, label %if.then, label %if.end
82 if.then: ; preds = %entry
85 if.end: ; preds = %entry
86 %tmp5 = load ptr, ptr %__a.addr, align 8
89 return: ; preds = %if.end, %if.then
90 %storemerge = phi ptr [ undef, %if.then ], [ %tmp5, %if.end ]
94 declare void @frob(ptr nocapture %p)