1; This testcase tests for a problem where LICM hoists loads out of a loop 2; despite the fact that calls to unknown functions may modify what is being 3; loaded from. Basically if the load gets hoisted, the subtract gets turned 4; into a constant zero. 5; 6; RUN: opt < %s -licm -gvn -instcombine -S | grep load 7 8@X = global i32 7 ; <i32*> [#uses=2] 9 10declare void @foo() 11 12define i32 @test(i1 %c) { 13 %A = load i32, i32* @X ; <i32> [#uses=1] 14 br label %Loop 15Loop: ; preds = %Loop, %0 16 call void @foo( ) 17 ;; Should not hoist this load! 18 %B = load i32, i32* @X ; <i32> [#uses=1] 19 br i1 %c, label %Loop, label %Out 20Out: ; preds = %Loop 21 %C = sub i32 %A, %B ; <i32> [#uses=1] 22 ret i32 %C 23} 24