• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Tests if the licm flag successfully hoists the add from loop0 to entry
2
3; RUN: %p2i -i %s --filetype=obj --disassemble --target x8664 --args \
4; RUN: -O2 -licm | FileCheck --check-prefix ENABLE %s
5
6; RUN: %p2i -i %s --filetype=obj --disassemble --target x8664 --args \
7; RUN: -O2 | FileCheck --check-prefix NOENABLE %s
8
9define internal void @dummy() {
10entry:
11  ret void
12}
13define internal i32 @test_licm(i32 %a32, i32 %b, i32 %c) {
14entry:
15  %a = trunc i32 %a32 to i1
16  br label %loop0
17loop0:                               ; <-+
18  call void @dummy()                 ;   |
19  %add1 = add i32 %b, %c             ;   |
20  br label %loop1                    ;   |
21loop1:                               ;   |
22  br i1 %a, label %loop0, label %out ; --+
23out:
24  ret i32 %add1
25}
26
27; CHECK-LABEL: test_licm
28
29; ENABLE: add
30; ENABLE: call
31
32; NOENABLE: call
33; NOENABLE-NEXT: mov
34; NOENABLE-NEXT: add
35
36; CHECK: ret