• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -asm-verbose=false -march=x86-64 -mtriple=x86_64-apple-darwin -o - < %s | FileCheck %s
2
3; LSR should leave non-affine expressions alone because it currently
4; doesn't know how to do anything with them, and when it tries, it
5; gets SCEVExpander's current expansion for them, which is suboptimal.
6
7; CHECK:        xorl %eax, %eax
8; CHECK-NEXT:   align
9; CHECK-NEXT: BB0_1:
10; CHECK-NEXT:   movq  %rax, (%rdx)
11; CHECK-NEXT:   addq  %rsi, %rax
12; CHECK-NEXT:   cmpq  %rdi, %rax
13; CHECK-NEXT:   jl
14; CHECK-NEXT:   imulq %rax, %rax
15; CHECK-NEXT:   ret
16define i64 @foo(i64 %n, i64 %s, i64* %p) nounwind {
17entry:
18  br label %loop
19
20loop:
21  %i = phi i64 [ 0, %entry ], [ %i.next, %loop ]
22  store volatile i64 %i, i64* %p
23  %i.next = add i64 %i, %s
24  %c = icmp slt i64 %i.next, %n
25  br i1 %c, label %loop, label %exit
26
27exit:
28  %mul = mul i64 %i.next, %i.next
29  ret i64 %mul
30}
31