[AArch64][NFC] NFC for const vector as Instruction operand (#116790)
[llvm-project.git] / llvm / test / Transforms / LICM / 2003-05-02-LoadHoist.ll
blob8bcc8adcbd1f1e1b524cb57d9b3df95386771fd7
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 -passes='loop-mssa(licm),gvn,instcombine' -S | grep load
8 @X = global i32 7               ; <ptr> [#uses=2]
10 declare void @foo()
12 define i32 @test(i1 %c) {
13         %A = load i32, ptr @X           ; <i32> [#uses=1]
14         br label %Loop
15 Loop:           ; preds = %Loop, %0
16         call void @foo( )
17         ;; Should not hoist this load!
18         %B = load i32, ptr @X           ; <i32> [#uses=1]
19         br i1 %c, label %Loop, label %Out
20 Out:            ; preds = %Loop
21         %C = sub i32 %A, %B             ; <i32> [#uses=1]
22         ret i32 %C