1; RUN: opt < %s -scalarrepl -S | FileCheck %s 2; PR10987 3 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.) 8 9declare void @extern_fn(i32*) 10declare i32 @extern_fn2(i32) 11declare i32 @__gcc_personality_v0(i32, i64, i8*, i8*) 12 13define void @odd_fn(i1) noinline { 14 %retptr1 = alloca i32 15 %retptr2 = alloca i32 16 br i1 %0, label %then, label %else 17 18then: ; preds = %2 19 invoke void @extern_fn(i32* %retptr1) 20 to label %join unwind label %unwind 21 22else: ; preds = %2 23 store i32 3, i32* %retptr2 24 br label %join 25 26join: ; preds = %then, %else 27 %storemerge.in = phi i32* [ %retptr2, %else ], [ %retptr1, %then ] 28 %storemerge = load i32* %storemerge.in 29 %x3 = call i32 @extern_fn2(i32 %storemerge) 30 ret void 31 32unwind: ; preds = %then 33 %info = landingpad { i8*, i32 } personality i32 (i32, i64, i8*, i8*)* @__gcc_personality_v0 34 cleanup 35 call void @extern_fn(i32* null) 36 unreachable 37} 38 39; CHECK: define void @odd_fn 40; CHECK: %storemerge.in = phi i32* [ %retptr2, %else ], [ %retptr1, %then ] 41