1; RUN: opt -S -O2 -enable-gvn-hoist < %s | FileCheck %s 2 3; Check that the inlined loads are hoisted. 4; CHECK-LABEL: define i32 @fun( 5; CHECK-LABEL: entry: 6; CHECK: load i32, i32* @A 7; CHECK: if.then: 8 9@A = external global i32 10@B = external global i32 11@C = external global i32 12 13define i32 @loadA() { 14 %a = load i32, i32* @A 15 ret i32 %a 16} 17 18define i32 @fun(i1 %c) { 19entry: 20 br i1 %c, label %if.then, label %if.else 21 22if.then: 23 store i32 1, i32* @B 24 %call1 = call i32 @loadA() 25 store i32 2, i32* @C 26 br label %if.endif 27 28if.else: 29 store i32 2, i32* @C 30 %call2 = call i32 @loadA() 31 store i32 1, i32* @B 32 br label %if.endif 33 34if.endif: 35 %ret = phi i32 [ %call1, %if.then ], [ %call2, %if.else ] 36 ret i32 %ret 37} 38 39