1 ; RUN: opt -simplifycfg -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 i64*], align 8
12 %__a.addr = getelementptr [4 x i64*], [4 x i64*]* %a, i64 0, i64 3
13 call void @frob(i64** %__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 i64*, i64** %__a.addr, align 8
23 return: ; preds = %if.end, %if.then
24 %storemerge = phi i64* [ undef, %if.then ], [ %tmp5, %if.end ]
31 define void @no0(i1 %c) nounwind {
33 %a = alloca [4 x i64*], align 8
34 %__a.addr = getelementptr [4 x i64*], [4 x i64*]* %a, i64 0, i64 4
35 call void @frob(i64** %__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 i64*, i64** %__a.addr, align 8
45 return: ; preds = %if.end, %if.then
46 %storemerge = phi i64* [ undef, %if.then ], [ %tmp5, %if.end ]
53 define void @no1(i1 %c, i64 %n) nounwind {
55 %a = alloca [4 x i64*], align 8
56 %__a.addr = getelementptr [4 x i64*], [4 x i64*]* %a, i64 0, i64 %n
57 call void @frob(i64** %__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 i64*, i64** %__a.addr, align 8
67 return: ; preds = %if.end, %if.then
68 %storemerge = phi i64* [ undef, %if.then ], [ %tmp5, %if.end ]
75 define void @no2(i1 %c, i64 %n) nounwind {
77 %a = alloca [4 x i64*], align 8
78 %__a.addr = getelementptr [4 x i64*], [4 x i64*]* %a, i64 1, i64 0
79 call void @frob(i64** %__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 i64*, i64** %__a.addr, align 8
89 return: ; preds = %if.end, %if.then
90 %storemerge = phi i64* [ undef, %if.then ], [ %tmp5, %if.end ]
94 declare void @frob(i64** nocapture %p)