1 ; RUN: opt -S < %s -gvn | FileCheck %s
3 declare void @llvm.sideeffect()
5 ; Store-to-load forwarding across a @llvm.sideeffect.
9 define float @s2l(float* %p) {
10 store float 0.0, float* %p
11 call void @llvm.sideeffect()
12 %t = load float, float* %p
16 ; Redundant load elimination across a @llvm.sideeffect.
21 define float @rle(float* %p) {
22 %r = load float, float* %p
23 call void @llvm.sideeffect()
24 %s = load float, float* %p
25 %t = fadd float %r, %s
29 ; LICM across a @llvm.sideeffect.
35 define float @licm(i64 %n, float* nocapture readonly %p) #0 {
40 %i = phi i64 [ 0, %bb0 ], [ %t5, %loop ]
41 %sum = phi float [ 0.000000e+00, %bb0 ], [ %t4, %loop ]
42 call void @llvm.sideeffect()
43 %t3 = load float, float* %p
44 %t4 = fadd float %sum, %t3
46 %t6 = icmp ult i64 %t5, %n
47 br i1 %t6, label %loop, label %bb2