• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S < %s -licm | FileCheck %s
2
3declare void @llvm.sideeffect()
4
5; LICM across a @llvm.sideeffect.
6
7; CHECK-LABEL: licm
8; CHECK: load
9; CHECK: loop:
10; CHECK-NOT: load
11define float @licm(i64 %n, float* nocapture readonly %p) #0 {
12bb0:
13  br label %loop
14
15loop:
16  %i = phi i64 [ 0, %bb0 ], [ %t5, %loop ]
17  %sum = phi float [ 0.000000e+00, %bb0 ], [ %t4, %loop ]
18  call void @llvm.sideeffect()
19  %t3 = load float, float* %p
20  %t4 = fadd float %sum, %t3
21  %t5 = add i64 %i, 1
22  %t6 = icmp ult i64 %t5, %n
23  br i1 %t6, label %loop, label %bb2
24
25bb2:
26  ret float %t4
27}
28