1 ; RUN: opt < %s -scalarrepl -S | FileCheck %s
4 ; Make sure scalarrepl doesn't move a load across an invoke which could
5 ; modify the loaded value.
6 ; (The PHI could theoretically be transformed by splitting the critical
7 ; edge, but scalarrepl doesn't modify the CFG, at least at the moment.)
9 declare void @extern_fn(i32*)
10 declare i32 @extern_fn2(i32)
11 declare i32 @__gcc_personality_v0(i32, i64, i8*, i8*)
13 define void @odd_fn(i1) noinline personality i32 (i32, i64, i8*, i8*)* @__gcc_personality_v0 {
16 br i1 %0, label %then, label %else
19 invoke void @extern_fn(i32* %retptr1)
20 to label %join unwind label %unwind
23 store i32 3, i32* %retptr2
26 join: ; preds = %then, %else
27 %storemerge.in = phi i32* [ %retptr2, %else ], [ %retptr1, %then ]
28 %storemerge = load i32, i32* %storemerge.in
29 %x3 = call i32 @extern_fn2(i32 %storemerge)
32 unwind: ; preds = %then
33 %info = landingpad { i8*, i32 }
35 call void @extern_fn(i32* null)
39 ; CHECK-LABEL: define void @odd_fn(
40 ; CHECK: %storemerge.in = phi i32* [ %retptr2, %else ], [ %retptr1, %then ]