brintos

brintos / llvm-project-archived public Read only

0
0
Text · 708 B · 8bcc8ad Raw
24 lines · plain
1; This testcase tests for a problem where LICM hoists loads out of a loop2; despite the fact that calls to unknown functions may modify what is being3; loaded from.  Basically if the load gets hoisted, the subtract gets turned4; into a constant zero.5;6; RUN: opt < %s -passes='loop-mssa(licm),gvn,instcombine' -S | grep load7 8@X = global i32 7		; <ptr> [#uses=2]9 10declare void @foo()11 12define i32 @test(i1 %c) {13	%A = load i32, ptr @X		; <i32> [#uses=1]14	br label %Loop15Loop:		; preds = %Loop, %016	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 %Out20Out:		; preds = %Loop21	%C = sub i32 %A, %B		; <i32> [#uses=1]22	ret i32 %C23}24