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.
6 ; RUN: opt < %s -licm -gvn -instcombine -S | grep load
8 @X = global i32 7 ; <i32*> [#uses=2]
12 define i32 @test(i1 %c) {
13 %A = load i32, i32* @X ; <i32> [#uses=1]
15 Loop: ; preds = %Loop, %0
17 ;; Should not hoist this load!
18 %B = load i32, i32* @X ; <i32> [#uses=1]
19 br i1 %c, label %Loop, label %Out
21 %C = sub i32 %A, %B ; <i32> [#uses=1]